diff --git a/src/Auth0.AspNetCore.Authentication/Auth0WebAppOptions.cs b/src/Auth0.AspNetCore.Authentication/Auth0WebAppOptions.cs index 2a4fc39..e72fdd4 100644 --- a/src/Auth0.AspNetCore.Authentication/Auth0WebAppOptions.cs +++ b/src/Auth0.AspNetCore.Authentication/Auth0WebAppOptions.cs @@ -123,5 +123,33 @@ public class Auth0WebAppOptions /// Sets whether to use pushed authorization requests or not. /// public bool UsePushedAuthorization { get; set; } = false; + + /// + /// Gets or sets the authentication scheme corresponding to the middleware + /// responsible of persisting user's identity after a successful authentication. + /// This value typically corresponds to a cookie middleware registered in the Startup class. + /// When omitted, is used as a fallback value. + /// + public string? SignInScheme { get; set; } + + /// + /// If set, this specifies the target scheme that this scheme should forward SignInAsync calls to. + /// For example Context.SignInAsync("ThisScheme") => Context.SignInAsync("ForwardSignInValue"); + /// Set the target to the current scheme to disable forwarding and allow normal processing. + /// + public string? ForwardSignIn { get; set; } + + /// + /// The Authentication Scheme to use with SignOut on the SignOutPath. SignInScheme will be used if this + /// is not set. + /// + public string? SignOutScheme { get; set; } + + /// + /// If set, this specifies the target scheme that this scheme should forward SignOutAsync calls to. + /// For example Context.SignOutAsync("ThisScheme") => Context.SignOutAsync("ForwardSignOutValue"); + /// Set the target to the current scheme to disable forwarding and allow normal processing. + /// + public string? ForwardSignOut { get; set; } } } diff --git a/src/Auth0.AspNetCore.Authentication/AuthenticationBuilderExtensions.cs b/src/Auth0.AspNetCore.Authentication/AuthenticationBuilderExtensions.cs index d2cd06b..6aa9c0b 100644 --- a/src/Auth0.AspNetCore.Authentication/AuthenticationBuilderExtensions.cs +++ b/src/Auth0.AspNetCore.Authentication/AuthenticationBuilderExtensions.cs @@ -96,6 +96,10 @@ private static void ConfigureOpenIdConnect(OpenIdConnectOptions oidcOptions, Aut oidcOptions.Backchannel = auth0Options.Backchannel!; oidcOptions.MaxAge = auth0Options.MaxAge; oidcOptions.AccessDeniedPath = auth0Options.AccessDeniedPath; + oidcOptions.SignInScheme = auth0Options.SignInScheme; + oidcOptions.ForwardSignIn = auth0Options.ForwardSignIn; + oidcOptions.SignOutScheme = auth0Options.SignOutScheme; + oidcOptions.ForwardSignOut = auth0Options.ForwardSignOut; if (!oidcOptions.Scope.Contains("openid")) {