Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit 9dedc98

Browse files
authored
Deprecate the IAuthenticationHandler property (#863)
* Deprecate the IAuthenticationHandler property
1 parent c06ed8c commit 9dedc98

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/Microsoft.AspNetCore.Http.Features/Authentication/IHttpAuthenticationFeature.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System;
45
using System.Security.Claims;
56

67
namespace Microsoft.AspNetCore.Http.Features.Authentication
@@ -9,6 +10,7 @@ public interface IHttpAuthenticationFeature
910
{
1011
ClaimsPrincipal User { get; set; }
1112

13+
[Obsolete("This is obsolete and will be removed in a future version. See https://go.microsoft.com/fwlink/?linkid=845470.")]
1214
IAuthenticationHandler Handler { get; set; }
1315
}
1416
}

src/Microsoft.AspNetCore.Http/Authentication/DefaultAuthenticationManager.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ public virtual void Uninitialize()
4242

4343
public override IEnumerable<AuthenticationDescription> GetAuthenticationSchemes()
4444
{
45+
#pragma warning disable CS0618 // Type or member is obsolete
4546
var handler = HttpAuthenticationFeature.Handler;
47+
#pragma warning restore CS0618 // Type or member is obsolete
4648
if (handler == null)
4749
{
4850
return new AuthenticationDescription[0];
@@ -61,7 +63,9 @@ public override async Task AuthenticateAsync(AuthenticateContext context)
6163
throw new ArgumentNullException(nameof(context));
6264
}
6365

66+
#pragma warning disable CS0618 // Type or member is obsolete
6467
var handler = HttpAuthenticationFeature.Handler;
68+
#pragma warning restore CS0618 // Type or member is obsolete
6569
if (handler != null)
6670
{
6771
await handler.AuthenticateAsync(context);
@@ -80,7 +84,9 @@ public override async Task<AuthenticateInfo> GetAuthenticateInfoAsync(string aut
8084
throw new ArgumentNullException(nameof(authenticationScheme));
8185
}
8286

87+
#pragma warning disable CS0618 // Type or member is obsolete
8388
var handler = HttpAuthenticationFeature.Handler;
89+
#pragma warning restore CS0618 // Type or member is obsolete
8490
var context = new AuthenticateContext(authenticationScheme);
8591
if (handler != null)
8692
{
@@ -107,7 +113,9 @@ public override async Task ChallengeAsync(string authenticationScheme, Authentic
107113
throw new ArgumentException(nameof(authenticationScheme));
108114
}
109115

116+
#pragma warning disable CS0618 // Type or member is obsolete
110117
var handler = HttpAuthenticationFeature.Handler;
118+
#pragma warning restore CS0618 // Type or member is obsolete
111119

112120
var challengeContext = new ChallengeContext(authenticationScheme, properties?.Items, behavior);
113121
if (handler != null)
@@ -133,7 +141,9 @@ public override async Task SignInAsync(string authenticationScheme, ClaimsPrinci
133141
throw new ArgumentNullException(nameof(principal));
134142
}
135143

144+
#pragma warning disable CS0618 // Type or member is obsolete
136145
var handler = HttpAuthenticationFeature.Handler;
146+
#pragma warning restore CS0618 // Type or member is obsolete
137147

138148
var signInContext = new SignInContext(authenticationScheme, principal, properties?.Items);
139149
if (handler != null)
@@ -154,7 +164,9 @@ public override async Task SignOutAsync(string authenticationScheme, Authenticat
154164
throw new ArgumentException(nameof(authenticationScheme));
155165
}
156166

167+
#pragma warning disable CS0618 // Type or member is obsolete
157168
var handler = HttpAuthenticationFeature.Handler;
169+
#pragma warning restore CS0618 // Type or member is obsolete
158170

159171
var signOutContext = new SignOutContext(authenticationScheme, properties?.Items);
160172
if (handler != null)

0 commit comments

Comments
 (0)