diff --git a/samples/CookieSample/Startup.cs b/samples/CookieSample/Startup.cs index 9c2c29e185..35aa1f5d35 100644 --- a/samples/CookieSample/Startup.cs +++ b/samples/CookieSample/Startup.cs @@ -27,7 +27,7 @@ namespace CookieSample { 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"; await context.Response.WriteAsync("Hello First timer"); diff --git a/src/Microsoft.AspNet.Security.Cookies/project.json b/src/Microsoft.AspNet.Security.Cookies/project.json index ee461aabbd..d446612a1e 100644 --- a/src/Microsoft.AspNet.Security.Cookies/project.json +++ b/src/Microsoft.AspNet.Security.Cookies/project.json @@ -31,11 +31,11 @@ "System.Resources.ResourceManager": "4.0.0.0", "System.Runtime": "4.0.20.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.Principal" : "4.0.0.0", "System.Threading": "4.0.0.0", - "System.Threading.Tasks": "4.0.0.0" + "System.Threading.Tasks": "4.0.10.0" } } } diff --git a/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationHandler.cs b/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationHandler.cs index 986826f792..3efed452ab 100644 --- a/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationHandler.cs +++ b/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationHandler.cs @@ -121,12 +121,13 @@ namespace Microsoft.AspNet.Security.Infrastructure return Task.FromResult(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) { - PriorHandler.GetDescriptions(callback, state); + PriorHandler.GetDescriptions(authTypeContext); } } @@ -266,11 +267,11 @@ namespace Microsoft.AspNet.Security.Infrastructure public virtual void SignIn(ISignInContext context) { 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)); SignOutContext = null; - context.Ack(BaseOptions.AuthenticationType, BaseOptions.Description.Dictionary); + context.Accept(BaseOptions.AuthenticationType, BaseOptions.Description.Dictionary); } if (PriorHandler != null) @@ -285,7 +286,7 @@ namespace Microsoft.AspNet.Security.Infrastructure { SignInIdentityContext = null; SignOutContext = context; - context.Ack(BaseOptions.AuthenticationType, BaseOptions.Description.Dictionary); + context.Accept(BaseOptions.AuthenticationType, BaseOptions.Description.Dictionary); } if (PriorHandler != null) @@ -299,7 +300,7 @@ namespace Microsoft.AspNet.Security.Infrastructure if (SecurityHelper.LookupChallenge(context.AuthenticationTypes, BaseOptions.AuthenticationType, BaseOptions.AuthenticationMode)) { ChallengeContext = context; - context.Ack(BaseOptions.AuthenticationType, BaseOptions.Description.Dictionary); + context.Accept(BaseOptions.AuthenticationType, BaseOptions.Description.Dictionary); } if (PriorHandler != null) diff --git a/src/Microsoft.AspNet.Security/Infrastructure/SecurityHelper.cs b/src/Microsoft.AspNet.Security/Infrastructure/SecurityHelper.cs index 7275da262c..0337c4f481 100644 --- a/src/Microsoft.AspNet.Security/Infrastructure/SecurityHelper.cs +++ b/src/Microsoft.AspNet.Security/Infrastructure/SecurityHelper.cs @@ -54,10 +54,10 @@ namespace Microsoft.AspNet.Security.Infrastructure /// Find response sign-in details for a specific authentication middleware /// /// The authentication type to look for - public static bool LookupSignIn(ClaimsPrincipal user, string authenticationType, out ClaimsIdentity identity) + public static bool LookupSignIn(IList identities, string authenticationType, out ClaimsIdentity identity) { identity = null; - foreach (var claimsIdentity in user.Identities) + foreach (var claimsIdentity in identities) { if (string.Equals(authenticationType, claimsIdentity.AuthenticationType, StringComparison.Ordinal)) {