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

Obsolete Auth 1.0 #806

Closed
wants to merge 1 commit into from
Closed
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
Expand Up @@ -9,21 +9,25 @@ namespace Microsoft.AspNetCore.Http.Authentication
/// <summary>
/// Used to store the results of an Authenticate call.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the pattern we usually use for obsolete messages. https://github.com/aspnet/Home/wiki/Engineering-guidelines#breaking-changes cc @Eilon

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this was mostly a placeholder for now, we have some time to craft the final message, since I can't check in this PR until I've updated all the downstream repos

public class AuthenticateInfo
{
/// <summary>
/// The <see cref="ClaimsPrincipal"/>.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public ClaimsPrincipal Principal { get; set; }

/// <summary>
/// The <see cref="AuthenticationProperties"/>.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public AuthenticationProperties Properties { get; set; }

/// <summary>
/// The <see cref="AuthenticationDescription"/>.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public AuthenticationDescription Description { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Microsoft.AspNetCore.Http.Authentication
/// <summary>
/// Contains information describing an authentication provider.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public class AuthenticationDescription
{
private const string DisplayNamePropertyKey = "DisplayName";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,47 @@

namespace Microsoft.AspNetCore.Http.Authentication
{
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public abstract class AuthenticationManager
{
/// <summary>
/// Constant used to represent the automatic scheme
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public const string AutomaticScheme = "Automatic";

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public abstract HttpContext HttpContext { get; }

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public abstract IEnumerable<AuthenticationDescription> GetAuthenticationSchemes();

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public abstract Task<AuthenticateInfo> GetAuthenticateInfoAsync(string authenticationScheme);

// Will remove once callees have been updated
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public abstract Task AuthenticateAsync(AuthenticateContext context);

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public virtual async Task<ClaimsPrincipal> AuthenticateAsync(string authenticationScheme)
{
return (await GetAuthenticateInfoAsync(authenticationScheme))?.Principal;
}

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public virtual Task ChallengeAsync()
{
return ChallengeAsync(properties: null);
}

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public virtual Task ChallengeAsync(AuthenticationProperties properties)
{
return ChallengeAsync(authenticationScheme: AutomaticScheme, properties: properties);
}

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public virtual Task ChallengeAsync(string authenticationScheme)
{
if (string.IsNullOrEmpty(authenticationScheme))
Expand All @@ -51,6 +61,7 @@ public virtual Task ChallengeAsync(string authenticationScheme)
}

// Leave it up to authentication handler to do the right thing for the challenge
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public virtual Task ChallengeAsync(string authenticationScheme, AuthenticationProperties properties)
{
if (string.IsNullOrEmpty(authenticationScheme))
Expand All @@ -61,6 +72,7 @@ public virtual Task ChallengeAsync(string authenticationScheme, AuthenticationPr
return ChallengeAsync(authenticationScheme, properties, ChallengeBehavior.Automatic);
}

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public virtual Task SignInAsync(string authenticationScheme, ClaimsPrincipal principal)
{
if (string.IsNullOrEmpty(authenticationScheme))
Expand All @@ -80,9 +92,11 @@ public virtual Task SignInAsync(string authenticationScheme, ClaimsPrincipal pri
/// Creates a challenge for the authentication manager with <see cref="ChallengeBehavior.Forbidden"/>.
/// </summary>
/// <returns>A <see cref="Task"/> that represents the asynchronous challenge operation.</returns>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public virtual Task ForbidAsync()
=> ForbidAsync(AutomaticScheme, properties: null);

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public virtual Task ForbidAsync(string authenticationScheme)
{
if (authenticationScheme == null)
Expand All @@ -94,6 +108,7 @@ public virtual Task ForbidAsync(string authenticationScheme)
}

// Deny access (typically a 403)
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public virtual Task ForbidAsync(string authenticationScheme, AuthenticationProperties properties)
{
if (authenticationScheme == null)
Expand All @@ -109,13 +124,17 @@ public virtual Task ForbidAsync(string authenticationScheme, AuthenticationPrope
/// </summary>
/// <param name="properties">Additional arbitrary values which may be used by particular authentication types.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous challenge operation.</returns>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public virtual Task ForbidAsync(AuthenticationProperties properties)
=> ForbidAsync(AutomaticScheme, properties);

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public abstract Task ChallengeAsync(string authenticationScheme, AuthenticationProperties properties, ChallengeBehavior behavior);

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public abstract Task SignInAsync(string authenticationScheme, ClaimsPrincipal principal, AuthenticationProperties properties);

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public virtual Task SignOutAsync(string authenticationScheme)
{
if (authenticationScheme == null)
Expand All @@ -126,6 +145,7 @@ public virtual Task SignOutAsync(string authenticationScheme)
return SignOutAsync(authenticationScheme, properties: null);
}

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public abstract Task SignOutAsync(string authenticationScheme, AuthenticationProperties properties);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Microsoft.AspNetCore.Http.Authentication
/// <summary>
/// Dictionary used to store state values about the authentication session.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public class AuthenticationProperties
{
internal const string IssuedUtcKey = ".issued";
Expand Down Expand Up @@ -39,11 +40,13 @@ public AuthenticationProperties(IDictionary<string, string> items)
/// <summary>
/// State values about the authentication session.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public IDictionary<string, string> Items { get; }

/// <summary>
/// Gets or sets whether the authentication session is persisted across multiple requests.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public bool IsPersistent
{
get { return Items.ContainsKey(IsPersistentKey); }
Expand All @@ -69,6 +72,7 @@ public bool IsPersistent
/// <summary>
/// Gets or sets the full path or absolute URI to be used as an http redirect response value.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public string RedirectUri
{
get
Expand All @@ -95,6 +99,7 @@ public string RedirectUri
/// <summary>
/// Gets or sets the time at which the authentication ticket was issued.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public DateTimeOffset? IssuedUtc
{
get
Expand Down Expand Up @@ -129,6 +134,7 @@ public DateTimeOffset? IssuedUtc
/// <summary>
/// Gets or sets the time at which the authentication ticket expires.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public DateTimeOffset? ExpiresUtc
{
get
Expand Down Expand Up @@ -163,6 +169,7 @@ public DateTimeOffset? ExpiresUtc
/// <summary>
/// Gets or sets if refreshing the authentication session should be allowed.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public bool? AllowRefresh
{
get
Expand Down
1 change: 1 addition & 0 deletions src/Microsoft.AspNetCore.Http.Abstractions/HttpContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public abstract class HttpContext
/// <summary>
/// Gets an object that facilitates authentication for this request.
/// </summary>
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public abstract AuthenticationManager Authentication { get; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Microsoft.AspNetCore.Http.Features.Authentication
{
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public class AuthenticateContext
{
public AuthenticateContext(string authenticationScheme)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// 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;

namespace Microsoft.AspNetCore.Http.Features.Authentication
{
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public enum ChallengeBehavior
{
Automatic,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Microsoft.AspNetCore.Http.Features.Authentication
{
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public class ChallengeContext
{
public ChallengeContext(string authenticationScheme)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// 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.Collections.Generic;

namespace Microsoft.AspNetCore.Http.Features.Authentication
{
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public class DescribeSchemesContext
{
private List<IDictionary<string, object>> _results;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
// 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.Threading.Tasks;

namespace Microsoft.AspNetCore.Http.Features.Authentication
{
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public interface IAuthenticationHandler
{
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
void GetDescriptions(DescribeSchemesContext context);

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
Task AuthenticateAsync(AuthenticateContext context);

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
Task ChallengeAsync(ChallengeContext context);

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
Task SignInAsync(SignInContext context);

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
Task SignOutAsync(SignOutContext context);
}
}
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("See https://go.microsoft.com/fwlink/?linkid=845470")]
IAuthenticationHandler Handler { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Microsoft.AspNetCore.Http.Features.Authentication
{
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public class SignInContext
{
public SignInContext(string authenticationScheme, ClaimsPrincipal principal, IDictionary<string, string> properties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Microsoft.AspNetCore.Http.Features.Authentication
{
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public class SignOutContext
{
public SignOutContext(string authenticationScheme, IDictionary<string, string> properties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Microsoft.AspNetCore.Http.Authentication.Internal
{
[Obsolete("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
Expand All @@ -35,11 +36,13 @@ public virtual void Uninitialize()
_features = default(FeatureReferences<IHttpAuthenticationFeature>);
}

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public override HttpContext HttpContext => _context;

private IHttpAuthenticationFeature HttpAuthenticationFeature =>
_features.Fetch(ref _features.Cache, _newAuthenticationFeature);

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public override IEnumerable<AuthenticationDescription> GetAuthenticationSchemes()
{
var handler = HttpAuthenticationFeature.Handler;
Expand All @@ -54,6 +57,7 @@ public override IEnumerable<AuthenticationDescription> GetAuthenticationSchemes(
}

// Remove once callers have been switched to GetAuthenticateInfoAsync
[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public override async Task AuthenticateAsync(AuthenticateContext context)
{
if (context == null)
Expand All @@ -73,6 +77,7 @@ public override async Task AuthenticateAsync(AuthenticateContext context)
}
}

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public override async Task<AuthenticateInfo> GetAuthenticateInfoAsync(string authenticationScheme)
{
if (authenticationScheme == null)
Expand Down Expand Up @@ -100,6 +105,7 @@ public override async Task<AuthenticateInfo> GetAuthenticateInfoAsync(string aut
};
}

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public override async Task ChallengeAsync(string authenticationScheme, AuthenticationProperties properties, ChallengeBehavior behavior)
{
if (string.IsNullOrEmpty(authenticationScheme))
Expand All @@ -121,6 +127,7 @@ public override async Task ChallengeAsync(string authenticationScheme, Authentic
}
}

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public override async Task SignInAsync(string authenticationScheme, ClaimsPrincipal principal, AuthenticationProperties properties)
{
if (string.IsNullOrEmpty(authenticationScheme))
Expand All @@ -147,6 +154,7 @@ public override async Task SignInAsync(string authenticationScheme, ClaimsPrinci
}
}

[Obsolete("See https://go.microsoft.com/fwlink/?linkid=845470")]
public override async Task SignOutAsync(string authenticationScheme, AuthenticationProperties properties)
{
if (string.IsNullOrEmpty(authenticationScheme))
Expand Down
Loading