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();
// Not including any auth types means it's a blanket challenge for any auth type.
if (context.AuthenticationSchemes == null || !context.AuthenticationSchemes.Any()
|| context.AuthenticationSchemes.Contains(authScheme, StringComparer.Ordinal))
if (context.AuthenticationScheme == null ||
string.Equals(context.AuthenticationScheme, authScheme, StringComparison.Ordinal))
{
_customChallenges |= scheme;
context.Accept(authScheme, GetDescription(authScheme));
context.Accept();
}
}
// 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);
Assert.NotNull(context.User);
Assert.False(context.User.Identity.IsAuthenticated);
context.Response.Challenge(authTypeList);
foreach (var scheme in authTypeList)
{
context.Response.Challenge(scheme);
}
return Task.FromResult(0);
}))
{