Browse Source

Fixes sequence validation error when both enable Challenge and Auth of dashboard authentication. #1097

master
Savorboard 2 years ago
parent
commit
011449b267
1 changed files with 11 additions and 10 deletions
  1. +11
    -10
      src/DotNetCore.CAP.Dashboard/CAP.BuilderExtension.cs

+ 11
- 10
src/DotNetCore.CAP.Dashboard/CAP.BuilderExtension.cs View File

@@ -111,6 +111,16 @@ namespace DotNetCore.CAP

internal static async Task<bool> Authentication(HttpContext context, DashboardOptions options)
{
var isAuthenticated = context.User?.Identity?.IsAuthenticated;

if (isAuthenticated == false && options.UseChallengeOnAuth)
{
await context.ChallengeAsync(options.DefaultChallengeScheme);
await context.Response.CompleteAsync();

return false;
}

if (options.UseAuth)
{
var result = await context.AuthenticateAsync(options.DefaultAuthenticationScheme);
@@ -125,16 +135,7 @@ namespace DotNetCore.CAP
}
}

var isAuthenticated = context.User?.Identity?.IsAuthenticated;

if (isAuthenticated == false && options.UseChallengeOnAuth)
{
await context.ChallengeAsync(options.DefaultChallengeScheme);
await context.Response.CompleteAsync();
return false;
}

return true;
}
}
}
}

Loading…
Cancel
Save