From a2b4606fa16acc55260e8be3ed9a218069fbf6f1 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Wed, 7 Jun 2017 09:08:40 -0700 Subject: [PATCH 1/3] Deprecate the IAuthenticationHandler property --- .../Authentication/IHttpAuthenticationFeature.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.AspNetCore.Http.Features/Authentication/IHttpAuthenticationFeature.cs b/src/Microsoft.AspNetCore.Http.Features/Authentication/IHttpAuthenticationFeature.cs index 080ce405..d499e102 100644 --- a/src/Microsoft.AspNetCore.Http.Features/Authentication/IHttpAuthenticationFeature.cs +++ b/src/Microsoft.AspNetCore.Http.Features/Authentication/IHttpAuthenticationFeature.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Security.Claims; namespace Microsoft.AspNetCore.Http.Features.Authentication @@ -9,6 +10,7 @@ public interface IHttpAuthenticationFeature { ClaimsPrincipal User { get; set; } + [Obsolete("This is obsolete and will be removed in a future version. The recommended alternative is to use Microsoft.AspNetCore.Authentication.AuthenticationHttpContextExtensions. See https://go.microsoft.com/fwlink/?linkid=845470.")] IAuthenticationHandler Handler { get; set; } } } \ No newline at end of file From fd110bad9a672001817c64708b63895c9e62fe4f Mon Sep 17 00:00:00 2001 From: David Fowler Date: Wed, 7 Jun 2017 09:19:59 -0700 Subject: [PATCH 2/3] Pragmas! --- .../Authentication/DefaultAuthenticationManager.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs b/src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs index 666e2179..a6cc320b 100644 --- a/src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs +++ b/src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs @@ -42,7 +42,9 @@ public virtual void Uninitialize() public override IEnumerable GetAuthenticationSchemes() { +#pragma warning disable CS0618 // Type or member is obsolete var handler = HttpAuthenticationFeature.Handler; +#pragma warning restore CS0618 // Type or member is obsolete if (handler == null) { return new AuthenticationDescription[0]; @@ -61,7 +63,9 @@ public override async Task AuthenticateAsync(AuthenticateContext context) throw new ArgumentNullException(nameof(context)); } +#pragma warning disable CS0618 // Type or member is obsolete var handler = HttpAuthenticationFeature.Handler; +#pragma warning restore CS0618 // Type or member is obsolete if (handler != null) { await handler.AuthenticateAsync(context); @@ -80,7 +84,9 @@ public override async Task GetAuthenticateInfoAsync(string aut throw new ArgumentNullException(nameof(authenticationScheme)); } +#pragma warning disable CS0618 // Type or member is obsolete var handler = HttpAuthenticationFeature.Handler; +#pragma warning restore CS0618 // Type or member is obsolete var context = new AuthenticateContext(authenticationScheme); if (handler != null) { @@ -107,7 +113,9 @@ public override async Task ChallengeAsync(string authenticationScheme, Authentic throw new ArgumentException(nameof(authenticationScheme)); } +#pragma warning disable CS0618 // Type or member is obsolete var handler = HttpAuthenticationFeature.Handler; +#pragma warning restore CS0618 // Type or member is obsolete var challengeContext = new ChallengeContext(authenticationScheme, properties?.Items, behavior); if (handler != null) @@ -133,7 +141,9 @@ public override async Task SignInAsync(string authenticationScheme, ClaimsPrinci throw new ArgumentNullException(nameof(principal)); } +#pragma warning disable CS0618 // Type or member is obsolete var handler = HttpAuthenticationFeature.Handler; +#pragma warning restore CS0618 // Type or member is obsolete var signInContext = new SignInContext(authenticationScheme, principal, properties?.Items); if (handler != null) @@ -154,7 +164,9 @@ public override async Task SignOutAsync(string authenticationScheme, Authenticat throw new ArgumentException(nameof(authenticationScheme)); } +#pragma warning disable CS0618 // Type or member is obsolete var handler = HttpAuthenticationFeature.Handler; +#pragma warning restore CS0618 // Type or member is obsolete var signOutContext = new SignOutContext(authenticationScheme, properties?.Items); if (handler != null) From ce9dab9f05bc02531f16da1d6976f4c41a535062 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Wed, 7 Jun 2017 09:28:06 -0700 Subject: [PATCH 3/3] PR feedback --- .../Authentication/IHttpAuthenticationFeature.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Http.Features/Authentication/IHttpAuthenticationFeature.cs b/src/Microsoft.AspNetCore.Http.Features/Authentication/IHttpAuthenticationFeature.cs index d499e102..279d6904 100644 --- a/src/Microsoft.AspNetCore.Http.Features/Authentication/IHttpAuthenticationFeature.cs +++ b/src/Microsoft.AspNetCore.Http.Features/Authentication/IHttpAuthenticationFeature.cs @@ -10,7 +10,7 @@ public interface IHttpAuthenticationFeature { ClaimsPrincipal User { get; set; } - [Obsolete("This is obsolete and will be removed in a future version. The recommended alternative is to use Microsoft.AspNetCore.Authentication.AuthenticationHttpContextExtensions. See https://go.microsoft.com/fwlink/?linkid=845470.")] + [Obsolete("This is obsolete and will be removed in a future version. See https://go.microsoft.com/fwlink/?linkid=845470.")] IAuthenticationHandler Handler { get; set; } } } \ No newline at end of file