React to Http Challenge changes

This commit is contained in:
Hao Kung 2015-04-15 13:10:35 -07:00
parent e03c015065
commit f191792b96
2 changed files with 7 additions and 4 deletions

View File

@ -79,11 +79,11 @@ namespace Microsoft.AspNet.Server.WebListener
{ {
var authScheme = scheme.ToString(); var authScheme = scheme.ToString();
// Not including any auth types means it's a blanket challenge for any auth type. // Not including any auth types means it's a blanket challenge for any auth type.
if (context.AuthenticationSchemes == null || !context.AuthenticationSchemes.Any() if (context.AuthenticationScheme == null ||
|| context.AuthenticationSchemes.Contains(authScheme, StringComparer.Ordinal)) string.Equals(context.AuthenticationScheme, authScheme, StringComparison.Ordinal))
{ {
_customChallenges |= scheme; _customChallenges |= scheme;
context.Accept(authScheme, GetDescription(authScheme)); context.Accept();
} }
} }
// A challenge was issued, it overrides any pre-set auth types. // A challenge was issued, it overrides any pre-set auth types.

View File

@ -353,7 +353,10 @@ namespace Microsoft.AspNet.Server.WebListener
var context = new DefaultHttpContext((IFeatureCollection)env); var context = new DefaultHttpContext((IFeatureCollection)env);
Assert.NotNull(context.User); Assert.NotNull(context.User);
Assert.False(context.User.Identity.IsAuthenticated); Assert.False(context.User.Identity.IsAuthenticated);
context.Response.Challenge(authTypeList); foreach (var scheme in authTypeList)
{
context.Response.Challenge(scheme);
}
return Task.FromResult(0); return Task.FromResult(0);
})) }))
{ {