Simplify AuthenticationHandler using LINQ
This commit is contained in:
parent
f8ff2cd6d1
commit
29b90ea070
|
|
@ -35,8 +35,8 @@ namespace Microsoft.AspNet.IISPlatformHandler
|
||||||
if (User != null)
|
if (User != null)
|
||||||
{
|
{
|
||||||
context.Authenticated(User, properties: null,
|
context.Authenticated(User, properties: null,
|
||||||
description: Options.AuthenticationDescriptions.Where(descrip =>
|
description: Options.AuthenticationDescriptions.FirstOrDefault(descrip =>
|
||||||
string.Equals(User.Identity.AuthenticationType, descrip.AuthenticationScheme, StringComparison.Ordinal)).FirstOrDefault()?.Items);
|
string.Equals(User.Identity.AuthenticationType, descrip.AuthenticationScheme, StringComparison.Ordinal))?.Items);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -48,6 +48,7 @@ namespace Microsoft.AspNet.IISPlatformHandler
|
||||||
{
|
{
|
||||||
return PriorHandler.AuthenticateAsync(context);
|
return PriorHandler.AuthenticateAsync(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult(0);
|
return Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -84,6 +85,7 @@ namespace Microsoft.AspNet.IISPlatformHandler
|
||||||
{
|
{
|
||||||
return PriorHandler.ChallengeAsync(context);
|
return PriorHandler.ChallengeAsync(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult(0);
|
return Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,6 +109,7 @@ namespace Microsoft.AspNet.IISPlatformHandler
|
||||||
{
|
{
|
||||||
return PriorHandler.SignInAsync(context);
|
return PriorHandler.SignInAsync(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult(0);
|
return Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,6 +120,7 @@ namespace Microsoft.AspNet.IISPlatformHandler
|
||||||
{
|
{
|
||||||
return PriorHandler.SignOutAsync(context);
|
return PriorHandler.SignOutAsync(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult(0);
|
return Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,14 +130,8 @@ namespace Microsoft.AspNet.IISPlatformHandler
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
foreach (var description in Options.AuthenticationDescriptions)
|
|
||||||
{
|
return Options.AuthenticationDescriptions.Any(description => string.Equals(description.AuthenticationScheme, authenticationScheme, StringComparison.Ordinal));
|
||||||
if (string.Equals(description.AuthenticationScheme, authenticationScheme, StringComparison.Ordinal))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue