Update for latest abstraction contracts.

This commit is contained in:
Chris Ross 2014-04-01 17:18:37 -07:00
parent 83855f8eac
commit 2b226c936f
4 changed files with 13 additions and 12 deletions

View File

@ -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");

View File

@ -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"
}
}
}

View File

@ -121,12 +121,13 @@ namespace Microsoft.AspNet.Security.Infrastructure
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)
{
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)

View File

@ -54,10 +54,10 @@ namespace Microsoft.AspNet.Security.Infrastructure
/// Find response sign-in details for a specific authentication middleware
/// </summary>
/// <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;
foreach (var claimsIdentity in user.Identities)
foreach (var claimsIdentity in identities)
{
if (string.Equals(authenticationType, claimsIdentity.AuthenticationType, StringComparison.Ordinal))
{