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

Deprecate the IAuthenticationHandler property #863

Merged
merged 3 commits into from
Jun 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,6 +10,7 @@ public interface IHttpAuthenticationFeature
{
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; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public virtual void Uninitialize()

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];
Expand All @@ -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);
Expand All @@ -80,7 +84,9 @@ public override async Task<AuthenticateInfo> 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)
{
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down