React to Authenticate(schemes) being removed
This commit is contained in:
parent
e16d263cd5
commit
f05520602f
|
|
@ -35,16 +35,16 @@ namespace Microsoft.AspNet.Mvc
|
||||||
// Build a ClaimsPrincipal with the Policy's required authentication types
|
// Build a ClaimsPrincipal with the Policy's required authentication types
|
||||||
if (Policy.ActiveAuthenticationSchemes != null && Policy.ActiveAuthenticationSchemes.Any())
|
if (Policy.ActiveAuthenticationSchemes != null && Policy.ActiveAuthenticationSchemes.Any())
|
||||||
{
|
{
|
||||||
var results = await context.HttpContext.AuthenticateAsync(Policy.ActiveAuthenticationSchemes);
|
var newPrincipal = new ClaimsPrincipal();
|
||||||
if (results != null)
|
foreach (var scheme in Policy.ActiveAuthenticationSchemes)
|
||||||
{
|
{
|
||||||
var newPrincipal = new ClaimsPrincipal();
|
var result = (await context.HttpContext.AuthenticateAsync(scheme))?.Principal;
|
||||||
foreach (var principal in results.Where(r => r.Principal != null).Select(r => r.Principal))
|
if (result != null)
|
||||||
{
|
{
|
||||||
newPrincipal.AddIdentities(principal.Identities);
|
newPrincipal.AddIdentities(result.Identities);
|
||||||
}
|
}
|
||||||
context.HttpContext.User = newPrincipal;
|
|
||||||
}
|
}
|
||||||
|
context.HttpContext.User = newPrincipal;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow Anonymous skips all authorization
|
// Allow Anonymous skips all authorization
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue