コード例 #1
0
        internal bool IsValid(string password, string realm, string method, string entity)
        {
            NameValueCollection nameValueCollection = new NameValueCollection(_parameters);

            nameValueCollection["password"] = password;
            nameValueCollection["realm"]    = realm;
            nameValueCollection["method"]   = method;
            nameValueCollection["entity"]   = entity;
            return(_parameters["response"] == AuthenticationResponse.CreateRequestDigest(nameValueCollection));
        }
コード例 #2
0
        internal bool IsValid(string password, string realm, string method, string entity)
        {
            NameValueCollection parameters = new NameValueCollection(this._parameters)
            {
                ["password"] = password,
                ["realm"]    = realm,
                ["method"]   = method,
                ["entity"]   = entity
            };

            return(this._parameters["response"] == AuthenticationResponse.CreateRequestDigest(parameters));
        }
コード例 #3
0
        internal bool IsValid(
            string password, string realm, string method, string entity
            )
        {
            var copied = new NameValueCollection(_parameters);

            copied["password"] = password;
            copied["realm"]    = realm;
            copied["method"]   = method;
            copied["entity"]   = entity;

            var expected = AuthenticationResponse.CreateRequestDigest(copied);

            return(_parameters["response"] == expected);
        }
コード例 #4
0
        private void initAsDigest()
        {
            string item = this.Parameters["qop"];

            if (item != null)
            {
                if (!item.Split(new char[] { ',' }).Contains <string>((string qop) => qop.Trim().ToLower() == "auth"))
                {
                    this.Parameters["qop"] = null;
                }
                else
                {
                    this.Parameters["qop"]    = "auth";
                    this.Parameters["cnonce"] = AuthenticationBase.CreateNonceValue();
                    uint num = this._nonceCount + 1;
                    this._nonceCount      = num;
                    this.Parameters["nc"] = string.Format("{0:x8}", num);
                }
            }
            this.Parameters["method"]   = "GET";
            this.Parameters["response"] = AuthenticationResponse.CreateRequestDigest(this.Parameters);
        }