private Authorization Authenticate()

in Managed/Util/AuthenticationModule.cs [82:109]


        private Authorization Authenticate(HttpWebRequest httpWebRequest, ICredentials credentials)
        {
            if (credentials == null)
            {
                return null;
            }

            // Get the username and password from the credentials
            NetworkCredential nc = credentials.GetCredential(httpWebRequest.RequestUri, AuthenticationTypeName);
            if (nc == null)
            {
                return null;
            }

            ICredentialPolicy policy = AuthenticationManager.CredentialPolicy;
            if (policy != null && !policy.ShouldSendCredential(httpWebRequest.RequestUri, httpWebRequest, nc, this))
            {
                return null;
            }

            string domain = nc.Domain;

            string basicTicket = (!String.IsNullOrEmpty(domain) ? (domain + "\\") : "") + nc.UserName + ":" + nc.Password;
            byte[] bytes = Encoding.UTF8.GetBytes(basicTicket);

            string header = AuthenticationTypeName + " " + Convert.ToBase64String(bytes);
            return new Authorization(header, true);
        }