Deprecate the IAuthenticationHandler property (#863)

* Deprecate the IAuthenticationHandler property
This commit is contained in:
David Fowler 2017-06-07 07:04:48 -10:00 committed by GitHub
parent c06ed8c29a
commit 9dedc98094
2 changed files with 14 additions and 0 deletions

View File

@ -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; }
}
}

View File

@ -42,7 +42,9 @@ namespace Microsoft.AspNetCore.Http.Authentication.Internal
public override IEnumerable<AuthenticationDescription> 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)