From f191792b96ab5ca6b2e003eec8697c91a78ec081 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Wed, 15 Apr 2015 13:10:35 -0700 Subject: [PATCH] React to Http Challenge changes --- .../AuthenticationHandler.cs | 6 +++--- .../AuthenticationTests.cs | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) 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); })) {