Update for latest abstraction contracts.
This commit is contained in:
parent
83855f8eac
commit
2b226c936f
|
|
@ -27,7 +27,7 @@ namespace CookieSample
|
||||||
{
|
{
|
||||||
if (context.User == null || !context.User.Identity.IsAuthenticated)
|
if (context.User == null || !context.User.Identity.IsAuthenticated)
|
||||||
{
|
{
|
||||||
context.Authentication.SignIn(new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim("name", "bob") }, CookieAuthenticationDefaults.AuthenticationType)));
|
context.Response.SignIn(new ClaimsIdentity(new[] { new Claim("name", "bob") }, CookieAuthenticationDefaults.AuthenticationType));
|
||||||
|
|
||||||
context.Response.ContentType = "text/plain";
|
context.Response.ContentType = "text/plain";
|
||||||
await context.Response.WriteAsync("Hello First timer");
|
await context.Response.WriteAsync("Hello First timer");
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,11 @@
|
||||||
"System.Resources.ResourceManager": "4.0.0.0",
|
"System.Resources.ResourceManager": "4.0.0.0",
|
||||||
"System.Runtime": "4.0.20.0",
|
"System.Runtime": "4.0.20.0",
|
||||||
"System.Runtime.Extensions": "4.0.10.0",
|
"System.Runtime.Extensions": "4.0.10.0",
|
||||||
"System.Runtime.InteropServices": "4.0.10.0",
|
"System.Runtime.InteropServices": "4.0.20.0",
|
||||||
"System.Security.Claims": "0.1-alpha-*",
|
"System.Security.Claims": "0.1-alpha-*",
|
||||||
"System.Security.Principal" : "4.0.0.0",
|
"System.Security.Principal" : "4.0.0.0",
|
||||||
"System.Threading": "4.0.0.0",
|
"System.Threading": "4.0.0.0",
|
||||||
"System.Threading.Tasks": "4.0.0.0"
|
"System.Threading.Tasks": "4.0.10.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,12 +121,13 @@ namespace Microsoft.AspNet.Security.Infrastructure
|
||||||
return Task.FromResult<bool>(false);
|
return Task.FromResult<bool>(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void GetDescriptions(DescriptionDelegate callback, object state)
|
public virtual void GetDescriptions(IAuthTypeContext authTypeContext)
|
||||||
{
|
{
|
||||||
callback(BaseOptions.Description.Dictionary, state);
|
authTypeContext.Accept(BaseOptions.Description.Dictionary);
|
||||||
|
|
||||||
if (PriorHandler != null)
|
if (PriorHandler != null)
|
||||||
{
|
{
|
||||||
PriorHandler.GetDescriptions(callback, state);
|
PriorHandler.GetDescriptions(authTypeContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -266,11 +267,11 @@ namespace Microsoft.AspNet.Security.Infrastructure
|
||||||
public virtual void SignIn(ISignInContext context)
|
public virtual void SignIn(ISignInContext context)
|
||||||
{
|
{
|
||||||
ClaimsIdentity identity;
|
ClaimsIdentity identity;
|
||||||
if (SecurityHelper.LookupSignIn(context.User, BaseOptions.AuthenticationType, out identity))
|
if (SecurityHelper.LookupSignIn(context.Identities, BaseOptions.AuthenticationType, out identity))
|
||||||
{
|
{
|
||||||
SignInIdentityContext = new SignInIdentityContext(identity, new AuthenticationProperties(context.Properties));
|
SignInIdentityContext = new SignInIdentityContext(identity, new AuthenticationProperties(context.Properties));
|
||||||
SignOutContext = null;
|
SignOutContext = null;
|
||||||
context.Ack(BaseOptions.AuthenticationType, BaseOptions.Description.Dictionary);
|
context.Accept(BaseOptions.AuthenticationType, BaseOptions.Description.Dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PriorHandler != null)
|
if (PriorHandler != null)
|
||||||
|
|
@ -285,7 +286,7 @@ namespace Microsoft.AspNet.Security.Infrastructure
|
||||||
{
|
{
|
||||||
SignInIdentityContext = null;
|
SignInIdentityContext = null;
|
||||||
SignOutContext = context;
|
SignOutContext = context;
|
||||||
context.Ack(BaseOptions.AuthenticationType, BaseOptions.Description.Dictionary);
|
context.Accept(BaseOptions.AuthenticationType, BaseOptions.Description.Dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PriorHandler != null)
|
if (PriorHandler != null)
|
||||||
|
|
@ -299,7 +300,7 @@ namespace Microsoft.AspNet.Security.Infrastructure
|
||||||
if (SecurityHelper.LookupChallenge(context.AuthenticationTypes, BaseOptions.AuthenticationType, BaseOptions.AuthenticationMode))
|
if (SecurityHelper.LookupChallenge(context.AuthenticationTypes, BaseOptions.AuthenticationType, BaseOptions.AuthenticationMode))
|
||||||
{
|
{
|
||||||
ChallengeContext = context;
|
ChallengeContext = context;
|
||||||
context.Ack(BaseOptions.AuthenticationType, BaseOptions.Description.Dictionary);
|
context.Accept(BaseOptions.AuthenticationType, BaseOptions.Description.Dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PriorHandler != null)
|
if (PriorHandler != null)
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,10 @@ namespace Microsoft.AspNet.Security.Infrastructure
|
||||||
/// Find response sign-in details for a specific authentication middleware
|
/// Find response sign-in details for a specific authentication middleware
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="authenticationType">The authentication type to look for</param>
|
/// <param name="authenticationType">The authentication type to look for</param>
|
||||||
public static bool LookupSignIn(ClaimsPrincipal user, string authenticationType, out ClaimsIdentity identity)
|
public static bool LookupSignIn(IList<ClaimsIdentity> identities, string authenticationType, out ClaimsIdentity identity)
|
||||||
{
|
{
|
||||||
identity = null;
|
identity = null;
|
||||||
foreach (var claimsIdentity in user.Identities)
|
foreach (var claimsIdentity in identities)
|
||||||
{
|
{
|
||||||
if (string.Equals(authenticationType, claimsIdentity.AuthenticationType, StringComparison.Ordinal))
|
if (string.Equals(authenticationType, claimsIdentity.AuthenticationType, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue