From 481c50e2f6ec2e52aa21cd3242913f1435a7fd98 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 8 Jun 2017 16:11:02 -0700 Subject: [PATCH] Obsolete AuthenticationManager --- .../Authentication/AuthenticationManager.cs | 1 + .../Authentication/DefaultAuthenticationManager.cs | 1 + src/Microsoft.AspNetCore.Http/DefaultHttpContext.cs | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/src/Microsoft.AspNetCore.Http.Abstractions/Authentication/AuthenticationManager.cs b/src/Microsoft.AspNetCore.Http.Abstractions/Authentication/AuthenticationManager.cs index 56d9dbad..b2916522 100644 --- a/src/Microsoft.AspNetCore.Http.Abstractions/Authentication/AuthenticationManager.cs +++ b/src/Microsoft.AspNetCore.Http.Abstractions/Authentication/AuthenticationManager.cs @@ -9,6 +9,7 @@ namespace Microsoft.AspNetCore.Http.Authentication { + [Obsolete("This is obsolete and will be removed in a future version. See https://go.microsoft.com/fwlink/?linkid=845470.")] public abstract class AuthenticationManager { /// diff --git a/src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs b/src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs index a6cc320b..9f4121f4 100644 --- a/src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs +++ b/src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs @@ -11,6 +11,7 @@ namespace Microsoft.AspNetCore.Http.Authentication.Internal { + [Obsolete("This is obsolete and will be removed in a future version. See https://go.microsoft.com/fwlink/?linkid=845470.")] public class DefaultAuthenticationManager : AuthenticationManager { // Lambda hoisted to static readonly field to improve inlining https://github.com/dotnet/roslyn/issues/13624 diff --git a/src/Microsoft.AspNetCore.Http/DefaultHttpContext.cs b/src/Microsoft.AspNetCore.Http/DefaultHttpContext.cs index cdd12630..d02ad632 100644 --- a/src/Microsoft.AspNetCore.Http/DefaultHttpContext.cs +++ b/src/Microsoft.AspNetCore.Http/DefaultHttpContext.cs @@ -28,7 +28,11 @@ public class DefaultHttpContext : HttpContext private HttpRequest _request; private HttpResponse _response; + +#pragma warning disable CS0618 // Type or member is obsolete private AuthenticationManager _authenticationManager; +#pragma warning restore CS0618 // Type or member is obsolete + private ConnectionInfo _connection; private WebSocketManager _websockets; @@ -66,7 +70,9 @@ public virtual void Uninitialize() } if (_authenticationManager != null) { +#pragma warning disable CS0618 // Type or member is obsolete UninitializeAuthenticationManager(_authenticationManager); +#pragma warning restore CS0618 // Type or member is obsolete _authenticationManager = null; } if (_connection != null) @@ -196,7 +202,9 @@ protected virtual void UninitializeHttpResponse(HttpResponse instance) { } protected virtual ConnectionInfo InitializeConnectionInfo() => new DefaultConnectionInfo(Features); protected virtual void UninitializeConnectionInfo(ConnectionInfo instance) { } + [Obsolete("This is obsolete and will be removed in a future version. See https://go.microsoft.com/fwlink/?linkid=845470.")] protected virtual AuthenticationManager InitializeAuthenticationManager() => new DefaultAuthenticationManager(this); + [Obsolete("This is obsolete and will be removed in a future version. See https://go.microsoft.com/fwlink/?linkid=845470.")] protected virtual void UninitializeAuthenticationManager(AuthenticationManager instance) { } protected virtual WebSocketManager InitializeWebSocketManager() => new DefaultWebSocketManager(Features);