diff --git a/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp.cs b/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp.cs index 0e3186b36f..e895bd3280 100644 --- a/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp.cs +++ b/src/Mvc/Mvc.Core/ref/Microsoft.AspNetCore.Mvc.Core.netcoreapp.cs @@ -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 authenticationSchemes) { } public SignOutResult(System.Collections.Generic.IList authenticationSchemes, Microsoft.AspNetCore.Authentication.AuthenticationProperties properties) { } public SignOutResult(string authenticationScheme) { } diff --git a/src/Mvc/Mvc.Core/src/ControllerBase.cs b/src/Mvc/Mvc.Core/src/ControllerBase.cs index 0c1179c805..b24e67a7c6 100644 --- a/src/Mvc/Mvc.Core/src/ControllerBase.cs +++ b/src/Mvc/Mvc.Core/src/ControllerBase.cs @@ -2386,6 +2386,15 @@ namespace Microsoft.AspNetCore.Mvc public virtual ForbidResult Forbid(AuthenticationProperties properties, params string[] authenticationSchemes) => new ForbidResult(authenticationSchemes, properties); + /// + /// Creates a . + /// + /// The containing the user claims. + /// The created for the response. + [NonAction] + public virtual SignInResult SignIn(ClaimsPrincipal principal) + => new SignInResult(principal); + /// /// Creates a with the specified authentication scheme. /// @@ -2396,6 +2405,18 @@ namespace Microsoft.AspNetCore.Mvc public virtual SignInResult SignIn(ClaimsPrincipal principal, string authenticationScheme) => new SignInResult(authenticationScheme, principal); + /// + /// Creates a with . + /// + /// The containing the user claims. + /// used to perform the sign-in operation. + /// The created for the response. + [NonAction] + public virtual SignInResult SignIn( + ClaimsPrincipal principal, + AuthenticationProperties properties) + => new SignInResult(principal, properties); + /// /// Creates a with the specified authentication scheme and /// . @@ -2411,6 +2432,23 @@ namespace Microsoft.AspNetCore.Mvc string authenticationScheme) => new SignInResult(authenticationScheme, principal, properties); + /// + /// Creates a . + /// + /// The created for the response. + [NonAction] + public virtual SignOutResult SignOut() + => new SignOutResult(); + + /// + /// Creates a with . + /// + /// used to perform the sign-out operation. + /// The created for the response. + [NonAction] + public virtual SignOutResult SignOut(AuthenticationProperties properties) + => new SignOutResult(properties); + /// /// Creates a with the specified authentication schemes. /// diff --git a/src/Mvc/Mvc.Core/src/SignInResult.cs b/src/Mvc/Mvc.Core/src/SignInResult.cs index 010138ff81..c6cf63ffe8 100644 --- a/src/Mvc/Mvc.Core/src/SignInResult.cs +++ b/src/Mvc/Mvc.Core/src/SignInResult.cs @@ -16,6 +16,16 @@ namespace Microsoft.AspNetCore.Mvc /// public class SignInResult : ActionResult { + /// + /// Initializes a new instance of with the + /// default authentication scheme. + /// + /// The claims principal containing the user claims. + public SignInResult(ClaimsPrincipal principal) + : this(authenticationScheme: null, principal, properties: null) + { + } + /// /// Initializes a new instance of with the /// specified authentication scheme. @@ -27,6 +37,17 @@ namespace Microsoft.AspNetCore.Mvc { } + /// + /// Initializes a new instance of with the + /// default authentication scheme and . + /// + /// The claims principal containing the user claims. + /// used to perform the sign-in operation. + public SignInResult(ClaimsPrincipal principal, AuthenticationProperties properties) + : this(authenticationScheme: null, principal, properties) + { + } + /// /// Initializes a new instance of with the /// specified authentication scheme and . @@ -36,8 +57,8 @@ namespace Microsoft.AspNetCore.Mvc /// used to perform the sign-in operation. 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; } diff --git a/src/Mvc/Mvc.Core/src/SignOutResult.cs b/src/Mvc/Mvc.Core/src/SignOutResult.cs index 47dbfb8ecb..439deded98 100644 --- a/src/Mvc/Mvc.Core/src/SignOutResult.cs +++ b/src/Mvc/Mvc.Core/src/SignOutResult.cs @@ -24,6 +24,16 @@ namespace Microsoft.AspNetCore.Mvc { } + /// + /// Initializes a new instance of with the default sign out scheme. + /// specified authentication scheme and . + /// + /// used to perform the sign-out operation. + public SignOutResult(AuthenticationProperties properties) + : this(Array.Empty(), properties) + { + } + /// /// Initializes a new instance of with the /// specified authentication scheme.