// Scheme selector private static AuthenticationSchemes AuthenticationSchemeSelector(HttpListenerRequest request, AuthenticationOptions options) { // Only change authentication scheme when requesting the authorization test page if (request.Url.AbsolutePath.Equals(options.AuthTestPage)) { string scheme = request.QueryString.GetValues("scheme")?.FirstOrDefault(); AuthenticationSchemes authenticationScheme; if (Enum.TryParse(scheme, true, out authenticationScheme)) { string resource = request.Url.PathAndQuery; AuthenticationSchemes selectedScheme = options.AuthenticationSchemes & authenticationScheme; string logMessage = $"Authentication scheme selected for {resource}: {selectedScheme}"; Log.Publish(MessageLevel.Debug, "AuthenticationSchemeSelected", logMessage); return(options.AuthenticationSchemes & authenticationScheme); } } // All requests to web server are treated as anonymous so as to not establish any extra // expectations for the browser - the AuthenticationHandler fully manages the security return(AuthenticationSchemes.Anonymous); }
internal ReadonlyAuthenticationOptions(AuthenticationOptions authenticationOptions) { m_authenticationOptions = authenticationOptions; }