diff --git a/src/Microsoft.AspNetCore.Http.Features/Authentication/IHttpAuthenticationFeature.cs b/src/Microsoft.AspNetCore.Http.Features/Authentication/IHttpAuthenticationFeature.cs index 080ce40574..279d6904f0 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 @@ namespace Microsoft.AspNetCore.Http.Features.Authentication { ClaimsPrincipal User { get; set; } + [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 diff --git a/src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs b/src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs index 666e2179e1..a6cc320bb3 100644 --- a/src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs +++ b/src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs @@ -42,7 +42,9 @@ namespace Microsoft.AspNetCore.Http.Authentication.Internal 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 @@ namespace Microsoft.AspNetCore.Http.Authentication.Internal 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 @@ namespace Microsoft.AspNetCore.Http.Authentication.Internal 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 @@ namespace Microsoft.AspNetCore.Http.Authentication.Internal 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 @@ namespace Microsoft.AspNetCore.Http.Authentication.Internal 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 @@ namespace Microsoft.AspNetCore.Http.Authentication.Internal 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)