コード例 #1
0
        public IIdentity ToIdentity()
        {
            IIdentity             identity;
            IIdentity             httpDigestIdentity;
            AuthenticationSchemes scheme = base.Scheme;

            if (scheme == AuthenticationSchemes.Basic)
            {
                IIdentity httpBasicIdentity = new HttpBasicIdentity(this.Parameters["username"], this.Parameters["password"]);
                identity = httpBasicIdentity;
            }
            else
            {
                if (scheme == AuthenticationSchemes.Digest)
                {
                    httpDigestIdentity = new HttpDigestIdentity(this.Parameters);
                }
                else
                {
                    httpDigestIdentity = null;
                }
                identity = httpDigestIdentity;
            }
            return(identity);
        }
コード例 #2
0
        public IIdentity ToIdentity()
        {
            object result;

            switch (base.Scheme)
            {
            case AuthenticationSchemes.Basic:
            {
                IIdentity identity = new HttpBasicIdentity(Parameters["username"], Parameters["password"]);
                result = identity;
                break;
            }

            case AuthenticationSchemes.Digest:
                result = new HttpDigestIdentity(Parameters);
                break;

            default:
                result = null;
                break;
            }
            return((IIdentity)result);
        }