diff --git a/src/Microsoft.AspNet.Server.WebListener/AuthenticationHandler.cs b/src/Microsoft.AspNet.Server.WebListener/AuthenticationHandler.cs index bbaa799bca..ed550f1074 100644 --- a/src/Microsoft.AspNet.Server.WebListener/AuthenticationHandler.cs +++ b/src/Microsoft.AspNet.Server.WebListener/AuthenticationHandler.cs @@ -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. diff --git a/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/AuthenticationTests.cs b/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/AuthenticationTests.cs index 451e9387af..f8a8c03947 100644 --- a/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/AuthenticationTests.cs +++ b/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/AuthenticationTests.cs @@ -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); })) {