[Mvc] Adds SignIn and SignOut method overloads without authentication scheme to ControllerBase (#23604)

This commit is contained in:
Kahbazi 2020-07-14 22:28:13 +04:30 committed by GitHub
parent f0bb1315cc
commit 9d7c3aff96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 1 deletions

View File

@ -541,10 +541,18 @@ namespace Microsoft.AspNetCore.Mvc
[Microsoft.AspNetCore.Mvc.NonActionAttribute]
public virtual Microsoft.AspNetCore.Mvc.RedirectToRouteResult RedirectToRoutePreserveMethod(string routeName = null, object routeValues = null, string fragment = null) { throw null; }
[Microsoft.AspNetCore.Mvc.NonActionAttribute]
public virtual Microsoft.AspNetCore.Mvc.SignInResult SignIn(System.Security.Claims.ClaimsPrincipal principal) { throw null; }
[Microsoft.AspNetCore.Mvc.NonActionAttribute]
public virtual Microsoft.AspNetCore.Mvc.SignInResult SignIn(System.Security.Claims.ClaimsPrincipal principal, Microsoft.AspNetCore.Authentication.AuthenticationProperties properties) { throw null; }
[Microsoft.AspNetCore.Mvc.NonActionAttribute]
public virtual Microsoft.AspNetCore.Mvc.SignInResult SignIn(System.Security.Claims.ClaimsPrincipal principal, Microsoft.AspNetCore.Authentication.AuthenticationProperties properties, string authenticationScheme) { throw null; }
[Microsoft.AspNetCore.Mvc.NonActionAttribute]
public virtual Microsoft.AspNetCore.Mvc.SignInResult SignIn(System.Security.Claims.ClaimsPrincipal principal, string authenticationScheme) { throw null; }
[Microsoft.AspNetCore.Mvc.NonActionAttribute]
public virtual Microsoft.AspNetCore.Mvc.SignOutResult SignOut() { throw null; }
[Microsoft.AspNetCore.Mvc.NonActionAttribute]
public virtual Microsoft.AspNetCore.Mvc.SignOutResult SignOut(Microsoft.AspNetCore.Authentication.AuthenticationProperties properties) { throw null; }
[Microsoft.AspNetCore.Mvc.NonActionAttribute]
public virtual Microsoft.AspNetCore.Mvc.SignOutResult SignOut(Microsoft.AspNetCore.Authentication.AuthenticationProperties properties, params string[] authenticationSchemes) { throw null; }
[Microsoft.AspNetCore.Mvc.NonActionAttribute]
public virtual Microsoft.AspNetCore.Mvc.SignOutResult SignOut(params string[] authenticationSchemes) { throw null; }
@ -1170,6 +1178,8 @@ namespace Microsoft.AspNetCore.Mvc
}
public partial class SignInResult : Microsoft.AspNetCore.Mvc.ActionResult
{
public SignInResult(System.Security.Claims.ClaimsPrincipal principal) { }
public SignInResult(System.Security.Claims.ClaimsPrincipal principal, Microsoft.AspNetCore.Authentication.AuthenticationProperties properties) { }
public SignInResult(string authenticationScheme, System.Security.Claims.ClaimsPrincipal principal) { }
public SignInResult(string authenticationScheme, System.Security.Claims.ClaimsPrincipal principal, Microsoft.AspNetCore.Authentication.AuthenticationProperties properties) { }
public string AuthenticationScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
@ -1181,6 +1191,7 @@ namespace Microsoft.AspNetCore.Mvc
public partial class SignOutResult : Microsoft.AspNetCore.Mvc.ActionResult
{
public SignOutResult() { }
public SignOutResult(Microsoft.AspNetCore.Authentication.AuthenticationProperties properties) { }
public SignOutResult(System.Collections.Generic.IList<string> authenticationSchemes) { }
public SignOutResult(System.Collections.Generic.IList<string> authenticationSchemes, Microsoft.AspNetCore.Authentication.AuthenticationProperties properties) { }
public SignOutResult(string authenticationScheme) { }

View File

@ -2386,6 +2386,15 @@ namespace Microsoft.AspNetCore.Mvc
public virtual ForbidResult Forbid(AuthenticationProperties properties, params string[] authenticationSchemes)
=> new ForbidResult(authenticationSchemes, properties);
/// <summary>
/// Creates a <see cref="SignInResult"/>.
/// </summary>
/// <param name="principal">The <see cref="ClaimsPrincipal"/> containing the user claims.</param>
/// <returns>The created <see cref="SignInResult"/> for the response.</returns>
[NonAction]
public virtual SignInResult SignIn(ClaimsPrincipal principal)
=> new SignInResult(principal);
/// <summary>
/// Creates a <see cref="SignInResult"/> with the specified authentication scheme.
/// </summary>
@ -2396,6 +2405,18 @@ namespace Microsoft.AspNetCore.Mvc
public virtual SignInResult SignIn(ClaimsPrincipal principal, string authenticationScheme)
=> new SignInResult(authenticationScheme, principal);
/// <summary>
/// Creates a <see cref="SignInResult"/> with <paramref name="properties"/>.
/// </summary>
/// <param name="principal">The <see cref="ClaimsPrincipal"/> containing the user claims.</param>
/// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the sign-in operation.</param>
/// <returns>The created <see cref="SignInResult"/> for the response.</returns>
[NonAction]
public virtual SignInResult SignIn(
ClaimsPrincipal principal,
AuthenticationProperties properties)
=> new SignInResult(principal, properties);
/// <summary>
/// Creates a <see cref="SignInResult"/> with the specified authentication scheme and
/// <paramref name="properties" />.
@ -2411,6 +2432,23 @@ namespace Microsoft.AspNetCore.Mvc
string authenticationScheme)
=> new SignInResult(authenticationScheme, principal, properties);
/// <summary>
/// Creates a <see cref="SignOutResult"/>.
/// </summary>
/// <returns>The created <see cref="SignOutResult"/> for the response.</returns>
[NonAction]
public virtual SignOutResult SignOut()
=> new SignOutResult();
/// <summary>
/// Creates a <see cref="SignOutResult"/> with <paramref name="properties"/>.
/// </summary>
/// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the sign-out operation.</param>
/// <returns>The created <see cref="SignOutResult"/> for the response.</returns>
[NonAction]
public virtual SignOutResult SignOut(AuthenticationProperties properties)
=> new SignOutResult(properties);
/// <summary>
/// Creates a <see cref="SignOutResult"/> with the specified authentication schemes.
/// </summary>

View File

@ -16,6 +16,16 @@ namespace Microsoft.AspNetCore.Mvc
/// </summary>
public class SignInResult : ActionResult
{
/// <summary>
/// Initializes a new instance of <see cref="SignInResult"/> with the
/// default authentication scheme.
/// </summary>
/// <param name="principal">The claims principal containing the user claims.</param>
public SignInResult(ClaimsPrincipal principal)
: this(authenticationScheme: null, principal, properties: null)
{
}
/// <summary>
/// Initializes a new instance of <see cref="SignInResult"/> with the
/// specified authentication scheme.
@ -27,6 +37,17 @@ namespace Microsoft.AspNetCore.Mvc
{
}
/// <summary>
/// Initializes a new instance of <see cref="SignInResult"/> with the
/// default authentication scheme and <paramref name="properties"/>.
/// </summary>
/// <param name="principal">The claims principal containing the user claims.</param>
/// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the sign-in operation.</param>
public SignInResult(ClaimsPrincipal principal, AuthenticationProperties properties)
: this(authenticationScheme: null, principal, properties)
{
}
/// <summary>
/// Initializes a new instance of <see cref="SignInResult"/> with the
/// specified authentication scheme and <paramref name="properties"/>.
@ -36,8 +57,8 @@ namespace Microsoft.AspNetCore.Mvc
/// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the sign-in operation.</param>
public SignInResult(string authenticationScheme, ClaimsPrincipal principal, AuthenticationProperties properties)
{
AuthenticationScheme = authenticationScheme ?? throw new ArgumentNullException(nameof(authenticationScheme));
Principal = principal ?? throw new ArgumentNullException(nameof(principal));
AuthenticationScheme = authenticationScheme;
Properties = properties;
}

View File

@ -24,6 +24,16 @@ namespace Microsoft.AspNetCore.Mvc
{
}
/// <summary>
/// Initializes a new instance of <see cref="SignOutResult"/> with the default sign out scheme.
/// specified authentication scheme and <paramref name="properties"/>.
/// </summary>
/// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the sign-out operation.</param>
public SignOutResult(AuthenticationProperties properties)
: this(Array.Empty<string>(), properties)
{
}
/// <summary>
/// Initializes a new instance of <see cref="SignOutResult"/> with the
/// specified authentication scheme.