IdentityServer / IdentityServer4.Templates

dotnet new templates for IdentityServer4
Apache License 2.0
695 stars 229 forks source link

External authentication error with Windows Integration on is4aspid template #70

Closed ggonzalez94 closed 4 years ago

ggonzalez94 commented 4 years ago

Issue / Steps to reproduce the problem

Install the template that uses ASP.NET Identity for user management(is4aspid template) and add Windows as external authentication running on IISExpress.

Relevant parts of the log file

An unhandled exception occurred while processing the request.
Exception: External authentication error
IdentityServer4.Quickstart.UI.ExternalController.Callback() in ExternalController.cs, line 98

Cause of the issue

The Cookie Scheme in the Callback method from external controller differs in the template from the one provided in the Quickstart repo. Template version:

 public async Task<IActionResult> Callback()
 {
      // read external identity from the temporary cookie
      var result = await HttpContext.AuthenticateAsync(IdentityConstants.ExternalScheme);
     //Code continues

Quickstart version:

public async Task<IActionResult> Callback()
{
      // read external identity from the temporary cookie
      var result = await 
HttpContext.AuthenticateAsync(IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme);
     //Code continues

Fix

Using the scheme from the QuickstartUI repo fixed the issue.

leastprivilege commented 4 years ago

thanks!

surenazatyan commented 4 years ago

thanks!

Writing it here for others to find this solution quicker " windows authentication exception ExternalController.cs line 98 _logger.IsEnabled(LogLevel.Debug)) "