Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
cleanup up cookie handler detection and error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
brockallen committed Nov 16, 2018
1 parent 1a20cc2 commit 7a83707
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -92,17 +92,17 @@ private static async Task ValidateAsync(IServiceProvider services, ILogger logge
if (options.Authentication.CookieAuthenticationScheme != null)
{
authenticationScheme = await schemes.GetSchemeAsync(options.Authentication.CookieAuthenticationScheme);
logger.LogInformation("Using explicitly configured scheme {scheme} for IdentityServer", options.Authentication.CookieAuthenticationScheme);
logger.LogInformation("Using explicitly configured authentication scheme {scheme} for IdentityServer", options.Authentication.CookieAuthenticationScheme);
}
else
{
authenticationScheme = await schemes.GetDefaultAuthenticateSchemeAsync();
logger.LogInformation("Using the default authentication scheme {scheme} for IdentityServer", authenticationScheme.Name);
}

if (!typeof(CookieAuthenticationHandler).IsAssignableFrom(authenticationScheme.HandlerType))
if (!typeof(IAuthenticationSignInHandler).IsAssignableFrom(authenticationScheme.HandlerType))
{
logger.LogError("Authentication scheme {scheme} is configured for IdentityServer, but it is not a cookie authentication scheme. Using a cookie scheme is required and must be configured as either the default authentication scheme or set the CookieAuthenticationScheme on the IdentityServerOptions.", authenticationScheme.Name);
logger.LogError("Authentication scheme {scheme} is configured for IdentityServer, but it is not a scheme that supports signin (like cookies). Either configure the default authentication scheme with cookies or set the CookieAuthenticationScheme on the IdentityServerOptions.", authenticationScheme.Name);
}

logger.LogDebug("Using {scheme} as default ASP.NET Core scheme for authentication", (await schemes.GetDefaultAuthenticateSchemeAsync())?.Name);
Expand Down

0 comments on commit 7a83707

Please sign in to comment.