internal void SetUser(AuthenticationSchemes expectedScheme, string realm, Func <IIdentity, NetworkCredential> credentialsFinder)
        {
            AuthenticationResponse authResponse = this._request.AuthResponse;

            if (authResponse == null)
            {
                return;
            }
            IIdentity identity = authResponse.ToIdentity();

            if (identity == null)
            {
                return;
            }
            NetworkCredential networkCredential = null;

            try
            {
                networkCredential = credentialsFinder(identity);
            }
            catch
            {
            }
            if (networkCredential == null)
            {
                return;
            }
            bool flag = (expectedScheme != AuthenticationSchemes.Basic) ? (expectedScheme == AuthenticationSchemes.Digest && ((HttpDigestIdentity)identity).IsValid(networkCredential.Password, realm, this._request.HttpMethod, null)) : (((HttpBasicIdentity)identity).Password == networkCredential.Password);

            if (flag)
            {
                this._user = new GenericPrincipal(identity, networkCredential.Roles);
            }
        }