Cookies: Do redirects for 401s if Active, regardless of challenges.

This commit is contained in:
Chris Ross 2014-04-10 16:32:44 -07:00
parent b889e45666
commit 7edb32f526
1 changed files with 7 additions and 1 deletions

View File

@ -219,7 +219,13 @@ namespace Microsoft.AspNet.Security.Cookies
protected override void ApplyResponseChallenge()
{
if (Response.StatusCode != 401 || !Options.LoginPath.HasValue || ChallengeContext == null)
if (Response.StatusCode != 401 || !Options.LoginPath.HasValue )
{
return;
}
// Active middleware should redirect on 401 even if there wasn't an explicit challenge.
if (ChallengeContext == null && Options.AuthenticationMode == AuthenticationMode.Passive)
{
return;
}