From d2471002e4f2ba8b87d71fca153e8de292d6994e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Thu, 3 Dec 2026 15:53:12 +0300 Subject: [PATCH 1/3] refactor(architecture): Introduce Surrogate Model and Consolidate Authentication Architecture --- .../Domain/Surrogates/SurrogateKind.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/CodeBeam.UltimateAuth.Core/Domain/Surrogates/SurrogateKind.cs diff --git a/src/CodeBeam.UltimateAuth.Core/Domain/Surrogates/SurrogateKind.cs b/src/CodeBeam.UltimateAuth.Core/Domain/Surrogates/SurrogateKind.cs new file mode 100644 index 00000000..59416dfc --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Core/Domain/Surrogates/SurrogateKind.cs @@ -0,0 +1,23 @@ +namespace CodeBeam.UltimateAuth.Core.Domain; + +/// +/// Identifies the kind of secondary authentication data used to maintain authentication continuity. +/// +public enum SurrogateKind +{ + /// + /// An authentication-capable session identifier. + /// Metadata-only session identifiers are not surrogates. + /// + SessionId = 0, + + /// + /// A token used to authenticate subsequent requests. + /// + AccessToken = 10, + + /// + /// A token used to renew authentication without presenting the original credential again. + /// + RefreshToken = 20 +} From 484c562a0c3eb5a3f701cf6a7f06a74b5a61e3ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Thu, 3 Dec 2026 21:15:46 +0300 Subject: [PATCH 2/3] Main Implementation --- .../Contracts/Token/PrimaryToken.cs | 19 -- .../Contracts/Token/TokenValidationResult.cs | 68 ------ .../Domain/Principals/GrantKind.cs | 8 - .../Domain/Principals/PrimaryTokenKind.cs | 7 - ...edentialPurpose.cs => SessionIdPurpose.cs} | 2 +- .../Domain/Session/UAuthSession.cs | 12 +- .../Extensions/UAuthModeExtensions.cs | 105 ++++++++ .../Options/TokenResponseMode.cs | 10 - .../Abstractions/ICredentialResponseWriter.cs | 12 - .../Abstractions/ISessionLineageValidator.cs | 2 +- .../Abstractions/ISurrogateResponseWriter.cs | 12 + .../Auth/Context/AuthFlowContext.cs | 10 +- .../Auth/Context/AuthFlowContextFactory.cs | 8 - .../Auth/IPrimaryTokenResolver.cs | 8 - .../Auth/PrimaryTokenResolver.cs | 19 -- .../Auth/Response/AuthResponseResolver.cs | 225 +++++++++--------- .../Auth/Response/EffectiveAuthResponse.cs | 32 ++- ...very.cs => EffectiveSurrogateTransport.cs} | 24 +- ...> SurrogateTransportCollisionValidator.cs} | 22 +- .../Auth/SemiHybridAuthorityValidator.cs | 2 +- .../AspNetCore/UAuthAuthenticationHandler.cs | 10 +- .../UAuthResourceAuthenticationHandler.cs | 91 +++---- .../Domain/HeaderTokenFormat.cs | 7 - .../Domain/HeaderValueFormat.cs | 10 + ...tDeliveryMode.cs => SurrogateTransport.cs} | 2 +- .../Endpoints/LoginEndpointHandler.cs | 12 +- .../Endpoints/LogoutEndpointHandler.cs | 10 +- .../Endpoints/PkceEndpointHandler.cs | 14 +- .../Endpoints/RefreshEndpointHandler.cs | 14 +- .../Endpoints/UAuthLoginTransportEndpoint.cs | 5 +- .../Endpoints/ValidateEndpointHandler.cs | 14 +- .../Extensions/ServiceCollectionExtensions.cs | 10 +- .../Extensions/SurrogateResolverExtensions.cs | 17 ++ .../Flows/Refresh/IRefreshResponsePolicy.cs | 2 +- .../Flows/Refresh/RefreshResponsePolicy.cs | 14 +- .../Flows/Refresh/RefreshTokenResolver.cs | 2 +- .../Cookies/IUAuthCookiePolicyBuilder.cs | 2 +- .../Cookies/UAuthCookiePolicyBuilder.cs | 14 +- .../ITransportCredentialResolver.cs | 10 - .../AspNetCore/TransportCredential.cs | 12 - .../AspNetCore/TransportCredentialKind.cs | 9 - .../AspNetCore/TransportCredentialResolver.cs | 51 ---- .../Credentials/IUAuthBodyPolicyBuilder.cs | 2 +- .../Credentials/IUAuthHeaderPolicyBuilder.cs | 2 +- ...seWriter.cs => SurrogateResponseWriter.cs} | 56 ++--- .../Credentials/UAuthBodyPolicyBuilder.cs | 2 +- .../Credentials/UAuthHeaderPolicyBuilder.cs | 8 +- .../Issuers/UAuthSessionIssuer.cs | 14 +- .../SessionId/SessionIdResolver.cs | 27 +-- .../Surrogates/ISurrogateResolver.cs | 9 + .../Surrogates/ResolvedSurrogate.cs | 22 ++ .../SurrogateReader.cs} | 14 +- .../Surrogates/SurrogateResolver.cs | 24 ++ .../Options/CredentialResponseOptions.cs | 60 ----- ...ptions.cs => SurrogateTransportOptions.cs} | 8 +- .../Options/UAuthHubCorsOptionsSetup.cs | 2 +- .../Options/UAuthResourceApiOptions.cs | 83 +++---- .../Options/UAuthResponseOptions.cs | 25 -- .../Options/UAuthServerOptions.cs | 16 +- ...s.cs => UAuthSurrogateTransportOptions.cs} | 14 +- .../UAuthResourceApiOptionsValidator.cs | 18 +- .../ResourceApi/RemoteHubValidationService.cs | 29 +-- .../ResourceApi/ResourceSessionIdResolver.cs | 41 +--- .../ResourceSurrogateTransportFactory.cs | 55 +++++ .../Security/UAuthCsrfGrantInspector.cs | 14 -- .../Security/UAuthCsrfPolicyEvaluator.cs | 2 +- .../Security/UAuthCsrfSurrogateInspector.cs | 14 ++ .../Services/JwtLogoutService.cs | 2 +- .../Services/RefreshTokenRotationService.cs | 2 +- .../Services/SessionLineageValidator.cs | 2 +- .../Services/UAuthSessionValidator.cs | 2 +- .../Data/UAuthSessionsModelBuilder.cs | 2 +- .../Projections/SessionProjection.cs | 2 +- .../Infrastructure/AuthServerFactory.cs | 2 +- .../LoginTests.cs | 6 +- .../PureJwtIdentityTests.cs | 16 +- .../RefreshTests.cs | 2 +- .../ResourceApi/ResourceApiTestHost.cs | 14 +- .../Core/UAuthModeExtensionsTests.cs | 118 +++++++++ .../Helpers/AuthFlowTestFactory.cs | 13 +- .../RemoteHubValidationServiceTests.cs | 55 ++--- .../ResourceSessionIdResolverTests.cs | 91 ++++--- .../UAuthResourceApiOptionsTests.cs | 36 +-- .../UAuthResourceApiOptionsValidatorTests.cs | 30 ++- .../UAuthResourceApiRegistrationTests.cs | 13 +- .../Security/UAuthCsrfPolicyEvaluatorTests.cs | 68 +++--- ...cs => UAuthCsrfSurrogateInspectorTests.cs} | 38 +-- .../Server/AuthFlowContextFactoryTests.cs | 30 +-- .../Server/AuthResponseResolverTests.cs | 6 +- .../Server/CookieInfrastructureTests.cs | 96 ++++---- .../Server/CredentialInfrastructureTests.cs | 30 +-- .../EffectiveServerOptionsProviderTests.cs | 15 +- .../Server/GrantCredentialReaderTests.cs | 159 ++++++------- .../Server/JwtLogoutServiceTests.cs | 6 +- .../Server/LoginEndpointHandlerTests.cs | 20 +- .../Server/LogoutEndpointHandlerTests.cs | 3 - .../Server/PkceEndpointHandlerTests.cs | 25 +- .../Server/RefreshFlowServiceTests.cs | 7 +- .../Server/RefreshTokenResolverTests.cs | 30 +-- .../RefreshTokenRotationServiceTests.cs | 9 +- .../SemiHybridAuthorityValidatorTests.cs | 20 +- .../Server/SessionEndpointHandlerTests.cs | 1 - ...sts.cs => SurrogateResponseWriterTests.cs} | 166 ++++++------- ...rogateTransportCollisionValidatorTests.cs} | 93 ++++---- .../TransportCredentialResolverTests.cs | 104 ++++---- .../Server/UAuthCorsHubOptionsSetupTests.cs | 20 +- .../Server/UAuthFlowServiceTests.cs | 13 +- .../UAuthLoginTransportEndpointTests.cs | 26 +- ...UAuthResourceAuthenticationHandlerTests.cs | 59 +++-- .../Server/UAuthSessionValidatorTests.cs | 8 +- ...thStatusAuthorizationResultHandlerTests.cs | 37 +-- .../Server/ValidateEndpointHandlerTests.cs | 111 ++++----- .../Sessions/SessionIdResolverTests.cs | 70 +++--- .../Sessions/UAuthSessionIssuerTests.cs | 6 +- 114 files changed, 1507 insertions(+), 1677 deletions(-) delete mode 100644 src/CodeBeam.UltimateAuth.Core/Contracts/Token/PrimaryToken.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Contracts/Token/TokenValidationResult.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Domain/Principals/GrantKind.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Domain/Principals/PrimaryTokenKind.cs rename src/CodeBeam.UltimateAuth.Core/Domain/Session/{SessionCredentialPurpose.cs => SessionIdPurpose.cs} (92%) create mode 100644 src/CodeBeam.UltimateAuth.Core/Extensions/UAuthModeExtensions.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Options/TokenResponseMode.cs delete mode 100644 src/CodeBeam.UltimateAuth.Server/Abstractions/ICredentialResponseWriter.cs create mode 100644 src/CodeBeam.UltimateAuth.Server/Abstractions/ISurrogateResponseWriter.cs delete mode 100644 src/CodeBeam.UltimateAuth.Server/Auth/IPrimaryTokenResolver.cs delete mode 100644 src/CodeBeam.UltimateAuth.Server/Auth/PrimaryTokenResolver.cs rename src/CodeBeam.UltimateAuth.Server/Auth/Response/{EffectiveGrantDelivery.cs => EffectiveSurrogateTransport.cs} (58%) rename src/CodeBeam.UltimateAuth.Server/Auth/Response/{GrantDeliveryCollisionValidator.cs => SurrogateTransportCollisionValidator.cs} (59%) delete mode 100644 src/CodeBeam.UltimateAuth.Server/Domain/HeaderTokenFormat.cs create mode 100644 src/CodeBeam.UltimateAuth.Server/Domain/HeaderValueFormat.cs rename src/CodeBeam.UltimateAuth.Server/Domain/{GrantDeliveryMode.cs => SurrogateTransport.cs} (95%) create mode 100644 src/CodeBeam.UltimateAuth.Server/Extensions/SurrogateResolverExtensions.cs delete mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/ITransportCredentialResolver.cs delete mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredential.cs delete mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredentialKind.cs delete mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredentialResolver.cs rename src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/{CredentialResponseWriter.cs => SurrogateResponseWriter.cs} (66%) create mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/ISurrogateResolver.cs create mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/ResolvedSurrogate.cs rename src/CodeBeam.UltimateAuth.Server/Infrastructure/{Credentials/GrantCredentialReader.cs => Surrogates/SurrogateReader.cs} (90%) create mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/SurrogateResolver.cs delete mode 100644 src/CodeBeam.UltimateAuth.Server/Options/CredentialResponseOptions.cs rename src/CodeBeam.UltimateAuth.Server/Options/{GrantDeliveryOptions.cs => SurrogateTransportOptions.cs} (84%) delete mode 100644 src/CodeBeam.UltimateAuth.Server/Options/UAuthResponseOptions.cs rename src/CodeBeam.UltimateAuth.Server/Options/{UAuthGrantDeliveryOptions.cs => UAuthSurrogateTransportOptions.cs} (73%) create mode 100644 src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSurrogateTransportFactory.cs delete mode 100644 src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfGrantInspector.cs create mode 100644 src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfSurrogateInspector.cs create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Core/UAuthModeExtensionsTests.cs rename tests/CodeBeam.UltimateAuth.Tests.Unit/Security/{UAuthCsrfGrantInspectorTests.cs => UAuthCsrfSurrogateInspectorTests.cs} (55%) rename tests/CodeBeam.UltimateAuth.Tests.Unit/Server/{CredentialResponseWriterTests.cs => SurrogateResponseWriterTests.cs} (70%) rename tests/CodeBeam.UltimateAuth.Tests.Unit/Server/{GrantDeliveryCollisionValidatorTests.cs => SurrogateTransportCollisionValidatorTests.cs} (54%) diff --git a/src/CodeBeam.UltimateAuth.Core/Contracts/Token/PrimaryToken.cs b/src/CodeBeam.UltimateAuth.Core/Contracts/Token/PrimaryToken.cs deleted file mode 100644 index 368e4a4b..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Contracts/Token/PrimaryToken.cs +++ /dev/null @@ -1,19 +0,0 @@ -//using CodeBeam.UltimateAuth.Core.Domain; - -//namespace CodeBeam.UltimateAuth.Core.Contracts; - -//public sealed record PrimaryToken -//{ -// public PrimaryTokenKind Kind { get; } -// public string Value { get; } - -// private PrimaryToken(PrimaryTokenKind kind, string value) -// { -// Kind = kind; -// Value = value; -// } - -// public static PrimaryToken FromSession(AuthSessionId sessionId) => new(PrimaryTokenKind.Session, sessionId.ToString()); - -// public static PrimaryToken FromAccessToken(AccessToken token) => new(PrimaryTokenKind.AccessToken, token.Token); -//} diff --git a/src/CodeBeam.UltimateAuth.Core/Contracts/Token/TokenValidationResult.cs b/src/CodeBeam.UltimateAuth.Core/Contracts/Token/TokenValidationResult.cs deleted file mode 100644 index c77b6a71..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Contracts/Token/TokenValidationResult.cs +++ /dev/null @@ -1,68 +0,0 @@ -//using CodeBeam.UltimateAuth.Core.Domain; -//using CodeBeam.UltimateAuth.Core.MultiTenancy; -//using System.Security.Claims; - -//namespace CodeBeam.UltimateAuth.Core.Contracts; - -//public sealed record TokenValidationResult -//{ -// public bool IsValid { get; init; } -// public TokenFormat Format { get; init; } -// public TenantKey? Tenant { get; init; } -// public TUserId? UserId { get; init; } -// public AuthSessionId? SessionId { get; init; } -// public IReadOnlyCollection Claims { get; init; } = Array.Empty(); -// public TokenInvalidReason? InvalidReason { get; init; } -// public DateTimeOffset? ExpiresAt { get; set; } - -// private TokenValidationResult( -// bool isValid, -// TokenFormat format, -// TenantKey? tenant, -// TUserId? userId, -// AuthSessionId? sessionId, -// IReadOnlyCollection? claims, -// TokenInvalidReason? invalidReason, -// DateTimeOffset? expiresAt -// ) -// { -// IsValid = isValid; -// Format = format; -// Tenant = tenant; -// UserId = userId; -// SessionId = sessionId; -// Claims = claims ?? Array.Empty(); -// InvalidReason = invalidReason; -// ExpiresAt = expiresAt; -// } - -// public static TokenValidationResult Valid( -// TokenFormat format, -// TenantKey tenant, -// TUserId userId, -// AuthSessionId? sessionId, -// IReadOnlyCollection claims, -// DateTimeOffset? expiresAt) -// => new( -// isValid: true, -// format, -// tenant, -// userId, -// sessionId, -// claims, -// invalidReason: null, -// expiresAt -// ); - -// public static TokenValidationResult Invalid(TokenFormat format, TokenInvalidReason reason) -// => new( -// isValid: false, -// format: format, -// tenant: null, -// userId: default, -// sessionId: null, -// claims: null, -// invalidReason: reason, -// expiresAt: null -// ); -//} diff --git a/src/CodeBeam.UltimateAuth.Core/Domain/Principals/GrantKind.cs b/src/CodeBeam.UltimateAuth.Core/Domain/Principals/GrantKind.cs deleted file mode 100644 index 162dac79..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Domain/Principals/GrantKind.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace CodeBeam.UltimateAuth.Core.Domain; - -public enum GrantKind -{ - Session = 0, - AccessToken = 10, - RefreshToken = 20 -} diff --git a/src/CodeBeam.UltimateAuth.Core/Domain/Principals/PrimaryTokenKind.cs b/src/CodeBeam.UltimateAuth.Core/Domain/Principals/PrimaryTokenKind.cs deleted file mode 100644 index 7b3ae60e..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Domain/Principals/PrimaryTokenKind.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CodeBeam.UltimateAuth.Core.Domain; - -public enum PrimaryTokenKind -{ - Session = 0, - AccessToken = 10 -} diff --git a/src/CodeBeam.UltimateAuth.Core/Domain/Session/SessionCredentialPurpose.cs b/src/CodeBeam.UltimateAuth.Core/Domain/Session/SessionIdPurpose.cs similarity index 92% rename from src/CodeBeam.UltimateAuth.Core/Domain/Session/SessionCredentialPurpose.cs rename to src/CodeBeam.UltimateAuth.Core/Domain/Session/SessionIdPurpose.cs index 7aecc82e..2ecb11c3 100644 --- a/src/CodeBeam.UltimateAuth.Core/Domain/Session/SessionCredentialPurpose.cs +++ b/src/CodeBeam.UltimateAuth.Core/Domain/Session/SessionIdPurpose.cs @@ -3,7 +3,7 @@ /// /// Defines whether a persisted session can authenticate an opaque credential or only represents JWT lineage. /// -public enum SessionCredentialPurpose +public enum SessionIdPurpose { /// /// The session ID is an opaque authentication credential. diff --git a/src/CodeBeam.UltimateAuth.Core/Domain/Session/UAuthSession.cs b/src/CodeBeam.UltimateAuth.Core/Domain/Session/UAuthSession.cs index 5a71277e..7186ecc4 100644 --- a/src/CodeBeam.UltimateAuth.Core/Domain/Session/UAuthSession.cs +++ b/src/CodeBeam.UltimateAuth.Core/Domain/Session/UAuthSession.cs @@ -19,10 +19,10 @@ public sealed class UAuthSession : IVersionedEntity public SessionMetadata Metadata { get; } public long Version { get; set; } - public SessionCredentialPurpose CredentialPurpose { get; } + public SessionIdPurpose CredentialPurpose { get; } - public bool IsOpaqueCredential => CredentialPurpose == SessionCredentialPurpose.Opaque; - public bool IsMetadataOnly => CredentialPurpose == SessionCredentialPurpose.MetadataOnly; + public bool IsOpaqueCredential => CredentialPurpose == SessionIdPurpose.Opaque; + public bool IsMetadataOnly => CredentialPurpose == SessionIdPurpose.MetadataOnly; public bool IsRevoked => RevokedAt != null; @@ -39,7 +39,7 @@ private UAuthSession( ClaimsSnapshot claims, SessionMetadata metadata, long version, - SessionCredentialPurpose credentialPurpose) + SessionIdPurpose credentialPurpose) { SessionId = sessionId; Tenant = tenant; @@ -67,7 +67,7 @@ public static UAuthSession Create( DeviceContext device, ClaimsSnapshot? claims, SessionMetadata metadata, - SessionCredentialPurpose credentialPurpose = SessionCredentialPurpose.Opaque) + SessionIdPurpose credentialPurpose = SessionIdPurpose.Opaque) { if (!Enum.IsDefined(credentialPurpose)) throw new ArgumentOutOfRangeException(nameof(credentialPurpose)); @@ -123,7 +123,7 @@ internal static UAuthSession FromProjection( ClaimsSnapshot claims, SessionMetadata metadata, long version, - SessionCredentialPurpose credentialPurpose) + SessionIdPurpose credentialPurpose) { return new UAuthSession( sessionId, diff --git a/src/CodeBeam.UltimateAuth.Core/Extensions/UAuthModeExtensions.cs b/src/CodeBeam.UltimateAuth.Core/Extensions/UAuthModeExtensions.cs new file mode 100644 index 00000000..7871af1b --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Core/Extensions/UAuthModeExtensions.cs @@ -0,0 +1,105 @@ +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; + +namespace CodeBeam.UltimateAuth.Core.Extensions; + +public static class UAuthModeExtensions +{ + public static SurrogateKind GetPrimarySurrogateKind(this UAuthMode mode) + => mode switch + { + UAuthMode.PureOpaque or UAuthMode.Hybrid + => SurrogateKind.SessionId, + + UAuthMode.SemiHybrid or UAuthMode.PureJwt + => SurrogateKind.AccessToken, + + _ => throw UnsupportedMode(mode) + }; + + public static bool SupportsSessionLineage(this UAuthMode mode) + => mode switch + { + UAuthMode.PureOpaque or + UAuthMode.Hybrid or + UAuthMode.SemiHybrid => true, + + UAuthMode.PureJwt => false, + + _ => throw UnsupportedMode(mode) + }; + + public static bool UsesSessionIdForAuthentication(this UAuthMode mode) + => mode.GetPrimarySurrogateKind() == SurrogateKind.SessionId; + + public static bool SupportsAccessToken(this UAuthMode mode) + => mode switch + { + UAuthMode.PureOpaque => false, + + UAuthMode.Hybrid or + UAuthMode.SemiHybrid or + UAuthMode.PureJwt => true, + + _ => throw UnsupportedMode(mode) + }; + + public static bool SupportsRefreshToken(this UAuthMode mode) + => mode switch + { + UAuthMode.PureOpaque => false, + + UAuthMode.Hybrid or + UAuthMode.SemiHybrid or + UAuthMode.PureJwt => true, + + _ => throw UnsupportedMode(mode) + }; + + public static TokenFormat? GetAccessTokenFormat(this UAuthMode mode) + => mode switch + { + UAuthMode.PureOpaque => null, + + UAuthMode.Hybrid => TokenFormat.Opaque, + + UAuthMode.SemiHybrid or + UAuthMode.PureJwt => TokenFormat.Jwt, + + _ => throw UnsupportedMode(mode) + }; + + public static bool SupportsSurrogate(this UAuthMode mode, SurrogateKind kind) + => kind switch + { + SurrogateKind.SessionId + => mode.UsesSessionIdForAuthentication(), + + SurrogateKind.AccessToken + => mode.SupportsAccessToken(), + + SurrogateKind.RefreshToken + => mode.SupportsRefreshToken(), + + _ => throw new ArgumentOutOfRangeException( + nameof(kind), kind, "Unsupported surrogate kind.") + }; + + public static TokenFormat? GetTokenFormat(this UAuthMode mode, SurrogateKind kind) + { + if (!mode.SupportsSurrogate(kind)) + return null; + + return kind switch + { + SurrogateKind.SessionId => TokenFormat.Opaque, + SurrogateKind.AccessToken => mode.GetAccessTokenFormat(), + SurrogateKind.RefreshToken => TokenFormat.Opaque, + + _ => throw new ArgumentOutOfRangeException(nameof(kind), kind, "Unsupported surrogate kind.") + }; + } + + private static ArgumentOutOfRangeException UnsupportedMode(UAuthMode mode) + => new(nameof(mode), mode, "Unsupported authentication mode."); +} diff --git a/src/CodeBeam.UltimateAuth.Core/Options/TokenResponseMode.cs b/src/CodeBeam.UltimateAuth.Core/Options/TokenResponseMode.cs deleted file mode 100644 index d7b8f0ee..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Options/TokenResponseMode.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace CodeBeam.UltimateAuth.Core.Options; - -[Obsolete("TokenResponseMode is no longer supported. Use GrantDeliveryMode instead.")] -public enum TokenResponseMode -{ - None = 0, - Cookie = 10, - Header = 20, - Body = 30 -} diff --git a/src/CodeBeam.UltimateAuth.Server/Abstractions/ICredentialResponseWriter.cs b/src/CodeBeam.UltimateAuth.Server/Abstractions/ICredentialResponseWriter.cs deleted file mode 100644 index 51be3f4b..00000000 --- a/src/CodeBeam.UltimateAuth.Server/Abstractions/ICredentialResponseWriter.cs +++ /dev/null @@ -1,12 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Contracts; -using CodeBeam.UltimateAuth.Core.Domain; -using Microsoft.AspNetCore.Http; - -namespace CodeBeam.UltimateAuth.Server.Abstractions; - -public interface ICredentialResponseWriter -{ - void Write(HttpContext context, GrantKind kind, AuthSessionId sessionId); - void Write(HttpContext context, GrantKind kind, AccessToken accessToken); - void Write(HttpContext context, GrantKind kind, RefreshTokenInfo refreshToken); -} diff --git a/src/CodeBeam.UltimateAuth.Server/Abstractions/ISessionLineageValidator.cs b/src/CodeBeam.UltimateAuth.Server/Abstractions/ISessionLineageValidator.cs index aa8d6a39..ecb4fa34 100644 --- a/src/CodeBeam.UltimateAuth.Server/Abstractions/ISessionLineageValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Abstractions/ISessionLineageValidator.cs @@ -5,5 +5,5 @@ namespace CodeBeam.UltimateAuth.Server.Abstractions; public interface ISessionLineageValidator { - Task ValidateAsync(SessionValidationContext context, SessionCredentialPurpose expectedPurpose, CancellationToken ct = default); + Task ValidateAsync(SessionValidationContext context, SessionIdPurpose expectedPurpose, CancellationToken ct = default); } diff --git a/src/CodeBeam.UltimateAuth.Server/Abstractions/ISurrogateResponseWriter.cs b/src/CodeBeam.UltimateAuth.Server/Abstractions/ISurrogateResponseWriter.cs new file mode 100644 index 00000000..450776e2 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Abstractions/ISurrogateResponseWriter.cs @@ -0,0 +1,12 @@ +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; +using Microsoft.AspNetCore.Http; + +namespace CodeBeam.UltimateAuth.Server.Abstractions; + +public interface ISurrogateResponseWriter +{ + void Write(HttpContext context, SurrogateKind kind, AuthSessionId sessionId); + void Write(HttpContext context, SurrogateKind kind, AccessToken accessToken); + void Write(HttpContext context, SurrogateKind kind, RefreshTokenInfo refreshToken); +} diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContext.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContext.cs index 6fa0d95b..1f8a83c1 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContext.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContext.cs @@ -1,7 +1,7 @@ using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Core.Extensions; using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; @@ -26,12 +26,12 @@ public sealed class AuthFlowContext public EffectiveAuthResponse Response { get; } public ReturnUrlInfo ReturnUrlInfo { get; } - public PrimaryTokenKind PrimaryTokenKind { get; } + public SurrogateKind PrimarySurrogateKind => EffectiveMode.GetPrimarySurrogateKind(); // Helpers public bool AllowsTokenIssuance => - Response.AccessTokenDelivery.Mode != GrantDeliveryMode.None || - Response.RefreshTokenDelivery.Mode != GrantDeliveryMode.None; + Response.AccessTokenTransport.Mode != SurrogateTransport.None || + Response.RefreshTokenTransport.Mode != SurrogateTransport.None; public bool IsSingleTenant => Tenant.IsSingle; public bool IsMultiTenant => Tenant.IsNormal; @@ -47,7 +47,6 @@ internal AuthFlowContext( SessionSecurityContext? session, UAuthServerOptions options, EffectiveAuthResponse response, - PrimaryTokenKind primaryTokenKind, ReturnUrlInfo returnUrlInfo) { if (!tenantKey.IsValid || tenantKey.IsUnresolved) @@ -66,7 +65,6 @@ internal AuthFlowContext( Options = options; Response = response; - PrimaryTokenKind = primaryTokenKind; ReturnUrlInfo = returnUrlInfo; } diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs index 5fc3c942..69dcb6aa 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs @@ -16,7 +16,6 @@ namespace CodeBeam.UltimateAuth.Server.Auth; internal sealed class AuthFlowContextFactory : IAuthFlowContextFactory { private readonly IApplicationProfileReader _applicationProfileReader; - private readonly IPrimaryTokenResolver _primaryTokenResolver; private readonly IEffectiveServerOptionsProvider _serverOptionsProvider; private readonly IAuthResponseResolver _authResponseResolver; private readonly IDeviceResolver _deviceResolver; @@ -27,7 +26,6 @@ internal sealed class AuthFlowContextFactory : IAuthFlowContextFactory public AuthFlowContextFactory( IApplicationProfileReader applicationProfileReader, - IPrimaryTokenResolver primaryTokenResolver, IEffectiveServerOptionsProvider serverOptionsProvider, IAuthResponseResolver authResponseResolver, IDeviceResolver deviceResolver, @@ -37,7 +35,6 @@ public AuthFlowContextFactory( IClock clock) { _applicationProfileReader = applicationProfileReader; - _primaryTokenResolver = primaryTokenResolver; _serverOptionsProvider = serverOptionsProvider; _authResponseResolver = authResponseResolver; _deviceResolver = deviceResolver; @@ -64,7 +61,6 @@ public async ValueTask CreateAsync(HttpContext ctx, AuthFlowTyp if (allowedModes is { Count: > 0 } && !allowedModes.Contains(effectiveMode)) throw new InvalidOperationException($"Auth mode '{effectiveMode}' is not allowed by server configuration."); - var primaryTokenKind = _primaryTokenResolver.Resolve(effectiveMode); var response = _authResponseResolver.Resolve(effectiveMode, flowType, applicationProfile, effective); var deviceInfo = await _deviceResolver.ResolveAsync(ctx); var deviceContext = _deviceContextFactory.Create(deviceInfo); @@ -168,7 +164,6 @@ public async ValueTask CreateAsync(HttpContext ctx, AuthFlowTyp sessionSecurityContext, options, response, - primaryTokenKind, returnUrlInfo ); } @@ -194,7 +189,6 @@ public async ValueTask RecreateWithApplicationProfileAsync(Auth throw new InvalidOperationException("An authenticated flow cannot change its authentication mode through a application profile override."); } - var primaryTokenKind = _primaryTokenResolver.Resolve(effectiveMode); var response = _authResponseResolver.Resolve(effectiveMode, flowType, overriddenProfile, effective); var returnUrlInfo = existing.ReturnUrlInfo; @@ -212,7 +206,6 @@ public async ValueTask RecreateWithApplicationProfileAsync(Auth session, options, response, - primaryTokenKind, returnUrlInfo ); } @@ -233,7 +226,6 @@ public ValueTask RecreateWithDeviceAsync(AuthFlowContext existi existing.Session, existing.Options, existing.Response, - existing.PrimaryTokenKind, existing.ReturnUrlInfo )); } diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/IPrimaryTokenResolver.cs b/src/CodeBeam.UltimateAuth.Server/Auth/IPrimaryTokenResolver.cs deleted file mode 100644 index 07a03b27..00000000 --- a/src/CodeBeam.UltimateAuth.Server/Auth/IPrimaryTokenResolver.cs +++ /dev/null @@ -1,8 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Domain; - -namespace CodeBeam.UltimateAuth.Server.Auth; - -public interface IPrimaryTokenResolver -{ - PrimaryTokenKind Resolve(UAuthMode effectiveMode); -} diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/PrimaryTokenResolver.cs b/src/CodeBeam.UltimateAuth.Server/Auth/PrimaryTokenResolver.cs deleted file mode 100644 index 4f3fd31f..00000000 --- a/src/CodeBeam.UltimateAuth.Server/Auth/PrimaryTokenResolver.cs +++ /dev/null @@ -1,19 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Domain; - -namespace CodeBeam.UltimateAuth.Server.Auth; - -internal sealed class PrimaryTokenResolver : IPrimaryTokenResolver -{ - public PrimaryTokenKind Resolve(UAuthMode effectiveMode) - { - return effectiveMode switch - { - UAuthMode.PureOpaque => PrimaryTokenKind.Session, - UAuthMode.Hybrid => PrimaryTokenKind.Session, - UAuthMode.SemiHybrid => PrimaryTokenKind.AccessToken, - UAuthMode.PureJwt => PrimaryTokenKind.AccessToken, - _ => throw new InvalidOperationException( - $"Unsupported auth mode: {effectiveMode}") - }; - } -} diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseResolver.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseResolver.cs index 5bfe525a..db6f403a 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseResolver.cs @@ -1,5 +1,5 @@ -using CodeBeam.UltimateAuth.Core.Contracts; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Extensions; using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Options; using Microsoft.Net.Http.Headers; @@ -8,17 +8,21 @@ namespace CodeBeam.UltimateAuth.Server.Auth; internal sealed class AuthResponseResolver : IAuthResponseResolver { - public EffectiveAuthResponse Resolve(UAuthMode effectiveMode, AuthFlowType flowType, UAuthApplicationProfile applicationProfile, EffectiveUAuthServerOptions effectiveOptions) + public EffectiveAuthResponse Resolve( + UAuthMode effectiveMode, + AuthFlowType flowType, + UAuthApplicationProfile applicationProfile, + EffectiveUAuthServerOptions effectiveOptions) { var options = effectiveOptions.Options; var redirect = flowType switch { - AuthFlowType.Login or AuthFlowType.Reauthentication => - EffectiveRedirectResponse.FromLogin(options.Redirect.Login), + AuthFlowType.Login or AuthFlowType.Reauthentication + => EffectiveRedirectResponse.FromLogin(options.Redirect.Login), - AuthFlowType.Logout => - EffectiveRedirectResponse.FromLogout(options.Redirect.Logout), + AuthFlowType.Logout + => EffectiveRedirectResponse.FromLogout(options.Redirect.Logout), _ => EffectiveRedirectResponse.Disabled }; @@ -27,151 +31,98 @@ public EffectiveAuthResponse Resolve(UAuthMode effectiveMode, AuthFlowType flowT } public EffectiveAuthResponse ResolveForAuthentication(UAuthMode effectiveMode, UAuthApplicationProfile applicationProfile, EffectiveUAuthServerOptions effectiveOptions) - { - return ResolveCore(effectiveMode, applicationProfile, effectiveOptions, EffectiveRedirectResponse.Disabled); - } + => ResolveCore(effectiveMode, applicationProfile, effectiveOptions, EffectiveRedirectResponse.Disabled); - private EffectiveAuthResponse ResolveCore(UAuthMode effectiveMode, UAuthApplicationProfile applicationProfile, EffectiveUAuthServerOptions effectiveOptions, EffectiveRedirectResponse redirect) + private static EffectiveAuthResponse ResolveCore( + UAuthMode effectiveMode, + UAuthApplicationProfile applicationProfile, + EffectiveUAuthServerOptions effectiveOptions, + EffectiveRedirectResponse redirect) { var options = effectiveOptions.Options; - var delivery = options.GrantDelivery; - - var session = ResolveGrant( - GrantKind.Session, - TokenFormat.Opaque, - effectiveMode is UAuthMode.PureOpaque or UAuthMode.Hybrid, - effectiveMode is UAuthMode.PureOpaque or UAuthMode.Hybrid - ? GrantDeliveryMode.Cookie - : GrantDeliveryMode.None, - delivery.Session, - delivery.Default, - applicationProfile, - options); - - var accessToken = ResolveGrant( - GrantKind.AccessToken, - effectiveMode is UAuthMode.PureOpaque or UAuthMode.Hybrid - ? TokenFormat.Opaque - : TokenFormat.Jwt, - effectiveMode is UAuthMode.Hybrid - or UAuthMode.SemiHybrid - or UAuthMode.PureJwt, - effectiveMode == UAuthMode.PureOpaque - ? GrantDeliveryMode.None - : GrantDeliveryMode.Header, - delivery.AccessToken, - delivery.Default, - applicationProfile, - options); - - var refreshToken = ResolveGrant( - GrantKind.RefreshToken, - TokenFormat.Opaque, - effectiveMode is UAuthMode.Hybrid - or UAuthMode.SemiHybrid - or UAuthMode.PureJwt, - GrantDeliveryMode.Cookie, - delivery.RefreshToken, - delivery.Default, - applicationProfile, - options); - - var response = new EffectiveAuthResponse(session, accessToken, refreshToken, redirect); - GrantDeliveryCollisionValidator.Validate(response); + + var response = new EffectiveAuthResponse( + ResolveTransport(SurrogateKind.SessionId, effectiveMode, applicationProfile, options), + ResolveTransport(SurrogateKind.AccessToken, effectiveMode, applicationProfile, options), + ResolveTransport(SurrogateKind.RefreshToken, effectiveMode, applicationProfile, options), + redirect); + + SurrogateTransportCollisionValidator.Validate(response); return response; } - private static EffectiveGrantDelivery ResolveGrant( - GrantKind kind, - TokenFormat tokenFormat, - bool available, - GrantDeliveryMode modeDefault, - GrantDeliveryOptions configured, - GrantDeliveryMode? globalDefault, - UAuthApplicationProfile applicationProfile, - UAuthServerOptions server) + private static EffectiveSurrogateTransport ResolveTransport(SurrogateKind kind, UAuthMode effectiveMode, UAuthApplicationProfile applicationProfile, UAuthServerOptions server) { - if (!available) + var configured = kind switch + { + SurrogateKind.SessionId + => server.Transport.SessionId, + + SurrogateKind.AccessToken + => server.Transport.AccessToken, + + SurrogateKind.RefreshToken + => server.Transport.RefreshToken, + + _ => throw new ArgumentOutOfRangeException(nameof(kind)) + }; + + var tokenFormat = effectiveMode.GetTokenFormat(kind); + + if (tokenFormat is null) { - if (configured.Mode is not null && configured.Mode != GrantDeliveryMode.None) + if (configured.Mode is not null && configured.Mode != SurrogateTransport.None) { - throw new InvalidOperationException($"Grant '{kind}' is not available in the selected authentication mode."); + throw new InvalidOperationException($"Surrogate '{kind}' is not available in the selected authentication mode."); } - return EffectiveGrantDelivery.Disabled(kind); + return EffectiveSurrogateTransport.Disabled(kind); } - var profileDefault = applicationProfile == UAuthApplicationProfile.Maui && - modeDefault == GrantDeliveryMode.Cookie - ? GrantDeliveryMode.Header - : modeDefault; - var mode = configured.Mode - ?? globalDefault - ?? profileDefault; + ?? server.Transport.Default + ?? GetDefaultTransport(kind, applicationProfile); if (!Enum.IsDefined(mode)) { - throw new InvalidOperationException( - $"Invalid delivery mode '{mode}' for grant '{kind}'."); + throw new InvalidOperationException($"Invalid transport '{mode}' for surrogate '{kind}'."); } - if (mode == GrantDeliveryMode.None) + if (mode == SurrogateTransport.None) { - throw new InvalidOperationException( - $"Grant '{kind}' is required by the selected authentication mode " + - "and cannot have delivery mode None."); + throw new InvalidOperationException($"Surrogate '{kind}' is required by the selected authentication mode and cannot have transport None."); } - if (mode == GrantDeliveryMode.Body) + if (mode == SurrogateTransport.Body) { - throw new NotSupportedException($"Body grant delivery is not supported for '{kind}'."); + throw new NotSupportedException($"Body transport is not supported for '{kind}'."); } - var cookie = mode == GrantDeliveryMode.Cookie - ? kind switch - { - GrantKind.Session => server.Cookie.Session, - GrantKind.AccessToken => server.Cookie.AccessToken, - GrantKind.RefreshToken => server.Cookie.RefreshToken, - _ => throw new InvalidOperationException($"Unsupported grant kind '{kind}'.") - } + var cookie = mode == SurrogateTransport.Cookie + ? GetCookieOptions(kind, server) : null; if (cookie is not null) { - try - { - _ = new SetCookieHeaderValue(cookie.Name, "validation").ToString(); - } - catch (ArgumentException ex) - { - throw new InvalidOperationException($"Invalid cookie name '{cookie.Name}' for grant '{kind}'.", ex); - } + ValidateCookieName(cookie, kind); } - var headerName = configured.HeaderName ?? kind switch - { - GrantKind.Session => "uas", - GrantKind.AccessToken => "uat", - GrantKind.RefreshToken => "uar", - _ => throw new InvalidOperationException($"Unsupported grant kind '{kind}'.") - }; + var headerName = configured.HeaderName ?? GetDefaultHeaderName(kind); - var headerFormat = configured.HeaderFormat ?? HeaderTokenFormat.Bearer; + var headerFormat = configured.HeaderFormat ?? HeaderValueFormat.Bearer; - var requestHeaderName = kind == GrantKind.AccessToken + var requestHeaderName = kind == SurrogateKind.AccessToken ? "Authorization" : headerName; - var requestHeaderFormat = kind == GrantKind.AccessToken - ? HeaderTokenFormat.Bearer + var requestHeaderFormat = kind == SurrogateKind.AccessToken + ? HeaderValueFormat.Bearer : headerFormat; - return new EffectiveGrantDelivery( + return new EffectiveSurrogateTransport( kind, - tokenFormat, + tokenFormat.Value, mode, headerName, headerFormat, @@ -179,4 +130,54 @@ private static EffectiveGrantDelivery ResolveGrant( requestHeaderName, requestHeaderFormat); } + + private static SurrogateTransport GetDefaultTransport(SurrogateKind kind, UAuthApplicationProfile applicationProfile) + { + if (applicationProfile == UAuthApplicationProfile.Maui) + return SurrogateTransport.Header; + + return kind switch + { + SurrogateKind.SessionId => SurrogateTransport.Cookie, + SurrogateKind.AccessToken => SurrogateTransport.Header, + SurrogateKind.RefreshToken => SurrogateTransport.Cookie, + + _ => throw new ArgumentOutOfRangeException(nameof(kind)) + }; + } + + private static UAuthCookieOptions GetCookieOptions(SurrogateKind kind, UAuthServerOptions server) + => kind switch + { + SurrogateKind.SessionId => server.Cookie.Session, + SurrogateKind.AccessToken => server.Cookie.AccessToken, + SurrogateKind.RefreshToken => server.Cookie.RefreshToken, + + _ => throw new ArgumentOutOfRangeException(nameof(kind)) + }; + + private static string GetDefaultHeaderName(SurrogateKind kind) + => kind switch + { + SurrogateKind.SessionId => "uas", + SurrogateKind.AccessToken => "uat", + SurrogateKind.RefreshToken => "uar", + + _ => throw new ArgumentOutOfRangeException(nameof(kind)) + }; + + private static void ValidateCookieName(UAuthCookieOptions cookie, SurrogateKind kind) + { + try + { + _ = new SetCookieHeaderValue( + cookie.Name, "validation").ToString(); + } + catch (ArgumentException ex) + { + throw new InvalidOperationException( + $"Invalid cookie name '{cookie.Name}' " + + $"for surrogate '{kind}'.", ex); + } + } } diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveAuthResponse.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveAuthResponse.cs index f1d587ba..95a2c4aa 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveAuthResponse.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveAuthResponse.cs @@ -1,21 +1,33 @@ -namespace CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Core.Domain; + +namespace CodeBeam.UltimateAuth.Server.Auth; public sealed class EffectiveAuthResponse { - public EffectiveGrantDelivery SessionIdDelivery { get; } - public EffectiveGrantDelivery AccessTokenDelivery { get; } - public EffectiveGrantDelivery RefreshTokenDelivery { get; } + public EffectiveSurrogateTransport SessionIdTransport { get; } + public EffectiveSurrogateTransport AccessTokenTransport { get; } + public EffectiveSurrogateTransport RefreshTokenTransport { get; } public EffectiveRedirectResponse Redirect { get; } public EffectiveAuthResponse( - EffectiveGrantDelivery sessionIdDelivery, - EffectiveGrantDelivery accessTokenDelivery, - EffectiveGrantDelivery refreshTokenDelivery, + EffectiveSurrogateTransport sessionIdTransport, + EffectiveSurrogateTransport accessTokenTransport, + EffectiveSurrogateTransport refreshTokenTransport, EffectiveRedirectResponse redirect) { - SessionIdDelivery = sessionIdDelivery; - AccessTokenDelivery = accessTokenDelivery; - RefreshTokenDelivery = refreshTokenDelivery; + SessionIdTransport = sessionIdTransport; + AccessTokenTransport = accessTokenTransport; + RefreshTokenTransport = refreshTokenTransport; Redirect = redirect; } + + public EffectiveSurrogateTransport GetTransport(SurrogateKind kind) + => kind switch + { + SurrogateKind.SessionId => SessionIdTransport, + SurrogateKind.AccessToken => AccessTokenTransport, + SurrogateKind.RefreshToken => RefreshTokenTransport, + + _ => throw new ArgumentOutOfRangeException(nameof(kind)) + }; } diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveGrantDelivery.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveSurrogateTransport.cs similarity index 58% rename from src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveGrantDelivery.cs rename to src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveSurrogateTransport.cs index b433395b..98e9e314 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveGrantDelivery.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveSurrogateTransport.cs @@ -5,29 +5,29 @@ namespace CodeBeam.UltimateAuth.Server.Auth; -public sealed class EffectiveGrantDelivery +public sealed class EffectiveSurrogateTransport { - public GrantKind Kind { get; } + public SurrogateKind Kind { get; } public TokenFormat TokenFormat { get; } - public GrantDeliveryMode Mode { get; } + public SurrogateTransport Mode { get; } public string? Name { get; } - public HeaderTokenFormat HeaderFormat { get; } + public HeaderValueFormat HeaderFormat { get; } public string? RequestHeaderName { get; } - public HeaderTokenFormat RequestHeaderFormat { get; } + public HeaderValueFormat RequestHeaderFormat { get; } public UAuthCookieOptions? Cookie { get; } - public EffectiveGrantDelivery( - GrantKind kind, + public EffectiveSurrogateTransport( + SurrogateKind kind, TokenFormat tokenFormat, - GrantDeliveryMode mode, + SurrogateTransport mode, string? name = null, - HeaderTokenFormat headerFormat = HeaderTokenFormat.Bearer, + HeaderValueFormat headerFormat = HeaderValueFormat.Bearer, UAuthCookieOptions? cookie = null, string? requestHeaderName = null, - HeaderTokenFormat? requestHeaderFormat = null) + HeaderValueFormat? requestHeaderFormat = null) { Kind = kind; TokenFormat = tokenFormat; @@ -42,6 +42,6 @@ public EffectiveGrantDelivery( Cookie = cookie; } - public static EffectiveGrantDelivery Disabled(GrantKind kind) - => new(kind, TokenFormat.Opaque, GrantDeliveryMode.None); + public static EffectiveSurrogateTransport Disabled(SurrogateKind kind) + => new(kind, TokenFormat.Opaque, SurrogateTransport.None); } diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/GrantDeliveryCollisionValidator.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/SurrogateTransportCollisionValidator.cs similarity index 59% rename from src/CodeBeam.UltimateAuth.Server/Auth/Response/GrantDeliveryCollisionValidator.cs rename to src/CodeBeam.UltimateAuth.Server/Auth/Response/SurrogateTransportCollisionValidator.cs index 13978318..dc087f5a 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/GrantDeliveryCollisionValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/SurrogateTransportCollisionValidator.cs @@ -3,31 +3,31 @@ namespace CodeBeam.UltimateAuth.Server.Auth; // TODO: Support collision detection with externally configured authentication schemes and reserved credential transport names. -internal static class GrantDeliveryCollisionValidator +internal static class SurrogateTransportCollisionValidator { public static void Validate(EffectiveAuthResponse response) { var grants = new[] { - response.SessionIdDelivery, - response.AccessTokenDelivery, - response.RefreshTokenDelivery + response.SessionIdTransport, + response.AccessTokenTransport, + response.RefreshTokenTransport }; - ValidateNames(grants, GrantDeliveryMode.Cookie, grant => grant.Cookie?.Name, "cookie"); + ValidateNames(grants, SurrogateTransport.Cookie, grant => grant.Cookie?.Name, "cookie"); - ValidateNames(grants, GrantDeliveryMode.Header, grant => grant.Name, "response header"); + ValidateNames(grants, SurrogateTransport.Header, grant => grant.Name, "response header"); - ValidateNames(grants, GrantDeliveryMode.Header, grant => grant.RequestHeaderName, "request header"); + ValidateNames(grants, SurrogateTransport.Header, grant => grant.RequestHeaderName, "request header"); } private static void ValidateNames( - IEnumerable grants, - GrantDeliveryMode mode, - Func nameSelector, + IEnumerable grants, + SurrogateTransport mode, + Func nameSelector, string source) { - var names = new Dictionary(StringComparer.OrdinalIgnoreCase); + var names = new Dictionary(StringComparer.OrdinalIgnoreCase); foreach (var grant in grants) { diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/SemiHybridAuthorityValidator.cs b/src/CodeBeam.UltimateAuth.Server/Auth/SemiHybridAuthorityValidator.cs index 08d1f133..2790df0e 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/SemiHybridAuthorityValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/SemiHybridAuthorityValidator.cs @@ -84,7 +84,7 @@ private async Task ValidateCoreAsync( SessionOptions = sessionOptions, Now = _clock.UtcNow }, - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, ct); if (!result.IsValid) diff --git a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs index 6e5b8abf..970db14e 100644 --- a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs @@ -19,7 +19,7 @@ namespace CodeBeam.UltimateAuth.Server.Authentication; internal sealed class UAuthAuthenticationHandler : AuthenticationHandler { - private readonly ITransportCredentialResolver _transportCredentialResolver; + private readonly ISurrogateResolver _surrogateResolver; private readonly ISessionValidator _sessionValidator; private readonly IDeviceContextFactory _deviceContextFactory; private readonly IAuthStateSnapshotFactory _snapshotFactory; @@ -31,7 +31,7 @@ internal sealed class UAuthAuthenticationHandler : AuthenticationHandler options, ILoggerFactory logger, UrlEncoder encoder, @@ -46,7 +46,7 @@ public UAuthAuthenticationHandler( IClock uauthClock) : base(options, logger, encoder) { - _transportCredentialResolver = transportCredentialResolver; + _surrogateResolver = surrogateResolver; _sessionValidator = sessionValidator; _deviceContextFactory = deviceContextFactory; _snapshotFactory = snapshotFactory; @@ -68,14 +68,14 @@ protected override async Task HandleAuthenticateAsync() var response = _authResponseResolver.ResolveForAuthentication(mode, applicationProfile, effective); - var credential = await _transportCredentialResolver.ResolveAsync(Context, mode, response); + var credential = await _surrogateResolver.ResolvePrimaryAsync(Context, mode, response); if (mode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) { if (credential is null) return AuthenticateResult.NoResult(); - if (credential.Kind != TransportCredentialKind.AccessToken) + if (credential.Kind != SurrogateKind.AccessToken) { return AuthenticateResult.Fail("JWT authentication requires an access token."); } diff --git a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs index 5366576d..8c05f793 100644 --- a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs @@ -3,9 +3,8 @@ using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; +using CodeBeam.UltimateAuth.Core.Extensions; using CodeBeam.UltimateAuth.Server.Abstractions; -using CodeBeam.UltimateAuth.Server.Auth; -using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; @@ -21,7 +20,7 @@ namespace CodeBeam.UltimateAuth.Server.Authentication; internal sealed class UAuthResourceAuthenticationHandler : AuthenticationHandler { - private readonly ITransportCredentialResolver _credentialResolver; + private readonly ISurrogateResolver _surrogateResolver; private readonly ISessionValidator _sessionValidator; private readonly IDeviceContextFactory _deviceFactory; private readonly IServiceProvider _services; @@ -30,7 +29,7 @@ internal sealed class UAuthResourceAuthenticationHandler : AuthenticationHandler private readonly IClock _clock; public UAuthResourceAuthenticationHandler( - ITransportCredentialResolver credentialResolver, + ISurrogateResolver surrogateResolver, ISessionValidator sessionValidator, IDeviceContextFactory deviceFactory, IServiceProvider services, @@ -42,7 +41,7 @@ public UAuthResourceAuthenticationHandler( UrlEncoder encoder) : base(options, logger, encoder) { - _credentialResolver = credentialResolver; + _surrogateResolver = surrogateResolver; _sessionValidator = sessionValidator; _deviceFactory = deviceFactory; _services = services; @@ -56,51 +55,43 @@ protected override async Task HandleAuthenticateAsync() var tenant = Context.GetTenant(); var mode = _modeProvider.Mode; - return mode is UAuthMode.PureJwt or UAuthMode.SemiHybrid - ? await AuthenticateJwtAsync(tenant, mode) - : await AuthenticateSessionAsync(tenant); + return mode.GetPrimarySurrogateKind() switch + { + SurrogateKind.SessionId + => await AuthenticateSessionAsync(tenant), + + SurrogateKind.AccessToken + => await AuthenticateJwtAsync(tenant, mode), + + _ => AuthenticateResult.Fail("Unsupported primary surrogate.") + }; } private async Task AuthenticateSessionAsync(TenantKey tenant) { - var mode = _modeProvider.Mode; - - var sessionDelivery = new EffectiveGrantDelivery( - GrantKind.Session, - TokenFormat.Opaque, - _resourceOptions.Auth.Session.DeliveryMode, - name: "Authorization", - headerFormat: HeaderTokenFormat.Bearer, - cookie: new UAuthCookieOptions - { - Name = _resourceOptions.Auth.Session.CookieName - }); - - var response = new EffectiveAuthResponse( - sessionDelivery, - EffectiveGrantDelivery.Disabled(GrantKind.AccessToken), - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), - EffectiveRedirectResponse.Disabled); + var transport = ResourceSurrogateTransportFactory.CreateSessionId(_resourceOptions.Auth); - var credential = await _credentialResolver.ResolveAsync(Context, mode, response); + var surrogate = await _surrogateResolver.ResolveAsync(Context, transport); - if (credential is null) + if (surrogate is null) return AuthenticateResult.NoResult(); - if (credential.Kind != TransportCredentialKind.Session) + if (surrogate.Kind != SurrogateKind.SessionId) { - return AuthenticateResult.Fail("Resource authentication requires a session credential."); + return AuthenticateResult.Fail("Resource authentication requires a session surrogate."); } - if (!AuthSessionId.TryCreate(credential.Value, out var sessionId)) + if (!AuthSessionId.TryCreate(surrogate.Value, out var sessionId)) + { return AuthenticateResult.Fail("Invalid session"); + } var result = await _sessionValidator.ValidateSessionAsync( new SessionValidationContext { Tenant = tenant, SessionId = sessionId, - Device = _deviceFactory.Create(credential.Device), + Device = _deviceFactory.Create(surrogate.Device), Now = _clock.UtcNow }, Context.RequestAborted); @@ -128,39 +119,26 @@ private async Task AuthenticateSessionAsync(TenantKey tenant private async Task AuthenticateJwtAsync(TenantKey tenant, UAuthMode mode) { - var accessDelivery = new EffectiveGrantDelivery( - GrantKind.AccessToken, - TokenFormat.Jwt, - _resourceOptions.Auth.AccessToken.DeliveryMode, - name: _resourceOptions.Auth.AccessToken.HeaderName, - headerFormat: _resourceOptions.Auth.AccessToken.HeaderFormat, - cookie: new UAuthCookieOptions - { - Name = _resourceOptions.Auth.AccessToken.CookieName - }); + var transport = ResourceSurrogateTransportFactory.CreateAccessToken(mode, _resourceOptions.Auth); - var response = new EffectiveAuthResponse( - EffectiveGrantDelivery.Disabled(GrantKind.Session), - accessDelivery, - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), - EffectiveRedirectResponse.Disabled); + var surrogate = await _surrogateResolver.ResolveAsync(Context, transport); - var credential = await _credentialResolver.ResolveAsync(Context, mode, response); - - if (credential is null) + if (surrogate is null) return AuthenticateResult.NoResult(); - if (credential.Kind != TransportCredentialKind.AccessToken) + if (surrogate.Kind != SurrogateKind.AccessToken) { return AuthenticateResult.Fail("JWT authentication requires an access token."); } var validator = _services.GetRequiredService(); - var validated = await validator.ValidateAsync(credential.Value, tenant, Context.RequestAborted); + var validated = await validator.ValidateAsync(surrogate.Value, tenant, Context.RequestAborted); if (validated is null) + { return AuthenticateResult.Fail("Invalid JWT access token."); + } var mismatchBehavior = _resourceOptions.Auth.Device.MismatchBehavior; @@ -176,7 +154,14 @@ private async Task AuthenticateJwtAsync(TenantKey tenant, UA } } - if (!UAuthJwtPrincipalFactory.TryCreate(validated, mode, mismatchBehavior, requestDeviceId, Scheme.Name, out var principal) || principal is null) + if (!UAuthJwtPrincipalFactory.TryCreate( + validated, + mode, + mismatchBehavior, + requestDeviceId, + Scheme.Name, + out var principal) || + principal is null) { return AuthenticateResult.Fail("JWT identity does not satisfy authentication mode."); } diff --git a/src/CodeBeam.UltimateAuth.Server/Domain/HeaderTokenFormat.cs b/src/CodeBeam.UltimateAuth.Server/Domain/HeaderTokenFormat.cs deleted file mode 100644 index 42fdd5de..00000000 --- a/src/CodeBeam.UltimateAuth.Server/Domain/HeaderTokenFormat.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CodeBeam.UltimateAuth.Server.Domain; - -public enum HeaderTokenFormat -{ - Bearer = 0, - Raw = 10 -} diff --git a/src/CodeBeam.UltimateAuth.Server/Domain/HeaderValueFormat.cs b/src/CodeBeam.UltimateAuth.Server/Domain/HeaderValueFormat.cs new file mode 100644 index 00000000..bf27f007 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Domain/HeaderValueFormat.cs @@ -0,0 +1,10 @@ +namespace CodeBeam.UltimateAuth.Server.Domain; + +/// +/// Defines how a value is represented in an HTTP header. +/// +public enum HeaderValueFormat +{ + Bearer = 0, + Raw = 10 +} diff --git a/src/CodeBeam.UltimateAuth.Server/Domain/GrantDeliveryMode.cs b/src/CodeBeam.UltimateAuth.Server/Domain/SurrogateTransport.cs similarity index 95% rename from src/CodeBeam.UltimateAuth.Server/Domain/GrantDeliveryMode.cs rename to src/CodeBeam.UltimateAuth.Server/Domain/SurrogateTransport.cs index a955a20d..d043328d 100644 --- a/src/CodeBeam.UltimateAuth.Server/Domain/GrantDeliveryMode.cs +++ b/src/CodeBeam.UltimateAuth.Server/Domain/SurrogateTransport.cs @@ -3,7 +3,7 @@ /// /// Defines how an issued authentication grant is delivered to the client in an HTTP response. /// -public enum GrantDeliveryMode +public enum SurrogateTransport { /// /// The grant is not delivered. diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/LoginEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/LoginEndpointHandler.cs index 6cccc125..47e3e67a 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/LoginEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/LoginEndpointHandler.cs @@ -20,7 +20,7 @@ internal sealed class LoginEndpointHandler : ILoginEndpointHandler { private readonly IAuthFlowContextAccessor _authFlow; private readonly IUAuthInternalFlowService _internalFlowService; - private readonly ICredentialResponseWriter _credentialResponseWriter; + private readonly ISurrogateResponseWriter _credentialResponseWriter; private readonly IAuthRedirectResolver _redirectResolver; private readonly IAuthStore _authStore; private readonly ILoginIdentifierResolver _loginIdentifierResolver; @@ -30,7 +30,7 @@ internal sealed class LoginEndpointHandler : ILoginEndpointHandler public LoginEndpointHandler( IAuthFlowContextAccessor authFlow, IUAuthInternalFlowService internalFlowService, - ICredentialResponseWriter credentialResponseWriter, + ISurrogateResponseWriter credentialResponseWriter, IAuthRedirectResolver redirectResolver, IAuthStore authStore, ILoginIdentifierResolver loginIdentifierResolver, @@ -60,7 +60,7 @@ public async Task LoginAsync(HttpContext ctx) var isFetch = ctx.Request.HasFormContentType && (await ctx.GetCachedFormAsync())?["__uauth_response_mode"].FirstOrDefault() == "fetch"; - if (!isFetch && (authFlow.Response.AccessTokenDelivery.Mode == GrantDeliveryMode.Header || authFlow.Response.SessionIdDelivery.Mode == GrantDeliveryMode.Header)) + if (!isFetch && (authFlow.Response.AccessTokenTransport.Mode == SurrogateTransport.Header || authFlow.Response.SessionIdTransport.Mode == SurrogateTransport.Header)) { return Results.BadRequest(new { @@ -156,17 +156,17 @@ public async Task LoginAsync(HttpContext ctx) if (result.SessionId is AuthSessionId sessionId) { - _credentialResponseWriter.Write(ctx, GrantKind.Session, sessionId); + _credentialResponseWriter.Write(ctx, SurrogateKind.SessionId, sessionId); } if (result.AccessToken is not null) { - _credentialResponseWriter.Write(ctx, GrantKind.AccessToken, result.AccessToken); + _credentialResponseWriter.Write(ctx, SurrogateKind.AccessToken, result.AccessToken); } if (result.RefreshToken is not null) { - _credentialResponseWriter.Write(ctx, GrantKind.RefreshToken, result.RefreshToken); + _credentialResponseWriter.Write(ctx, SurrogateKind.RefreshToken, result.RefreshToken); } var decision = _redirectResolver.ResolveSuccess(authFlow, ctx); diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs index 4376b73f..7f090159 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs @@ -58,9 +58,9 @@ await _flow.LogoutAsync( } } - DeleteIfCookie(ctx, authFlow.Response.SessionIdDelivery); - DeleteIfCookie(ctx, authFlow.Response.RefreshTokenDelivery); - DeleteIfCookie(ctx, authFlow.Response.AccessTokenDelivery); + DeleteIfCookie(ctx, authFlow.Response.SessionIdTransport); + DeleteIfCookie(ctx, authFlow.Response.RefreshTokenTransport); + DeleteIfCookie(ctx, authFlow.Response.AccessTokenTransport); var decision = _redirectResolver.ResolveSuccess(authFlow, ctx); @@ -199,9 +199,9 @@ public async Task LogoutAllAdminAsync(HttpContext ctx, UserKey userKey) return Results.Ok(); } - private void DeleteIfCookie(HttpContext ctx, EffectiveGrantDelivery delivery) + private void DeleteIfCookie(HttpContext ctx, EffectiveSurrogateTransport delivery) { - if (delivery.Mode != GrantDeliveryMode.Cookie) + if (delivery.Mode != SurrogateTransport.Cookie) return; var cookie = delivery.Cookie diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/PkceEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/PkceEndpointHandler.cs index 4a7ddbc5..d6b9e0f6 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/PkceEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/PkceEndpointHandler.cs @@ -28,7 +28,7 @@ internal sealed class PkceEndpointHandler : IPkceEndpointHandler private readonly IAuthStore _authStore; private readonly IPkceAuthorizationValidator _validator; private readonly IClock _clock; - private readonly ICredentialResponseWriter _credentialResponseWriter; + private readonly ISurrogateResponseWriter _credentialResponseWriter; private readonly IAuthRedirectResolver _redirectResolver; public PkceEndpointHandler( @@ -39,7 +39,7 @@ public PkceEndpointHandler( IAuthStore authStore, IPkceAuthorizationValidator validator, IClock clock, - ICredentialResponseWriter credentialResponseWriter, + ISurrogateResponseWriter credentialResponseWriter, IAuthRedirectResolver redirectResolver) { _authContext = authContext; @@ -162,8 +162,8 @@ public async Task CompleteAsync(HttpContext ctx) var isFetch = ctx.Request.HasFormContentType && (await ctx.GetCachedFormAsync())?["__uauth_response_mode"].FirstOrDefault() == "fetch"; if (!isFetch && - (auth.Response.AccessTokenDelivery.Mode == GrantDeliveryMode.Header || - auth.Response.SessionIdDelivery.Mode == GrantDeliveryMode.Header)) + (auth.Response.AccessTokenTransport.Mode == SurrogateTransport.Header || + auth.Response.SessionIdTransport.Mode == SurrogateTransport.Header)) { return Results.BadRequest(new { @@ -210,13 +210,13 @@ public async Task CompleteAsync(HttpContext ctx) var login = result.LoginResult!; if (login.SessionId is not null) - _credentialResponseWriter.Write(ctx, GrantKind.Session, login.SessionId.Value); + _credentialResponseWriter.Write(ctx, SurrogateKind.SessionId, login.SessionId.Value); if (login.AccessToken is not null) - _credentialResponseWriter.Write(ctx, GrantKind.AccessToken, login.AccessToken); + _credentialResponseWriter.Write(ctx, SurrogateKind.AccessToken, login.AccessToken); if (login.RefreshToken is not null) - _credentialResponseWriter.Write(ctx, GrantKind.RefreshToken, login.RefreshToken); + _credentialResponseWriter.Write(ctx, SurrogateKind.RefreshToken, login.RefreshToken); var decision = _redirectResolver.ResolveSuccess(auth, ctx); diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/RefreshEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/RefreshEndpointHandler.cs index 6f1ff5cf..825063c3 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/RefreshEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/RefreshEndpointHandler.cs @@ -12,7 +12,7 @@ public sealed class RefreshEndpointHandler : IRefreshEndpointHandler { private readonly IAuthFlowContextAccessor _authContext; private readonly IRefreshFlowService _refreshFlow; - private readonly ICredentialResponseWriter _credentialWriter; + private readonly ISurrogateResponseWriter _credentialWriter; private readonly IRefreshResponseWriter _refreshWriter; private readonly IRefreshTokenResolver _refreshTokenResolver; private readonly IRefreshResponsePolicy _refreshPolicy; @@ -20,7 +20,7 @@ public sealed class RefreshEndpointHandler : IRefreshEndpointHandler public RefreshEndpointHandler( IAuthFlowContextAccessor authContext, IRefreshFlowService refreshFlow, - ICredentialResponseWriter credentialWriter, + ISurrogateResponseWriter credentialWriter, IRefreshResponseWriter refreshWriter, IRefreshTokenResolver refreshTokenResolver, IRefreshResponsePolicy refreshPolicy) @@ -58,18 +58,18 @@ public async Task RefreshAsync(HttpContext ctx) var primary = _refreshPolicy.SelectPrimary(flow, request, result); - if (primary == GrantKind.Session && result.SessionId is not null) + if (primary == SurrogateKind.SessionId && result.SessionId is not null) { - _credentialWriter.Write(ctx, GrantKind.Session, result.SessionId.Value); + _credentialWriter.Write(ctx, SurrogateKind.SessionId, result.SessionId.Value); } - else if (primary == GrantKind.AccessToken && result.AccessToken is not null) + else if (primary == SurrogateKind.AccessToken && result.AccessToken is not null) { - _credentialWriter.Write(ctx, GrantKind.AccessToken, result.AccessToken); + _credentialWriter.Write(ctx, SurrogateKind.AccessToken, result.AccessToken); } if (_refreshPolicy.WriteRefreshToken(flow) && result.RefreshToken is not null) { - _credentialWriter.Write(ctx, GrantKind.RefreshToken, result.RefreshToken); + _credentialWriter.Write(ctx, SurrogateKind.RefreshToken, result.RefreshToken); } if (flow.Options.Diagnostics.EnableRefreshDetails) diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/UAuthLoginTransportEndpoint.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/UAuthLoginTransportEndpoint.cs index d8be8510..edf100d0 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/UAuthLoginTransportEndpoint.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/UAuthLoginTransportEndpoint.cs @@ -10,15 +10,14 @@ public static IResult Get(HttpContext context, IAuthFlowContextAccessor accessor { var response = accessor.Current.Response; - var sessionHeader = response.SessionIdDelivery.Mode == GrantDeliveryMode.Header; + var sessionHeader = response.SessionIdTransport.Mode == SurrogateTransport.Header; - var accessHeader = response.AccessTokenDelivery.Mode == GrantDeliveryMode.Header; + var accessHeader = response.AccessTokenTransport.Mode == SurrogateTransport.Header; context.Response.Headers.CacheControl = "no-store"; return Results.Ok(new { - // The current client does not manage header-delivered opaque session IDs. Supported = !sessionHeader, // Native navigation cannot capture response headers. diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs index 35ab0d30..c819f4f9 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs @@ -14,7 +14,7 @@ namespace CodeBeam.UltimateAuth.Server.Endpoints; internal sealed class ValidateEndpointHandler : IValidateEndpointHandler { private readonly IAuthFlowContextAccessor _authContext; - private readonly ITransportCredentialResolver _credentialResolver; + private readonly ISurrogateResolver _surrogateResolver; private readonly ISessionValidator _sessionValidator; private readonly SemiHybridAuthorityValidator _authorityValidator; private readonly IAuthStateSnapshotFactory _snapshotFactory; @@ -22,14 +22,14 @@ internal sealed class ValidateEndpointHandler : IValidateEndpointHandler public ValidateEndpointHandler( IAuthFlowContextAccessor authContext, - ITransportCredentialResolver credentialResolver, + ISurrogateResolver surrogateResolver, ISessionValidator sessionValidator, SemiHybridAuthorityValidator authorityValidator, IAuthStateSnapshotFactory snapshotFactory, IClock clock) { _authContext = authContext; - _credentialResolver = credentialResolver; + _surrogateResolver = surrogateResolver; _sessionValidator = sessionValidator; _authorityValidator = authorityValidator; _snapshotFactory = snapshotFactory; @@ -45,9 +45,9 @@ public async Task ValidateAsync(HttpContext context, CancellationToken return await ValidateJwtAsync(context, auth, ct); } - var credential = await _credentialResolver.ResolveAsync(context, auth.EffectiveMode, auth.Response); + var surrogate = await _surrogateResolver.ResolvePrimaryAsync(context, auth.EffectiveMode, auth.Response); - if (credential is null) + if (surrogate is null) { return Results.Json( new AuthValidationResult @@ -58,9 +58,9 @@ public async Task ValidateAsync(HttpContext context, CancellationToken ); } - if (credential.Kind == TransportCredentialKind.Session) + if (surrogate.Kind == SurrogateKind.SessionId) { - if (!AuthSessionId.TryCreate(credential.Value, out var sessionId)) + if (!AuthSessionId.TryCreate(surrogate.Value, out var sessionId)) { return Results.Json( new AuthValidationResult diff --git a/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs b/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs index 2cae5fe3..0febdd24 100644 --- a/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs @@ -233,7 +233,7 @@ private static IServiceCollection AddUltimateAuthServerInternal(this IServiceCol sp.GetRequiredService(), sp.GetRequiredService(), sp.GetRequiredService(), - sp.GetRequiredService())); + sp.GetRequiredService())); services.TryAddScoped(); services.TryAddScoped(); @@ -281,10 +281,9 @@ private static IServiceCollection AddUltimateAuthServerInternal(this IServiceCol services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); - services.TryAddScoped(); + services.TryAddScoped(); services.TryAddSingleton(); services.TryAddSingleton(); - services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddScoped(); @@ -319,7 +318,7 @@ private static IServiceCollection AddUltimateAuthServerInternal(this IServiceCol }); }); - services.TryAddScoped(); + services.TryAddScoped(); services.TryAddScoped(); services.TryAddSingleton(); @@ -515,10 +514,9 @@ private static IServiceCollection AddUltimateAuthResourceInternal(this IServiceC services.TryAddScoped(); services.TryAddScoped(); - services.TryAddScoped(); + services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); - services.TryAddSingleton(); services.TryAddSingleton(); diff --git a/src/CodeBeam.UltimateAuth.Server/Extensions/SurrogateResolverExtensions.cs b/src/CodeBeam.UltimateAuth.Server/Extensions/SurrogateResolverExtensions.cs new file mode 100644 index 00000000..d4188dc6 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Extensions/SurrogateResolverExtensions.cs @@ -0,0 +1,17 @@ +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Extensions; +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Infrastructure; +using Microsoft.AspNetCore.Http; + +namespace CodeBeam.UltimateAuth.Server.Extensions; + +public static class SurrogateResolverExtensions +{ + public static ValueTask ResolvePrimaryAsync(this ISurrogateResolver resolver, HttpContext context, UAuthMode mode, EffectiveAuthResponse response) + { + var kind = mode.GetPrimarySurrogateKind(); + + return resolver.ResolveAsync(context, response.GetTransport(kind)); + } +} diff --git a/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/IRefreshResponsePolicy.cs b/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/IRefreshResponsePolicy.cs index 9d8e1515..ad2dcd7b 100644 --- a/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/IRefreshResponsePolicy.cs +++ b/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/IRefreshResponsePolicy.cs @@ -6,6 +6,6 @@ namespace CodeBeam.UltimateAuth.Server.Flows; public interface IRefreshResponsePolicy { - GrantKind SelectPrimary(AuthFlowContext flow, RefreshFlowRequest request, RefreshFlowResult result); + SurrogateKind SelectPrimary(AuthFlowContext flow, RefreshFlowRequest request, RefreshFlowResult result); bool WriteRefreshToken(AuthFlowContext flow); } diff --git a/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshResponsePolicy.cs b/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshResponsePolicy.cs index a1f6f186..31d03f25 100644 --- a/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshResponsePolicy.cs +++ b/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshResponsePolicy.cs @@ -6,24 +6,24 @@ namespace CodeBeam.UltimateAuth.Server.Flows; internal class RefreshResponsePolicy : IRefreshResponsePolicy { - public GrantKind SelectPrimary(AuthFlowContext flow, RefreshFlowRequest request, RefreshFlowResult result) + public SurrogateKind SelectPrimary(AuthFlowContext flow, RefreshFlowRequest request, RefreshFlowResult result) { if (flow.EffectiveMode == UAuthMode.PureOpaque) - return GrantKind.Session; + return SurrogateKind.SessionId; if (flow.EffectiveMode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) - return GrantKind.AccessToken; + return SurrogateKind.AccessToken; if (!string.IsNullOrWhiteSpace(request.RefreshToken) && request.SessionId == null) - return GrantKind.AccessToken; + return SurrogateKind.AccessToken; if (request.SessionId != null) - return GrantKind.Session; + return SurrogateKind.SessionId; if (flow.ApplicationProfile == UAuthApplicationProfile.Api) - return GrantKind.AccessToken; + return SurrogateKind.AccessToken; - return GrantKind.Session; + return SurrogateKind.SessionId; } diff --git a/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshTokenResolver.cs b/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshTokenResolver.cs index 17c6aa1c..b1ef54f5 100644 --- a/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshTokenResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshTokenResolver.cs @@ -21,6 +21,6 @@ public RefreshTokenResolver(IAuthFlowContextAccessor authContext) if (flow is null) return null; - return GrantCredentialReader.Read(context, flow.Response.RefreshTokenDelivery); + return SurrogateReader.Read(context, flow.Response.RefreshTokenTransport); } } diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/IUAuthCookiePolicyBuilder.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/IUAuthCookiePolicyBuilder.cs index c87c97ed..b94a07b7 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/IUAuthCookiePolicyBuilder.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/IUAuthCookiePolicyBuilder.cs @@ -6,5 +6,5 @@ namespace CodeBeam.UltimateAuth.Server.Infrastructure; public interface IUAuthCookiePolicyBuilder { - CookieOptions Build(EffectiveGrantDelivery delivery, AuthFlowContext context, GrantKind kind); + CookieOptions Build(EffectiveSurrogateTransport delivery, AuthFlowContext context, SurrogateKind kind); } diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/UAuthCookiePolicyBuilder.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/UAuthCookiePolicyBuilder.cs index 3247858e..bd9a93e9 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/UAuthCookiePolicyBuilder.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/UAuthCookiePolicyBuilder.cs @@ -8,9 +8,9 @@ namespace CodeBeam.UltimateAuth.Server.Infrastructure; internal sealed class UAuthCookiePolicyBuilder : IUAuthCookiePolicyBuilder { - public CookieOptions Build(EffectiveGrantDelivery delivery, AuthFlowContext context, GrantKind kind) + public CookieOptions Build(EffectiveSurrogateTransport delivery, AuthFlowContext context, SurrogateKind kind) { - if (delivery.Mode != GrantDeliveryMode.Cookie) + if (delivery.Mode != SurrogateTransport.Cookie) { throw new InvalidOperationException($"Cookie policy requested for non-cookie grant '{kind}'."); } @@ -51,7 +51,7 @@ private static SameSiteMode ResolveSameSite(UAuthCookieOptions cookie, AuthFlowC }; } - private static void ApplyLifetime(CookieOptions target, UAuthCookieOptions src, AuthFlowContext context, GrantKind kind) + private static void ApplyLifetime(CookieOptions target, UAuthCookieOptions src, AuthFlowContext context, SurrogateKind kind) { var buffer = src.Lifetime.IdleBuffer ?? TimeSpan.Zero; var baseLifetime = ResolveBaseLifetime(context, kind, src); @@ -62,7 +62,7 @@ private static void ApplyLifetime(CookieOptions target, UAuthCookieOptions src, } } - private static TimeSpan? ResolveBaseLifetime(AuthFlowContext context, GrantKind kind, UAuthCookieOptions src) + private static TimeSpan? ResolveBaseLifetime(AuthFlowContext context, SurrogateKind kind, UAuthCookieOptions src) { if (src.MaxAge is not null) return src.MaxAge; @@ -72,9 +72,9 @@ private static void ApplyLifetime(CookieOptions target, UAuthCookieOptions src, return kind switch { - GrantKind.Session => ResolveSessionLifetime(context), - GrantKind.RefreshToken => context.Options.Token.RefreshTokenLifetime, - GrantKind.AccessToken => context.Options.Token.AccessTokenLifetime, + SurrogateKind.SessionId => ResolveSessionLifetime(context), + SurrogateKind.RefreshToken => context.Options.Token.RefreshTokenLifetime, + SurrogateKind.AccessToken => context.Options.Token.AccessTokenLifetime, _ => null }; } diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/ITransportCredentialResolver.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/ITransportCredentialResolver.cs deleted file mode 100644 index a8eb9f14..00000000 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/ITransportCredentialResolver.cs +++ /dev/null @@ -1,10 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Server.Auth; -using Microsoft.AspNetCore.Http; - -namespace CodeBeam.UltimateAuth.Server.Infrastructure; - -public interface ITransportCredentialResolver -{ - ValueTask ResolveAsync(HttpContext context, UAuthMode mode, EffectiveAuthResponse response); -} diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredential.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredential.cs deleted file mode 100644 index aac3255f..00000000 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredential.cs +++ /dev/null @@ -1,12 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Contracts; - -namespace CodeBeam.UltimateAuth.Server.Infrastructure; - -public sealed class TransportCredential -{ - public required TransportCredentialKind Kind { get; init; } - public required string Value { get; init; } - - public string? TenantId { get; init; } - public required DeviceInfo Device { get; init; } -} diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredentialKind.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredentialKind.cs deleted file mode 100644 index 870a458e..00000000 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredentialKind.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace CodeBeam.UltimateAuth.Server.Infrastructure; - -public enum TransportCredentialKind -{ - Session = 0, - AccessToken = 10, - RefreshToken = 20, - Hub = 30 -} diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredentialResolver.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredentialResolver.cs deleted file mode 100644 index 164c764b..00000000 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredentialResolver.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Server.Auth; -using CodeBeam.UltimateAuth.Server.Extensions; -using Microsoft.AspNetCore.Http; - -namespace CodeBeam.UltimateAuth.Server.Infrastructure; - -internal sealed class TransportCredentialResolver : ITransportCredentialResolver -{ - private readonly IPrimaryTokenResolver _primaryTokenResolver; - - public TransportCredentialResolver(IPrimaryTokenResolver primaryTokenResolver) - { - _primaryTokenResolver = primaryTokenResolver; - } - - public async ValueTask ResolveAsync(HttpContext context, UAuthMode mode, EffectiveAuthResponse response) - { - var primaryToken = _primaryTokenResolver.Resolve(mode); - - var (delivery, kind) = primaryToken switch - { - PrimaryTokenKind.Session => - ( - response.SessionIdDelivery, - TransportCredentialKind.Session - ), - - PrimaryTokenKind.AccessToken => - ( - response.AccessTokenDelivery, - TransportCredentialKind.AccessToken - ), - - _ => throw new InvalidOperationException($"Unsupported primary token kind: {primaryToken}") - }; - - var value = GrantCredentialReader.Read(context, delivery); - - if (value is null) - return null; - - return new TransportCredential - { - Kind = kind, - Value = value, - TenantId = context.GetTenant().Value, - Device = await context.GetDeviceAsync() - }; - } -} diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/IUAuthBodyPolicyBuilder.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/IUAuthBodyPolicyBuilder.cs index 72cff948..87ae9f89 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/IUAuthBodyPolicyBuilder.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/IUAuthBodyPolicyBuilder.cs @@ -5,5 +5,5 @@ namespace CodeBeam.UltimateAuth.Server.Infrastructure; public interface IUAuthBodyPolicyBuilder { - object BuildBodyValue(string rawValue, EffectiveGrantDelivery delivery, AuthFlowContext context); + object BuildBodyValue(string rawValue, EffectiveSurrogateTransport delivery, AuthFlowContext context); } diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/IUAuthHeaderPolicyBuilder.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/IUAuthHeaderPolicyBuilder.cs index 4b6f34be..e339155c 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/IUAuthHeaderPolicyBuilder.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/IUAuthHeaderPolicyBuilder.cs @@ -5,5 +5,5 @@ namespace CodeBeam.UltimateAuth.Server.Infrastructure; public interface IUAuthHeaderPolicyBuilder { - string BuildHeaderValue(string rawValue, EffectiveGrantDelivery delivery, AuthFlowContext context); + string BuildHeaderValue(string rawValue, EffectiveSurrogateTransport delivery, AuthFlowContext context); } diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/CredentialResponseWriter.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/SurrogateResponseWriter.cs similarity index 66% rename from src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/CredentialResponseWriter.cs rename to src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/SurrogateResponseWriter.cs index ae510830..7763d4fa 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/CredentialResponseWriter.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/SurrogateResponseWriter.cs @@ -1,6 +1,5 @@ using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Domain; @@ -8,14 +7,14 @@ namespace CodeBeam.UltimateAuth.Server.Infrastructure; -internal sealed class CredentialResponseWriter : ICredentialResponseWriter +internal sealed class SurrogateResponseWriter : ISurrogateResponseWriter { private readonly IAuthFlowContextAccessor _authContext; private readonly IUAuthCookieManager _cookieManager; private readonly IUAuthCookiePolicyBuilder _cookiePolicy; private readonly IUAuthHeaderPolicyBuilder _headerPolicy; - public CredentialResponseWriter( + public SurrogateResponseWriter( IAuthFlowContextAccessor authContext, IUAuthCookieManager cookieManager, IUAuthCookiePolicyBuilder cookiePolicy, @@ -27,22 +26,22 @@ public CredentialResponseWriter( _headerPolicy = headerPolicy; } - public void Write(HttpContext context, GrantKind kind, AuthSessionId sessionId) + public void Write(HttpContext context, SurrogateKind kind, AuthSessionId sessionId) => WriteInternal(context, kind, sessionId.ToString()); - public void Write(HttpContext context, GrantKind kind, AccessToken token) + public void Write(HttpContext context, SurrogateKind kind, AccessToken token) { ArgumentNullException.ThrowIfNull(token); WriteInternal(context, kind, token.Token); - if (kind != GrantKind.AccessToken) + if (kind != SurrogateKind.AccessToken) return; var auth = _authContext.Current; - var delivery = auth.Response.AccessTokenDelivery; + var delivery = auth.Response.AccessTokenTransport; - if (delivery.Mode != GrantDeliveryMode.Header) + if (delivery.Mode != SurrogateTransport.Header) return; var headerName = delivery.Name; @@ -60,10 +59,10 @@ public void Write(HttpContext context, GrantKind kind, AccessToken token) headers.CacheControl = "no-store"; } - public void Write(HttpContext context, GrantKind kind, RefreshTokenInfo token) + public void Write(HttpContext context, SurrogateKind kind, RefreshTokenInfo token) => WriteInternal(context, kind, token.Token); - public void WriteInternal(HttpContext context, GrantKind kind, string value) + public void WriteInternal(HttpContext context, SurrogateKind kind, string value) { var auth = _authContext.Current; var delivery = ResolveDelivery(auth.Response, kind); @@ -76,18 +75,18 @@ public void WriteInternal(HttpContext context, GrantKind kind, string value) switch (delivery.Mode) { - case GrantDeliveryMode.None: + case SurrogateTransport.None: return; - case GrantDeliveryMode.Cookie: + case SurrogateTransport.Cookie: WriteCookie(context, kind, value, delivery, auth); return; - case GrantDeliveryMode.Header: + case SurrogateTransport.Header: WriteHeader(context, value, delivery, auth); return; - case GrantDeliveryMode.Body: + case SurrogateTransport.Body: throw new NotSupportedException( $"Body grant delivery is not supported for '{kind}'."); @@ -97,16 +96,10 @@ public void WriteInternal(HttpContext context, GrantKind kind, string value) } } - private void WriteCookie( - HttpContext context, - GrantKind kind, - string value, - EffectiveGrantDelivery delivery, - AuthFlowContext auth) + private void WriteCookie(HttpContext context, SurrogateKind kind, string value, EffectiveSurrogateTransport delivery, AuthFlowContext auth) { var cookie = delivery.Cookie - ?? throw new InvalidOperationException( - $"Cookie options missing for grant '{kind}'."); + ?? throw new InvalidOperationException($"Cookie options missing for grant '{kind}'."); var cookieOptions = _cookiePolicy.Build(delivery, auth, kind); @@ -117,18 +110,13 @@ private void WriteCookie( cookieOptions); } - private void WriteHeader( - HttpContext context, - string value, - EffectiveGrantDelivery delivery, - AuthFlowContext auth) + private void WriteHeader(HttpContext context, string value, EffectiveSurrogateTransport delivery, AuthFlowContext auth) { var headerName = delivery.Name; if (string.IsNullOrWhiteSpace(headerName)) { - throw new InvalidOperationException( - $"Header name missing for grant '{delivery.Kind}'."); + throw new InvalidOperationException($"Header name missing for grant '{delivery.Kind}'."); } var formatted = _headerPolicy.BuildHeaderValue( @@ -139,14 +127,12 @@ private void WriteHeader( context.Response.Headers[headerName] = formatted; } - private static EffectiveGrantDelivery ResolveDelivery( - EffectiveAuthResponse response, - GrantKind kind) + private static EffectiveSurrogateTransport ResolveDelivery(EffectiveAuthResponse response, SurrogateKind kind) => kind switch { - GrantKind.Session => response.SessionIdDelivery, - GrantKind.AccessToken => response.AccessTokenDelivery, - GrantKind.RefreshToken => response.RefreshTokenDelivery, + SurrogateKind.SessionId => response.SessionIdTransport, + SurrogateKind.AccessToken => response.AccessTokenTransport, + SurrogateKind.RefreshToken => response.RefreshTokenTransport, _ => throw new ArgumentOutOfRangeException(nameof(kind)) }; } \ No newline at end of file diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthBodyPolicyBuilder.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthBodyPolicyBuilder.cs index 638887ad..53697639 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthBodyPolicyBuilder.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthBodyPolicyBuilder.cs @@ -4,7 +4,7 @@ namespace CodeBeam.UltimateAuth.Server.Infrastructure; internal class UAuthBodyPolicyBuilder : IUAuthBodyPolicyBuilder { - public object BuildBodyValue(string rawValue, EffectiveGrantDelivery delivery, AuthFlowContext context) + public object BuildBodyValue(string rawValue, EffectiveSurrogateTransport delivery, AuthFlowContext context) { throw new NotImplementedException(); } diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthHeaderPolicyBuilder.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthHeaderPolicyBuilder.cs index 7e678d21..6af62e7d 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthHeaderPolicyBuilder.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthHeaderPolicyBuilder.cs @@ -5,9 +5,9 @@ namespace CodeBeam.UltimateAuth.Server.Infrastructure; internal sealed class UAuthHeaderPolicyBuilder : IUAuthHeaderPolicyBuilder { - public string BuildHeaderValue(string rawValue, EffectiveGrantDelivery delivery, AuthFlowContext context) + public string BuildHeaderValue(string rawValue, EffectiveSurrogateTransport delivery, AuthFlowContext context) { - if (delivery.Mode != GrantDeliveryMode.Header) + if (delivery.Mode != SurrogateTransport.Header) { throw new InvalidOperationException($"Header policy requested for non-header grant '{delivery.Kind}'."); } @@ -19,8 +19,8 @@ public string BuildHeaderValue(string rawValue, EffectiveGrantDelivery delivery, return delivery.HeaderFormat switch { - HeaderTokenFormat.Bearer => $"Bearer {rawValue}", - HeaderTokenFormat.Raw => rawValue, + HeaderValueFormat.Bearer => $"Bearer {rawValue}", + HeaderValueFormat.Raw => rawValue, _ => throw new InvalidOperationException($"Unsupported header token format: {delivery.HeaderFormat}") }; } diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs index 8eb4fa48..abffe8c5 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs @@ -38,10 +38,10 @@ public async Task IssueSessionAsync(SessionIssuanceContext contex var purpose = context.Mode switch { UAuthMode.PureOpaque or UAuthMode.Hybrid - => SessionCredentialPurpose.Opaque, + => SessionIdPurpose.Opaque, UAuthMode.SemiHybrid - => SessionCredentialPurpose.MetadataOnly, + => SessionIdPurpose.MetadataOnly, UAuthMode.PureJwt => throw new InvalidOperationException("PureJwt does not create sessions."), @@ -51,8 +51,8 @@ UAuthMode.PureOpaque or UAuthMode.Hybrid var rawSessionId = purpose switch { - SessionCredentialPurpose.Opaque => _opaqueGenerator.Generate(), - SessionCredentialPurpose.MetadataOnly => + SessionIdPurpose.Opaque => _opaqueGenerator.Generate(), + SessionIdPurpose.MetadataOnly => _opaqueGenerator.Generate(), _ => throw new InvalidOperationException("Unsupported session credential purpose.") @@ -256,7 +256,7 @@ context.Device.DeviceId is not DeviceId incomingDeviceId || return new IssuedSession { Session = session, - OpaqueSessionId = purpose == SessionCredentialPurpose.Opaque ? rawSessionId : null + OpaqueSessionId = purpose == SessionIdPurpose.Opaque ? rawSessionId : null }; } @@ -313,10 +313,10 @@ await kernel.ExecuteAsync(async _ => var expectedPurpose = context.Mode switch { UAuthMode.PureOpaque or UAuthMode.Hybrid - => SessionCredentialPurpose.Opaque, + => SessionIdPurpose.Opaque, UAuthMode.SemiHybrid - => SessionCredentialPurpose.MetadataOnly, + => SessionIdPurpose.MetadataOnly, _ => throw new InvalidOperationException("Session rotation is not supported in this mode.") }; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/SessionId/SessionIdResolver.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/SessionId/SessionIdResolver.cs index 7d5e432a..98a1d77d 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/SessionId/SessionIdResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/SessionId/SessionIdResolver.cs @@ -1,4 +1,5 @@ using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Extensions; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; using Microsoft.AspNetCore.Http; @@ -8,23 +9,20 @@ namespace CodeBeam.UltimateAuth.Server.Infrastructure; public sealed class SessionIdResolver : ISessionIdResolver { private readonly IApplicationProfileReader _applicationProfileReader; - private readonly IEffectiveServerOptionsProvider _effectiveOptionsProvider; - private readonly IAuthResponseResolver _authResponseResolver; - - private readonly ITransportCredentialResolver _transportCredentialResolver; + private readonly ISurrogateResolver _surrogateResolver; internal SessionIdResolver( IApplicationProfileReader applicationProfileReader, IEffectiveServerOptionsProvider effectiveOptionsProvider, IAuthResponseResolver authResponseResolver, - ITransportCredentialResolver transportCredentialResolver) + ISurrogateResolver surrogateResolver) { _applicationProfileReader = applicationProfileReader; _effectiveOptionsProvider = effectiveOptionsProvider; _authResponseResolver = authResponseResolver; - _transportCredentialResolver = transportCredentialResolver; + _surrogateResolver = surrogateResolver; } public async ValueTask ResolveAsync(HttpContext context, CancellationToken ct = default) @@ -35,23 +33,22 @@ internal SessionIdResolver( var effective = _effectiveOptionsProvider.GetEffective(context, applicationProfile); - // JWT-based modes must never resolve an opaque session authentication credential. - if (effective.Mode is not (UAuthMode.PureOpaque or UAuthMode.Hybrid)) - { + if (!effective.Mode.UsesSessionIdForAuthentication()) return null; - } var response = _authResponseResolver.ResolveForAuthentication(effective.Mode, applicationProfile, effective); - var credential = await _transportCredentialResolver.ResolveAsync(context, effective.Mode, response); + var surrogate = await _surrogateResolver.ResolveAsync(context, response.SessionIdTransport); - if (credential is null || credential.Kind != TransportCredentialKind.Session) + if (surrogate is null || surrogate.Kind != SurrogateKind.SessionId) { return null; } - return AuthSessionId.TryCreate(credential.Value, out var sessionId) - ? sessionId - : null; + return AuthSessionId.TryCreate( + surrogate.Value, + out var sessionId) + ? sessionId + : null; } } diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/ISurrogateResolver.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/ISurrogateResolver.cs new file mode 100644 index 00000000..ad99f65c --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/ISurrogateResolver.cs @@ -0,0 +1,9 @@ +using CodeBeam.UltimateAuth.Server.Auth; +using Microsoft.AspNetCore.Http; + +namespace CodeBeam.UltimateAuth.Server.Infrastructure; + +public interface ISurrogateResolver +{ + ValueTask ResolveAsync(HttpContext context, EffectiveSurrogateTransport transport); +} diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/ResolvedSurrogate.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/ResolvedSurrogate.cs new file mode 100644 index 00000000..40286e39 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/ResolvedSurrogate.cs @@ -0,0 +1,22 @@ +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; + +namespace CodeBeam.UltimateAuth.Server.Infrastructure; + +/// +/// Represents a surrogate resolved from an incoming request. +/// +/// +/// Resolution does not establish authenticity or validity. +/// The surrogate and its request context must be validated before being trusted. +/// +public sealed class ResolvedSurrogate +{ + public required SurrogateKind Kind { get; init; } + + public required string Value { get; init; } + + public string? TenantId { get; init; } + + public required DeviceInfo Device { get; init; } +} diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/GrantCredentialReader.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/SurrogateReader.cs similarity index 90% rename from src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/GrantCredentialReader.cs rename to src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/SurrogateReader.cs index a06eab25..0b9a7168 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/GrantCredentialReader.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/SurrogateReader.cs @@ -4,16 +4,16 @@ namespace CodeBeam.UltimateAuth.Server.Infrastructure; -internal static class GrantCredentialReader +internal static class SurrogateReader { - public static string? Read(HttpContext context, EffectiveGrantDelivery delivery) + public static string? Read(HttpContext context, EffectiveSurrogateTransport delivery) { return delivery.Mode switch { - GrantDeliveryMode.Cookie => + SurrogateTransport.Cookie => ReadCookie(context, delivery.Cookie?.Name), - GrantDeliveryMode.Header => + SurrogateTransport.Header => ReadHeader(context, delivery.RequestHeaderName, delivery.RequestHeaderFormat), _ => null @@ -34,7 +34,7 @@ internal static class GrantCredentialReader return Normalize(value); } - public static string? ReadHeader(HttpContext context, string? name, HeaderTokenFormat format) + public static string? ReadHeader(HttpContext context, string? name, HeaderValueFormat format) { if (string.IsNullOrWhiteSpace(name)) return null; @@ -55,7 +55,7 @@ internal static class GrantCredentialReader switch (format) { - case HeaderTokenFormat.Bearer: + case HeaderValueFormat.Bearer: const string prefix = "Bearer "; if (!value.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) @@ -66,7 +66,7 @@ internal static class GrantCredentialReader value = value[prefix.Length..]; break; - case HeaderTokenFormat.Raw: + case HeaderValueFormat.Raw: break; default: diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/SurrogateResolver.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/SurrogateResolver.cs new file mode 100644 index 00000000..53bda78e --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Surrogates/SurrogateResolver.cs @@ -0,0 +1,24 @@ +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Extensions; +using Microsoft.AspNetCore.Http; + +namespace CodeBeam.UltimateAuth.Server.Infrastructure; + +internal sealed class SurrogateResolver : ISurrogateResolver +{ + public async ValueTask ResolveAsync(HttpContext context, EffectiveSurrogateTransport transport) + { + var value = SurrogateReader.Read(context, transport); + + if (value is null) + return null; + + return new ResolvedSurrogate + { + Kind = transport.Kind, + Value = value, + TenantId = context.GetTenant().Value, + Device = await context.GetDeviceAsync() + }; + } +} diff --git a/src/CodeBeam.UltimateAuth.Server/Options/CredentialResponseOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/CredentialResponseOptions.cs deleted file mode 100644 index 2ca502b8..00000000 --- a/src/CodeBeam.UltimateAuth.Server/Options/CredentialResponseOptions.cs +++ /dev/null @@ -1,60 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Contracts; -using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Core.Options; -using CodeBeam.UltimateAuth.Server.Domain; - -namespace CodeBeam.UltimateAuth.Server.Options; - -[Obsolete("CredentialResponseOptions is no longer supported. Use GrantDeliveryOptions instead.")] -public sealed class CredentialResponseOptions -{ - public GrantKind Kind { get; init; } - public TokenResponseMode Mode { get; set; } = TokenResponseMode.None; - - /// - /// Header or body name - /// - public string? Name { get; set; } - - /// - /// Applies when Mode = Header - /// - public HeaderTokenFormat HeaderFormat { get; set; } = HeaderTokenFormat.Bearer; - public TokenFormat TokenFormat { get; set; } - - // Only for cookie - public UAuthCookieOptions? Cookie { get; init; } - - internal CredentialResponseOptions Clone() => new() - { - Kind = Kind, - Mode = Mode, - Name = Name, - HeaderFormat = HeaderFormat, - TokenFormat = TokenFormat, - Cookie = Cookie?.Clone() - }; - - public CredentialResponseOptions WithCookie(UAuthCookieOptions cookie) - { - if (Mode != TokenResponseMode.Cookie) - throw new InvalidOperationException("Cookie can only be set when Mode = Cookie."); - - return new CredentialResponseOptions() - { - Kind = Kind, - Mode = Mode, - Name = Name, - HeaderFormat = HeaderFormat, - TokenFormat = TokenFormat, - Cookie = cookie - }; - } - - public static CredentialResponseOptions Disabled(GrantKind kind) - => new() - { - Kind = kind, - Mode = TokenResponseMode.None - }; -} diff --git a/src/CodeBeam.UltimateAuth.Server/Options/GrantDeliveryOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/SurrogateTransportOptions.cs similarity index 84% rename from src/CodeBeam.UltimateAuth.Server/Options/GrantDeliveryOptions.cs rename to src/CodeBeam.UltimateAuth.Server/Options/SurrogateTransportOptions.cs index f529170c..2f949673 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/GrantDeliveryOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/SurrogateTransportOptions.cs @@ -11,7 +11,7 @@ namespace CodeBeam.UltimateAuth.Server.Options; /// Grant identity, token format, and issuance behavior are determined by the effective authentication mode /// and cannot be changed through delivery options. /// -public sealed class GrantDeliveryOptions +public sealed class SurrogateTransportOptions { /// /// Gets or sets the delivery mode for this grant. @@ -19,7 +19,7 @@ public sealed class GrantDeliveryOptions /// /// Null inherits the global delivery preference or the authentication mode and application profile defaults when no global preference is configured. /// - public GrantDeliveryMode? Mode { get; set; } + public SurrogateTransport? Mode { get; set; } /// /// Gets or sets the HTTP response header name when delivery mode is Header. @@ -29,9 +29,9 @@ public sealed class GrantDeliveryOptions /// /// Gets or sets the header value format when delivery mode is Header. /// - public HeaderTokenFormat? HeaderFormat { get; set; } + public HeaderValueFormat? HeaderFormat { get; set; } - internal GrantDeliveryOptions Clone() => new() + internal SurrogateTransportOptions Clone() => new() { Mode = Mode, HeaderName = HeaderName, diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthHubCorsOptionsSetup.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthHubCorsOptionsSetup.cs index 3e016a26..1ae9e0ae 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthHubCorsOptionsSetup.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthHubCorsOptionsSetup.cs @@ -20,7 +20,7 @@ public void Configure(CorsOptions options) if (origins.Length == 0) return; - var accessHeader = server.GrantDelivery.AccessToken.HeaderName ?? "uat"; + var accessHeader = server.Transport.AccessToken.HeaderName ?? "uat"; var exposedHeaders = new HashSet(StringComparer.OrdinalIgnoreCase) { diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs index 9b3016ee..62064df2 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs @@ -43,9 +43,25 @@ public sealed class UAuthResourceAuthOptions /// public UAuthMode? Mode { get; set; } - public UAuthResourceSessionOptions Session { get; set; } = new(); + public UAuthResourceSurrogateTransportOptions SessionId + { + get; + set; + } = new() + { + Mode = SurrogateTransport.Cookie, + CookieName = "uas" + }; - public UAuthResourceAccessTokenOptions AccessToken { get; set; } = new(); + public UAuthResourceSurrogateTransportOptions AccessToken + { + get; + set; + } = new() + { + Mode = SurrogateTransport.Header, + CookieName = "uat" + }; public UAuthResourceDeviceOptions Device { get; set; } = new(); @@ -55,7 +71,7 @@ public sealed class UAuthResourceAuthOptions internal UAuthResourceAuthOptions Clone() => new() { Mode = Mode, - Session = Session.Clone(), + SessionId = SessionId.Clone(), AccessToken = AccessToken.Clone(), Device = Device.Clone(), Jwt = Jwt is null @@ -72,44 +88,6 @@ public sealed class UAuthResourceAuthOptions }; } -/// -/// Incoming opaque session credential configuration. -/// -public sealed class UAuthResourceSessionOptions -{ - public GrantDeliveryMode DeliveryMode { get; set; } = GrantDeliveryMode.Cookie; - - public string CookieName { get; set; } = "uas"; - - internal UAuthResourceSessionOptions Clone() => new() - { - DeliveryMode = DeliveryMode, - CookieName = CookieName - }; -} - -/// -/// Incoming access token credential configuration. -/// -public sealed class UAuthResourceAccessTokenOptions -{ - public GrantDeliveryMode DeliveryMode { get; set; } = GrantDeliveryMode.Header; - - public string CookieName { get; set; } = "uat"; - - public string HeaderName { get; set; } = "Authorization"; - - public HeaderTokenFormat HeaderFormat { get; set; } = HeaderTokenFormat.Bearer; - - internal UAuthResourceAccessTokenOptions Clone() => new() - { - DeliveryMode = DeliveryMode, - CookieName = CookieName, - HeaderName = HeaderName, - HeaderFormat = HeaderFormat - }; -} - /// /// Device security policies applied during credential validation. /// @@ -190,3 +168,26 @@ public sealed class UAuthResourceValidationOptions Default = Default }; } + +/// +/// Configures how a Resource API accepts an incoming surrogate. +/// +public sealed class UAuthResourceSurrogateTransportOptions +{ + public SurrogateTransport Mode { get; set; } + + public string CookieName { get; set; } = string.Empty; + + public string HeaderName { get; set; } = "Authorization"; + + public HeaderValueFormat HeaderFormat { get; set; } = HeaderValueFormat.Bearer; + + internal UAuthResourceSurrogateTransportOptions Clone() + => new() + { + Mode = Mode, + CookieName = CookieName, + HeaderName = HeaderName, + HeaderFormat = HeaderFormat + }; +} diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthResponseOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthResponseOptions.cs deleted file mode 100644 index 39662674..00000000 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthResponseOptions.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace CodeBeam.UltimateAuth.Server.Options; - -/// -/// Legacy authentication response configuration. -/// -[Obsolete( - "UAuthResponseOptions is no longer supported. " + - "Use UAuthGrantDeliveryOptions and UAuthRedirectOptions instead.")] -public sealed class UAuthResponseOptions -{ - [Obsolete("Use GrantDelivery.Session instead.")] - public CredentialResponseOptions SessionIdDelivery { get; set; } = new(); - - [Obsolete("Use GrantDelivery.AccessToken instead.")] - public CredentialResponseOptions AccessTokenDelivery { get; set; } = new(); - - [Obsolete("Use GrantDelivery.RefreshToken instead.")] - public CredentialResponseOptions RefreshTokenDelivery { get; set; } = new(); - - [Obsolete("Use Redirect.Login instead.")] - public LoginRedirectOptions Login { get; set; } = new(); - - [Obsolete("Use Redirect.Logout instead.")] - public LogoutRedirectOptions Logout { get; set; } = new(); -} diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs index 206dd800..eb138011 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs @@ -137,7 +137,7 @@ public sealed class UAuthServerOptions /// /// Configures how authentication grants are delivered to clients. /// - public UAuthGrantDeliveryOptions GrantDelivery { get; set; } = new(); + public UAuthSurrogateTransportOptions Transport { get; set; } = new(); /// /// Configures authentication flow redirects. @@ -189,18 +189,6 @@ public sealed class UAuthServerOptions /// public UAuthArtifactStoreOptions AuthArtifacts { get; set; } = new(); - [Obsolete("AuthResponse is no longer supported. Use GrantDelivery and Redirect instead.")] - public UAuthResponseOptions AuthResponse - { - get => throw new NotSupportedException( - "AuthResponse is no longer supported. " + - "Use GrantDelivery and Redirect instead."); - - set => throw new NotSupportedException( - "AuthResponse is no longer supported. " + - "Use GrantDelivery and Redirect instead."); - } - // ------------------------------------------------------- // CUSTOMIZATION HOOKS @@ -240,7 +228,7 @@ internal UAuthServerOptions Clone() Cookie = Cookie.Clone(), Diagnostics = Diagnostics.Clone(), - GrantDelivery = GrantDelivery.Clone(), + Transport = Transport.Clone(), Redirect = Redirect.Clone(), ResetCredential = ResetCredential.Clone(), CredentialSessionPolicy = CredentialSessionPolicy.Clone(), diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthGrantDeliveryOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthSurrogateTransportOptions.cs similarity index 73% rename from src/CodeBeam.UltimateAuth.Server/Options/UAuthGrantDeliveryOptions.cs rename to src/CodeBeam.UltimateAuth.Server/Options/UAuthSurrogateTransportOptions.cs index e8e6ad92..ef4ae257 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthGrantDeliveryOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthSurrogateTransportOptions.cs @@ -10,7 +10,7 @@ namespace CodeBeam.UltimateAuth.Server.Options; /// /// The effective authentication mode determines which grants exist and which delivery configurations are supported. /// -public sealed class UAuthGrantDeliveryOptions +public sealed class UAuthSurrogateTransportOptions { /// /// Gets or sets the default delivery mode for grants issued by the authentication mode. @@ -18,27 +18,27 @@ public sealed class UAuthGrantDeliveryOptions /// /// Null uses authentication mode and application profile defaults. Individual grant settings take precedence. /// - public GrantDeliveryMode? Default { get; set; } + public SurrogateTransport? Default { get; set; } /// /// Configures delivery of the session grant. /// - public GrantDeliveryOptions Session { get; set; } = new(); + public SurrogateTransportOptions SessionId { get; set; } = new(); /// /// Configures delivery of the access token grant. /// - public GrantDeliveryOptions AccessToken { get; set; } = new(); + public SurrogateTransportOptions AccessToken { get; set; } = new(); /// /// Configures delivery of the refresh token grant. /// - public GrantDeliveryOptions RefreshToken { get; set; } = new(); + public SurrogateTransportOptions RefreshToken { get; set; } = new(); - internal UAuthGrantDeliveryOptions Clone() => new() + internal UAuthSurrogateTransportOptions Clone() => new() { Default = Default, - Session = Session.Clone(), + SessionId = SessionId.Clone(), AccessToken = AccessToken.Clone(), RefreshToken = RefreshToken.Clone() }; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs index 0070c43a..89a2de27 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs @@ -54,8 +54,8 @@ public ValidateOptionsResult Validate(string? name, UAuthResourceApiOptions opti if (errors.Count > 0) return ValidateOptionsResult.Fail(errors); - if (auth.Session is null) - errors.Add("Auth.Session must be configured."); + if (auth.SessionId is null) + errors.Add("Auth.SessionId must be configured."); if (auth.AccessToken is null) errors.Add("Auth.AccessToken must be configured."); @@ -66,21 +66,21 @@ public ValidateOptionsResult Validate(string? name, UAuthResourceApiOptions opti if (options.Cryptography is null) errors.Add("Cryptography must be configured."); - if (auth.Session is not null) + if (auth.SessionId is not null) { - if (!Enum.IsDefined(auth.Session.DeliveryMode)) - errors.Add("Auth.Session.DeliveryMode is invalid."); + if (!Enum.IsDefined(auth.SessionId.Mode)) + errors.Add("Auth.SessionId.Mode is invalid."); - if (string.IsNullOrWhiteSpace(auth.Session.CookieName)) - errors.Add("Auth.Session.CookieName is required."); + if (string.IsNullOrWhiteSpace(auth.SessionId.CookieName)) + errors.Add("Auth.SessionId.CookieName is required."); } if (auth.AccessToken is not null) { var token = auth.AccessToken; - if (!Enum.IsDefined(token.DeliveryMode)) - errors.Add("Auth.AccessToken.DeliveryMode is invalid."); + if (!Enum.IsDefined(token.Mode)) + errors.Add("Auth.AccessToken.Mode is invalid."); if (!Enum.IsDefined(token.HeaderFormat)) errors.Add("Auth.AccessToken.HeaderFormat is invalid."); diff --git a/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs b/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs index 5a37fb78..f2cddb3e 100644 --- a/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs +++ b/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs @@ -19,13 +19,13 @@ internal sealed class RemoteHubValidationService private static readonly object CacheKey = new(); private readonly HttpClient _http; - private readonly ITransportCredentialResolver _credentials; + private readonly ISurrogateResolver _surrogateResolver; private readonly UAuthResourceApiOptions _options; - public RemoteHubValidationService(HttpClient http, ITransportCredentialResolver credentials, IOptions options) + public RemoteHubValidationService(HttpClient http, ISurrogateResolver surrogateResolver, IOptions options) { _http = http; - _credentials = credentials; + _surrogateResolver = surrogateResolver; _options = options.Value; } @@ -73,26 +73,11 @@ SessionValidationResult Invalid() var access = _options.Auth.AccessToken; - var delivery = new EffectiveGrantDelivery( - GrantKind.AccessToken, - TokenFormat.Jwt, - access.DeliveryMode, - name: access.HeaderName, - headerFormat: access.HeaderFormat, - cookie: new UAuthCookieOptions - { - Name = access.CookieName - }); - - var response = new EffectiveAuthResponse( - EffectiveGrantDelivery.Disabled(GrantKind.Session), - delivery, - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), - EffectiveRedirectResponse.Disabled); + var transport = ResourceSurrogateTransportFactory.CreateAccessToken(UAuthMode.SemiHybrid, _options.Auth); - var credential = await _credentials.ResolveAsync(context, UAuthMode.SemiHybrid, response); + var surrogate = await _surrogateResolver.ResolveAsync(context, transport); - if (credential is null || credential.Kind != TransportCredentialKind.AccessToken) + if (surrogate is null || surrogate.Kind != SurrogateKind.AccessToken) { return Invalid(); } @@ -108,7 +93,7 @@ SessionValidationResult Invalid() using var request = new HttpRequestMessage(HttpMethod.Post, "/auth/validate"); - request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", credential.Value); + request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", surrogate.Value); request.Headers.TryAddWithoutValidation(UAuthConstants.Headers.Validation, nameof(UAuthValidationRequirement.HubValidated)); diff --git a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSessionIdResolver.cs b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSessionIdResolver.cs index 515aabb8..28947b84 100644 --- a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSessionIdResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSessionIdResolver.cs @@ -1,7 +1,5 @@ -using CodeBeam.UltimateAuth.Core.Contracts; -using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Server.Auth; -using CodeBeam.UltimateAuth.Server.Domain; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Extensions; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Server.ResourceApi; using Microsoft.AspNetCore.Http; @@ -13,55 +11,36 @@ internal sealed class ResourceSessionIdResolver : ISessionIdResolver { private readonly ResourceApiAuthModeProvider _modeProvider; private readonly UAuthResourceApiOptions _options; - private readonly ITransportCredentialResolver _credentialResolver; + private readonly ISurrogateResolver _surrogateResolver; public ResourceSessionIdResolver( ResourceApiAuthModeProvider modeProvider, IOptions options, - ITransportCredentialResolver credentialResolver) + ISurrogateResolver surrogateResolver) { _modeProvider = modeProvider; _options = options.Value; - _credentialResolver = credentialResolver; + _surrogateResolver = surrogateResolver; } public async ValueTask ResolveAsync(HttpContext context, CancellationToken ct = default) { ct.ThrowIfCancellationRequested(); - var mode = _modeProvider.Mode; - - if (mode is not (UAuthMode.PureOpaque or UAuthMode.Hybrid)) - { + if (!_modeProvider.Mode.UsesSessionIdForAuthentication()) return null; - } - - var sessionDelivery = new EffectiveGrantDelivery( - GrantKind.Session, - TokenFormat.Opaque, - _options.Auth.Session.DeliveryMode, - name: "Authorization", - headerFormat: HeaderTokenFormat.Bearer, - cookie: new UAuthCookieOptions - { - Name = _options.Auth.Session.CookieName - }); - var response = new EffectiveAuthResponse( - sessionDelivery, - EffectiveGrantDelivery.Disabled(GrantKind.AccessToken), - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), - EffectiveRedirectResponse.Disabled); + var transport = ResourceSurrogateTransportFactory.CreateSessionId(_options.Auth); - var credential = await _credentialResolver.ResolveAsync(context, mode, response); + var surrogate = await _surrogateResolver.ResolveAsync(context, transport); - if (credential is null || credential.Kind != TransportCredentialKind.Session) + if (surrogate is null || surrogate.Kind != SurrogateKind.SessionId) { return null; } return AuthSessionId.TryCreate( - credential.Value, + surrogate.Value, out var sessionId) ? sessionId : null; diff --git a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSurrogateTransportFactory.cs b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSurrogateTransportFactory.cs new file mode 100644 index 00000000..a26da387 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSurrogateTransportFactory.cs @@ -0,0 +1,55 @@ +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Extensions; +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; +using CodeBeam.UltimateAuth.Server.Options; + +namespace CodeBeam.UltimateAuth.Server.ResourceApi; + +internal static class ResourceSurrogateTransportFactory +{ + public static EffectiveSurrogateTransport CreatePrimary(UAuthMode mode, UAuthResourceAuthOptions options) + => Create(mode, mode.GetPrimarySurrogateKind(), options); + + public static EffectiveSurrogateTransport CreateSessionId(UAuthResourceAuthOptions options) + => CreateTransport(SurrogateKind.SessionId, TokenFormat.Opaque, options.SessionId); + + public static EffectiveSurrogateTransport CreateAccessToken(UAuthMode mode, UAuthResourceAuthOptions options) + => Create(mode, SurrogateKind.AccessToken, options); + + public static EffectiveSurrogateTransport Create(UAuthMode mode, SurrogateKind kind, UAuthResourceAuthOptions options) + { + var format = mode.GetTokenFormat(kind) + ?? throw new InvalidOperationException($"Surrogate '{kind}' is not supported by mode '{mode}'."); + + var configured = kind switch + { + SurrogateKind.SessionId => options.SessionId, + SurrogateKind.AccessToken => options.AccessToken, + + _ => throw new InvalidOperationException($"Resource APIs do not accept '{kind}' surrogates.") + }; + + return CreateTransport(kind, format, configured); + } + + private static EffectiveSurrogateTransport CreateTransport(SurrogateKind kind, TokenFormat format, UAuthResourceSurrogateTransportOptions configured) + { + if (configured.Mode is not (SurrogateTransport.Cookie or SurrogateTransport.Header)) + { + throw new InvalidOperationException($"Unsupported Resource API transport '{configured.Mode}' for '{kind}'."); + } + + return new EffectiveSurrogateTransport( + kind, + format, + configured.Mode, + name: configured.HeaderName, + headerFormat: configured.HeaderFormat, + cookie: new UAuthCookieOptions + { + Name = configured.CookieName + }); + } +} diff --git a/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfGrantInspector.cs b/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfGrantInspector.cs deleted file mode 100644 index 6cd07c67..00000000 --- a/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfGrantInspector.cs +++ /dev/null @@ -1,14 +0,0 @@ -using CodeBeam.UltimateAuth.Server.Auth; -using CodeBeam.UltimateAuth.Server.Domain; - -namespace CodeBeam.UltimateAuth.Server.Security; - -internal static class UAuthCsrfGrantInspector -{ - public static bool UsesAuthenticationCookie(EffectiveAuthResponse response) - { - return response.SessionIdDelivery.Mode == GrantDeliveryMode.Cookie - || response.AccessTokenDelivery.Mode == GrantDeliveryMode.Cookie - || response.RefreshTokenDelivery.Mode == GrantDeliveryMode.Cookie; - } -} diff --git a/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfPolicyEvaluator.cs b/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfPolicyEvaluator.cs index ac9a84c2..77b2002e 100644 --- a/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfPolicyEvaluator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfPolicyEvaluator.cs @@ -6,7 +6,7 @@ internal sealed class UAuthCsrfPolicyEvaluator { public bool RequiresProtection(AuthFlowContext auth, UAuthCsrfOperation operation) { - return RequiresProtection(operation, UAuthCsrfGrantInspector.UsesAuthenticationCookie(auth.Response)); + return RequiresProtection(operation, UAuthCsrfSurrogateInspector.UsesAuthenticationCookie(auth.Response)); } internal static bool RequiresProtection(UAuthCsrfOperation operation, bool usesAuthenticationCookie) diff --git a/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfSurrogateInspector.cs b/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfSurrogateInspector.cs new file mode 100644 index 00000000..aac0182d --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfSurrogateInspector.cs @@ -0,0 +1,14 @@ +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; + +namespace CodeBeam.UltimateAuth.Server.Security; + +internal static class UAuthCsrfSurrogateInspector +{ + public static bool UsesAuthenticationCookie(EffectiveAuthResponse response) + { + return response.SessionIdTransport.Mode == SurrogateTransport.Cookie + || response.AccessTokenTransport.Mode == SurrogateTransport.Cookie + || response.RefreshTokenTransport.Mode == SurrogateTransport.Cookie; + } +} diff --git a/src/CodeBeam.UltimateAuth.Server/Services/JwtLogoutService.cs b/src/CodeBeam.UltimateAuth.Server/Services/JwtLogoutService.cs index 667f818d..3908127e 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/JwtLogoutService.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/JwtLogoutService.cs @@ -104,7 +104,7 @@ await store.ExecuteAsync( SessionOptions = flow.Options.Session, Now = now }, - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, ct); if (!lineage.IsValid || diff --git a/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs b/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs index 845e3dcc..02436f7e 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs @@ -237,7 +237,7 @@ validation.UserKey is not UserKey userKey || Device = context.Device, SessionOptions = flow.Options.Session }, - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, ct); if (!lineage.IsValid || diff --git a/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs b/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs index 54643755..6ddbdef3 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs @@ -14,7 +14,7 @@ public SessionLineageValidator(ISessionStoreFactory storeFactory) _storeFactory = storeFactory; } - public async Task ValidateAsync(SessionValidationContext context, SessionCredentialPurpose expectedPurpose, CancellationToken ct = default) + public async Task ValidateAsync(SessionValidationContext context, SessionIdPurpose expectedPurpose, CancellationToken ct = default) { var options = context.SessionOptions ?? throw new InvalidOperationException("Session options are required for lineage validation."); diff --git a/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs b/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs index fc3cb6dd..f134bd65 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs @@ -18,7 +18,7 @@ public UAuthSessionValidator(ISessionLineageValidator lineageValidator, IUserCla public async Task ValidateSessionAsync(SessionValidationContext context, CancellationToken ct = default) { - var result = await _lineageValidator.ValidateAsync(context, SessionCredentialPurpose.Opaque, ct); + var result = await _lineageValidator.ValidateAsync(context, SessionIdPurpose.Opaque, ct); if (!result.IsValid || result.UserKey is not UserKey userKey || diff --git a/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Data/UAuthSessionsModelBuilder.cs b/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Data/UAuthSessionsModelBuilder.cs index 494e7d4e..e04e18ff 100644 --- a/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Data/UAuthSessionsModelBuilder.cs +++ b/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Data/UAuthSessionsModelBuilder.cs @@ -156,7 +156,7 @@ private static void ConfigureSessions(ModelBuilder b) e.Property(x => x.CredentialPurpose) .HasConversion() - .HasDefaultValue(SessionCredentialPurpose.Opaque) + .HasDefaultValue(SessionIdPurpose.Opaque) .IsRequired(); e.HasIndex(x => new { x.Tenant, x.SessionId }).IsUnique(); diff --git a/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Projections/SessionProjection.cs b/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Projections/SessionProjection.cs index 9adcfc02..3c284fe3 100644 --- a/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Projections/SessionProjection.cs +++ b/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Projections/SessionProjection.cs @@ -23,7 +23,7 @@ public sealed class SessionProjection public SessionMetadata Metadata { get; set; } = SessionMetadata.Empty; public long Version { get; set; } - public SessionCredentialPurpose CredentialPurpose { get; set; } = SessionCredentialPurpose.Opaque; + public SessionIdPurpose CredentialPurpose { get; set; } = SessionIdPurpose.Opaque; public bool IsRevoked => RevokedAt != null; } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/Infrastructure/AuthServerFactory.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/Infrastructure/AuthServerFactory.cs index 98145c0c..7db210bc 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/Infrastructure/AuthServerFactory.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/Infrastructure/AuthServerFactory.cs @@ -67,7 +67,7 @@ protected override void ConfigureWebHost(IWebHostBuilder builder) services.PostConfigure(options => { // TODO: Decouple test projects and remove UAuthHub sample dependency. This is a temporary workaround to avoid UAuthHub sample's default cookie delivery mode from interfering with the tests. - options.GrantDelivery.Default = GrantDeliveryMode.Cookie; + options.Transport.Default = SurrogateTransport.Cookie; options.RateLimiting.Enabled = false; options.Login.IncludeFailureDetails = false; options.DeviceLimits.MaxDevices = null; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/LoginTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/LoginTests.cs index de2dac52..1528a7dc 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/LoginTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/LoginTests.cs @@ -1864,9 +1864,9 @@ public async Task HybridLogin_WithSessionCookieAndBearerToken_ShouldValidate() using var factory = AuthServerFactory.Create(options => { options.AuthMode = UAuthMode.Hybrid; - options.GrantDelivery.Session.Mode = GrantDeliveryMode.Cookie; - options.GrantDelivery.AccessToken.Mode = GrantDeliveryMode.Header; - options.GrantDelivery.RefreshToken.Mode = GrantDeliveryMode.Cookie; + options.Transport.SessionId.Mode = SurrogateTransport.Cookie; + options.Transport.AccessToken.Mode = SurrogateTransport.Header; + options.Transport.RefreshToken.Mode = SurrogateTransport.Cookie; }); var ct = TestContext.Current.CancellationToken; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/PureJwtIdentityTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/PureJwtIdentityTests.cs index fce7226f..dc4f69fb 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/PureJwtIdentityTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/PureJwtIdentityTests.cs @@ -580,26 +580,22 @@ public static async Task CreateAsync(DeviceMismatchBehavior deviceMismatch options.Session.DeviceMismatchBehavior = deviceMismatchBehavior; - options.GrantDelivery.AccessToken.Mode = GrantDeliveryMode.Header; - options.GrantDelivery.AccessToken.HeaderName = "Authorization"; - options.GrantDelivery.AccessToken.HeaderFormat = HeaderTokenFormat.Bearer; + options.Transport.AccessToken.Mode = SurrogateTransport.Header; + options.Transport.AccessToken.HeaderName = "Authorization"; + options.Transport.AccessToken.HeaderFormat = HeaderValueFormat.Bearer; }) .AddUltimateAuthInMemory(); builder.Services.Replace(ServiceDescriptor.Scoped(_ => runtimeStateProvider.Object)); - var sessionValidator = - new Mock(MockBehavior.Strict); + var sessionValidator = new Mock(MockBehavior.Strict); - builder.Services.Replace( - ServiceDescriptor.Scoped( - _ => sessionValidator.Object)); + builder.Services.Replace(ServiceDescriptor.Scoped(_ => sessionValidator.Object)); var app = builder.Build(); app.UseRouting(); - app.UseUltimateAuthWithAspNetCore( - useRateLimiting: false); + app.UseUltimateAuthWithAspNetCore(useRateLimiting: false); app.MapGet("/test/purejwt/identity", async ( diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs index 3d555f5c..a69879ca 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs @@ -2447,7 +2447,7 @@ public async Task Refresh_Hybrid_Maui_HeaderCredentials_ShouldSupportConsecutive using var factory = AuthServerFactory.Create(options => { options.AuthMode = UAuthMode.Hybrid; - options.GrantDelivery.Default = GrantDeliveryMode.Header; + options.Transport.Default = SurrogateTransport.Header; }); factory.Clock.Reset(); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/ResourceApi/ResourceApiTestHost.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/ResourceApi/ResourceApiTestHost.cs index 3e7eab37..ebf42d5e 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/ResourceApi/ResourceApiTestHost.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/ResourceApi/ResourceApiTestHost.cs @@ -46,7 +46,7 @@ public static async Task CreateAsync( { options.Hub.BaseUrl = "https://uauth.test"; options.Auth.Mode = UAuthMode.PureOpaque; - options.Auth.Session.DeliveryMode = GrantDeliveryMode.Header; + options.Auth.SessionId.Mode = SurrogateTransport.Header; configureResourceApi?.Invoke(options); }); @@ -85,14 +85,14 @@ public static async Task CreateAsync( // Resource API tests authenticate with: // Authorization: Bearer var authenticationResponse = new EffectiveAuthResponse( - new EffectiveGrantDelivery( - GrantKind.Session, + new EffectiveSurrogateTransport( + SurrogateKind.SessionId, TokenFormat.Opaque, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: "Authorization", - headerFormat: HeaderTokenFormat.Bearer), - EffectiveGrantDelivery.Disabled(GrantKind.AccessToken), - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + headerFormat: HeaderValueFormat.Bearer), + EffectiveSurrogateTransport.Disabled(SurrogateKind.AccessToken), + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), EffectiveRedirectResponse.Disabled); var authResponseResolver = new Mock(); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/UAuthModeExtensionsTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/UAuthModeExtensionsTests.cs new file mode 100644 index 00000000..97381fc9 --- /dev/null +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/UAuthModeExtensionsTests.cs @@ -0,0 +1,118 @@ +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Extensions; + +namespace CodeBeam.UltimateAuth.Tests.Unit.Core; + +public class UAuthModeExtensionsTests +{ + [Theory] + [InlineData(UAuthMode.PureOpaque, SurrogateKind.SessionId, true, false, false, null)] + [InlineData(UAuthMode.Hybrid, SurrogateKind.SessionId, true, true, true, TokenFormat.Opaque)] + [InlineData(UAuthMode.SemiHybrid, SurrogateKind.AccessToken, true, true, true, TokenFormat.Jwt)] + [InlineData(UAuthMode.PureJwt, SurrogateKind.AccessToken, false, true, true, TokenFormat.Jwt)] + public void Mode_ShouldExposeExpectedCharacteristics( + UAuthMode mode, + SurrogateKind primarySurrogate, + bool supportsLineage, + bool supportsAccessToken, + bool supportsRefreshToken, + TokenFormat? accessTokenFormat) + { + Assert.Equal( + primarySurrogate, + mode.GetPrimarySurrogateKind()); + + Assert.Equal( + supportsLineage, + mode.SupportsSessionLineage()); + + Assert.Equal( + supportsAccessToken, + mode.SupportsAccessToken()); + + Assert.Equal( + supportsRefreshToken, + mode.SupportsRefreshToken()); + + Assert.Equal( + accessTokenFormat, + mode.GetAccessTokenFormat()); + + Assert.Equal( + primarySurrogate == SurrogateKind.SessionId, + mode.UsesSessionIdForAuthentication()); + } + + [Fact] + public void UnsupportedMode_ShouldBeRejected() + { + var mode = (UAuthMode)int.MaxValue; + + Assert.Throws( + () => mode.GetPrimarySurrogateKind()); + + Assert.Throws( + () => mode.SupportsSessionLineage()); + + Assert.Throws( + () => mode.SupportsAccessToken()); + + Assert.Throws( + () => mode.SupportsRefreshToken()); + + Assert.Throws( + () => mode.GetAccessTokenFormat()); + + Assert.Throws( + () => mode.UsesSessionIdForAuthentication()); + } + + [Theory] + [InlineData(UAuthMode.PureOpaque, true, false, false)] + [InlineData(UAuthMode.Hybrid, true, true, true)] + [InlineData(UAuthMode.SemiHybrid, false, true, true)] + [InlineData(UAuthMode.PureJwt, false, true, true)] + public void SupportsSurrogate_ShouldMatchMode( + UAuthMode mode, + bool sessionId, + bool accessToken, + bool refreshToken) + { + Assert.Equal( + sessionId, + mode.SupportsSurrogate(SurrogateKind.SessionId)); + + Assert.Equal( + accessToken, + mode.SupportsSurrogate(SurrogateKind.AccessToken)); + + Assert.Equal( + refreshToken, + mode.SupportsSurrogate(SurrogateKind.RefreshToken)); + } + + [Theory] + [InlineData(UAuthMode.PureOpaque, TokenFormat.Opaque, null, null)] + [InlineData(UAuthMode.Hybrid, TokenFormat.Opaque, TokenFormat.Opaque, TokenFormat.Opaque)] + [InlineData(UAuthMode.SemiHybrid, null, TokenFormat.Jwt, TokenFormat.Opaque)] + [InlineData(UAuthMode.PureJwt, null, TokenFormat.Jwt ,TokenFormat.Opaque)] + public void GetTokenFormat_ShouldMatchMode(UAuthMode mode, TokenFormat? sessionId, TokenFormat? accessToken, TokenFormat? refreshToken) + { + Assert.Equal(sessionId, mode.GetTokenFormat(SurrogateKind.SessionId)); + Assert.Equal(accessToken, mode.GetTokenFormat(SurrogateKind.AccessToken)); + Assert.Equal(refreshToken, mode.GetTokenFormat(SurrogateKind.RefreshToken)); + } + + [Fact] + public void UnsupportedSurrogateKind_ShouldBeRejected() + { + var kind = (SurrogateKind)int.MaxValue; + + Assert.Throws( + () => UAuthMode.Hybrid.SupportsSurrogate(kind)); + + Assert.Throws( + () => UAuthMode.Hybrid.GetTokenFormat(kind)); + } +} diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/AuthFlowTestFactory.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/AuthFlowTestFactory.cs index daa76a8a..a98e94f2 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/AuthFlowTestFactory.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/AuthFlowTestFactory.cs @@ -37,16 +37,15 @@ public static AuthFlowContext New( session: session, options: TestServerOptions.Default(), response: response ?? new EffectiveAuthResponse( - sessionIdDelivery: - EffectiveGrantDelivery.Disabled(GrantKind.Session), - accessTokenDelivery: - EffectiveGrantDelivery.Disabled(GrantKind.AccessToken), - refreshTokenDelivery: - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + sessionIdTransport: + EffectiveSurrogateTransport.Disabled(SurrogateKind.SessionId), + accessTokenTransport: + EffectiveSurrogateTransport.Disabled(SurrogateKind.AccessToken), + refreshTokenTransport: + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), redirect: redirect ?? EffectiveRedirectResponse.Disabled ), - primaryTokenKind: PrimaryTokenKind.Session, returnUrlInfo: returnUrlInfo ?? ReturnUrlInfo.None() ); } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/RemoteHubValidationServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/RemoteHubValidationServiceTests.cs index 4e34eeee..a69a7011 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/RemoteHubValidationServiceTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/RemoteHubValidationServiceTests.cs @@ -5,11 +5,13 @@ using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Server.ResourceApi; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; using Microsoft.AspNetCore.Http; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Moq; @@ -55,8 +57,7 @@ public async Task ValidateAsync_ShouldSendExpectedHubValidationRequest() fixture.Credentials.Verify(x => x.ResolveAsync( fixture.Context, - UAuthMode.SemiHybrid, - It.IsAny()), Times.Once); + It.IsAny()), Times.Once); } [Fact] @@ -166,16 +167,15 @@ public async Task ValidateAsync_InvalidClaim_ShouldReject( } [Fact] - public async Task ValidateAsync_MissingCredential_ShouldReject() + public async Task ValidateAsync_MissingSurrogate_ShouldReject() { using var fixture = CreateFixture(); fixture.Credentials .Setup(x => x.ResolveAsync( fixture.Context, - UAuthMode.SemiHybrid, - It.IsAny())) - .ReturnsAsync((TransportCredential?)null); + It.IsAny())) + .ReturnsAsync((ResolvedSurrogate?)null); var result = await ValidateAsync(fixture); @@ -185,20 +185,17 @@ public async Task ValidateAsync_MissingCredential_ShouldReject() } [Theory] - [InlineData(TransportCredentialKind.Session)] - [InlineData(TransportCredentialKind.RefreshToken)] - [InlineData(TransportCredentialKind.Hub)] - public async Task ValidateAsync_WrongCredentialKind_ShouldReject( - TransportCredentialKind kind) + [InlineData(SurrogateKind.SessionId)] + [InlineData(SurrogateKind.RefreshToken)] + public async Task ValidateAsync_WrongCredentialKind_ShouldReject(SurrogateKind kind) { using var fixture = CreateFixture(); fixture.Credentials .Setup(x => x.ResolveAsync( fixture.Context, - UAuthMode.SemiHybrid, - It.IsAny())) - .ReturnsAsync(CreateCredential(kind)); + It.IsAny())) + .ReturnsAsync(CreateSurrogate(kind)); var result = await ValidateAsync(fixture); @@ -549,8 +546,7 @@ await act.Should() [Theory] [InlineData(true)] [InlineData(false)] - public async Task ValidateAsync_SameRequest_ShouldCacheResult( - bool valid) + public async Task ValidateAsync_SameRequest_ShouldCacheResult(bool valid) { using var fixture = CreateFixture(); @@ -573,8 +569,7 @@ public async Task ValidateAsync_SameRequest_ShouldCacheResult( fixture.Credentials.Verify(x => x.ResolveAsync( fixture.Context, - UAuthMode.SemiHybrid, - It.IsAny()), Times.Once); + It.IsAny()), Times.Once); } [Fact] @@ -588,11 +583,8 @@ public async Task ValidateAsync_DifferentRequests_ShouldNotShareCache() fixture.Services); fixture.Credentials - .Setup(x => x.ResolveAsync( - secondContext, - UAuthMode.SemiHybrid, - It.IsAny())) - .ReturnsAsync(CreateCredential()); + .Setup(x => x.ResolveAsync(secondContext, It.IsAny())) + .ReturnsAsync(CreateSurrogate()); fixture.DeviceResolver .Setup(x => x.ResolveAsync(secondContext)) @@ -625,7 +617,7 @@ private static Fixture CreateFixture() DeviceMismatchBehavior.Reject; var credentials = - new Mock( + new Mock( MockBehavior.Strict); var deviceResolver = @@ -638,11 +630,8 @@ private static Fixture CreateFixture() var context = CreateHttpContext(services); credentials - .Setup(x => x.ResolveAsync( - context, - UAuthMode.SemiHybrid, - It.IsAny())) - .ReturnsAsync(CreateCredential()); + .Setup(x => x.ResolveAsync(context, It.IsAny())) + .ReturnsAsync(CreateSurrogate()); deviceResolver .Setup(x => x.ResolveAsync(context)) @@ -712,11 +701,9 @@ private static ClaimsPrincipal CreatePrincipal( UAuthConstants.SchemeDefaults.GlobalScheme)); } - private static TransportCredential CreateCredential( - TransportCredentialKind kind = - TransportCredentialKind.AccessToken) + private static ResolvedSurrogate CreateSurrogate(SurrogateKind kind = SurrogateKind.AccessToken) { - return new TransportCredential + return new ResolvedSurrogate { Kind = kind, Value = AccessToken, @@ -803,7 +790,7 @@ private static void AssertInvalid( private sealed record Fixture( RemoteHubValidationService Sut, DefaultHttpContext Context, - Mock Credentials, + Mock Credentials, Mock DeviceResolver, RecordingHttpHandler Handler, UAuthResourceApiOptions Options, diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceSessionIdResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceSessionIdResolverTests.cs index e5efbfde..790376e1 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceSessionIdResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceSessionIdResolverTests.cs @@ -4,6 +4,7 @@ using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Domain; +using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Server.ResourceApi; @@ -26,7 +27,7 @@ public async Task ResolveAsync_WhenSessionBasedMode_ShouldResolveSession(UAuthMo var (sut, context, transport) = CreateSut( mode, CreateCredential( - TransportCredentialKind.Session, + SurrogateKind.SessionId, sessionId.Value)); var result = await sut.ResolveAsync( @@ -37,8 +38,7 @@ public async Task ResolveAsync_WhenSessionBasedMode_ShouldResolveSession(UAuthMo transport.Verify(x => x.ResolveAsync( context, - mode, - It.IsAny()), + It.IsAny()), Times.Once); } @@ -82,7 +82,7 @@ public async Task ResolveAsync_WhenCredentialIsAccessToken_ShouldReturnNull(UAut var (sut, context, _) = CreateSut( mode, CreateCredential( - TransportCredentialKind.AccessToken, + SurrogateKind.AccessToken, sessionId.Value)); var result = await sut.ResolveAsync( @@ -101,7 +101,7 @@ public async Task ResolveAsync_WhenSessionIdIsInvalid_ShouldReturnNull(string va var (sut, context, _) = CreateSut( UAuthMode.PureOpaque, CreateCredential( - TransportCredentialKind.Session, + SurrogateKind.SessionId, value)); var result = await sut.ResolveAsync( @@ -118,7 +118,7 @@ public async Task ResolveAsync_ShouldUseConfiguredSessionCookie(UAuthMode mode) { var (sut, context, transport) = CreateSut( mode, - deliveryMode: GrantDeliveryMode.Cookie, + deliveryMode: SurrogateTransport.Cookie, cookieName: "custom-resource-session"); await sut.ResolveAsync( @@ -127,18 +127,15 @@ await sut.ResolveAsync( transport.Verify(x => x.ResolveAsync( context, - mode, - It.Is(response => - response.SessionIdDelivery.Mode == - GrantDeliveryMode.Cookie && - response.SessionIdDelivery.Kind == - GrantKind.Session && - response.SessionIdDelivery.TokenFormat == - TokenFormat.Opaque && - response.SessionIdDelivery.Cookie != null && - response.SessionIdDelivery.Cookie.Name == - "custom-resource-session")), + It.Is(t => + t.Mode == SurrogateTransport.Cookie && + t.Kind == SurrogateKind.SessionId && + t.TokenFormat == TokenFormat.Opaque && + t.Cookie != null && + t.Cookie.Name == "custom-resource-session")), Times.Once); + + transport.VerifyNoOtherCalls(); } [Theory] @@ -148,7 +145,7 @@ public async Task ResolveAsync_WhenHeaderIsConfigured_ShouldUseAuthorizationBear { var (sut, context, transport) = CreateSut( mode, - deliveryMode: GrantDeliveryMode.Header); + deliveryMode: SurrogateTransport.Header); await sut.ResolveAsync( context, @@ -156,21 +153,21 @@ await sut.ResolveAsync( transport.Verify(x => x.ResolveAsync( context, - mode, - It.Is(response => - response.SessionIdDelivery.Mode == - GrantDeliveryMode.Header && - response.SessionIdDelivery.RequestHeaderName == - "Authorization" && - response.SessionIdDelivery.RequestHeaderFormat == - HeaderTokenFormat.Bearer)), + It.Is(t => + t.Kind == SurrogateKind.SessionId && + t.TokenFormat == TokenFormat.Opaque && + t.Mode == SurrogateTransport.Header && + t.RequestHeaderName == "Authorization" && + t.RequestHeaderFormat == HeaderValueFormat.Bearer)), Times.Once); + + transport.VerifyNoOtherCalls(); } [Theory] [InlineData(UAuthMode.PureOpaque)] [InlineData(UAuthMode.Hybrid)] - public async Task ResolveAsync_ShouldDisableNonSessionGrants(UAuthMode mode) + public async Task ResolveAsync_ShouldResolveOnlySessionIdSurrogate(UAuthMode mode) { var (sut, context, transport) = CreateSut(mode); @@ -180,33 +177,28 @@ await sut.ResolveAsync( transport.Verify(x => x.ResolveAsync( context, - mode, - It.Is(response => - response.AccessTokenDelivery.Mode == - GrantDeliveryMode.None && - response.RefreshTokenDelivery.Mode == - GrantDeliveryMode.None)), + It.Is(t => + t.Kind == SurrogateKind.SessionId && + t.TokenFormat == TokenFormat.Opaque)), Times.Once); + + transport.VerifyNoOtherCalls(); } [Fact] public async Task ResolveAsync_WhenCancelled_ShouldThrowBeforeResolvingCredential() { - var (sut, context, transport) = - CreateSut(UAuthMode.PureOpaque); + var (sut, context, transport) = CreateSut(UAuthMode.PureOpaque); using var cancellation = new CancellationTokenSource(); cancellation.Cancel(); Func act = async () => { - await sut.ResolveAsync( - context, - cancellation.Token); + await sut.ResolveAsync(context, cancellation.Token); }; - await act.Should() - .ThrowAsync(); + await act.Should().ThrowAsync(); transport.VerifyNoOtherCalls(); } @@ -214,11 +206,11 @@ await act.Should() private static ( ResourceSessionIdResolver Sut, DefaultHttpContext Context, - Mock Transport) + Mock Transport) CreateSut( UAuthMode mode, - TransportCredential? credential = null, - GrantDeliveryMode deliveryMode = GrantDeliveryMode.Cookie, + ResolvedSurrogate? credential = null, + SurrogateTransport deliveryMode = SurrogateTransport.Cookie, string cookieName = "uas") { var context = new DefaultHttpContext(); @@ -226,8 +218,8 @@ private static ( var options = new UAuthResourceApiOptions(); options.Auth.Mode = mode; - options.Auth.Session.DeliveryMode = deliveryMode; - options.Auth.Session.CookieName = cookieName; + options.Auth.SessionId.Mode = deliveryMode; + options.Auth.SessionId.CookieName = cookieName; var wrappedOptions = Options.Create(options); @@ -235,14 +227,13 @@ private static ( wrappedOptions, Mock.Of()); - var transport = new Mock( + var transport = new Mock( MockBehavior.Strict); transport .Setup(x => x.ResolveAsync( context, - mode, - It.IsAny())) + It.IsAny())) .ReturnsAsync(credential); var sut = new ResourceSessionIdResolver( @@ -253,9 +244,9 @@ private static ( return (sut, context, transport); } - private static TransportCredential CreateCredential(TransportCredentialKind kind, string value) + private static ResolvedSurrogate CreateCredential(SurrogateKind kind, string value) { - return new TransportCredential + return new ResolvedSurrogate { Kind = kind, Value = value, diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs index 7f5322b9..c4bfec07 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs @@ -21,15 +21,15 @@ public void Defaults_ShouldBeInitializedCorrectly() Assert.Null(options.Auth.Mode); Assert.Null(options.Auth.Jwt); - Assert.Equal(GrantDeliveryMode.Cookie, options.Auth.Session.DeliveryMode); + Assert.Equal(SurrogateTransport.Cookie, options.Auth.SessionId.Mode); - Assert.Equal("uas", options.Auth.Session.CookieName); + Assert.Equal("uas", options.Auth.SessionId.CookieName); - Assert.Equal(GrantDeliveryMode.Header, options.Auth.AccessToken.DeliveryMode); + Assert.Equal(SurrogateTransport.Header, options.Auth.AccessToken.Mode); Assert.Equal("uat", options.Auth.AccessToken.CookieName); Assert.Equal("Authorization", options.Auth.AccessToken.HeaderName); - Assert.Equal(HeaderTokenFormat.Bearer, options.Auth.AccessToken.HeaderFormat); + Assert.Equal(HeaderValueFormat.Bearer, options.Auth.AccessToken.HeaderFormat); Assert.Equal(DeviceMismatchBehavior.Reject, options.Auth.Device.MismatchBehavior); @@ -48,16 +48,16 @@ public void Clone_ShouldPreserveConfiguredValues() Assert.Equal(source.Auth.Mode, clone.Auth.Mode); Assert.Equal( - source.Auth.Session.DeliveryMode, - clone.Auth.Session.DeliveryMode); + source.Auth.SessionId.Mode, + clone.Auth.SessionId.Mode); Assert.Equal( - source.Auth.Session.CookieName, - clone.Auth.Session.CookieName); + source.Auth.SessionId.CookieName, + clone.Auth.SessionId.CookieName); Assert.Equal( - source.Auth.AccessToken.DeliveryMode, - clone.Auth.AccessToken.DeliveryMode); + source.Auth.AccessToken.Mode, + clone.Auth.AccessToken.Mode); Assert.Equal( source.Auth.AccessToken.CookieName, @@ -127,7 +127,7 @@ public void Clone_ShouldCreateIndependentNestedObjects() Assert.NotSame(source, clone); Assert.NotSame(source.Auth, clone.Auth); - Assert.NotSame(source.Auth.Session, clone.Auth.Session); + Assert.NotSame(source.Auth.SessionId, clone.Auth.SessionId); Assert.NotSame(source.Auth.AccessToken, clone.Auth.AccessToken); Assert.NotSame(source.Auth.Device, clone.Auth.Device); Assert.NotSame(source.Auth.Jwt, clone.Auth.Jwt); @@ -146,7 +146,7 @@ public void Clone_ModifyingClone_ShouldNotModifySource() var clone = source.Clone(); clone.Auth.Mode = UAuthMode.PureOpaque; - clone.Auth.Session.CookieName = "changed-session"; + clone.Auth.SessionId.CookieName = "changed-session"; clone.Auth.AccessToken.CookieName = "changed-access"; clone.Auth.AccessToken.HeaderName = "X-Changed"; clone.Auth.Device.MismatchBehavior = @@ -157,7 +157,7 @@ public void Clone_ModifyingClone_ShouldNotModifySource() clone.MultiTenant.HeaderName = "X-Other-Tenant"; Assert.Equal(UAuthMode.PureJwt, source.Auth.Mode); - Assert.Equal("session-custom", source.Auth.Session.CookieName); + Assert.Equal("session-custom", source.Auth.SessionId.CookieName); Assert.Equal("access-custom", source.Auth.AccessToken.CookieName); Assert.Equal("X-Access-Token", source.Auth.AccessToken.HeaderName); Assert.Equal( @@ -298,18 +298,18 @@ private static UAuthResourceApiOptions CreateConfiguredOptions() { Mode = UAuthMode.PureJwt, - Session = new UAuthResourceSessionOptions + SessionId = new UAuthResourceSurrogateTransportOptions { - DeliveryMode = GrantDeliveryMode.Cookie, + Mode = SurrogateTransport.Cookie, CookieName = "session-custom" }, - AccessToken = new UAuthResourceAccessTokenOptions + AccessToken = new UAuthResourceSurrogateTransportOptions { - DeliveryMode = GrantDeliveryMode.Cookie, + Mode = SurrogateTransport.Cookie, CookieName = "access-custom", HeaderName = "X-Access-Token", - HeaderFormat = HeaderTokenFormat.Bearer + HeaderFormat = HeaderValueFormat.Bearer }, Device = new UAuthResourceDeviceOptions diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs index e426d64c..f82fcef5 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs @@ -137,19 +137,17 @@ public void MissingRootSections_ShouldReportAllErrors() } [Theory] - [InlineData("Session", "Auth.Session must be configured.")] + [InlineData("Session", "Auth.SessionId must be configured.")] [InlineData("AccessToken", "Auth.AccessToken must be configured.")] [InlineData("Device", "Auth.Device must be configured.")] - public void MissingAuthSection_ShouldFail( - string section, - string expectedError) + public void MissingAuthSection_ShouldFail(string section, string expectedError) { var options = ValidOptions(); switch (section) { case "Session": - options.Auth.Session = null!; + options.Auth.SessionId = null!; break; case "AccessToken": options.Auth.AccessToken = null!; @@ -167,13 +165,13 @@ public void MissingAuthSections_ShouldReportAllErrors() { var options = ValidOptions(); - options.Auth.Session = null!; + options.Auth.SessionId = null!; options.Auth.AccessToken = null!; options.Auth.Device = null!; AssertErrors( options, - "Auth.Session must be configured.", + "Auth.SessionId must be configured.", "Auth.AccessToken must be configured.", "Auth.Device must be configured."); } @@ -182,11 +180,11 @@ public void MissingAuthSections_ShouldReportAllErrors() public void InvalidSessionDeliveryMode_ShouldFail() { var options = ValidOptions(); - options.Auth.Session.DeliveryMode = (GrantDeliveryMode)999; + options.Auth.SessionId.Mode = (SurrogateTransport)999; AssertInvalid( options, - "Auth.Session.DeliveryMode is invalid."); + "Auth.SessionId.Mode is invalid."); } [Theory] @@ -196,29 +194,29 @@ public void InvalidSessionDeliveryMode_ShouldFail() public void MissingSessionCookieName_ShouldFail(string? value) { var options = ValidOptions(); - options.Auth.Session.CookieName = value!; + options.Auth.SessionId.CookieName = value!; AssertInvalid( options, - "Auth.Session.CookieName is required."); + "Auth.SessionId.CookieName is required."); } [Fact] public void InvalidAccessTokenDeliveryMode_ShouldFail() { var options = ValidOptions(); - options.Auth.AccessToken.DeliveryMode = (GrantDeliveryMode)999; + options.Auth.AccessToken.Mode = (SurrogateTransport)999; AssertInvalid( options, - "Auth.AccessToken.DeliveryMode is invalid."); + "Auth.AccessToken.Mode is invalid."); } [Fact] public void InvalidAccessTokenHeaderFormat_ShouldFail() { var options = ValidOptions(); - options.Auth.AccessToken.HeaderFormat = (HeaderTokenFormat)999; + options.Auth.AccessToken.HeaderFormat = (HeaderValueFormat)999; AssertInvalid( options, @@ -500,7 +498,7 @@ public void MultipleInvalidFields_ShouldReportAllApplicableErrors() { var options = ValidOptions(UAuthMode.PureJwt); - options.Auth.Session.CookieName = ""; + options.Auth.SessionId.CookieName = ""; options.Auth.AccessToken.HeaderName = ""; options.Auth.Device.MismatchBehavior = DeviceMismatchBehavior.AllowAndRebind; @@ -514,7 +512,7 @@ public void MultipleInvalidFields_ShouldReportAllApplicableErrors() AssertErrors( options, - "Auth.Session.CookieName is required.", + "Auth.SessionId.CookieName is required.", "Auth.AccessToken.HeaderName is required.", "JWT authentication modes do not support device rebinding.", "Auth.Jwt.Issuer is required.", diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiRegistrationTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiRegistrationTests.cs index 1f679a85..c1ceb60b 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiRegistrationTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiRegistrationTests.cs @@ -67,11 +67,9 @@ public void AddUltimateAuthResourceApi_ShouldRegisterTransportCredentialResolver using var scope = provider.CreateScope(); - var resolver = - scope.ServiceProvider.GetRequiredService(); + var resolver = scope.ServiceProvider.GetRequiredService(); - resolver.Should() - .BeOfType(); + resolver.Should().BeOfType(); } [Fact] @@ -80,12 +78,9 @@ public void AddUltimateAuthResourceApi_ShouldRegisterDeviceContextFactory() using var provider = CreateProvider(); using var scope = provider.CreateScope(); + var factory = scope.ServiceProvider.GetRequiredService(); - var factory = - scope.ServiceProvider.GetRequiredService(); - - factory.Should() - .BeOfType(); + factory.Should().BeOfType(); } [Fact] diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfPolicyEvaluatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfPolicyEvaluatorTests.cs index ac0945c2..63dd1598 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfPolicyEvaluatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfPolicyEvaluatorTests.cs @@ -41,22 +41,22 @@ public void RequiresProtection_WhenOperationIsUnknown_ShouldFailClosed(bool uses } [Theory] - [InlineData(GrantKind.Session)] - [InlineData(GrantKind.AccessToken)] - [InlineData(GrantKind.RefreshToken)] + [InlineData(SurrogateKind.SessionId)] + [InlineData(SurrogateKind.AccessToken)] + [InlineData(SurrogateKind.RefreshToken)] public void RequiresProtection_WhenAnyGrantUsesCookie_ShouldReturnTrue( - GrantKind cookieGrant) + SurrogateKind cookieGrant) { var response = CreateResponse( - sessionMode: cookieGrant == GrantKind.Session - ? GrantDeliveryMode.Cookie - : GrantDeliveryMode.Header, - accessMode: cookieGrant == GrantKind.AccessToken - ? GrantDeliveryMode.Cookie - : GrantDeliveryMode.Header, - refreshMode: cookieGrant == GrantKind.RefreshToken - ? GrantDeliveryMode.Cookie - : GrantDeliveryMode.Header); + sessionMode: cookieGrant == SurrogateKind.SessionId + ? SurrogateTransport.Cookie + : SurrogateTransport.Header, + accessMode: cookieGrant == SurrogateKind.AccessToken + ? SurrogateTransport.Cookie + : SurrogateTransport.Header, + refreshMode: cookieGrant == SurrogateKind.RefreshToken + ? SurrogateTransport.Cookie + : SurrogateTransport.Header); var flow = AuthFlowTestFactory.New(response: response); @@ -76,9 +76,9 @@ public void RequiresProtection_WhenAllGrantsUseHeader_ShouldReturnFalse( UAuthCsrfOperation operation) { var response = CreateResponse( - GrantDeliveryMode.Header, - GrantDeliveryMode.Header, - GrantDeliveryMode.Header); + SurrogateTransport.Header, + SurrogateTransport.Header, + SurrogateTransport.Header); var flow = AuthFlowTestFactory.New(response: response); @@ -96,9 +96,9 @@ public void RequiresProtection_WhenAllGrantsAreDisabled_ShouldReturnFalse( UAuthCsrfOperation operation) { var response = CreateResponse( - GrantDeliveryMode.None, - GrantDeliveryMode.None, - GrantDeliveryMode.None); + SurrogateTransport.None, + SurrogateTransport.None, + SurrogateTransport.None); var flow = AuthFlowTestFactory.New(response: response); @@ -112,9 +112,9 @@ public void RequiresProtection_WhenAllGrantsAreDisabled_ShouldReturnFalse( public void RequiresProtection_WhenAccessTokenUsesHeaderAndRefreshUsesCookie_ShouldReturnTrue() { var response = CreateResponse( - GrantDeliveryMode.None, - GrantDeliveryMode.Header, - GrantDeliveryMode.Cookie); + SurrogateTransport.None, + SurrogateTransport.Header, + SurrogateTransport.Cookie); var flow = AuthFlowTestFactory.New(response: response); @@ -127,29 +127,29 @@ public void RequiresProtection_WhenAccessTokenUsesHeaderAndRefreshUsesCookie_Sho } private static EffectiveAuthResponse CreateResponse( - GrantDeliveryMode sessionMode, - GrantDeliveryMode accessMode, - GrantDeliveryMode refreshMode) + SurrogateTransport sessionMode, + SurrogateTransport accessMode, + SurrogateTransport refreshMode) { return new EffectiveAuthResponse( - CreateDelivery(GrantKind.Session, sessionMode, "uas"), - CreateDelivery(GrantKind.AccessToken, accessMode, "uat"), - CreateDelivery(GrantKind.RefreshToken, refreshMode, "uar"), + CreateDelivery(SurrogateKind.SessionId, sessionMode, "uas"), + CreateDelivery(SurrogateKind.AccessToken, accessMode, "uat"), + CreateDelivery(SurrogateKind.RefreshToken, refreshMode, "uar"), EffectiveRedirectResponse.Disabled); } - private static EffectiveGrantDelivery CreateDelivery( - GrantKind kind, - GrantDeliveryMode mode, + private static EffectiveSurrogateTransport CreateDelivery( + SurrogateKind kind, + SurrogateTransport mode, string name) { - return new EffectiveGrantDelivery( + return new EffectiveSurrogateTransport( kind, TokenFormat.Opaque, mode, name: name, - headerFormat: HeaderTokenFormat.Bearer, - cookie: mode == GrantDeliveryMode.Cookie + headerFormat: HeaderValueFormat.Bearer, + cookie: mode == SurrogateTransport.Cookie ? new UAuthCookieOptions { Name = name } : null); } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfGrantInspectorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfSurrogateInspectorTests.cs similarity index 55% rename from tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfGrantInspectorTests.cs rename to tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfSurrogateInspectorTests.cs index ca8534cd..d5100bb5 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfGrantInspectorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfSurrogateInspectorTests.cs @@ -7,19 +7,19 @@ namespace CodeBeam.UltimateAuth.Tests.Unit.Server; -public sealed class UAuthCsrfGrantInspectorTests +public sealed class UAuthCsrfSurrogateInspectorTests { - public static TheoryData DeliveryCombinations + public static TheoryData DeliveryCombinations { get { - var data = new TheoryData(); + var data = new TheoryData(); var modes = new[] { - GrantDeliveryMode.None, - GrantDeliveryMode.Header, - GrantDeliveryMode.Cookie + SurrogateTransport.None, + SurrogateTransport.Header, + SurrogateTransport.Cookie }; foreach (var session in modes) @@ -27,9 +27,9 @@ public static TheoryData _profileReader = new(MockBehavior.Strict); - private readonly Mock _primaryTokenResolver = new(MockBehavior.Strict); private readonly Mock _optionsProvider = new(MockBehavior.Strict); private readonly Mock _responseResolver = new(MockBehavior.Strict); private readonly Mock _deviceResolver = new(MockBehavior.Strict); @@ -106,10 +105,6 @@ public AuthFlowContextFactoryTests() .Setup(x => x.GetEffective(_http, Profile)) .Returns(_effective); - _primaryTokenResolver - .Setup(x => x.Resolve(UAuthMode.SemiHybrid)) - .Returns(PrimaryTokenKind.AccessToken); - _responseResolver .Setup(x => x.Resolve( UAuthMode.SemiHybrid, @@ -137,7 +132,6 @@ public AuthFlowContextFactoryTests() _sut = new AuthFlowContextFactory( _profileReader.Object, - _primaryTokenResolver.Object, _optionsProvider.Object, _responseResolver.Object, _deviceResolver.Object, @@ -220,7 +214,7 @@ private void SetupLineage( _lineageValidator .Setup(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, Ct)) .ReturnsAsync(result); } @@ -320,10 +314,6 @@ public async Task CreateAsync_SemiHybrid_Standard_ShouldAuthenticateWithoutSessi Assert.Equal(Tenant, result.Tenant); Assert.Equal(_deviceContext, result.Device); - Assert.Equal( - PrimaryTokenKind.AccessToken, - result.PrimaryTokenKind); - Assert.Same(_options, result.Options); Assert.Same(_response, result.Response); @@ -349,11 +339,11 @@ public async Task CreateAsync_SemiHybrid_HubValidated_ShouldCreateSessionContext _lineageValidator .Setup(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, Ct)) .Callback< SessionValidationContext, - SessionCredentialPurpose, + SessionIdPurpose, CancellationToken>( (context, _, _) => captured = context) .ReturnsAsync(CreateActiveLineage()); @@ -385,7 +375,7 @@ public async Task CreateAsync_SemiHybrid_HubValidated_ShouldCreateSessionContext _lineageValidator.Verify( x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, Ct), Times.Once); @@ -419,7 +409,7 @@ public async Task CreateAsync_SemiHybrid_InvalidLineage_ShouldRemainAnonymous( _lineageValidator.Verify( x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, Ct), Times.Once); @@ -466,7 +456,7 @@ public async Task CreateAsync_SemiHybrid_LineageBindingMismatch_ShouldRemainAnon _lineageValidator.Verify( x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, Ct), Times.Once); @@ -535,7 +525,7 @@ public async Task CreateAsync_SemiHybrid_RepeatedHubValidation_ShouldReuseLineag _lineageValidator.Verify( x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, Ct), Times.Once); @@ -575,7 +565,7 @@ public async Task CreateAsync_SemiHybrid_ShouldHonorEndpointClassification(UAuth _lineageValidator.Verify( x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, Ct), Times.Once); } @@ -615,7 +605,7 @@ public async Task CreateAsync_SemiHybrid_EndpointOverride_ShouldRequireHubValida _lineageValidator.Verify( x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, Ct), Times.Once); @@ -654,7 +644,7 @@ public async Task CreateAsync_SemiHybrid_MandatoryHubValidation_CannotBeDowngrad _lineageValidator.Verify( x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, Ct), Times.Once); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs index 13b4bc8c..91407970 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs @@ -24,8 +24,8 @@ public void Resolve_ShouldEnableExpectedGrants(UAuthMode mode, bool session, boo var result = sut.ResolveForAuthentication(mode, UAuthApplicationProfile.BlazorWasm, effective); - Assert.Equal(session, result.SessionIdDelivery.Mode != GrantDeliveryMode.None); - Assert.Equal(accessToken, result.AccessTokenDelivery.Mode != GrantDeliveryMode.None); - Assert.Equal(refreshToken, result.RefreshTokenDelivery.Mode != GrantDeliveryMode.None); + Assert.Equal(session, result.SessionIdTransport.Mode != SurrogateTransport.None); + Assert.Equal(accessToken, result.AccessTokenTransport.Mode != SurrogateTransport.None); + Assert.Equal(refreshToken, result.RefreshTokenTransport.Mode != SurrogateTransport.None); } } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CookieInfrastructureTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CookieInfrastructureTests.cs index 18e6024d..00fc1a31 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CookieInfrastructureTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CookieInfrastructureTests.cs @@ -25,15 +25,15 @@ public void Build_should_throw_when_cookie_options_are_missing() { var context = AuthFlowTestFactory.New(); - var delivery = new EffectiveGrantDelivery( - kind: GrantKind.Session, + var delivery = new EffectiveSurrogateTransport( + kind: SurrogateKind.SessionId, tokenFormat: TokenFormat.Opaque, - mode: GrantDeliveryMode.Cookie); + mode: SurrogateTransport.Cookie); var act = () => _builder.Build( delivery, context, - GrantKind.Session); + SurrogateKind.SessionId); act.Should() .Throw() @@ -55,7 +55,7 @@ public void Build_should_preserve_explicit_cookie_settings() cookie.SameSite = SameSiteMode.Strict; var options = Build( - GrantKind.Session, + SurrogateKind.SessionId, cookie); options.HttpOnly.Should().BeTrue(); @@ -72,7 +72,7 @@ public void Build_should_support_non_http_only_cookie_configuration() cookie.HttpOnly = false; var options = Build( - GrantKind.Session, + SurrogateKind.SessionId, cookie); options.HttpOnly.Should().BeFalse(); @@ -85,7 +85,7 @@ public void Build_should_disable_secure_when_policy_is_not_always() cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest; var options = Build( - GrantKind.Session, + SurrogateKind.SessionId, cookie); options.Secure.Should().BeFalse(); @@ -99,7 +99,7 @@ public void Build_should_preserve_host_only_cookie_configuration() cookie.Path = "/"; var options = Build( - GrantKind.Session, + SurrogateKind.SessionId, cookie); options.Domain.Should().BeNull(); @@ -134,9 +134,9 @@ public void Build_should_resolve_same_site_from_deployment_mode( context.Options.HubDeploymentMode = deploymentMode; var options = _builder.Build( - CreateResponse(GrantKind.Session, cookie), + CreateResponse(SurrogateKind.SessionId, cookie), context, - GrantKind.Session); + SurrogateKind.SessionId); options.SameSite.Should().Be(expected); } @@ -156,9 +156,9 @@ public void Explicit_same_site_should_override_deployment_mode( UAuthHubDeploymentMode.External; var options = _builder.Build( - CreateResponse(GrantKind.Session, cookie), + CreateResponse(SurrogateKind.SessionId, cookie), context, - GrantKind.Session); + SurrogateKind.SessionId); options.SameSite.Should().Be(explicitMode); } @@ -183,9 +183,9 @@ public void Explicit_max_age_should_override_all_other_lifetimes() TimeSpan.FromHours(4); var options = _builder.Build( - CreateResponse(GrantKind.Session, cookie), + CreateResponse(SurrogateKind.SessionId, cookie), context, - GrantKind.Session); + SurrogateKind.SessionId); options.MaxAge.Should().Be(TimeSpan.FromMinutes(35)); } @@ -206,9 +206,9 @@ public void Absolute_lifetime_override_should_take_precedence_over_grant_lifetim TimeSpan.FromHours(4); var options = _builder.Build( - CreateResponse(GrantKind.Session, cookie), + CreateResponse(SurrogateKind.SessionId, cookie), context, - GrantKind.Session); + SurrogateKind.SessionId); // Current implementation adds IdleBuffer even // when AbsoluteLifetimeOverride is specified. @@ -223,7 +223,7 @@ public void Null_idle_buffer_should_be_treated_as_zero() cookie.Lifetime.IdleBuffer = null; var options = Build( - GrantKind.Session, + SurrogateKind.SessionId, cookie); options.MaxAge.Should().Be(TimeSpan.FromMinutes(30)); @@ -237,7 +237,7 @@ public void Zero_idle_buffer_should_not_extend_lifetime() cookie.Lifetime.IdleBuffer = TimeSpan.Zero; var options = Build( - GrantKind.Session, + SurrogateKind.SessionId, cookie); options.MaxAge.Should().Be(TimeSpan.FromMinutes(30)); @@ -262,9 +262,9 @@ public void Pure_opaque_session_should_use_idle_timeout() TimeSpan.FromDays(7); var options = _builder.Build( - CreateResponse(GrantKind.Session, cookie), + CreateResponse(SurrogateKind.SessionId, cookie), context, - GrantKind.Session); + SurrogateKind.SessionId); options.MaxAge.Should().Be(TimeSpan.FromMinutes(25)); } @@ -284,9 +284,9 @@ public void Hybrid_session_should_use_refresh_lifetime_when_longer() TimeSpan.FromDays(7); var options = _builder.Build( - CreateResponse(GrantKind.Session, cookie), + CreateResponse(SurrogateKind.SessionId, cookie), context, - GrantKind.Session); + SurrogateKind.SessionId); options.MaxAge.Should().Be( TimeSpan.FromDays(7) + TimeSpan.FromMinutes(5)); @@ -307,9 +307,9 @@ public void Hybrid_session_should_use_idle_timeout_when_longer() TimeSpan.FromHours(2); var options = _builder.Build( - CreateResponse(GrantKind.Session, cookie), + CreateResponse(SurrogateKind.SessionId, cookie), context, - GrantKind.Session); + SurrogateKind.SessionId); options.MaxAge.Should().Be( TimeSpan.FromHours(12) + TimeSpan.FromMinutes(5)); @@ -330,9 +330,9 @@ public void Non_hybrid_session_should_use_idle_timeout() TimeSpan.FromDays(1); var options = _builder.Build( - CreateResponse(GrantKind.Session, cookie), + CreateResponse(SurrogateKind.SessionId, cookie), context, - GrantKind.Session); + SurrogateKind.SessionId); options.MaxAge.Should().Be(TimeSpan.FromMinutes(20)); } @@ -352,9 +352,9 @@ public void Access_token_cookie_should_use_access_token_lifetime() TimeSpan.FromMinutes(15); var options = _builder.Build( - CreateResponse(GrantKind.AccessToken, cookie), + CreateResponse(SurrogateKind.AccessToken, cookie), context, - GrantKind.AccessToken); + SurrogateKind.AccessToken); options.MaxAge.Should().Be(TimeSpan.FromMinutes(20)); } @@ -370,9 +370,9 @@ public void Refresh_token_cookie_should_use_refresh_token_lifetime() TimeSpan.FromDays(14); var options = _builder.Build( - CreateResponse(GrantKind.RefreshToken, cookie), + CreateResponse(SurrogateKind.RefreshToken, cookie), context, - GrantKind.RefreshToken); + SurrogateKind.RefreshToken); options.MaxAge.Should().Be( TimeSpan.FromDays(14) + TimeSpan.FromMinutes(5)); @@ -386,7 +386,7 @@ public void Unknown_grant_kind_without_override_should_not_set_max_age() cookie.Lifetime.AbsoluteLifetimeOverride = null; var options = Build( - (GrantKind)999, + (SurrogateKind)999, cookie); options.MaxAge.Should().BeNull(); @@ -399,7 +399,7 @@ public void Unknown_grant_kind_should_still_support_explicit_max_age() cookie.MaxAge = TimeSpan.FromMinutes(10); var options = Build( - (GrantKind)999, + (SurrogateKind)999, cookie); options.MaxAge.Should().Be(TimeSpan.FromMinutes(15)); @@ -611,15 +611,15 @@ public void Build_should_reject_non_cookie_delivery() { var context = AuthFlowTestFactory.New(); - var delivery = new EffectiveGrantDelivery( - kind: GrantKind.Session, + var delivery = new EffectiveSurrogateTransport( + kind: SurrogateKind.SessionId, tokenFormat: TokenFormat.Opaque, - mode: GrantDeliveryMode.Header); + mode: SurrogateTransport.Header); var act = () => _builder.Build( delivery, context, - GrantKind.Session); + SurrogateKind.SessionId); act.Should() .Throw() @@ -631,16 +631,16 @@ public void Build_should_reject_mismatched_grant_kind() { var context = AuthFlowTestFactory.New(); - var delivery = new EffectiveGrantDelivery( - kind: GrantKind.RefreshToken, + var delivery = new EffectiveSurrogateTransport( + kind: SurrogateKind.RefreshToken, tokenFormat: TokenFormat.Opaque, - mode: GrantDeliveryMode.Cookie, + mode: SurrogateTransport.Cookie, cookie: CreateCookie()); var act = () => _builder.Build( delivery, context, - GrantKind.Session); + SurrogateKind.SessionId); act.Should() .Throw() @@ -651,17 +651,11 @@ public void Build_should_reject_mismatched_grant_kind() // HELPERS // --------------------------------------------------------- - private CookieOptions Build( - GrantKind kind, - UAuthCookieOptions cookie, - UAuthMode mode = UAuthMode.PureOpaque) + private CookieOptions Build(SurrogateKind kind, UAuthCookieOptions cookie, UAuthMode mode = UAuthMode.PureOpaque) { var context = AuthFlowTestFactory.New(mode: mode); - return _builder.Build( - CreateResponse(kind, cookie), - context, - kind); + return _builder.Build(CreateResponse(kind, cookie), context, kind); } private static UAuthCookieOptions CreateCookie() @@ -681,12 +675,12 @@ private static UAuthCookieOptions CreateCookie() }; } - private static EffectiveGrantDelivery CreateResponse(GrantKind kind, UAuthCookieOptions cookie) + private static EffectiveSurrogateTransport CreateResponse(SurrogateKind kind, UAuthCookieOptions cookie) { - return new EffectiveGrantDelivery( + return new EffectiveSurrogateTransport( kind: kind, tokenFormat: TokenFormat.Opaque, - mode: GrantDeliveryMode.Cookie, + mode: SurrogateTransport.Cookie, cookie: cookie); } } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialInfrastructureTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialInfrastructureTests.cs index f119ce1b..526326bc 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialInfrastructureTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialInfrastructureTests.cs @@ -21,7 +21,7 @@ public void Header_builder_should_format_bearer_tokens( string expected) { var builder = new UAuthHeaderPolicyBuilder(); - var delivery = HeaderDelivery(HeaderTokenFormat.Bearer); + var delivery = HeaderDelivery(HeaderValueFormat.Bearer); builder.BuildHeaderValue(raw, delivery, null!) .Should().Be(expected); @@ -31,7 +31,7 @@ public void Header_builder_should_format_bearer_tokens( public void Header_builder_should_preserve_raw_tokens() { var builder = new UAuthHeaderPolicyBuilder(); - var delivery = HeaderDelivery(HeaderTokenFormat.Raw); + var delivery = HeaderDelivery(HeaderValueFormat.Raw); builder.BuildHeaderValue("raw-token", delivery, null!) .Should().Be("raw-token"); @@ -44,7 +44,7 @@ public void Header_builder_should_preserve_raw_tokens() public void Header_builder_should_reject_empty_values(string? value) { var builder = new UAuthHeaderPolicyBuilder(); - var delivery = HeaderDelivery(HeaderTokenFormat.Bearer); + var delivery = HeaderDelivery(HeaderValueFormat.Bearer); Action act = () => builder.BuildHeaderValue(value!, delivery, null!); @@ -59,7 +59,7 @@ public void Header_builder_should_reject_unsupported_format() { var builder = new UAuthHeaderPolicyBuilder(); - var delivery = HeaderDelivery((HeaderTokenFormat)999); + var delivery = HeaderDelivery((HeaderValueFormat)999); Action act = () => builder.BuildHeaderValue("token", delivery, null!); @@ -70,19 +70,19 @@ public void Header_builder_should_reject_unsupported_format() } [Theory] - [InlineData(GrantDeliveryMode.None)] - [InlineData(GrantDeliveryMode.Cookie)] - [InlineData(GrantDeliveryMode.Body)] + [InlineData(SurrogateTransport.None)] + [InlineData(SurrogateTransport.Cookie)] + [InlineData(SurrogateTransport.Body)] public void Header_builder_should_reject_non_header_delivery( - GrantDeliveryMode mode) + SurrogateTransport mode) { var builder = new UAuthHeaderPolicyBuilder(); - var delivery = new EffectiveGrantDelivery( - kind: GrantKind.AccessToken, + var delivery = new EffectiveSurrogateTransport( + kind: SurrogateKind.AccessToken, tokenFormat: TokenFormat.Jwt, mode: mode, - headerFormat: HeaderTokenFormat.Bearer); + headerFormat: HeaderValueFormat.Bearer); Action act = () => builder.BuildHeaderValue("token", delivery, null!); @@ -91,12 +91,12 @@ public void Header_builder_should_reject_non_header_delivery( .Throw(); } - private static EffectiveGrantDelivery HeaderDelivery(HeaderTokenFormat format) + private static EffectiveSurrogateTransport HeaderDelivery(HeaderValueFormat format) { - return new EffectiveGrantDelivery( - kind: GrantKind.AccessToken, + return new EffectiveSurrogateTransport( + kind: SurrogateKind.AccessToken, tokenFormat: TokenFormat.Jwt, - mode: GrantDeliveryMode.Header, + mode: SurrogateTransport.Header, name: "Authorization", headerFormat: format); } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs index c913b09a..64b177ad 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs @@ -165,11 +165,9 @@ public void PureOpaque_should_initialize_missing_optional_session_defaults() effective.Options.Session.MaxLifetime.Should().BeNull(); effective.Options.Session.DeviceMismatchBehavior.Should().Be(DeviceMismatchBehavior.Reject); - effective.Options.Cookie.Session.Lifetime.IdleBuffer - .Should().Be(TimeSpan.FromDays(2)); + effective.Options.Cookie.Session.Lifetime.IdleBuffer.Should().Be(TimeSpan.FromDays(2)); - effective.Options.GrantDelivery.RefreshToken.Mode - .Should().BeNull(); + effective.Options.Transport.RefreshToken.Mode.Should().BeNull(); } [Fact] @@ -215,14 +213,11 @@ public void Hybrid_should_apply_expected_defaults() options.Token.AccessTokenLifetime.Should().Be(TimeSpan.FromMinutes(10)); options.Token.RefreshTokenLifetime.Should().Be(TimeSpan.FromDays(7)); - options.Cookie.Session.Lifetime.IdleBuffer - .Should().Be(TimeSpan.FromMinutes(5)); + options.Cookie.Session.Lifetime.IdleBuffer.Should().Be(TimeSpan.FromMinutes(5)); - options.Cookie.RefreshToken.Lifetime.IdleBuffer - .Should().Be(TimeSpan.FromMinutes(5)); + options.Cookie.RefreshToken.Lifetime.IdleBuffer.Should().Be(TimeSpan.FromMinutes(5)); - options.GrantDelivery.RefreshToken.Mode - .Should().BeNull(); + options.Transport.RefreshToken.Mode.Should().BeNull(); } [Fact] diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantCredentialReaderTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantCredentialReaderTests.cs index 9a0ac369..2b1ea477 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantCredentialReaderTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantCredentialReaderTests.cs @@ -16,32 +16,32 @@ public sealed class GrantCredentialReaderTests private const string Token = "valid-token-value"; [Theory] - [InlineData(GrantKind.Session, "uas")] - [InlineData(GrantKind.AccessToken, "uat")] - [InlineData(GrantKind.RefreshToken, "uar")] - public void Read_WhenCookieIsConfigured_ShouldReadConfiguredCookie(GrantKind kind, string name) + [InlineData(SurrogateKind.SessionId, "uas")] + [InlineData(SurrogateKind.AccessToken, "uat")] + [InlineData(SurrogateKind.RefreshToken, "uar")] + public void Read_WhenCookieIsConfigured_ShouldReadConfiguredCookie(SurrogateKind kind, string name) { var context = new DefaultHttpContext(); context.Request.Headers.Cookie = $"{name}={Token}"; var delivery = CreateCookieDelivery(kind, name); - GrantCredentialReader.Read(context, delivery) + SurrogateReader.Read(context, delivery) .Should().Be(Token); } [Theory] - [InlineData(GrantKind.Session, "uas")] - [InlineData(GrantKind.AccessToken, "Authorization")] - [InlineData(GrantKind.RefreshToken, "uar")] - public void Read_WhenHeaderIsConfigured_ShouldReadConfiguredHeader(GrantKind kind, string name) + [InlineData(SurrogateKind.SessionId, "uas")] + [InlineData(SurrogateKind.AccessToken, "Authorization")] + [InlineData(SurrogateKind.RefreshToken, "uar")] + public void Read_WhenHeaderIsConfigured_ShouldReadConfiguredHeader(SurrogateKind kind, string name) { var context = new DefaultHttpContext(); context.Request.Headers[name] = $"Bearer {Token}"; var delivery = CreateHeaderDelivery(kind, name); - GrantCredentialReader.Read(context, delivery) + SurrogateReader.Read(context, delivery) .Should().Be(Token); } @@ -53,16 +53,16 @@ public void Read_ShouldUseRequestHeaderInsteadOfResponseHeader() context.Request.Headers["uat"] = "wrong-token"; context.Request.Headers.Authorization = $"Bearer {Token}"; - var delivery = new EffectiveGrantDelivery( - GrantKind.AccessToken, + var delivery = new EffectiveSurrogateTransport( + SurrogateKind.AccessToken, TokenFormat.Jwt, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: "uat", - headerFormat: HeaderTokenFormat.Raw, + headerFormat: HeaderValueFormat.Raw, requestHeaderName: "Authorization", - requestHeaderFormat: HeaderTokenFormat.Bearer); + requestHeaderFormat: HeaderValueFormat.Bearer); - GrantCredentialReader.Read(context, delivery) + SurrogateReader.Read(context, delivery) .Should().Be(Token); } @@ -72,16 +72,16 @@ public void Read_WhenRequestHeaderIsMissing_ShouldNotUseResponseHeader() var context = new DefaultHttpContext(); context.Request.Headers["uat"] = Token; - var delivery = new EffectiveGrantDelivery( - GrantKind.AccessToken, + var delivery = new EffectiveSurrogateTransport( + SurrogateKind.AccessToken, TokenFormat.Jwt, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: "uat", - headerFormat: HeaderTokenFormat.Raw, + headerFormat: HeaderValueFormat.Raw, requestHeaderName: "Authorization", - requestHeaderFormat: HeaderTokenFormat.Bearer); + requestHeaderFormat: HeaderValueFormat.Bearer); - GrantCredentialReader.Read(context, delivery) + SurrogateReader.Read(context, delivery) .Should().BeNull(); } @@ -94,9 +94,9 @@ public void Read_WhenCookieIsConfigured_ShouldIgnoreHeader() context.Request.Headers.Authorization = "Bearer wrong-token"; var delivery = CreateCookieDelivery( - GrantKind.Session, "uas"); + SurrogateKind.SessionId, "uas"); - GrantCredentialReader.Read(context, delivery) + SurrogateReader.Read(context, delivery) .Should().Be(Token); } @@ -109,9 +109,9 @@ public void Read_WhenHeaderIsConfigured_ShouldIgnoreCookie() context.Request.Headers.Authorization = $"Bearer {Token}"; var delivery = CreateHeaderDelivery( - GrantKind.Session, "Authorization"); + SurrogateKind.SessionId, "Authorization"); - GrantCredentialReader.Read(context, delivery) + SurrogateReader.Read(context, delivery) .Should().Be(Token); } @@ -124,9 +124,9 @@ public void Read_WhenCookieIsMissing_ShouldNotFallbackToHeader() context.Request.Headers["uas"] = Token; var delivery = CreateCookieDelivery( - GrantKind.Session, "uas"); + SurrogateKind.SessionId, "uas"); - GrantCredentialReader.Read(context, delivery) + SurrogateReader.Read(context, delivery) .Should().BeNull(); } @@ -137,9 +137,9 @@ public void Read_WhenHeaderIsMissing_ShouldNotFallbackToCookie() context.Request.Headers.Cookie = $"uas={Token}"; var delivery = CreateHeaderDelivery( - GrantKind.Session, "Authorization"); + SurrogateKind.SessionId, "Authorization"); - GrantCredentialReader.Read(context, delivery) + SurrogateReader.Read(context, delivery) .Should().BeNull(); } @@ -152,9 +152,9 @@ public void Read_WhenHeaderIsMalformed_ShouldNotFallbackToCookie() context.Request.Headers.Cookie = $"uas={Token}"; var delivery = CreateHeaderDelivery( - GrantKind.Session, "Authorization"); + SurrogateKind.SessionId, "Authorization"); - GrantCredentialReader.Read(context, delivery) + SurrogateReader.Read(context, delivery) .Should().BeNull(); } @@ -163,16 +163,15 @@ public void Read_WhenHeaderIsMalformed_ShouldNotFallbackToCookie() [InlineData("bearer valid-token-value")] [InlineData("BEARER valid-token-value")] [InlineData(" Bearer valid-token-value ")] - public void ReadHeader_WhenBearerIsValid_ShouldReturnToken( - string value) + public void ReadHeader_WhenBearerIsValid_ShouldReturnToken(string value) { var context = new DefaultHttpContext(); context.Request.Headers.Authorization = value; - GrantCredentialReader.ReadHeader( + SurrogateReader.ReadHeader( context, "Authorization", - HeaderTokenFormat.Bearer) + HeaderValueFormat.Bearer) .Should().Be(Token); } @@ -187,32 +186,30 @@ public void ReadHeader_WhenBearerIsValid_ShouldReturnToken( [InlineData("Bearer token\tvalue")] [InlineData("Bearer token,value")] [InlineData("Bearer token1, Bearer token2")] - public void ReadHeader_WhenBearerIsMalformed_ShouldReturnNull( - string value) + public void ReadHeader_WhenBearerIsMalformed_ShouldReturnNull(string value) { var context = new DefaultHttpContext(); context.Request.Headers.Authorization = value; - GrantCredentialReader.ReadHeader( + SurrogateReader.ReadHeader( context, "Authorization", - HeaderTokenFormat.Bearer) + HeaderValueFormat.Bearer) .Should().BeNull(); } [Theory] [InlineData("valid-token-value")] [InlineData(" valid-token-value ")] - public void ReadHeader_WhenRawIsConfigured_ShouldReturnToken( - string value) + public void ReadHeader_WhenRawIsConfigured_ShouldReturnToken(string value) { var context = new DefaultHttpContext(); context.Request.Headers["uat"] = value; - GrantCredentialReader.ReadHeader( + SurrogateReader.ReadHeader( context, "uat", - HeaderTokenFormat.Raw) + HeaderValueFormat.Raw) .Should().Be(Token); } @@ -229,10 +226,10 @@ public void ReadHeader_WhenRawIsMalformed_ShouldReturnNull( var context = new DefaultHttpContext(); context.Request.Headers["uat"] = value; - GrantCredentialReader.ReadHeader( + SurrogateReader.ReadHeader( context, "uat", - HeaderTokenFormat.Raw) + HeaderValueFormat.Raw) .Should().BeNull(); } @@ -249,10 +246,10 @@ public void ReadHeader_WhenMultipleValuesExist_ShouldReturnNull( context.Request.Headers.Authorization = new StringValues(new[] { first, second }); - GrantCredentialReader.ReadHeader( + SurrogateReader.ReadHeader( context, "Authorization", - HeaderTokenFormat.Bearer) + HeaderValueFormat.Bearer) .Should().BeNull(); } @@ -264,10 +261,10 @@ public void ReadHeader_WhenMultipleRawValuesExist_ShouldReturnNull() context.Request.Headers["uat"] = new StringValues(new[] { "token1", "token2" }); - GrantCredentialReader.ReadHeader( + SurrogateReader.ReadHeader( context, "uat", - HeaderTokenFormat.Raw) + HeaderValueFormat.Raw) .Should().BeNull(); } @@ -280,10 +277,10 @@ public void ReadHeader_WhenNameIsInvalid_ShouldReturnNull( { var context = new DefaultHttpContext(); - GrantCredentialReader.ReadHeader( + SurrogateReader.ReadHeader( context, name, - HeaderTokenFormat.Bearer) + HeaderValueFormat.Bearer) .Should().BeNull(); } @@ -293,10 +290,10 @@ public void ReadHeader_WhenFormatIsUnsupported_ShouldReturnNull() var context = new DefaultHttpContext(); context.Request.Headers.Authorization = $"Bearer {Token}"; - GrantCredentialReader.ReadHeader( + SurrogateReader.ReadHeader( context, "Authorization", - (HeaderTokenFormat)999) + (HeaderValueFormat)999) .Should().BeNull(); } @@ -306,7 +303,7 @@ public void ReadCookie_WhenCookieIsMissing_ShouldReturnNull() var context = new DefaultHttpContext(); context.Request.Headers.Cookie = "other-cookie=other-value"; - GrantCredentialReader.ReadCookie(context, "uas") + SurrogateReader.ReadCookie(context, "uas") .Should().BeNull(); } @@ -319,7 +316,7 @@ public void ReadCookie_WhenNameIsInvalid_ShouldReturnNull( { var context = new DefaultHttpContext(); - GrantCredentialReader.ReadCookie(context, name) + SurrogateReader.ReadCookie(context, name) .Should().BeNull(); } @@ -329,7 +326,7 @@ public void ReadCookie_WhenCookieIsEmpty_ShouldReturnNull() var context = new DefaultHttpContext(); context.Request.Headers.Cookie = "uas="; - GrantCredentialReader.ReadCookie(context, "uas") + SurrogateReader.ReadCookie(context, "uas") .Should().BeNull(); } @@ -341,16 +338,15 @@ public void ReadCookie_ShouldIgnoreUnrelatedCookies() context.Request.Headers.Cookie = $"other=other-value; uas={Token}; uar=refresh-token"; - GrantCredentialReader.ReadCookie(context, "uas") + SurrogateReader.ReadCookie(context, "uas") .Should().Be(Token); } [Theory] - [InlineData(GrantKind.Session)] - [InlineData(GrantKind.AccessToken)] - [InlineData(GrantKind.RefreshToken)] - public void Read_WhenDeliveryIsDisabled_ShouldReturnNull( - GrantKind kind) + [InlineData(SurrogateKind.SessionId)] + [InlineData(SurrogateKind.AccessToken)] + [InlineData(SurrogateKind.RefreshToken)] + public void Read_WhenDeliveryIsDisabled_ShouldReturnNull(SurrogateKind kind) { var context = new DefaultHttpContext(); @@ -359,9 +355,9 @@ public void Read_WhenDeliveryIsDisabled_ShouldReturnNull( context.Request.Headers.Authorization = $"Bearer {Token}"; - GrantCredentialReader.Read( + SurrogateReader.Read( context, - EffectiveGrantDelivery.Disabled(kind)) + EffectiveSurrogateTransport.Disabled(kind)) .Should().BeNull(); } @@ -373,14 +369,14 @@ public void Read_ShouldNeverResolveCredentialFromQueryString() context.Request.QueryString = new QueryString( $"?uas={Token}&sessionId={Token}&uat={Token}"); - GrantCredentialReader.Read( + SurrogateReader.Read( context, - CreateCookieDelivery(GrantKind.Session, "uas")) + CreateCookieDelivery(SurrogateKind.SessionId, "uas")) .Should().BeNull(); - GrantCredentialReader.Read( + SurrogateReader.Read( context, - CreateHeaderDelivery(GrantKind.Session, "uas")) + CreateHeaderDelivery(SurrogateKind.SessionId, "uas")) .Should().BeNull(); } @@ -391,13 +387,12 @@ public void Read_ShouldNeverResolveCredentialFromQueryString() [InlineData("uas=; uas=token2")] [InlineData("uas=token1; UAS=token2")] [InlineData("other=value; uas=token1; uas=token2")] - public void ReadCookie_WhenDuplicateCredentialsExist_ShouldReturnNull( - string cookieHeader) + public void ReadCookie_WhenDuplicateCredentialsExist_ShouldReturnNull(string cookieHeader) { var context = new DefaultHttpContext(); context.Request.Headers.Cookie = cookieHeader; - GrantCredentialReader.ReadCookie(context, "uas") + SurrogateReader.ReadCookie(context, "uas") .Should().BeNull(); } @@ -413,7 +408,7 @@ public void ReadCookie_WhenDuplicateCredentialsExistAcrossHeaders_ShouldReturnNu "uas=token2" }); - GrantCredentialReader.ReadCookie(context, "uas") + SurrogateReader.ReadCookie(context, "uas") .Should().BeNull(); } @@ -425,7 +420,7 @@ public void ReadCookie_WhenUnrelatedCookieIsDuplicated_ShouldResolveCredential() context.Request.Headers.Cookie = "other=value1; uas=valid-token; other=value2"; - GrantCredentialReader.ReadCookie(context, "uas") + SurrogateReader.ReadCookie(context, "uas") .Should().Be("valid-token"); } @@ -437,30 +432,30 @@ public void ReadCookie_WhenSimilarCookieNamesExist_ShouldResolveCredential() context.Request.Headers.Cookie = "uas=valid-token; uas-other=other-token"; - GrantCredentialReader.ReadCookie(context, "uas") + SurrogateReader.ReadCookie(context, "uas") .Should().Be("valid-token"); } - private static EffectiveGrantDelivery CreateCookieDelivery(GrantKind kind, string name) + private static EffectiveSurrogateTransport CreateCookieDelivery(SurrogateKind kind, string name) { - return new EffectiveGrantDelivery( + return new EffectiveSurrogateTransport( kind, TokenFormat.Opaque, - GrantDeliveryMode.Cookie, + SurrogateTransport.Cookie, cookie: new UAuthCookieOptions { Name = name }); } - private static EffectiveGrantDelivery CreateHeaderDelivery(GrantKind kind, string name) + private static EffectiveSurrogateTransport CreateHeaderDelivery(SurrogateKind kind, string name) { - return new EffectiveGrantDelivery( + return new EffectiveSurrogateTransport( kind, TokenFormat.Opaque, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: name, - headerFormat: HeaderTokenFormat.Bearer); + headerFormat: HeaderValueFormat.Bearer); } } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/JwtLogoutServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/JwtLogoutServiceTests.cs index 0f9e73b4..6bed1c72 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/JwtLogoutServiceTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/JwtLogoutServiceTests.cs @@ -117,7 +117,7 @@ private void SetupLineage(SessionValidationResult result) _lineageValidator .Setup(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, Ct)) .ReturnsAsync(result); } @@ -576,11 +576,11 @@ public async Task SemiHybrid_ShouldReturnSessionIssuerResult( _lineageValidator .Setup(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, Ct)) .Callback< SessionValidationContext, - SessionCredentialPurpose, + SessionIdPurpose, CancellationToken>( (context, _, _) => captured = context) .ReturnsAsync(lineage); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginEndpointHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginEndpointHandlerTests.cs index 7a26ae18..b9f3aefc 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginEndpointHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginEndpointHandlerTests.cs @@ -732,20 +732,20 @@ public async Task LoginAsync_WhenIdentifierResolvesToDifferentUser_DoesNotSuppre [InlineData(true)] public async Task LoginAsync_HeaderDeliveryWithoutFetch_ReturnsBadRequest(bool sessionHeader) { - var headerDelivery = new EffectiveGrantDelivery( - sessionHeader ? GrantKind.Session : GrantKind.AccessToken, + var headerDelivery = new EffectiveSurrogateTransport( + sessionHeader ? SurrogateKind.SessionId : SurrogateKind.AccessToken, sessionHeader ? TokenFormat.Opaque : TokenFormat.Jwt, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: sessionHeader ? "uas" : "uat"); var response = new EffectiveAuthResponse( sessionHeader ? headerDelivery - : EffectiveGrantDelivery.Disabled(GrantKind.Session), + : EffectiveSurrogateTransport.Disabled(SurrogateKind.SessionId), sessionHeader - ? EffectiveGrantDelivery.Disabled(GrantKind.AccessToken) + ? EffectiveSurrogateTransport.Disabled(SurrogateKind.AccessToken) : headerDelivery, - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), EffectiveRedirectResponse.Disabled); var fixture = CreateFixture( @@ -830,7 +830,7 @@ public async Task LoginAsync_SuccessfulFetch_ReturnsRedirectInBody() fixture.CredentialWriter.Setup(x => x.Write( fixture.HttpContext, - GrantKind.Session, + SurrogateKind.SessionId, sessionId)); fixture.RedirectResolver.Setup(x => x.ResolveSuccess( @@ -851,7 +851,7 @@ public async Task LoginAsync_SuccessfulFetch_ReturnsRedirectInBody() fixture.CredentialWriter.Verify(x => x.Write( fixture.HttpContext, - GrantKind.Session, + SurrogateKind.SessionId, sessionId), Times.Once); } @@ -867,7 +867,7 @@ private static Fixture CreateFixture(AuthFlowContext? flow = null) var internalFlow = new Mock(MockBehavior.Strict); - var credentialWriter = new Mock(MockBehavior.Strict); + var credentialWriter = new Mock(MockBehavior.Strict); var redirectResolver = new Mock(MockBehavior.Loose); @@ -968,7 +968,7 @@ private sealed record Fixture( LoginEndpointHandler Sut, AuthFlowContext Flow, Mock InternalFlow, - Mock CredentialWriter, + Mock CredentialWriter, Mock RedirectResolver, Mock AuthStore, Mock IdentifierResolver, diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LogoutEndpointHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LogoutEndpointHandlerTests.cs index cab1d97c..7b1009a0 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LogoutEndpointHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LogoutEndpointHandlerTests.cs @@ -813,7 +813,6 @@ private static AuthFlowContext CreateFlowWithSession( session: session, options: source.Options, response: source.Response, - primaryTokenKind: source.PrimaryTokenKind, returnUrlInfo: source.ReturnUrlInfo ); } @@ -833,7 +832,6 @@ private static AuthFlowContext CreateUnauthenticatedFlow() session: null, options: source.Options, response: source.Response, - primaryTokenKind: source.PrimaryTokenKind, returnUrlInfo: source.ReturnUrlInfo ); } @@ -876,7 +874,6 @@ private static AuthFlowContext CreatePureJwtFlow() session: null, options: source.Options, response: source.Response, - primaryTokenKind: source.PrimaryTokenKind, returnUrlInfo: source.ReturnUrlInfo); } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/PkceEndpointHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/PkceEndpointHandlerTests.cs index 6025cc6e..cb8e9f50 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/PkceEndpointHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/PkceEndpointHandlerTests.cs @@ -648,7 +648,7 @@ public async Task CompleteAsync_WhenSuccessfulAndRedirectDisabled_ReturnsOk() fixture.CredentialWriter .Setup(x => x.Write( fixture.HttpContext, - GrantKind.Session, + SurrogateKind.SessionId, sessionId)); fixture.RedirectResolver @@ -664,7 +664,7 @@ public async Task CompleteAsync_WhenSuccessfulAndRedirectDisabled_ReturnsOk() fixture.CredentialWriter.Verify(x => x.Write( fixture.HttpContext, - GrantKind.Session, + SurrogateKind.SessionId, sessionId), Times.Once); } @@ -692,7 +692,7 @@ public async Task CompleteAsync_WhenSuccessfulAndRedirectEnabled_ReturnsRedirect fixture.CredentialWriter .Setup(x => x.Write( fixture.HttpContext, - GrantKind.Session, + SurrogateKind.SessionId, sessionId)); fixture.RedirectResolver @@ -783,13 +783,13 @@ public async Task CompleteAsync_WhenDeviceLimitExceeded_PreservesHubFromForm() public async Task CompleteAsync_HeaderDeliveryWithoutFetch_ReturnsBadRequest() { var response = new EffectiveAuthResponse( - EffectiveGrantDelivery.Disabled(GrantKind.Session), - new EffectiveGrantDelivery( - GrantKind.AccessToken, + EffectiveSurrogateTransport.Disabled(SurrogateKind.SessionId), + new EffectiveSurrogateTransport( + SurrogateKind.AccessToken, TokenFormat.Jwt, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: "uat"), - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), EffectiveRedirectResponse.Disabled); var fixture = CreateFixture( @@ -882,7 +882,7 @@ public async Task CompleteAsync_SuccessfulFetch_ReturnsRedirectInBody() fixture.CredentialWriter.Setup(x => x.Write( fixture.HttpContext, - GrantKind.Session, + SurrogateKind.SessionId, sessionId)); fixture.RedirectResolver.Setup(x => x.ResolveSuccess( @@ -904,7 +904,7 @@ public async Task CompleteAsync_SuccessfulFetch_ReturnsRedirectInBody() fixture.CredentialWriter.Verify(x => x.Write( fixture.HttpContext, - GrantKind.Session, + SurrogateKind.SessionId, sessionId), Times.Once); } @@ -939,7 +939,7 @@ private static Fixture CreateFixture( new Mock(MockBehavior.Strict); var credentialWriter = - new Mock(MockBehavior.Strict); + new Mock(MockBehavior.Strict); var redirectResolver = new Mock(MockBehavior.Strict); @@ -1040,7 +1040,6 @@ private static AuthFlowContext CreateNonLoginFlow() session: source.Session, options: source.Options, response: source.Response, - primaryTokenKind: source.PrimaryTokenKind, returnUrlInfo: source.ReturnUrlInfo); } @@ -1051,7 +1050,7 @@ private sealed record Fixture( Mock InternalFlow, Mock AuthStore, Mock Validator, - Mock CredentialWriter, + Mock CredentialWriter, Mock RedirectResolver, DefaultHttpContext HttpContext); } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshFlowServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshFlowServiceTests.cs index 5a81fd48..cedb048b 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshFlowServiceTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshFlowServiceTests.cs @@ -521,11 +521,10 @@ private static AuthFlowContext CreateFlow(UAuthMode mode) session: null, options: effective.Options, response: new EffectiveAuthResponse( - sessionIdDelivery: EffectiveGrantDelivery.Disabled(GrantKind.Session), - accessTokenDelivery: EffectiveGrantDelivery.Disabled(GrantKind.AccessToken), - refreshTokenDelivery: EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + sessionIdTransport: EffectiveSurrogateTransport.Disabled(SurrogateKind.SessionId), + accessTokenTransport: EffectiveSurrogateTransport.Disabled(SurrogateKind.AccessToken), + refreshTokenTransport: EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), redirect: EffectiveRedirectResponse.Disabled), - primaryTokenKind: PrimaryTokenKind.AccessToken, returnUrlInfo: ReturnUrlInfo.None()); } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenResolverTests.cs index d835baff..471700f1 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenResolverTests.cs @@ -49,9 +49,9 @@ public void Resolve_WhenCookieIsConfigured_ShouldResolveRefreshCookie(UAuthMode } [Theory] - [InlineData(HeaderTokenFormat.Bearer, "Bearer valid-refresh-token")] - [InlineData(HeaderTokenFormat.Raw, "valid-refresh-token")] - public void Resolve_WhenHeaderIsConfigured_ShouldResolveRefreshHeader(HeaderTokenFormat format, string headerValue) + [InlineData(HeaderValueFormat.Bearer, "Bearer valid-refresh-token")] + [InlineData(HeaderValueFormat.Raw, "valid-refresh-token")] + public void Resolve_WhenHeaderIsConfigured_ShouldResolveRefreshHeader(HeaderValueFormat format, string headerValue) { var context = new DefaultHttpContext(); @@ -209,7 +209,7 @@ public void Resolve_WhenRefreshDeliveryIsDisabled_ShouldReturnNull() $"Bearer {RefreshToken}"; var sut = CreateSut( - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), UAuthMode.PureOpaque); sut.Resolve(context).Should().BeNull(); @@ -232,11 +232,11 @@ public void Resolve_ShouldNeverUseQueryString() .Should().BeNull(); } - private static RefreshTokenResolver CreateSut(EffectiveGrantDelivery refreshDelivery, UAuthMode mode = UAuthMode.Hybrid) + private static RefreshTokenResolver CreateSut(EffectiveSurrogateTransport refreshDelivery, UAuthMode mode = UAuthMode.Hybrid) { var response = new EffectiveAuthResponse( - EffectiveGrantDelivery.Disabled(GrantKind.Session), - EffectiveGrantDelivery.Disabled(GrantKind.AccessToken), + EffectiveSurrogateTransport.Disabled(SurrogateKind.SessionId), + EffectiveSurrogateTransport.Disabled(SurrogateKind.AccessToken), refreshDelivery, EffectiveRedirectResponse.Disabled); @@ -253,24 +253,24 @@ private static RefreshTokenResolver CreateSut(EffectiveGrantDelivery refreshDeli return new RefreshTokenResolver(accessor.Object); } - private static EffectiveGrantDelivery CreateCookieDelivery(string name = "uar") + private static EffectiveSurrogateTransport CreateCookieDelivery(string name = "uar") { - return new EffectiveGrantDelivery( - GrantKind.RefreshToken, + return new EffectiveSurrogateTransport( + SurrogateKind.RefreshToken, TokenFormat.Opaque, - GrantDeliveryMode.Cookie, + SurrogateTransport.Cookie, cookie: new UAuthCookieOptions { Name = name }); } - private static EffectiveGrantDelivery CreateHeaderDelivery(string name = "uar", HeaderTokenFormat format = HeaderTokenFormat.Bearer) + private static EffectiveSurrogateTransport CreateHeaderDelivery(string name = "uar", HeaderValueFormat format = HeaderValueFormat.Bearer) { - return new EffectiveGrantDelivery( - GrantKind.RefreshToken, + return new EffectiveSurrogateTransport( + SurrogateKind.RefreshToken, TokenFormat.Opaque, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: name, headerFormat: format); } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenRotationServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenRotationServiceTests.cs index cba42849..8edac14b 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenRotationServiceTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenRotationServiceTests.cs @@ -570,11 +570,10 @@ public Fixture(UAuthMode mode, TenantKey? tenant = null, bool multiTenant = fals session: null, options: options, response: new EffectiveAuthResponse( - sessionIdDelivery: EffectiveGrantDelivery.Disabled(GrantKind.Session), - accessTokenDelivery: EffectiveGrantDelivery.Disabled(GrantKind.AccessToken), - refreshTokenDelivery: EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + sessionIdTransport: EffectiveSurrogateTransport.Disabled(SurrogateKind.SessionId), + accessTokenTransport: EffectiveSurrogateTransport.Disabled(SurrogateKind.AccessToken), + refreshTokenTransport: EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), redirect: EffectiveRedirectResponse.Disabled), - primaryTokenKind: PrimaryTokenKind.AccessToken, returnUrlInfo: ReturnUrlInfo.None()); StoreFactory.Setup(x => x.Create(Tenant)).Returns(Store.Object); @@ -636,7 +635,7 @@ token.SessionId is AuthSessionId sessionId && It.Is(c => c.Tenant == Tenant && c.SessionId == sessionId), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, It.IsAny())) .ReturnsAsync(SessionValidationResult.Active( Tenant, diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SemiHybridAuthorityValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SemiHybridAuthorityValidatorTests.cs index ef5164f0..c95eb450 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SemiHybridAuthorityValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SemiHybridAuthorityValidatorTests.cs @@ -35,10 +35,10 @@ public async Task ValidateAsync_ValidPrincipal_ShouldValidateMetadataLineage() fixture.Lineage .Setup(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken)) .Callback((context, _, _) => { captured = context; @@ -59,7 +59,7 @@ public async Task ValidateAsync_ValidPrincipal_ShouldValidateMetadataLineage() fixture.Lineage.Verify(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken), Times.Once); fixture.Lineage.VerifyNoOtherCalls(); @@ -214,7 +214,7 @@ public async Task ValidateAsync_AllowPolicy_ShouldAcceptMissingOrDifferentDevice It.Is(c => c.Device == device && c.SessionOptions == fixture.Options), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken)) .ReturnsAsync(expected); @@ -228,7 +228,7 @@ public async Task ValidateAsync_AllowPolicy_ShouldAcceptMissingOrDifferentDevice fixture.Lineage.Verify(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken), Times.Once); } @@ -340,7 +340,7 @@ public async Task ValidateAsync_SameRequest_ShouldCacheResult( fixture.Lineage.Verify(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken), Times.Once); } @@ -360,7 +360,7 @@ await ValidateAsync(fixture with fixture.Lineage.Verify(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken), Times.Exactly(2)); } @@ -376,7 +376,7 @@ public async Task ValidateAsync_ConcurrentCalls_ShouldShareInFlightTask() fixture.Lineage .Setup(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken)) .Returns(completion.Task); @@ -391,7 +391,7 @@ public async Task ValidateAsync_ConcurrentCalls_ShouldShareInFlightTask() fixture.Lineage.Verify(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken), Times.Once); } @@ -458,7 +458,7 @@ private static void SetupLineage( fixture.Lineage .Setup(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken)) .ReturnsAsync(result); } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SessionEndpointHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SessionEndpointHandlerTests.cs index 1eea4a3d..59eb1f34 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SessionEndpointHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SessionEndpointHandlerTests.cs @@ -679,7 +679,6 @@ private static AuthFlowContext CreateUnauthenticatedFlow() session: null, options: authenticated.Options, response: authenticated.Response, - primaryTokenKind: authenticated.PrimaryTokenKind, returnUrlInfo: authenticated.ReturnUrlInfo); } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialResponseWriterTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SurrogateResponseWriterTests.cs similarity index 70% rename from tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialResponseWriterTests.cs rename to tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SurrogateResponseWriterTests.cs index 3f8f50d2..aa4fe84a 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialResponseWriterTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SurrogateResponseWriterTests.cs @@ -1,7 +1,6 @@ using AwesomeAssertions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; @@ -11,13 +10,13 @@ namespace CodeBeam.UltimateAuth.Tests.Unit; -public class CredentialResponseWriterTests +public class SurrogateResponseWriterTests { [Theory] - [InlineData(GrantKind.Session)] - [InlineData(GrantKind.AccessToken)] - [InlineData(GrantKind.RefreshToken)] - public void None_delivery_should_not_write_credentials(GrantKind kind) + [InlineData(SurrogateKind.SessionId)] + [InlineData(SurrogateKind.AccessToken)] + [InlineData(SurrogateKind.RefreshToken)] + public void None_delivery_should_not_write_credentials(SurrogateKind kind) { var setup = CreateWriter(CreateResponse()); var context = TestHttpContext.Create(); @@ -30,17 +29,17 @@ public void None_delivery_should_not_write_credentials(GrantKind kind) } [Theory] - [InlineData(GrantKind.Session)] - [InlineData(GrantKind.AccessToken)] - [InlineData(GrantKind.RefreshToken)] - public void Header_delivery_should_write_correct_grant(GrantKind kind) + [InlineData(SurrogateKind.SessionId)] + [InlineData(SurrogateKind.AccessToken)] + [InlineData(SurrogateKind.RefreshToken)] + public void Header_delivery_should_write_correct_grant(SurrogateKind kind) { - var delivery = new EffectiveGrantDelivery( + var delivery = new EffectiveSurrogateTransport( kind, TokenFormat.Opaque, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: "Authorization", - headerFormat: HeaderTokenFormat.Bearer); + headerFormat: HeaderValueFormat.Bearer); var setup = CreateWriter(CreateResponse(kind, delivery)); var context = TestHttpContext.Create(); @@ -57,21 +56,21 @@ public void Header_delivery_should_write_correct_grant(GrantKind kind) [Fact] public void Raw_header_delivery_should_not_add_bearer_prefix() { - var delivery = new EffectiveGrantDelivery( - GrantKind.AccessToken, + var delivery = new EffectiveSurrogateTransport( + SurrogateKind.AccessToken, TokenFormat.Jwt, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: "Authorization", - headerFormat: HeaderTokenFormat.Raw); + headerFormat: HeaderValueFormat.Raw); var setup = CreateWriter( - CreateResponse(GrantKind.AccessToken, delivery)); + CreateResponse(SurrogateKind.AccessToken, delivery)); var context = TestHttpContext.Create(); setup.Writer.WriteInternal( context, - GrantKind.AccessToken, + SurrogateKind.AccessToken, "raw-token"); context.Response.Headers.Authorization.ToString() @@ -81,21 +80,21 @@ public void Raw_header_delivery_should_not_add_bearer_prefix() [Fact] public void Header_delivery_should_support_custom_header_name() { - var delivery = new EffectiveGrantDelivery( - GrantKind.AccessToken, + var delivery = new EffectiveSurrogateTransport( + SurrogateKind.AccessToken, TokenFormat.Jwt, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: "X-UAuth-Token", - headerFormat: HeaderTokenFormat.Raw); + headerFormat: HeaderValueFormat.Raw); var setup = CreateWriter( - CreateResponse(GrantKind.AccessToken, delivery)); + CreateResponse(SurrogateKind.AccessToken, delivery)); var context = TestHttpContext.Create(); setup.Writer.WriteInternal( context, - GrantKind.AccessToken, + SurrogateKind.AccessToken, "custom-token"); context.Response.Headers["X-UAuth-Token"].ToString() @@ -108,22 +107,22 @@ public void Header_delivery_should_support_custom_header_name() [Fact] public void Header_delivery_should_replace_existing_header() { - var delivery = new EffectiveGrantDelivery( - GrantKind.AccessToken, + var delivery = new EffectiveSurrogateTransport( + SurrogateKind.AccessToken, TokenFormat.Jwt, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: "Authorization", - headerFormat: HeaderTokenFormat.Bearer); + headerFormat: HeaderValueFormat.Bearer); var setup = CreateWriter( - CreateResponse(GrantKind.AccessToken, delivery)); + CreateResponse(SurrogateKind.AccessToken, delivery)); var context = TestHttpContext.Create(); context.Response.Headers.Authorization = "Bearer old-token"; setup.Writer.WriteInternal( context, - GrantKind.AccessToken, + SurrogateKind.AccessToken, "new-token"); context.Response.Headers.Authorization.ToString() @@ -131,21 +130,20 @@ public void Header_delivery_should_replace_existing_header() } [Theory] - [InlineData(GrantKind.Session)] - [InlineData(GrantKind.AccessToken)] - [InlineData(GrantKind.RefreshToken)] - public void Cookie_delivery_should_write_correct_credential( - GrantKind kind) + [InlineData(SurrogateKind.SessionId)] + [InlineData(SurrogateKind.AccessToken)] + [InlineData(SurrogateKind.RefreshToken)] + public void Cookie_delivery_should_write_correct_credential(SurrogateKind kind) { var cookie = new UAuthCookieOptions { Name = "uauth-credential" }; - var delivery = new EffectiveGrantDelivery( + var delivery = new EffectiveSurrogateTransport( kind, TokenFormat.Opaque, - GrantDeliveryMode.Cookie, + SurrogateTransport.Cookie, cookie: cookie); var setup = CreateWriter(CreateResponse(kind, delivery)); @@ -168,16 +166,15 @@ public void Cookie_delivery_should_write_correct_credential( } [Theory] - [InlineData(GrantKind.Session)] - [InlineData(GrantKind.AccessToken)] - [InlineData(GrantKind.RefreshToken)] - public void Cookie_delivery_without_options_should_throw( - GrantKind kind) + [InlineData(SurrogateKind.SessionId)] + [InlineData(SurrogateKind.AccessToken)] + [InlineData(SurrogateKind.RefreshToken)] + public void Cookie_delivery_without_options_should_throw(SurrogateKind kind) { - var delivery = new EffectiveGrantDelivery( + var delivery = new EffectiveSurrogateTransport( kind, TokenFormat.Opaque, - GrantDeliveryMode.Cookie); + SurrogateTransport.Cookie); var setup = CreateWriter(CreateResponse(kind, delivery)); var context = TestHttpContext.Create(); @@ -194,16 +191,15 @@ public void Cookie_delivery_without_options_should_throw( } [Theory] - [InlineData(GrantKind.Session)] - [InlineData(GrantKind.AccessToken)] - [InlineData(GrantKind.RefreshToken)] - public void Body_delivery_should_throw_not_supported( - GrantKind kind) + [InlineData(SurrogateKind.SessionId)] + [InlineData(SurrogateKind.AccessToken)] + [InlineData(SurrogateKind.RefreshToken)] + public void Body_delivery_should_throw_not_supported(SurrogateKind kind) { - var delivery = new EffectiveGrantDelivery( + var delivery = new EffectiveSurrogateTransport( kind, TokenFormat.Opaque, - GrantDeliveryMode.Body); + SurrogateTransport.Body); var setup = CreateWriter(CreateResponse(kind, delivery)); var context = TestHttpContext.Create(); @@ -227,7 +223,7 @@ public void Unsupported_grant_kind_should_throw() Action act = () => setup.Writer.WriteInternal( context, - (GrantKind)999, + (SurrogateKind)999, "token"); act.Should() @@ -238,22 +234,22 @@ public void Unsupported_grant_kind_should_throw() [Fact] public void Header_policy_failure_should_propagate() { - var delivery = new EffectiveGrantDelivery( - GrantKind.AccessToken, + var delivery = new EffectiveSurrogateTransport( + SurrogateKind.AccessToken, TokenFormat.Jwt, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: "Authorization", - headerFormat: (HeaderTokenFormat)999); + headerFormat: (HeaderValueFormat)999); var setup = CreateWriter( - CreateResponse(GrantKind.AccessToken, delivery)); + CreateResponse(SurrogateKind.AccessToken, delivery)); var context = TestHttpContext.Create(); Action act = () => setup.Writer.WriteInternal( context, - GrantKind.AccessToken, + SurrogateKind.AccessToken, "token"); act.Should() @@ -267,21 +263,21 @@ public void Header_policy_failure_should_propagate() [Fact] public void Mismatched_grant_kind_should_throw() { - var delivery = new EffectiveGrantDelivery( - GrantKind.RefreshToken, + var delivery = new EffectiveSurrogateTransport( + SurrogateKind.RefreshToken, TokenFormat.Opaque, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: "Authorization"); var setup = CreateWriter( - CreateResponse(GrantKind.AccessToken, delivery)); + CreateResponse(SurrogateKind.AccessToken, delivery)); var context = TestHttpContext.Create(); Action act = () => setup.Writer.WriteInternal( context, - GrantKind.AccessToken, + SurrogateKind.AccessToken, "token"); act.Should() @@ -295,20 +291,20 @@ public void Mismatched_grant_kind_should_throw() [Fact] public void Unsupported_delivery_mode_should_throw() { - var delivery = new EffectiveGrantDelivery( - GrantKind.AccessToken, + var delivery = new EffectiveSurrogateTransport( + SurrogateKind.AccessToken, TokenFormat.Jwt, - (GrantDeliveryMode)999); + (SurrogateTransport)999); var setup = CreateWriter( - CreateResponse(GrantKind.AccessToken, delivery)); + CreateResponse(SurrogateKind.AccessToken, delivery)); var context = TestHttpContext.Create(); Action act = () => setup.Writer.WriteInternal( context, - GrantKind.AccessToken, + SurrogateKind.AccessToken, "token"); act.Should() @@ -326,7 +322,7 @@ private static WriterSetup CreateWriter(EffectiveAuthResponse response) var cookieManager = new FakeCookieManager(); var cookiePolicy = new FakeCookiePolicyBuilder(); - var writer = new CredentialResponseWriter( + var writer = new SurrogateResponseWriter( accessor, cookieManager, cookiePolicy, @@ -339,25 +335,23 @@ private static WriterSetup CreateWriter(EffectiveAuthResponse response) cookiePolicy); } - private static EffectiveAuthResponse CreateResponse( - GrantKind? kind = null, - EffectiveGrantDelivery? delivery = null) + private static EffectiveAuthResponse CreateResponse(SurrogateKind? kind = null, EffectiveSurrogateTransport? delivery = null) { - var session = EffectiveGrantDelivery.Disabled(GrantKind.Session); - var access = EffectiveGrantDelivery.Disabled(GrantKind.AccessToken); - var refresh = EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken); + var session = EffectiveSurrogateTransport.Disabled(SurrogateKind.SessionId); + var access = EffectiveSurrogateTransport.Disabled(SurrogateKind.AccessToken); + var refresh = EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken); switch (kind) { - case GrantKind.Session: + case SurrogateKind.SessionId: session = delivery!; break; - case GrantKind.AccessToken: + case SurrogateKind.AccessToken: access = delivery!; break; - case GrantKind.RefreshToken: + case SurrogateKind.RefreshToken: refresh = delivery!; break; } @@ -370,7 +364,7 @@ private static EffectiveAuthResponse CreateResponse( } private sealed record WriterSetup( - CredentialResponseWriter Writer, + SurrogateResponseWriter Writer, AuthFlowContext Auth, FakeCookieManager CookieManager, FakeCookiePolicyBuilder CookiePolicy); @@ -421,12 +415,11 @@ public void Delete(HttpContext context, string name) } } - private sealed class FakeCookiePolicyBuilder - : IUAuthCookiePolicyBuilder + private sealed class FakeCookiePolicyBuilder : IUAuthCookiePolicyBuilder { public int BuildCount { get; private set; } - public GrantKind? LastKind { get; private set; } - public EffectiveGrantDelivery? LastDelivery { get; private set; } + public SurrogateKind? LastKind { get; private set; } + public EffectiveSurrogateTransport? LastDelivery { get; private set; } public AuthFlowContext? LastAuth { get; private set; } public CookieOptions CookieOptions { get; } = new() @@ -436,10 +429,7 @@ private sealed class FakeCookiePolicyBuilder SameSite = SameSiteMode.Strict }; - public CookieOptions Build( - EffectiveGrantDelivery delivery, - AuthFlowContext context, - GrantKind kind) + public CookieOptions Build(EffectiveSurrogateTransport delivery, AuthFlowContext context, SurrogateKind kind) { BuildCount++; LastDelivery = delivery; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantDeliveryCollisionValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SurrogateTransportCollisionValidatorTests.cs similarity index 54% rename from tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantDeliveryCollisionValidatorTests.cs rename to tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SurrogateTransportCollisionValidatorTests.cs index 2a4042c5..92f3e0a4 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantDeliveryCollisionValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SurrogateTransportCollisionValidatorTests.cs @@ -1,25 +1,24 @@ using AwesomeAssertions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Options; namespace CodeBeam.UltimateAuth.Tests.Unit.Server; -public sealed class GrantDeliveryCollisionValidatorTests +public sealed class SurrogateTransportCollisionValidatorTests { [Fact] public void Validate_WhenGrantNamesAreDistinct_ShouldPass() { var response = CreateResponse( - Cookie(GrantKind.Session, "uas"), - Header(GrantKind.AccessToken, "uat", "Authorization"), - Cookie(GrantKind.RefreshToken, "uar")); + Cookie(SurrogateKind.SessionId, "uas"), + Header(SurrogateKind.AccessToken, "uat", "Authorization"), + Cookie(SurrogateKind.RefreshToken, "uar")); Action act = () => - GrantDeliveryCollisionValidator.Validate(response); + SurrogateTransportCollisionValidator.Validate(response); act.Should().NotThrow(); } @@ -32,12 +31,12 @@ public void Validate_WhenCookieNamesCollide_ShouldThrow( string refreshName) { var response = CreateResponse( - Cookie(GrantKind.Session, sessionName), - Header(GrantKind.AccessToken, "uat", "Authorization"), - Cookie(GrantKind.RefreshToken, refreshName)); + Cookie(SurrogateKind.SessionId, sessionName), + Header(SurrogateKind.AccessToken, "uat", "Authorization"), + Cookie(SurrogateKind.RefreshToken, refreshName)); Action act = () => - GrantDeliveryCollisionValidator.Validate(response); + SurrogateTransportCollisionValidator.Validate(response); act.Should() .Throw() @@ -52,12 +51,12 @@ public void Validate_WhenResponseHeaderNamesCollide_ShouldThrow( string accessName) { var response = CreateResponse( - Header(GrantKind.Session, sessionName, "uas"), - Header(GrantKind.AccessToken, accessName, "Authorization"), - Cookie(GrantKind.RefreshToken, "uar")); + Header(SurrogateKind.SessionId, sessionName, "uas"), + Header(SurrogateKind.AccessToken, accessName, "Authorization"), + Cookie(SurrogateKind.RefreshToken, "uar")); Action act = () => - GrantDeliveryCollisionValidator.Validate(response); + SurrogateTransportCollisionValidator.Validate(response); act.Should() .Throw() @@ -72,12 +71,12 @@ public void Validate_WhenRequestHeaderNamesCollide_ShouldThrow( string accessName) { var response = CreateResponse( - Header(GrantKind.Session, "uas", sessionName), - Header(GrantKind.AccessToken, "uat", accessName), - Cookie(GrantKind.RefreshToken, "uar")); + Header(SurrogateKind.SessionId, "uas", sessionName), + Header(SurrogateKind.AccessToken, "uat", accessName), + Cookie(SurrogateKind.RefreshToken, "uar")); Action act = () => - GrantDeliveryCollisionValidator.Validate(response); + SurrogateTransportCollisionValidator.Validate(response); act.Should() .Throw() @@ -88,12 +87,12 @@ public void Validate_WhenRequestHeaderNamesCollide_ShouldThrow( public void Validate_WhenCookieAndHeaderShareName_ShouldPass() { var response = CreateResponse( - Cookie(GrantKind.Session, "token"), - Header(GrantKind.AccessToken, "token", "token"), - Cookie(GrantKind.RefreshToken, "uar")); + Cookie(SurrogateKind.SessionId, "token"), + Header(SurrogateKind.AccessToken, "token", "token"), + Cookie(SurrogateKind.RefreshToken, "uar")); Action act = () => - GrantDeliveryCollisionValidator.Validate(response); + SurrogateTransportCollisionValidator.Validate(response); act.Should().NotThrow(); } @@ -102,12 +101,12 @@ public void Validate_WhenCookieAndHeaderShareName_ShouldPass() public void Validate_WhenRequestAndResponseHeadersShareName_ShouldPass() { var response = CreateResponse( - Header(GrantKind.Session, "uas", "uat"), - Header(GrantKind.AccessToken, "uat", "Authorization"), - Cookie(GrantKind.RefreshToken, "uar")); + Header(SurrogateKind.SessionId, "uas", "uat"), + Header(SurrogateKind.AccessToken, "uat", "Authorization"), + Cookie(SurrogateKind.RefreshToken, "uar")); Action act = () => - GrantDeliveryCollisionValidator.Validate(response); + SurrogateTransportCollisionValidator.Validate(response); act.Should().NotThrow(); } @@ -116,12 +115,12 @@ public void Validate_WhenRequestAndResponseHeadersShareName_ShouldPass() public void Validate_ShouldIgnoreDisabledGrants() { var response = CreateResponse( - EffectiveGrantDelivery.Disabled(GrantKind.Session), - Header(GrantKind.AccessToken, "uat", "Authorization"), - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken)); + EffectiveSurrogateTransport.Disabled(SurrogateKind.SessionId), + Header(SurrogateKind.AccessToken, "uat", "Authorization"), + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken)); Action act = () => - GrantDeliveryCollisionValidator.Validate(response); + SurrogateTransportCollisionValidator.Validate(response); act.Should().NotThrow(); } @@ -134,12 +133,12 @@ public void Validate_WhenHeaderNameIsMissing_ShouldThrow( string? name) { var response = CreateResponse( - Header(GrantKind.Session, name, "uas"), - EffectiveGrantDelivery.Disabled(GrantKind.AccessToken), - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken)); + Header(SurrogateKind.SessionId, name, "uas"), + EffectiveSurrogateTransport.Disabled(SurrogateKind.AccessToken), + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken)); Action act = () => - GrantDeliveryCollisionValidator.Validate(response); + SurrogateTransportCollisionValidator.Validate(response); act.Should() .Throw() @@ -147,9 +146,9 @@ public void Validate_WhenHeaderNameIsMissing_ShouldThrow( } private static EffectiveAuthResponse CreateResponse( - EffectiveGrantDelivery session, - EffectiveGrantDelivery access, - EffectiveGrantDelivery refresh) + EffectiveSurrogateTransport session, + EffectiveSurrogateTransport access, + EffectiveSurrogateTransport refresh) { return new EffectiveAuthResponse( session, @@ -158,32 +157,32 @@ private static EffectiveAuthResponse CreateResponse( EffectiveRedirectResponse.Disabled); } - private static EffectiveGrantDelivery Cookie( - GrantKind kind, + private static EffectiveSurrogateTransport Cookie( + SurrogateKind kind, string name) { - return new EffectiveGrantDelivery( + return new EffectiveSurrogateTransport( kind, TokenFormat.Opaque, - GrantDeliveryMode.Cookie, + SurrogateTransport.Cookie, cookie: new UAuthCookieOptions { Name = name }); } - private static EffectiveGrantDelivery Header( - GrantKind kind, + private static EffectiveSurrogateTransport Header( + SurrogateKind kind, string? responseName, string? requestName) { - return new EffectiveGrantDelivery( + return new EffectiveSurrogateTransport( kind, TokenFormat.Opaque, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: responseName, - headerFormat: HeaderTokenFormat.Bearer, + headerFormat: HeaderValueFormat.Bearer, requestHeaderName: requestName, - requestHeaderFormat: HeaderTokenFormat.Bearer); + requestHeaderFormat: HeaderValueFormat.Bearer); } } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs index 92fcf438..043b1582 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs @@ -3,10 +3,10 @@ using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Domain; +using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; @@ -23,13 +23,13 @@ public sealed class TransportCredentialResolverTests private const string RefreshToken = "refresh-token-value"; [Theory] - [InlineData(UAuthMode.PureOpaque, TransportCredentialKind.Session, SessionToken)] - [InlineData(UAuthMode.Hybrid, TransportCredentialKind.Session, SessionToken)] - [InlineData(UAuthMode.SemiHybrid, TransportCredentialKind.AccessToken, AccessToken)] - [InlineData(UAuthMode.PureJwt, TransportCredentialKind.AccessToken, AccessToken)] + [InlineData(UAuthMode.PureOpaque, SurrogateKind.SessionId, SessionToken)] + [InlineData(UAuthMode.Hybrid, SurrogateKind.SessionId, SessionToken)] + [InlineData(UAuthMode.SemiHybrid, SurrogateKind.AccessToken, AccessToken)] + [InlineData(UAuthMode.PureJwt, SurrogateKind.AccessToken, AccessToken)] public async Task ResolveAsync_ShouldSelectPrimaryCredentialAccordingToMode( UAuthMode mode, - TransportCredentialKind expectedKind, + SurrogateKind expectedKind, string expectedValue) { var context = CreateContext(); @@ -55,7 +55,7 @@ public async Task ResolveAsync_ShouldSelectPrimaryCredentialAccordingToMode( var sut = CreateSut(); - var result = await sut.ResolveAsync( + var result = await sut.ResolvePrimaryAsync( context, mode, CreateResponse()); @@ -84,7 +84,7 @@ public async Task ResolveAsync_WhenSessionIsMissing_ShouldNotFallbackToAccessTok var sut = CreateSut(); - var result = await sut.ResolveAsync( + var result = await sut.ResolvePrimaryAsync( context, mode, CreateResponse()); @@ -105,7 +105,7 @@ public async Task ResolveAsync_WhenAccessTokenIsMissing_ShouldNotFallbackToSessi var sut = CreateSut(); - var result = await sut.ResolveAsync( + var result = await sut.ResolvePrimaryAsync( context, mode, CreateResponse()); @@ -128,7 +128,7 @@ public async Task ResolveAsync_ShouldNeverUseRefreshTokenAsPrimaryCredential( var sut = CreateSut(); - var result = await sut.ResolveAsync( + var result = await sut.ResolvePrimaryAsync( context, mode, CreateResponse()); @@ -153,14 +153,14 @@ public async Task ResolveAsync_WhenPrimaryDeliveryIsDisabled_ShouldReturnNull( $"Bearer {AccessToken}"; var response = new EffectiveAuthResponse( - EffectiveGrantDelivery.Disabled(GrantKind.Session), - EffectiveGrantDelivery.Disabled(GrantKind.AccessToken), - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + EffectiveSurrogateTransport.Disabled(SurrogateKind.SessionId), + EffectiveSurrogateTransport.Disabled(SurrogateKind.AccessToken), + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), EffectiveRedirectResponse.Disabled); var sut = CreateSut(); - var result = await sut.ResolveAsync( + var result = await sut.ResolvePrimaryAsync( context, mode, response); @@ -184,7 +184,7 @@ public async Task ResolveAsync_WhenAccessTokenIsMalformed_ShouldNotFallbackToSes var sut = CreateSut(); - var result = await sut.ResolveAsync( + var result = await sut.ResolvePrimaryAsync( context, mode, CreateResponse()); @@ -214,25 +214,25 @@ public async Task ResolveAsync_WhenSessionUsesHeader_ShouldResolveConfiguredHead context.Request.Headers.Cookie = "uas=wrong-token"; var response = new EffectiveAuthResponse( - new EffectiveGrantDelivery( - GrantKind.Session, + new EffectiveSurrogateTransport( + SurrogateKind.SessionId, TokenFormat.Opaque, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: "X-Session", - headerFormat: HeaderTokenFormat.Raw), - EffectiveGrantDelivery.Disabled(GrantKind.AccessToken), - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + headerFormat: HeaderValueFormat.Raw), + EffectiveSurrogateTransport.Disabled(SurrogateKind.AccessToken), + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), EffectiveRedirectResponse.Disabled); var sut = CreateSut(); - var result = await sut.ResolveAsync( + var result = await sut.ResolvePrimaryAsync( context, UAuthMode.PureOpaque, response); result.Should().NotBeNull(); - result!.Kind.Should().Be(TransportCredentialKind.Session); + result!.Kind.Should().Be(SurrogateKind.SessionId); result.Value.Should().Be(SessionToken); } @@ -261,51 +261,33 @@ public async Task ResolveAsync_WhenAccessTokenUsesCookie_ShouldResolveConfigured "Bearer wrong-token"; var response = new EffectiveAuthResponse( - EffectiveGrantDelivery.Disabled(GrantKind.Session), - new EffectiveGrantDelivery( - GrantKind.AccessToken, + EffectiveSurrogateTransport.Disabled(SurrogateKind.SessionId), + new EffectiveSurrogateTransport( + SurrogateKind.AccessToken, TokenFormat.Jwt, - GrantDeliveryMode.Cookie, + SurrogateTransport.Cookie, cookie: new UAuthCookieOptions { Name = "uat" }), - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), EffectiveRedirectResponse.Disabled); var sut = CreateSut(); - var result = await sut.ResolveAsync( + var result = await sut.ResolvePrimaryAsync( context, UAuthMode.PureJwt, response); result.Should().NotBeNull(); - result!.Kind.Should().Be(TransportCredentialKind.AccessToken); + result!.Kind.Should().Be(SurrogateKind.AccessToken); result.Value.Should().Be(AccessToken); } - [Fact] - public async Task ResolveAsync_WhenModeIsUnsupported_ShouldThrow() - { - var context = CreateContext(); - var sut = CreateSut(); - - Func act = async () => - { - await sut.ResolveAsync( - context, - (UAuthMode)999, - CreateResponse()); - }; - - await act.Should().ThrowAsync(); - } - - private static TransportCredentialResolver CreateSut() + private static SurrogateResolver CreateSut() { - return new TransportCredentialResolver( - new PrimaryTokenResolver()); + return new SurrogateResolver(); } private static DefaultHttpContext CreateContext() @@ -321,26 +303,26 @@ private static DefaultHttpContext CreateContext() private static EffectiveAuthResponse CreateResponse() { return new EffectiveAuthResponse( - new EffectiveGrantDelivery( - GrantKind.Session, + new EffectiveSurrogateTransport( + SurrogateKind.SessionId, TokenFormat.Opaque, - GrantDeliveryMode.Cookie, + SurrogateTransport.Cookie, cookie: new UAuthCookieOptions { Name = "uas" }), - new EffectiveGrantDelivery( - GrantKind.AccessToken, + new EffectiveSurrogateTransport( + SurrogateKind.AccessToken, TokenFormat.Jwt, - GrantDeliveryMode.Header, + SurrogateTransport.Header, name: "uat", - headerFormat: HeaderTokenFormat.Raw, + headerFormat: HeaderValueFormat.Raw, requestHeaderName: "Authorization", - requestHeaderFormat: HeaderTokenFormat.Bearer), - new EffectiveGrantDelivery( - GrantKind.RefreshToken, + requestHeaderFormat: HeaderValueFormat.Bearer), + new EffectiveSurrogateTransport( + SurrogateKind.RefreshToken, TokenFormat.Opaque, - GrantDeliveryMode.Cookie, + SurrogateTransport.Cookie, cookie: new UAuthCookieOptions { Name = "uar" diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthCorsHubOptionsSetupTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthCorsHubOptionsSetupTests.cs index d4dc9bc7..91f14670 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthCorsHubOptionsSetupTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthCorsHubOptionsSetupTests.cs @@ -60,27 +60,15 @@ public void Configure_ExposesJwtTransportHeaders() public void Configure_ExposesConfiguredAccessTokenHeader() { var server = new UAuthServerOptions(); - - server.Hub.AllowedClientOrigins.Add( - "https://app.example.com"); - - server.GrantDelivery.AccessToken.HeaderName = - "X-Custom-Access"; - - var setup = new UAuthHubCorsOptionsSetup( - Options.Create(server)); - + server.Hub.AllowedClientOrigins.Add("https://app.example.com"); + server.Transport.AccessToken.HeaderName = "X-Custom-Access"; + var setup = new UAuthHubCorsOptionsSetup(Options.Create(server)); var cors = new CorsOptions(); - setup.Configure(cors); - var policy = cors.GetPolicy("UAuthHub"); Assert.NotNull(policy); - - Assert.Contains( - "X-Custom-Access", - policy.ExposedHeaders); + Assert.Contains("X-Custom-Access", policy.ExposedHeaders); } [Fact] diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthFlowServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthFlowServiceTests.cs index 5a7b9944..2ebf5753 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthFlowServiceTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthFlowServiceTests.cs @@ -747,15 +747,14 @@ private static AuthFlowContext CreateFlow( session: session, options: TestServerOptions.Default(), response: new EffectiveAuthResponse( - sessionIdDelivery: - EffectiveGrantDelivery.Disabled(GrantKind.Session), - accessTokenDelivery: - EffectiveGrantDelivery.Disabled(GrantKind.AccessToken), - refreshTokenDelivery: - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + sessionIdTransport: + EffectiveSurrogateTransport.Disabled(SurrogateKind.SessionId), + accessTokenTransport: + EffectiveSurrogateTransport.Disabled(SurrogateKind.AccessToken), + refreshTokenTransport: + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), redirect: EffectiveRedirectResponse.Disabled), - primaryTokenKind: PrimaryTokenKind.Session, returnUrlInfo: ReturnUrlInfo.None()); } } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthLoginTransportEndpointTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthLoginTransportEndpointTests.cs index 2d987485..4d4fb2fb 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthLoginTransportEndpointTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthLoginTransportEndpointTests.cs @@ -14,16 +14,16 @@ namespace CodeBeam.UltimateAuth.Tests.Unit.Server; public sealed class UAuthLoginTransportEndpointTests { [Theory] - [InlineData(GrantDeliveryMode.Cookie, GrantDeliveryMode.None, true, true, false)] - [InlineData(GrantDeliveryMode.Cookie, GrantDeliveryMode.Header, true, false, true)] - [InlineData(GrantDeliveryMode.Header, GrantDeliveryMode.None, false, false, false)] - [InlineData(GrantDeliveryMode.Header, GrantDeliveryMode.Header, false, false, true)] - public void Get_ReportsEffectiveTransportCapabilities(GrantDeliveryMode session, GrantDeliveryMode access, bool supported, bool navigationSupported, bool accessTokenInHeader) + [InlineData(SurrogateTransport.Cookie, SurrogateTransport.None, true, true, false)] + [InlineData(SurrogateTransport.Cookie, SurrogateTransport.Header, true, false, true)] + [InlineData(SurrogateTransport.Header, SurrogateTransport.None, false, false, false)] + [InlineData(SurrogateTransport.Header, SurrogateTransport.Header, false, false, true)] + public void Get_ReportsEffectiveTransportCapabilities(SurrogateTransport session, SurrogateTransport access, bool supported, bool navigationSupported, bool accessTokenInHeader) { var response = new EffectiveAuthResponse( - Delivery(GrantKind.Session, session), - Delivery(GrantKind.AccessToken, access), - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + Delivery(SurrogateKind.SessionId, session), + Delivery(SurrogateKind.AccessToken, access), + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), EffectiveRedirectResponse.Disabled); var flow = AuthFlowTestFactory.New(response: response); @@ -45,14 +45,14 @@ public void Get_ReportsEffectiveTransportCapabilities(GrantDeliveryMode session, json.GetProperty("accessTokenInHeader").GetBoolean().Should().Be(accessTokenInHeader); } - private static EffectiveGrantDelivery Delivery(GrantKind kind,GrantDeliveryMode mode) + private static EffectiveSurrogateTransport Delivery(SurrogateKind kind,SurrogateTransport mode) { - if (mode == GrantDeliveryMode.None) - return EffectiveGrantDelivery.Disabled(kind); + if (mode == SurrogateTransport.None) + return EffectiveSurrogateTransport.Disabled(kind); - return new EffectiveGrantDelivery( + return new EffectiveSurrogateTransport( kind, - kind == GrantKind.AccessToken + kind == SurrogateKind.AccessToken ? TokenFormat.Jwt : TokenFormat.Opaque, mode); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs index 12646a46..a9345424 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs @@ -11,6 +11,7 @@ using CodeBeam.UltimateAuth.Server.Authentication; using CodeBeam.UltimateAuth.Server.Contracts; using CodeBeam.UltimateAuth.Server.Domain; +using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Server.ResourceApi; @@ -66,9 +67,8 @@ public async Task AuthenticateAsync_WhenCredentialDoesNotExist_ShouldReturnNoRes setup.CredentialResolver .Setup(x => x.ResolveAsync( It.IsAny(), - UAuthMode.PureOpaque, - It.IsAny())) - .ReturnsAsync((TransportCredential?)null); + It.IsAny())) + .ReturnsAsync((ResolvedSurrogate?)null); var result = await AuthenticateAsync(setup); @@ -89,8 +89,7 @@ public async Task AuthenticateAsync_WhenCredentialIsMalformed_ShouldFail() setup.CredentialResolver .Setup(x => x.ResolveAsync( It.IsAny(), - UAuthMode.PureOpaque, - It.IsAny())) + It.IsAny())) .ReturnsAsync(CreateSessionCredential("invalid")); var result = await AuthenticateAsync(setup); @@ -114,8 +113,7 @@ public async Task AuthenticateAsync_WhenCredentialIsNotSession_ShouldFail() setup.CredentialResolver .Setup(x => x.ResolveAsync( It.IsAny(), - UAuthMode.PureOpaque, - It.IsAny())) + It.IsAny())) .ReturnsAsync(CreateJwtCredential()); var result = await AuthenticateAsync(setup); @@ -123,7 +121,7 @@ public async Task AuthenticateAsync_WhenCredentialIsNotSession_ShouldFail() result.Succeeded.Should().BeFalse(); result.Failure.Should().NotBeNull(); result.Failure!.Message.Should() - .Be("Resource authentication requires a session credential."); + .Be("Resource authentication requires a session surrogate."); setup.SessionValidator.Verify( x => x.ValidateSessionAsync( @@ -324,8 +322,7 @@ public async Task AuthenticateAsync_ShouldCreateDeviceFromTransportCredential() setup.CredentialResolver .Setup(x => x.ResolveAsync( It.IsAny(), - UAuthMode.PureOpaque, - It.IsAny())) + It.IsAny())) .ReturnsAsync(CreateSessionCredential(TestSessionId, deviceInfo)); setup.DeviceFactory @@ -409,9 +406,8 @@ public async Task AuthenticateAsync_PureJwt_WhenCredentialIsMissing_ShouldReturn setup.CredentialResolver .Setup(x => x.ResolveAsync( It.IsAny(), - UAuthMode.PureJwt, - It.IsAny())) - .ReturnsAsync((TransportCredential?)null); + It.IsAny())) + .ReturnsAsync((ResolvedSurrogate?)null); var result = await AuthenticateAsync(setup); @@ -435,8 +431,7 @@ public async Task AuthenticateAsync_PureJwt_WhenCredentialIsNotAccessToken_Shoul setup.CredentialResolver .Setup(x => x.ResolveAsync( It.IsAny(), - UAuthMode.PureJwt, - It.IsAny())) + It.IsAny())) .ReturnsAsync(CreateSessionCredential(TestSessionId)); var result = await AuthenticateAsync(setup); @@ -718,7 +713,7 @@ public async Task AuthenticateAsync_PureJwt_ShouldNotStoreSessionValidationResul private static TestSetup CreateTestContext( UAuthMode mode = UAuthMode.PureOpaque) { - var credentialResolver = new Mock(); + var credentialResolver = new Mock(); var sessionValidator = new Mock(); var deviceFactory = new Mock(); var deviceResolver = new Mock(); @@ -738,22 +733,22 @@ private static TestSetup CreateTestContext( credentialResolver .Setup(x => x.ResolveAsync( It.IsAny(), - UAuthMode.PureOpaque, - It.IsAny())) + It.Is( + t => t.Kind == SurrogateKind.SessionId))) .ReturnsAsync(CreateSessionCredential(TestSessionId)); credentialResolver .Setup(x => x.ResolveAsync( It.IsAny(), - UAuthMode.PureJwt, - It.IsAny())) + It.Is( + t => t.Kind == SurrogateKind.AccessToken))) .ReturnsAsync(CreateJwtCredential()); var services = new ServiceCollection(); services.AddLogging(); - services.AddSingleton( + services.AddSingleton( credentialResolver.Object); services.AddSingleton( @@ -777,13 +772,13 @@ private static TestSetup CreateTestContext( Auth = new UAuthResourceAuthOptions { Mode = mode, - Session = new UAuthResourceSessionOptions + SessionId = new UAuthResourceSurrogateTransportOptions { - DeliveryMode = GrantDeliveryMode.Cookie + Mode = SurrogateTransport.Cookie }, - AccessToken = new UAuthResourceAccessTokenOptions + AccessToken = new UAuthResourceSurrogateTransportOptions { - DeliveryMode = GrantDeliveryMode.Cookie + Mode = SurrogateTransport.Cookie } }, })); @@ -819,21 +814,21 @@ private static Task AuthenticateAsync(TestSetup setup) return setup.HttpContext.AuthenticateAsync(Scheme); } - private static TransportCredential CreateSessionCredential(string value, DeviceInfo? device = null) + private static ResolvedSurrogate CreateSessionCredential(string value, DeviceInfo? device = null) { - return new TransportCredential + return new ResolvedSurrogate { - Kind = TransportCredentialKind.Session, + Kind = SurrogateKind.SessionId, Value = value, Device = device ?? CreateDeviceInfo() }; } - private static TransportCredential CreateJwtCredential() + private static ResolvedSurrogate CreateJwtCredential() { - return new TransportCredential + return new ResolvedSurrogate { - Kind = TransportCredentialKind.AccessToken, + Kind = SurrogateKind.AccessToken, Value = TestJwt, Device = CreateDeviceInfo() }; @@ -895,7 +890,7 @@ private static void VerifyNoSessionValidation(TestSetup setup) private sealed record TestSetup( DefaultHttpContext HttpContext, - Mock CredentialResolver, + Mock CredentialResolver, Mock SessionValidator, Mock DeviceFactory, Mock DeviceResolver, diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs index 01637d5d..27a041ba 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs @@ -569,7 +569,7 @@ public async Task ValidateSessionAsync_MetadataOnlySession_ReturnsNotFound() device: fixture.Session.Device, claims: ClaimsSnapshot.Empty, metadata: SessionMetadata.Empty, - credentialPurpose: SessionCredentialPurpose.MetadataOnly); + credentialPurpose: SessionIdPurpose.MetadataOnly); fixture.Store .Setup(x => x.GetSessionAsync( @@ -615,17 +615,17 @@ public void MetadataOnlySession_PreservesPurpose_AfterMutation() device: DeviceContext.Anonymous(), claims: ClaimsSnapshot.Empty, metadata: SessionMetadata.Empty, - credentialPurpose: SessionCredentialPurpose.MetadataOnly); + credentialPurpose: SessionIdPurpose.MetadataOnly); session.IsMetadataOnly.Should().BeTrue(); session.ExtendExpiration(now.AddHours(2)) .CredentialPurpose.Should() - .Be(SessionCredentialPurpose.MetadataOnly); + .Be(SessionIdPurpose.MetadataOnly); session.Revoke(now.AddMinutes(10)) .CredentialPurpose.Should() - .Be(SessionCredentialPurpose.MetadataOnly); + .Be(SessionIdPurpose.MetadataOnly); } // --------------------------------------------------------------------- diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthStatusAuthorizationResultHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthStatusAuthorizationResultHandlerTests.cs index eb7ba4d2..8f67c9f5 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthStatusAuthorizationResultHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthStatusAuthorizationResultHandlerTests.cs @@ -102,8 +102,7 @@ private static SessionValidationResult CreateActiveLineage( userStatus: status); } - private static AuthValidationResult CreateHubResponse( - UserStatus status = UserStatus.Active) + private static AuthValidationResult CreateHubResponse(UserStatus status = UserStatus.Active) { return new AuthValidationResult { @@ -157,7 +156,7 @@ private sealed class Fixture : IDisposable public Mock DeviceContextFactory { get; } = new(MockBehavior.Strict); - public Mock Credentials { get; } + public Mock Credentials { get; } = new(MockBehavior.Strict); public Mock Clock { get; } @@ -180,26 +179,20 @@ private sealed class Fixture : IDisposable private readonly UAuthStatusAuthorizationResultHandler _sut = new(); - public Fixture( - UAuthMode mode, - bool resource = false) + public Fixture(UAuthMode mode, bool resource = false) { Context.User = CreatePrincipal(User.Value); Context.RequestAborted = CancellationToken; - Context.Items[ - UAuthConstants.HttpItems.TenantContextKey] = - UAuthTenantContext.Resolved(Tenant); + Context.Items[UAuthConstants.HttpItems.TenantContextKey] = UAuthTenantContext.Resolved(Tenant); ServerOptions.AuthMode = mode; - ServerOptions.Session.DeviceMismatchBehavior = - DeviceMismatchBehavior.Reject; + ServerOptions.Session.DeviceMismatchBehavior = DeviceMismatchBehavior.Reject; ResourceOptions.Auth.Mode = mode; - ResourceOptions.Auth.Device.MismatchBehavior = - DeviceMismatchBehavior.Reject; + ResourceOptions.Auth.Device.MismatchBehavior = DeviceMismatchBehavior.Reject; var effective = new EffectiveUAuthServerOptions { @@ -261,11 +254,10 @@ public Fixture( Credentials .Setup(x => x.ResolveAsync( Context, - UAuthMode.SemiHybrid, - It.IsAny())) - .ReturnsAsync(new TransportCredential + It.IsAny())) + .ReturnsAsync(new ResolvedSurrogate { - Kind = TransportCredentialKind.AccessToken, + Kind = SurrogateKind.AccessToken, Value = "test-access-token", TenantId = Tenant.Value, Device = deviceInfo @@ -352,7 +344,7 @@ public void SetupLineage(SessionValidationResult result) Lineage .Setup(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, CancellationToken)) .ReturnsAsync(result); } @@ -440,7 +432,7 @@ public void VerifyLocalAuthorityValidation() context.Device.DeviceId == Device && context.SessionOptions == ServerOptions.Session && context.Now == Now), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, CancellationToken), Times.Once); @@ -596,16 +588,13 @@ public async Task HandleAsync_AlreadyForbidden_ShouldNotRunAdditionalValidation( { using var fixture = new Fixture(UAuthMode.SemiHybrid); - await fixture.ExecuteAsync( - PolicyAuthorizationResult.Forbid()); + await fixture.ExecuteAsync(PolicyAuthorizationResult.Forbid()); fixture.AssertForbidden(); fixture.VerifyNoAuthorityValidation(); fixture.Users.VerifyNoOtherCalls(); - Assert.False( - fixture.Context.Response.Headers.ContainsKey( - UAuthConstants.Headers.AuthRecovery)); + Assert.False(fixture.Context.Response.Headers.ContainsKey(UAuthConstants.Headers.AuthRecovery)); } [Theory] diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs index b4ab71c3..d0b23244 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs @@ -29,16 +29,16 @@ public sealed class ValidateEndpointHandlerTests // ===================================================================== [Fact] - public async Task ValidateAsync_WhenCredentialIsMissing_ReturnsUnauthorizedNotFound() + public async Task ValidateAsync_WhenSurrogateIsMissing_ReturnsUnauthorizedNotFound() { var fixture = CreateFixture(); - fixture.CredentialResolver + fixture.SurrogateResolver .Setup(x => x.ResolveAsync( fixture.HttpContext, - fixture.Flow.EffectiveMode, - fixture.Flow.Response)) - .ReturnsAsync((TransportCredential?)null); + It.Is( + t => t.Kind == SurrogateKind.SessionId))) + .ReturnsAsync((ResolvedSurrogate?)null); var result = await fixture.Sut.ValidateAsync( fixture.HttpContext, @@ -63,24 +63,24 @@ public async Task ValidateAsync_WhenCredentialIsMissing_ReturnsUnauthorizedNotFo } [Fact] - public async Task ValidateAsync_WhenCredentialKindIsAccessToken_ReturnsUnauthorizedUnsupported() + public async Task ValidateAsync_WhenSurrogateKindIsAccessToken_ReturnsUnauthorizedUnsupported() { var fixture = CreateFixture(); - var credential = new TransportCredential + var surrogate = new ResolvedSurrogate { - Kind = TransportCredentialKind.AccessToken, + Kind = SurrogateKind.AccessToken, Value = "access-token", TenantId = fixture.Flow.Tenant.Value, Device = TestDevice.DefaultDeviceInfo() }; - fixture.CredentialResolver + fixture.SurrogateResolver .Setup(x => x.ResolveAsync( fixture.HttpContext, - fixture.Flow.EffectiveMode, - fixture.Flow.Response)) - .ReturnsAsync(credential); + It.Is( + t => t.Kind == SurrogateKind.SessionId))) + .ReturnsAsync(surrogate); var result = await fixture.Sut.ValidateAsync( fixture.HttpContext, @@ -97,6 +97,7 @@ public async Task ValidateAsync_WhenCredentialKindIsAccessToken_ReturnsUnauthori json.Value!.State.Should() .Be(SessionState.Unsupported); + json.Value.IsValid.Should().BeFalse(); json.Value.Snapshot.Should().BeNull(); fixture.SessionValidator.VerifyNoOtherCalls(); @@ -108,24 +109,24 @@ public async Task ValidateAsync_WhenCredentialKindIsAccessToken_ReturnsUnauthori // ===================================================================== [Fact] - public async Task ValidateAsync_WhenSessionCredentialCannotBeParsed_ReturnsUnauthorizedInvalid() + public async Task ValidateAsync_WhenSessionSurrogateCannotBeParsed_ReturnsUnauthorizedInvalid() { var fixture = CreateFixture(); - var credential = new TransportCredential + var surrogate = new ResolvedSurrogate { - Kind = TransportCredentialKind.Session, + Kind = SurrogateKind.SessionId, Value = "invalid", TenantId = fixture.Flow.Tenant.Value, Device = TestDevice.DefaultDeviceInfo() }; - fixture.CredentialResolver + fixture.SurrogateResolver .Setup(x => x.ResolveAsync( fixture.HttpContext, - fixture.Flow.EffectiveMode, - fixture.Flow.Response)) - .ReturnsAsync(credential); + It.Is( + t => t.Kind == SurrogateKind.SessionId))) + .ReturnsAsync(surrogate); var result = await fixture.Sut.ValidateAsync( fixture.HttpContext, @@ -161,9 +162,7 @@ public async Task ValidateAsync_WhenSessionCredentialIsValid_PassesExpectedConte var sessionId = TestIds.Session("validate-session"); - SetupSessionCredential( - fixture, - sessionId); + SetupSessionSurrogate(fixture, sessionId); SessionValidationContext? capturedContext = null; CancellationToken capturedToken = default; @@ -224,7 +223,7 @@ public async Task ValidateAsync_WhenValidationIsInvalidWithoutUserKey_ReturnsOkI var sessionId = TestIds.Session("missing-user-session"); - SetupSessionCredential( + SetupSessionSurrogate( fixture, sessionId); @@ -277,7 +276,7 @@ public async Task ValidateAsync_WhenSessionIsValid_ReturnsOkActiveWithSnapshot() var sessionId = TestIds.Session("active-session"); - SetupSessionCredential( + SetupSessionSurrogate( fixture, sessionId); @@ -349,7 +348,7 @@ public async Task ValidateAsync_WhenValidationIsInvalidButContainsUserKey_Return var userKey = UserKey.New(); - SetupSessionCredential( + SetupSessionSurrogate( fixture, sessionId); @@ -403,7 +402,7 @@ public async Task ValidateAsync_PropagatesCancellationTokenToSessionValidator() var sessionId = TestIds.Session("cancellation-session"); - SetupSessionCredential( + SetupSessionSurrogate( fixture, sessionId); @@ -442,7 +441,7 @@ public async Task ValidateAsync_WhenValidationIsActiveButHasNoUserKey_ReturnsUna var sessionId = TestIds.Session("active-without-user"); - SetupSessionCredential( + SetupSessionSurrogate( fixture, sessionId); @@ -507,7 +506,7 @@ public async Task ValidateAsync_PureJwt_NoCredential_ReturnsUnauthorizedNotFound json.Value!.State.Should().Be(SessionState.NotFound); json.Value.Snapshot.Should().BeNull(); - fixture.CredentialResolver.VerifyNoOtherCalls(); + fixture.SurrogateResolver.VerifyNoOtherCalls(); fixture.SessionValidator.VerifyNoOtherCalls(); fixture.SnapshotFactory.VerifyNoOtherCalls(); } @@ -530,7 +529,7 @@ public async Task ValidateAsync_PureJwt_AuthenticationFails_ReturnsUnauthorizedI json.Value!.State.Should().Be(SessionState.Invalid); json.Value.Snapshot.Should().BeNull(); - fixture.CredentialResolver.VerifyNoOtherCalls(); + fixture.SurrogateResolver.VerifyNoOtherCalls(); fixture.SessionValidator.VerifyNoOtherCalls(); fixture.SnapshotFactory.VerifyNoOtherCalls(); } @@ -616,7 +615,7 @@ public async Task ValidateAsync_PureJwt_ValidPrincipal_ReturnsActiveSnapshot() snapshot.Claims.Claims["uauth:permission"] .Should().Contain("users.read"); - fixture.CredentialResolver.VerifyNoOtherCalls(); + fixture.SurrogateResolver.VerifyNoOtherCalls(); fixture.SessionValidator.VerifyNoOtherCalls(); fixture.SnapshotFactory.VerifyNoOtherCalls(); } @@ -669,7 +668,7 @@ public async Task ValidateAsync_SemiHybrid_Standard_ShouldNotValidateLineage(str Assert.Null(ok.Value.ChainId); Assert.Null(ok.Value.RootId); - fixture.CredentialResolver.VerifyNoOtherCalls(); + fixture.SurrogateResolver.VerifyNoOtherCalls(); fixture.SessionValidator.VerifyNoOtherCalls(); fixture.LineageValidator.VerifyNoOtherCalls(); fixture.SnapshotFactory.VerifyNoOtherCalls(); @@ -755,7 +754,7 @@ public async Task ValidateAsync_PureJwt_HubValidated_ShouldReturnBadRequest(bool Assert.IsType(result); - fixture.CredentialResolver.VerifyNoOtherCalls(); + fixture.SurrogateResolver.VerifyNoOtherCalls(); fixture.SessionValidator.VerifyNoOtherCalls(); fixture.LineageValidator.VerifyNoOtherCalls(); fixture.SnapshotFactory.VerifyNoOtherCalls(); @@ -780,11 +779,11 @@ public async Task ValidateAsync_SemiHybrid_HubValidated_ShouldReturnAuthoritativ fixture.LineageValidator .Setup(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken)) .Callback< SessionValidationContext, - SessionCredentialPurpose, + SessionIdPurpose, CancellationToken>( (context, _, _) => captured = context) .ReturnsAsync(validation); @@ -839,7 +838,7 @@ public async Task ValidateAsync_SemiHybrid_HubValidated_ShouldReturnAuthoritativ fixture.LineageValidator.Verify( x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken), Times.Once); @@ -849,7 +848,7 @@ public async Task ValidateAsync_SemiHybrid_HubValidated_ShouldReturnAuthoritativ fixture.CancellationToken), Times.Once); - fixture.CredentialResolver.VerifyNoOtherCalls(); + fixture.SurrogateResolver.VerifyNoOtherCalls(); fixture.SessionValidator.VerifyNoOtherCalls(); } @@ -866,17 +865,11 @@ public async Task ValidateAsync_SemiHybrid_InvalidLineage_ShouldReturnInvalidSta out _, out _); - fixture.HttpContext.Request.Headers[ - UAuthConstants.Headers.Validation] = - "HubValidated"; + fixture.HttpContext.Request.Headers[UAuthConstants.Headers.Validation] = "HubValidated"; - SetupSemiHybridLineage( - fixture, - SessionValidationResult.Invalid(state)); + SetupSemiHybridLineage(fixture, SessionValidationResult.Invalid(state)); - var result = await fixture.Sut.ValidateAsync( - fixture.HttpContext, - fixture.CancellationToken); + var result = await fixture.Sut.ValidateAsync(fixture.HttpContext, fixture.CancellationToken); var ok = Assert.IsType>(result); @@ -886,7 +879,7 @@ public async Task ValidateAsync_SemiHybrid_InvalidLineage_ShouldReturnInvalidSta Assert.Null(ok.Value.Snapshot); fixture.SnapshotFactory.VerifyNoOtherCalls(); - fixture.CredentialResolver.VerifyNoOtherCalls(); + fixture.SurrogateResolver.VerifyNoOtherCalls(); fixture.SessionValidator.VerifyNoOtherCalls(); } @@ -1010,7 +1003,7 @@ public async Task ValidateAsync_ConfiguredHubValidation_CannotBeDowngraded(strin fixture.LineageValidator.Verify( x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken), Times.Once); } @@ -1067,7 +1060,7 @@ public async Task ValidateAsync_EndpointRequirement_CannotBeDowngraded() fixture.LineageValidator.Verify( x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken), Times.Once); } @@ -1112,7 +1105,7 @@ private static Fixture CreateFixture(UAuthMode mode = UAuthMode.PureOpaque) var flow = AuthFlowTestFactory.New(mode: mode); var authContext = new Mock(MockBehavior.Strict); - var credentialResolver = new Mock(MockBehavior.Strict); + var surrogateResolver = new Mock(MockBehavior.Strict); var sessionValidator = new Mock(MockBehavior.Strict); var snapshotFactory = new Mock(MockBehavior.Strict); var lineageValidator = new Mock(MockBehavior.Strict); @@ -1139,7 +1132,7 @@ private static Fixture CreateFixture(UAuthMode mode = UAuthMode.PureOpaque) var sut = new ValidateEndpointHandler( authContext.Object, - credentialResolver.Object, + surrogateResolver.Object, sessionValidator.Object, authorityValidator, snapshotFactory.Object, @@ -1148,7 +1141,7 @@ private static Fixture CreateFixture(UAuthMode mode = UAuthMode.PureOpaque) return new Fixture( sut, flow, - credentialResolver, + surrogateResolver, sessionValidator, lineageValidator, snapshotFactory, @@ -1230,7 +1223,7 @@ private static void SetupSemiHybridLineage( fixture.LineageValidator .Setup(x => x.ValidateAsync( It.IsAny(), - SessionCredentialPurpose.MetadataOnly, + SessionIdPurpose.MetadataOnly, fixture.CancellationToken)) .ReturnsAsync(validation); } @@ -1258,16 +1251,16 @@ private static AuthenticateResult JwtSuccess(ClaimsPrincipal principal) return AuthenticateResult.Success(new AuthenticationTicket(principal, UAuthConstants.SchemeDefaults.GlobalScheme)); } - private static void SetupSessionCredential(Fixture fixture, AuthSessionId sessionId) + private static void SetupSessionSurrogate(Fixture fixture, AuthSessionId sessionId) { - fixture.CredentialResolver + fixture.SurrogateResolver .Setup(x => x.ResolveAsync( fixture.HttpContext, - fixture.Flow.EffectiveMode, - fixture.Flow.Response)) - .ReturnsAsync(new TransportCredential + It.Is( + t => t.Kind == SurrogateKind.SessionId))) + .ReturnsAsync(new ResolvedSurrogate { - Kind = TransportCredentialKind.Session, + Kind = SurrogateKind.SessionId, Value = sessionId.Value, TenantId = fixture.Flow.Tenant.Value, Device = TestDevice.DefaultDeviceInfo() @@ -1305,7 +1298,7 @@ private static AuthStateSnapshot CreateSnapshot(TenantKey tenant, UserKey userKe private sealed record Fixture( ValidateEndpointHandler Sut, AuthFlowContext Flow, - Mock CredentialResolver, + Mock SurrogateResolver, Mock SessionValidator, Mock LineageValidator, Mock SnapshotFactory, diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/SessionIdResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/SessionIdResolverTests.cs index 95b18591..2f90df8f 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/SessionIdResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/SessionIdResolverTests.cs @@ -5,6 +5,7 @@ using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Domain; +using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; @@ -28,7 +29,7 @@ public async Task ResolveAsync_ShouldResolveSessionCredential(UAuthMode mode) var (sut, context, transport) = CreateSut( mode, - CreateCredential(TransportCredentialKind.Session, SessionValue)); + CreateCredential(SurrogateKind.SessionId, SessionValue)); var result = await sut.ResolveAsync( context, @@ -38,20 +39,18 @@ public async Task ResolveAsync_ShouldResolveSessionCredential(UAuthMode mode) transport.Verify(x => x.ResolveAsync( context, - mode, - It.IsAny()), + It.IsAny()), Times.Once); } [Theory] [InlineData(UAuthMode.PureJwt)] [InlineData(UAuthMode.SemiHybrid)] - public async Task ResolveAsync_WhenJwtBasedMode_ShouldNotResolveSession( - UAuthMode mode) + public async Task ResolveAsync_WhenJwtBasedMode_ShouldNotResolveSession(UAuthMode mode) { var (sut, context, transport) = CreateSut( mode, - CreateCredential(TransportCredentialKind.Session, SessionValue)); + CreateCredential(SurrogateKind.SessionId, SessionValue)); var result = await sut.ResolveAsync( context, @@ -61,16 +60,14 @@ public async Task ResolveAsync_WhenJwtBasedMode_ShouldNotResolveSession( transport.Verify(x => x.ResolveAsync( It.IsAny(), - It.IsAny(), - It.IsAny()), + It.IsAny()), Times.Never); } [Theory] [InlineData(UAuthMode.PureOpaque)] [InlineData(UAuthMode.Hybrid)] - public async Task ResolveAsync_WhenCredentialIsMissing_ShouldReturnNull( - UAuthMode mode) + public async Task ResolveAsync_WhenCredentialIsMissing_ShouldReturnNull(UAuthMode mode) { var (sut, context, transport) = CreateSut(mode, null); @@ -82,21 +79,19 @@ public async Task ResolveAsync_WhenCredentialIsMissing_ShouldReturnNull( transport.Verify(x => x.ResolveAsync( context, - mode, - It.IsAny()), + It.IsAny()), Times.Once); } [Theory] [InlineData(UAuthMode.PureOpaque)] [InlineData(UAuthMode.Hybrid)] - public async Task ResolveAsync_WhenCredentialIsNotSession_ShouldReturnNull( - UAuthMode mode) + public async Task ResolveAsync_WhenCredentialIsNotSession_ShouldReturnNull(UAuthMode mode) { var (sut, context, _) = CreateSut( mode, CreateCredential( - TransportCredentialKind.AccessToken, + SurrogateKind.AccessToken, SessionValue)); var result = await sut.ResolveAsync( @@ -115,7 +110,7 @@ public async Task ResolveAsync_WhenSessionIdIsInvalid_ShouldReturnNull( { var (sut, context, _) = CreateSut( UAuthMode.PureOpaque, - CreateCredential(TransportCredentialKind.Session, value)); + CreateCredential(SurrogateKind.SessionId, value)); var result = await sut.ResolveAsync( context, @@ -127,15 +122,14 @@ public async Task ResolveAsync_WhenSessionIdIsInvalid_ShouldReturnNull( [Theory] [InlineData(UAuthMode.PureOpaque)] [InlineData(UAuthMode.Hybrid)] - public async Task ResolveAsync_ShouldUseEffectiveModeAndApplicationProfile( - UAuthMode mode) + public async Task ResolveAsync_ShouldUseEffectiveModeAndApplicationProfile(UAuthMode mode) { var context = new DefaultHttpContext(); var profileReader = new Mock(); var effectiveProvider = new Mock(); var responseResolver = new Mock(); - var transport = new Mock(); + var transport = new Mock(); var effective = new EffectiveUAuthServerOptions { @@ -161,9 +155,9 @@ public async Task ResolveAsync_ShouldUseEffectiveModeAndApplicationProfile( .Returns(response); transport - .Setup(x => x.ResolveAsync(context, mode, response)) + .Setup(x => x.ResolveAsync(context, response.SessionIdTransport)) .ReturnsAsync(CreateCredential( - TransportCredentialKind.Session, + SurrogateKind.SessionId, SessionValue)); var sut = new SessionIdResolver( @@ -191,22 +185,22 @@ public async Task ResolveAsync_ShouldUseEffectiveModeAndApplicationProfile( Times.Once); transport.Verify( - x => x.ResolveAsync(context, mode, response), + x => x.ResolveAsync(context, response.SessionIdTransport), Times.Once); } private static ( - SessionIdResolver Sut, - DefaultHttpContext Context, - Mock Transport) - CreateSut(UAuthMode mode, TransportCredential? credential) + SessionIdResolver Sut, + DefaultHttpContext Context, + Mock Transport) + CreateSut(UAuthMode mode, ResolvedSurrogate? surrogate) { var context = new DefaultHttpContext(); var profileReader = new Mock(); var effectiveProvider = new Mock(); var responseResolver = new Mock(); - var transport = new Mock(); + var transport = new Mock(); var effective = new EffectiveUAuthServerOptions { @@ -232,8 +226,10 @@ private static ( .Returns(response); transport - .Setup(x => x.ResolveAsync(context, mode, response)) - .ReturnsAsync(credential); + .Setup(x => x.ResolveAsync( + context, + response.SessionIdTransport)) + .ReturnsAsync(surrogate); var sut = new SessionIdResolver( profileReader.Object, @@ -247,24 +243,22 @@ private static ( private static EffectiveAuthResponse CreateResponse() { return new EffectiveAuthResponse( - new EffectiveGrantDelivery( - GrantKind.Session, + new EffectiveSurrogateTransport( + SurrogateKind.SessionId, TokenFormat.Opaque, - GrantDeliveryMode.Cookie, + SurrogateTransport.Cookie, cookie: new UAuthCookieOptions { Name = "uas" }), - EffectiveGrantDelivery.Disabled(GrantKind.AccessToken), - EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), + EffectiveSurrogateTransport.Disabled(SurrogateKind.AccessToken), + EffectiveSurrogateTransport.Disabled(SurrogateKind.RefreshToken), EffectiveRedirectResponse.Disabled); } - private static TransportCredential CreateCredential( - TransportCredentialKind kind, - string value) + private static ResolvedSurrogate CreateCredential(SurrogateKind kind, string value) { - return new TransportCredential + return new ResolvedSurrogate { Kind = kind, Value = value, diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs index b6aa5829..66cf7ddc 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs @@ -1776,8 +1776,8 @@ private static RotationSetup SetupSuccessfulRotation(Fixture fixture, SessionRot context.CurrentSessionId, root.SecurityVersion, credentialPurpose: context.Mode == UAuthMode.SemiHybrid - ? SessionCredentialPurpose.MetadataOnly - : SessionCredentialPurpose.Opaque); + ? SessionIdPurpose.MetadataOnly + : SessionIdPurpose.Opaque); chain = chain.AttachSession( oldSession.SessionId, @@ -1962,7 +1962,7 @@ private static UAuthSession CreateSession( DateTimeOffset createdAt, AuthSessionId? sessionId = null, long securityVersion = 0, - SessionCredentialPurpose credentialPurpose = SessionCredentialPurpose.Opaque) + SessionIdPurpose credentialPurpose = SessionIdPurpose.Opaque) { return UAuthSession.Create( sessionId ?? AuthSessionId.Parse(Guid.NewGuid().ToString(), null), From f4c8bf2197030de21c5cbd9926212864b720fcdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Thu, 3 Dec 2026 23:13:31 +0300 Subject: [PATCH 3/3] Add Docs --- docs/content/auth-flows/login-flow.md | 20 +- docs/content/auth-flows/overview.md | 16 +- docs/content/auth-flows/refresh-flow.md | 50 ++--- .../configuration/advanced-configuration.md | 25 ++- docs/content/configuration/overview.md | 18 +- docs/content/configuration/server-options.md | 193 ++++++++---------- .../fundamentals/application-profiles.md | 2 +- docs/content/fundamentals/auth-model.md | 2 +- docs/content/fundamentals/auth-modes.md | 2 +- docs/content/fundamentals/core-concepts.md | 157 ++++++++++++++ docs/content/fundamentals/flow-based-auth.md | 2 +- .../content/fundamentals/request-lifecycle.md | 2 +- .../fundamentals/runtime-architecture.md | 32 +-- docs/content/migration/v0.2.0.md | 103 ++++++---- .../wwwroot/docs/auth-flows/login-flow.json | 4 +- .../wwwroot/docs/auth-flows/overview.json | 4 +- .../wwwroot/docs/auth-flows/refresh-flow.json | 8 +- .../configuration/advanced-configuration.json | 8 +- .../wwwroot/docs/configuration/overview.json | 4 +- .../docs/configuration/server-options.json | 73 +++---- .../wwwroot/docs/docs-index.json | 19 +- .../fundamentals/application-profiles.json | 2 +- .../wwwroot/docs/fundamentals/auth-model.json | 2 +- .../wwwroot/docs/fundamentals/auth-modes.json | 2 +- .../docs/fundamentals/core-concepts.json | 64 ++++++ .../docs/fundamentals/flow-based-auth.json | 2 +- .../docs/fundamentals/request-lifecycle.json | 2 +- .../fundamentals/runtime-architecture.json | 4 +- .../wwwroot/docs/migration/v0.2.0.json | 37 +++- .../Program.cs | 2 +- .../Domain/Surrogates/SurrogateKind.cs | 8 +- .../SurrogateTransportCollisionValidator.cs | 28 ++- .../Domain/SurrogateTransport.cs | 10 +- .../Credentials/SurrogateResponseWriter.cs | 55 ++--- .../Options/SurrogateTransportOptions.cs | 13 +- .../Options/UAuthResourceApiOptions.cs | 16 +- .../Options/UAuthServerOptions.cs | 12 +- .../Options/UAuthSurrogateTransportOptions.cs | 18 +- .../UAuthResourceApiOptionsValidator.cs | 64 +++--- .../ResourceApi/RemoteHubValidationService.cs | 2 - .../ResourceSurrogateTransportFactory.cs | 33 +-- .../UAuthResourceApiOptionsValidatorTests.cs | 77 +++++-- .../Server/SurrogateResponseWriterTests.cs | 4 +- 43 files changed, 749 insertions(+), 452 deletions(-) create mode 100644 docs/content/fundamentals/core-concepts.md create mode 100644 docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/core-concepts.json diff --git a/docs/content/auth-flows/login-flow.md b/docs/content/auth-flows/login-flow.md index df419a68..be42ceea 100644 --- a/docs/content/auth-flows/login-flow.md +++ b/docs/content/auth-flows/login-flow.md @@ -8,11 +8,13 @@ group: auth-flows Logging in is often described as a simple exchange: verify a password, issue a token, and consider the user authenticated. That description leaves out the part that matters most over time: **what exactly has been established and how can it be managed or revoked?** -UltimateAuth treats login as a **controlled session-establishment flow**. Credential verification is essential, but it is only one stage. A successful login connects an authenticated user to a tenant, a device context, a session hierarchy, and the security state that governs future requests. +UltimateAuth treats login as a controlled authentication-establishment flow. -The central idea is straightforward: +Credential verification is essential, but it is only one stage. A successful login establishes trust in an identity within a tenant and device context, according to the effective authentication mode. -> **Login establishes a session. Tokens, when enabled, are credentials issued in connection with that session—not the session itself.** +> **Login establishes authentication. Surrogates allow that authentication to continue without repeatedly presenting the original credential.** + +Session-managed modes also establish the applicable session lineage. This distinction shapes how UltimateAuth handles device awareness, session continuity, token issuance, revocation, and authentication policy. @@ -23,7 +25,7 @@ In a token-centric design, login is frequently treated as the moment a token is UltimateAuth starts with the authentication lifecycle instead. It separates four responsibilities: 1. **Identity resolution:** determine which user is attempting to authenticate. -2. **Authentication and security evaluation:** verify the credential and decide whether the attempt is allowed. +2. **Surrogate issuance and transport:** issue the applicable tokens and transport them according to the effective authentication mode and application profile. 3. **Session establishment:** create a managed authentication instance in the appropriate device and user context. 4. **Credential delivery:** optionally issue access and refresh tokens and deliver the applicable credentials according to the server mode and application profile. @@ -227,13 +229,13 @@ Depending on the effective mode and issuer behavior, an individual token type ma ### 9. Dispatch the login event and deliver the response -Following successful session and optional token issuance, UltimateAuth dispatches a `UserLoggedInContext` event containing the tenant, user key, time, device, and session ID. +The HTTP endpoint delegates surrogate transport to `ISurrogateResponseWriter`. -The HTTP endpoint then delegates credential delivery to `ICredentialResponseWriter`. Session ID, access token, and refresh token are handled as distinct grant kinds. Delivery is resolved using the effective mode, authentication flow, application profile, and server configuration. +Session ID, access token, and refresh token are handled as distinct surrogate kinds. Their effective transports are determined by the authentication mode, flow, application profile, and server configuration. Depending on configuration, the HTTP response may complete with `200 OK` or a success redirect. A rejected login may produce `401 Unauthorized` or a configured failure redirect. -**Important for v0.1.0:** `TokenResponseMode.Body` is currently unsupported and rejected during response resolution. Do not assume that the HTTP login endpoint returns a JSON object containing the issued tokens. Consult the configured delivery modes and application profile instead. +**Important:** `SurrogateTransport.Body` is currently unsupported. Do not assume that the HTTP login endpoint returns a JSON object containing the issued tokens. ## TryLogin: evaluate without establishing a session @@ -302,9 +304,9 @@ Identity + Valid Credential + Security Decision Ongoing auth lifecycle ``` -The session is the managed authentication instance. Tokens, where used, are credentials associated with that instance. They can be issued, refreshed, and validated without redefining what a login means. +A session represents a managed authentication instance where session lineage is used. -This is the shift UltimateAuth is designed to make: **from login as token generation to login as lifecycle-aware session establishment**. +Surrogates represent the authentication data used to continue authenticated interactions. Their issuance and validation depend on the effective authentication mode. ## Key takeaways diff --git a/docs/content/auth-flows/overview.md b/docs/content/auth-flows/overview.md index a8976ede..105edc2e 100644 --- a/docs/content/auth-flows/overview.md +++ b/docs/content/auth-flows/overview.md @@ -60,7 +60,7 @@ AuthFlowContextFactory - Read tenant, session, and user contexts - Resolve application profile and effective server options - Determine effective authentication mode - - Resolve primary token kind and response delivery policy + - Resolve primary surrogate kind and effective transport - Resolve device context and return URL - Validate existing session where applicable - Reject invalid or unresolved tenant @@ -105,11 +105,11 @@ The filter initializes the flow context; it does **not**, by itself, validate a | `ApplicationProfile` | Describes the kind of application interacting with the server. | | `EffectiveMode` | Determines the authentication model actually in force for this request. | | `Options` | Supplies the effective server policy. | -| `PrimaryTokenKind` | Identifies the primary credential/token kind for the effective mode. | +| `PrimarySurrogateKind` | Identifies the primary surrogate for the effective authentication mode. | +| `Response` | Describes effective surrogate transport and redirect behavior. | | `Device` | Carries the resolved device context. | | `Session` | Carries validated session security context when available. | | `IsAuthenticated` / `UserKey` | Represent the resolved authentication identity for this request. | -| `Response` | Describes effective credential delivery and redirect behavior. | | `ReturnUrlInfo` | Carries parsed navigation intent for applicable browser flows. | The factory rejects unresolved or invalid tenant context and disallowed authentication modes. When a session context is present, it invokes session validation. For session-authoritative modes such as `PureOpaque` and `Hybrid`, that validation also affects the resolved authentication state. @@ -167,11 +167,11 @@ This separation helps prevent HTTP transport details from becoming security poli A successful domain operation and the HTTP response carrying its outcome are different concerns. -`AuthResponseResolver` derives the effective response configuration from the authentication mode, flow type, application profile, and server options. It binds applicable cookie settings and validates the delivery configuration before the endpoint performs the operation. +`AuthResponseResolver` derives the effective response configuration from the authentication mode, flow type, application profile, and server options. -This means a flow can use the same underlying authentication semantics while producing a client-appropriate HTTP outcome—for example, a response with managed cookies or a browser redirect when configured. +It resolves the applicable surrogate transports, binds cookie settings, and validates transport compatibility before the endpoint performs the operation. -**Current implementation note:** `TokenResponseMode.Body` credential delivery is explicitly unsupported by the response resolver. Do not assume that access or refresh credentials are returned in a JSON response body. +**Current implementation note:** `SurrogateTransport.Body` is not supported. Do not assume that access or refresh tokens are returned in a JSON response body. A redirect is a navigation decision, **not** an authentication or revocation mechanism. It can return a browser to the application after login or logout; the underlying security operation must stand independently of whether the browser follows the redirect. @@ -199,6 +199,8 @@ A useful mental model is to distinguish **proof**, **policy**, and **state**: | Policy | Effective mode, server options, authority decisions | Determines what is permitted. | | State | User eligibility, credential records, security state, session root/chain/session | Determines the authoritative lifecycle and validity where applicable. | | Delivery | Cookies, supported response modes, redirect | Communicates the result to the client. | +| Transport | Cookies and HTTP headers | Carries authentication surrogates between applications. | +| Redirect | Navigation behavior | Communicates the navigation outcome to the client. | A valid-looking token is not, by itself, permission to ignore revocation, tenant boundaries, session state, or mode-specific validation. Conversely, not every authentication mode is built around a persisted session hierarchy. The authoritative checks must match the configured model. @@ -241,7 +243,7 @@ This is the larger goal of UltimateAuth's unified model—not to make every auth - **`AuthFlowContext` resolves tenant, mode, application profile, device, identity/session information, and response policy** before the handler executes. - **Proof is not the source of truth.** Validation depends on authoritative state and the effective authentication mode. - **Authority and orchestration are distinct responsibilities.** The exact checks and state transitions vary by flow. -- **Credential delivery and redirects are outcomes**, not substitutes for security decisions. +- **Surrogate transport and redirects are outcomes**, not substitutes for security decisions. - **Login, refresh, and logout share a model without sharing identical execution paths.** ## Next step diff --git a/docs/content/auth-flows/refresh-flow.md b/docs/content/auth-flows/refresh-flow.md index 18e06aba..a6fc919c 100644 --- a/docs/content/auth-flows/refresh-flow.md +++ b/docs/content/auth-flows/refresh-flow.md @@ -6,7 +6,7 @@ group: auth-flows # Refresh Flow -Refresh is how an existing authentication context continues without asking the user to authenticate again. In UltimateAuth, it is not synonymous with issuing a new access token: the operation depends on the active authentication mode and on whether the context is represented by a server-side session, refresh credentials, or both. +Refresh is how an existing authentication context continues without asking the user to authenticate again. In UltimateAuth, it is not synonymous with issuing a new access token: the operation depends on the active authentication mode and on whether the context is represented by a server-side session, refresh token, or both. A successful refresh preserves the authenticated identity and its continuity. It does **not** prove the user's credentials again, create a new login, or necessarily extend every lifetime associated with the authentication. @@ -22,7 +22,7 @@ UltimateAuth distinguishes three related operations: - **Refresh** attempts to continue an already established context, subject to its current validity and security policies. - **Reauthentication** establishes trust again when continuation is unavailable or no longer permitted. -This distinction matters for both security and client behavior. A refresh request can fail because a session expired, a refresh credential is invalid or consumed, the device context does not match, or the underlying chain is no longer usable. The client should treat an unsuccessful refresh as a need to authenticate again, not as an invitation to retry the same credential indefinitely. +This distinction matters for both security and client behavior. A refresh request can fail because a session expired, a refresh token is invalid or consumed, the device context does not match, or the underlying chain is no longer usable. The client should treat an unsuccessful refresh as a need to authenticate again, not as an invitation to retry the same credential indefinitely. ## Mode-dependent strategies @@ -48,7 +48,7 @@ The refresh operation: 1. Validates the refresh token, tenant, and device binding. 2. Verifies that the token is associated with a valid refresh chain and is not session-bound. 3. Resolves the authenticated user's current identity information and claims. -4. Generates replacement access and refresh credentials. +4. Generates replacement access and refresh tokens. 5. Atomically consumes the previous refresh token and persists its replacement. The new JWT access token can be validated independently by Resource APIs. @@ -91,7 +91,7 @@ A successful **NoOp** is not a failed refresh: the existing state was valid, but ## Refresh-token rotation -Rotation replaces a valid refresh credential while preserving its association with the existing authentication context. +Rotation replaces a valid refresh token while preserving its association with the existing authentication context. ```text Refresh token @@ -155,7 +155,7 @@ A successful refresh does not create a new authentication session. The session identifier remains metadata and is not delivered as an opaque authentication credential. -An expired access token does not prevent renewal when the refresh credential and its associated session lineage remain valid. +An expired access token does not prevent renewal when the refresh token and its associated session lineage remain valid. However, a revoked, expired, or otherwise invalid session cannot be renewed through refresh. @@ -163,7 +163,7 @@ Session touch and refresh-token rotation are separate persistence operations. Th ### PureJwt: session-independent token continuity -PureJwt refresh validates the refresh credential and its associated refresh chain without resolving an authentication session. +PureJwt refresh validates the refresh token and its associated refresh chain without resolving an authentication session. The previous refresh token is consumed and replaced together with a new JWT access token. @@ -171,31 +171,35 @@ No session root, session chain, or authentication session is created as part of Previously issued access tokens remain subject to their own expiration and validation requirements. -## Request resolution and response delivery +## Request Resolution and Response Transport -The refresh endpoint uses the effective `AuthFlowContext` to resolve the authentication mode, tenant, device and available authentication context. +The effective authentication mode determines how authentication continuity is established. -In PureOpaque and Hybrid, the session credential participates in authentication continuation. +In PureOpaque and Hybrid, the session ID participates in authentication continuation. -In SemiHybrid, the refresh credential identifies the associated session lineage, which must be validated authoritatively. +In SemiHybrid, the refresh token identifies the associated session lineage, which must be validated authoritatively. -In PureJwt, continuation is based on the session-independent refresh chain. +PureJwt uses a session-independent refresh chain. -Refresh-token input is resolved exclusively from the effective refresh grant delivery configuration. +Refresh tokens are resolved exclusively from their effective transport configuration. -- When cookie delivery is active, the configured refresh cookie is used. -- When header delivery is active, the configured refresh request header and header format are used. -- When refresh grant delivery is disabled, no refresh credential is resolved. +- When cookie transport is active, the configured refresh cookie is used. +- When header transport is active, the configured request header and header format are used. +- When refresh token transport is disabled, no refresh token is resolved. -The default refresh credential name is `uar` for both cookie and header delivery. +The default refresh token name is `uar` for both cookie and header transport. -The `X-Refresh-Token` header is not an implicit credential source. It is accepted only when explicitly configured as the refresh grant header. +The `X-Refresh-Token` header is not an implicit token source. It is accepted only when explicitly configured. -Missing, malformed, or duplicate refresh credentials are rejected without falling back to another transport. +Missing, malformed, or duplicate refresh tokens are rejected without falling back to another transport. -On success, the endpoint chooses a **primary credential** according to the refresh response policy, rather than automatically writing every credential returned by the flow. The refresh token is written separately when permitted by the response policy and when a replacement exists. Actual cookie/header placement is determined by the effective response configuration and application profile. +On success, the endpoint selects the applicable primary surrogate according to the refresh response policy. A replacement refresh token is written separately when permitted by the policy and when one has been issued. -The HTTP endpoint returns **`204 No Content`** on successful refresh and **`401 Unauthorized`** when continuation fails. Clients should obtain credentials from the configured response delivery mechanism rather than expecting a JSON token payload. When `Diagnostics.EnableRefreshDetails` is enabled, the endpoint also writes the refresh outcome through its diagnostic response writer. +The HTTP endpoint returns **`204 No Content`** on successful refresh and **`401 Unauthorized`** when continuation fails. + +Clients obtain newly issued tokens through the effective transport configuration rather than expecting a JSON token payload. + +When `Diagnostics.EnableRefreshDetails` is enabled, the endpoint also writes the refresh outcome through its diagnostic response writer. ## Outcomes and client expectations @@ -203,8 +207,8 @@ The HTTP endpoint returns **`204 No Content`** on successful refresh and **`401 | --- | --- | --- | | `NoOp` | Existing session is valid; no touch was necessary | Continue normally | | `Touched` | Existing session activity was updated | Continue normally | -| `Rotated` | Refresh token was consumed and replacement credentials issued | Replace stored credentials with the new values | -| `ReauthRequired` | The flow could not safely continue | Stop using the failed refresh credential and require authentication | +| `Rotated` | Refresh token was consumed and replacement surrogates issued | Replace stored surrogates with the new values | +| `ReauthRequired` | The flow could not safely continue | Stop using the failed refresh token and require authentication | `RefreshFlowResult` also recognizes `Success` as a successful outcome, although the mode-specific branches described above return `NoOp`, `Touched`, `Rotated` or `ReauthRequired`. @@ -234,7 +238,7 @@ The useful distinction is not simply *stateful versus stateless*. It is **what m - `PureOpaque` continues an existing server-side session, with conditional activity updates. - `Hybrid` requires session validity and successful refresh-token rotation. - `SemiHybrid` describes JWT renewal with server-managed lifecycle state. -- `PureJwt` rotates refresh credentials through a session-independent refresh chain. +- `PureJwt` rotates refresh tokens through a session-independent refresh chain. Refresh does not authenticate a user again. It extends the usefulness of an already established authentication context only within the boundaries of the selected mode and configured security policies. diff --git a/docs/content/configuration/advanced-configuration.md b/docs/content/configuration/advanced-configuration.md index e3051792..2a90dbb3 100644 --- a/docs/content/configuration/advanced-configuration.md +++ b/docs/content/configuration/advanced-configuration.md @@ -310,11 +310,11 @@ UltimateAuth applies authentication-mode-specific defaults when resolving effect These defaults adapt the authentication infrastructure to the selected mode without requiring mode-specific application code. -### Mode-defined credential behavior +### Mode-defined surrogate behavior -The effective authentication mode determines which credential types are issued and how they participate in authentication. +The effective authentication mode determines which surrogate kinds are supported and how they participate in authentication. -JWT and opaque credential issuance are not independent mode-selection flags. +JWT and opaque token issuance are not independent mode-selection flags. Applications select the authentication strategy through `AuthMode` or `ApplicationProfileModes`. @@ -327,7 +327,7 @@ Applications select the authentication strategy through `AuthMode` or `Applicati | SemiHybrid | JWT authentication with server-managed session lineage | | PureJwt | Session-independent JWT authentication without session touch | -Mode defaults also configure applicable credential delivery and cookie lifetime behavior. +Mode defaults also configure applicable surrogate transport and cookie lifetime behavior. ### Global values and mode overrides @@ -660,13 +660,15 @@ These interfaces have different responsibilities. | `ISessionValidator` | Validate the session | | `IDeviceResolver` | Resolve device information | -The server resolves authentication credentials through a unified, mode-aware credential resolution mechanism. +UltimateAuth uses a unified surrogate resolution mechanism. -The effective authentication mode determines the primary credential, while the effective grant delivery configuration determines its transport. +The effective authentication mode determines the primary surrogate, while the effective transport configuration determines how it is resolved. -Each grant is resolved exclusively from its configured cookie or request header. Alternative credential sources are not used as fallbacks. +Each surrogate is resolved exclusively from its configured cookie or request header. Alternative sources are not used as fallbacks. -This keeps credential resolution consistent across authentication handlers, session context resolution, validation endpoints, and refresh flows. +Surrogate resolution extracts authentication data from a request. It does not establish authenticity or validity. + +This separation keeps resolution consistent across authentication handlers, session context resolution, validation endpoints, and refresh flows. ### Custom Session Validator @@ -1087,13 +1089,13 @@ It does not replace `IEffectiveAuthModeResolver`. ### Configuring incompatible authentication components -Supporting all four authentication modes does not mean that every issued credential can be accepted by every Resource API configuration. +Supporting all four authentication modes does not mean that every issued token can be accepted by every Resource API configuration. -Ensure that the issuing server, Resource API, cryptographic settings and credential delivery configuration are compatible. +Ensure that the issuing server, Resource API, cryptographic settings, and surrogate transport configuration are compatible. Mode changes should be applied as coordinated configuration changes. -Existing credentials are not automatically converted to the new authentication mode. +Existing tokens are not automatically converted to the new authentication mode. ### Replacing Security Components Unnecessarily @@ -1140,6 +1142,7 @@ Validate their results through tests and appropriate application safeguards. | Tenant identification | `ITenantIdResolver` | Resolve tenant identifiers | | Session validation | `ISessionValidator` | Validate sessions | | Session identification | `ISessionIdResolver` | Resolve session identifiers | +| Surrogate resolution | `ISurrogateResolver` | Resolve incoming authentication surrogates | | Device identification | `IDeviceResolver` | Resolve device information | | Signing keys | `IJwtSigningKeyProvider` | Supply JWT signing keys | | Lifecycle events | `UAuthEvents` | Observe completed authentication operations | diff --git a/docs/content/configuration/overview.md b/docs/content/configuration/overview.md index bd4c824c..d3244bd7 100644 --- a/docs/content/configuration/overview.md +++ b/docs/content/configuration/overview.md @@ -38,7 +38,7 @@ UltimateAuth │ └── UAuthServerOptions │ ├── Core-defined options │ ├── Authentication mode restrictions -│ ├── Grant delivery and credential resolution +│ ├── Surrogate transport and resolution │ ├── Endpoints │ ├── Hub configuration │ ├── Credential policies @@ -119,9 +119,9 @@ UltimateAuth separates configuration according to the component responsible for | Component | Configuration responsibility | |---|---| -| Server | Authentication flows, credential issuance, lifecycle, and security policies | -| Client | Application integration, credential handling, navigation, and automatic refresh | -| Resource API | Incoming credential validation and protected resource authentication | +| Server | Authentication flows, token issuance, lifecycle, and security policies | +| Client | Application integration, surrogate handling, navigation, and automatic refresh | +| Resource API | Incoming surrogate validation and protected resource authentication | Shared authentication contracts and domain concepts are provided by UltimateAuth Core. @@ -157,7 +157,7 @@ This keeps configuration ownership explicit and allows UltimateAuth to resolve e | `HubDeploymentMode` | Hub deployment arrangement | | `Hub` | Hub-specific configuration | | `Cookie` | Authentication cookie behavior | -| `GrantDelivery` | Authentication grant delivery and credential transport | +| `Transport` | Authentication surrogate transport | | `Endpoints` | Server endpoint configuration | | `CredentialSessionPolicy` | Session handling after credential changes and recovery | | `ResetCredential` | Credential reset configuration | @@ -167,7 +167,7 @@ This keeps configuration ownership explicit and allows UltimateAuth to resolve e | `LoginIdentifiers` | Identifier types permitted for login | | `UserProfile` | User profile behavior | | `Pagination` | Pagination limits and defaults | -| `AuthResponse` | Authentication response behavior | +| `Redirect` | Authentication-related navigation behavior | | `Navigation` | Navigation and redirect behavior | | `Diagnostics` | Diagnostic configuration | | `Events` | Server event configuration | @@ -460,7 +460,7 @@ UltimateAuth supports four authentication modes: All modes share the same application-level authentication programming model. -The selected mode determines the underlying credential, validation and lifecycle strategy. +The selected mode determines the underlying surrogate, validation, and lifecycle strategy. Hybrid is the recommended general-purpose starting point when no specialized authentication requirements have been identified. @@ -643,7 +643,7 @@ builder.Services.AddUltimateAuthResourceApi(options => Key = builder.Configuration["UltimateAuth:JwtVerificationKey"]! }); - options.Auth.AccessToken.DeliveryMode = GrantDeliveryMode.Header; + options.Auth.AccessToken.Mode = SurrogateTransport.Header; }); ``` @@ -685,7 +685,7 @@ The server registers validators for areas including: - Token settings. - Multi-tenancy. - User identifiers. -- Grant delivery and credential resolution. +- Surrogate transport and resolution. - Pagination. For example, the server validates that: diff --git a/docs/content/configuration/server-options.md b/docs/content/configuration/server-options.md index efd226f9..eedd9cfc 100644 --- a/docs/content/configuration/server-options.md +++ b/docs/content/configuration/server-options.md @@ -98,13 +98,12 @@ It composes authentication configuration into logical groups according to their | `ApplicationProfileModes` | Application-profile-specific mode selection | | `AllowedModes` | Restrict permitted authentication modes | | `Session` | Session lifecycle and security policies | -| `Token` | Credential lifetimes and token configuration | +| `Token` | Token lifetimes and renewal behavior | +| `Transport` | Authentication surrogate transport | | `Validation` | Authentication validation requirements | | `Login` | Login and lockout behavior | | `Pkce` | PKCE flow configuration | | `DeviceLimits` | Active-device admission limits | -| `GrantDelivery` | Authentication credential delivery | -| `SessionResolution` | Incoming session credential resolution | | `Cookie` | Cookie configuration | | `Endpoints` | Endpoint exposure and configuration | | `MultiTenant` | Tenant resolution | @@ -236,11 +235,11 @@ See [Advanced Configuration](/docs/configuration/advanced-configuration) for the ## 5. Token Options -`options.Token` configures authentication credential lifetimes and token-related behavior. +`options.Token` configures token lifetimes and renewal behavior. -UltimateAuth determines which credential types are issued according to the effective authentication mode. +The effective authentication mode determines which surrogate kinds are supported and which token formats are used. -Applications do not need to enable JWT or opaque credential issuance independently. +Applications do not need to enable JWT or opaque token issuance independently. ```csharp builder.Services.AddUltimateAuthServer(options => @@ -281,15 +280,13 @@ For example: Configuring a credential lifetime does not enable a credential type that is unsupported by the effective mode. -### Session identifiers and credentials +### Session identifiers and surrogates -The purpose of a session identifier depends on the authentication mode. +In PureOpaque and Hybrid, the session identifier acts as an opaque authentication surrogate. -In PureOpaque and Hybrid, the session identifier is an opaque authentication credential. +In SemiHybrid, the session identifier is carried as metadata within the JWT and identifies the associated session lineage. -In SemiHybrid, the session identifier represents session lineage metadata. - -A metadata-only session identifier must never be accepted as an opaque authentication credential. +A metadata-only session identifier must never be accepted as an independent authentication surrogate. ### Refresh Token Concurrency Window @@ -478,7 +475,7 @@ The mode override runs after the built-in mode defaults. See [Advanced Configuration](/docs/configuration/advanced-configuration) for details. -## 7/A. Validation Options +## 8. Validation Options `options.Validation` configures authentication validation requirements for applicable UltimateAuth server operations. @@ -548,7 +545,7 @@ PureJwt cannot satisfy a HubValidated requirement because it has no associated a See [Request Lifecycle](/docs/fundamentals/request-lifecycle) for validation behavior. -## 8. Endpoint Options +## 9. Endpoint Options `options.Endpoints` controls endpoint paths, feature groups, and individual action restrictions. @@ -637,57 +634,55 @@ For example, an application that delegates user provisioning to administrators m Endpoint exposure is a separate concern from authorization: an exposed endpoint must still enforce the applicable security policy. -## 9. Credential Resolution +## 10. Surrogate Resolution -UltimateAuth resolves incoming authentication credentials according to the effective authentication mode and grant delivery configuration. +UltimateAuth resolves incoming authentication surrogates according to the effective authentication mode and transport configuration. -Each authentication grant has a single configured transport. Credential resolution does not use an ordered list of alternative sources. +Each surrogate has a single configured transport. Alternative sources are not used as fallbacks. -### Primary Authentication Credential +### Primary Surrogate -The effective authentication mode determines which credential establishes the authentication identity. +The effective authentication mode determines which surrogate is used to establish the authentication identity. -| Authentication mode | Primary credential | +| Authentication mode | Primary surrogate | |---|---| -| PureOpaque | Opaque session credential | -| Hybrid | Opaque session credential | +| PureOpaque | Opaque session ID | +| Hybrid | Opaque session ID | | SemiHybrid | JWT access token | | PureJwt | JWT access token | -### Credential Transport - -Incoming credentials are resolved from the configured cookie or request header. +### Incoming Transport -- Cookie delivery reads the configured authentication cookie. -- Header delivery reads the effective request header using the expected header format. -- Query-string credential resolution is not supported. -- Missing or invalid credentials do not trigger fallback to another transport. -- Duplicate credential values are rejected. +Surrogates are resolved exclusively from the configured cookie or request header. -Refresh tokens are resolved separately using their own grant delivery configuration. +- Cookie transport reads the configured authentication cookie. +- Header transport reads the effective request header using the expected header format. +- Query-string transport is not supported. +- Missing or invalid values do not trigger fallback to another transport. +- Duplicate surrogate values are rejected. -### Default Request Header Names +Refresh tokens are resolved separately using their own transport configuration. -When header delivery is active, the following request header names are used by default: +### Default Request Headers -| Grant | Request header | +| Surrogate | Request header | |---|---| -| Session | `uas` | -| Access token | `Authorization` | -| Refresh token | `uar` | +| Session ID | `uas` | +| Access Token | `Authorization` | +| Refresh Token | `uar` | -Access tokens are presented using the `Bearer` authorization scheme. Session and refresh token headers follow their configured header formats. +Access tokens use the Bearer format in the default authorization header. -### Configuration Consistency +### Transport Collisions -Active grants must not share the same cookie name, request header name, or response header name within their respective transport namespaces. +Active surrogates must not share the same cookie name, request header name, or response header name within their respective transport namespaces. -Conflicting effective grant configurations are rejected. +Conflicting effective transport configurations are rejected. -See the Grant Delivery section for configuration examples and delivery defaults. +See [Surrogate Transport and Authentication Responses](#22-surrogate-transport-and-authentication-responses) for configuration examples. -## 10. Cookie Configuration +## 11. Cookie Configuration `options.Cookie` controls cookies used for authentication credentials. @@ -755,7 +750,8 @@ Cookie settings interact with: For cross-site deployments, configure cookie behavior together with CORS and the relevant browser security requirements. -## 11. Hub Deployment Mode + +## 12. Hub Deployment Mode `options.HubDeploymentMode` describes how UAuthHub is deployed relative to the application. @@ -811,7 +807,7 @@ External deployment requires careful coordination of cookie policies, redirects, The deployment mode influences authentication transport behavior; it is not merely descriptive metadata. -## 12. Hub Options +## 13. Hub Options `options.Hub` configures UAuthHub integration. @@ -842,22 +838,6 @@ Hub artifacts support authentication orchestration and should generally be short Only trusted origins should be included in `AllowedClientOrigins`. -## 13. Primary Credential Selection - -UltimateAuth determines the primary authentication credential from the effective authentication mode. - -| Authentication mode | Primary credential | -|---|---| -| PureOpaque | Session | -| Hybrid | Session | -| SemiHybrid | JWT access token | -| PureJwt | JWT access token | - -Primary credential selection is not based on request paths, UI/API classification, or the presence of additional authentication headers. - -The effective grant delivery configuration determines how the selected credential is transported. - -For more information, see [Authentication Modes](/docs/fundamentals/auth-modes). ## 14. Credential Session Policy @@ -1250,93 +1230,86 @@ The application should return valid, trusted navigation destinations. Avoid constructing redirects from unvalidated user-controlled URLs. -## 22. Credential Delivery and Authentication Responses +## 22. Surrogate Transport and Authentication Responses + +UltimateAuth separates surrogate transport from navigation behavior. + +The effective authentication mode determines which surrogates are supported. Transport configuration determines how those surrogates are carried between applications. -UltimateAuth separates credential delivery from navigation behavior. +### Transport Configuration -Authentication grant delivery and incoming credential transport are configured through `options.GrantDelivery`: +Surrogate transport is configured through `options.Transport`: ```csharp -options.GrantDelivery.Default -options.GrantDelivery.Session -options.GrantDelivery.AccessToken -options.GrantDelivery.RefreshToken +options.Transport.Default +options.Transport.SessionId +options.Transport.AccessToken +options.Transport.RefreshToken ``` -Each grant can have its own delivery configuration. +Each surrogate can have its own transport configuration. -### Mode-Specific Delivery Defaults +### Default Transports -| Authentication Mode | Session | Access Token | Refresh Token | +| Authentication mode | Session ID | Access Token | Refresh Token | |---|---|---|---| -| PureOpaque | Cookie | Not issued | Not issued | +| PureOpaque | Cookie | — | — | | Hybrid | Cookie | Header | Cookie | -| PureJwt | Not issued | Header | Cookie | +| SemiHybrid | — | Header | Cookie | +| PureJwt | — | Header | Cookie | -These are the built-in defaults before application-profile adaptation and explicit configuration. +These defaults apply to supported surrogates. Actual token issuance remains subject to the effective authentication configuration. -For MAUI, grants that would otherwise use cookie delivery default to header delivery. +For .NET MAUI, supported surrogates default to header transport. -### Configure Grant Delivery +### Configure Surrogate Transport ```csharp builder.Services.AddUltimateAuthServer(options => { - options.AuthMode = UAuthMode.PureJwt; - - options.GrantDelivery.AccessToken.Mode = GrantDeliveryMode.Header; - options.GrantDelivery.RefreshToken.Mode = GrantDeliveryMode.Cookie; + options.Transport.AccessToken.Mode = SurrogateTransport.Header; + options.Transport.RefreshToken.Mode = SurrogateTransport.Cookie; }); ``` -An explicit per-grant delivery mode takes precedence over the global delivery default and the built-in mode-specific default. +An explicit per-surrogate transport setting takes precedence over the global transport preference and built-in defaults. + +Transport configuration does not enable surrogate kinds that are unsupported by the effective authentication mode. -Only credentials available in the selected authentication mode can be configured for delivery. +`SurrogateTransport.Body` is reserved and is not currently supported. ### Request and Response Headers -Request and response headers serve different purposes. +Request and response header names do not necessarily match. -Response headers deliver newly issued credentials to the client. Request headers present credentials for authentication or refresh. +Response headers deliver newly issued tokens to the client. Request headers present those tokens for authentication or renewal. -| Grant | Default response header | Default request header | +| Surrogate | Default response header | Default request header | |---|---|---| -| Session | `uas` | `uas` | -| Access token | `uat` | `Authorization` | -| Refresh token | `uar` | `uar` | +| Session ID | `uas` | `uas` | +| Access Token | `uat` | `Authorization` | +| Refresh Token | `uar` | `uar` | -The access token response header can be customized independently of the incoming `Authorization: Bearer` convention. +Header names are case-insensitive. Active surrogates must use distinct header names within each direction. -Session and refresh token headers use their configured header names and formats in both directions. +### Redirect Behavior -Header names are case-insensitive. Active grants must use distinct header names within each direction. - -### Redirect Configuration - -Login and logout redirect behavior is configured separately: +Redirect configuration is independent of surrogate transport. ```csharp -options.Redirect.Login -options.Redirect.Logout +options.Redirect.Login.SuccessRedirect = "/dashboard"; +options.Redirect.Logout.SuccessRedirect = "/"; ``` -A redirect is a navigation concern, not an authentication credential. - -### Login Transport Discovery - -The client discovers whether the effective server configuration supports navigation-based login or requires fetch-based submission. - -Header-delivered access tokens require a transport that allows the client to observe and process the authentication response. - -Applications should normally allow the client to select the appropriate login transport automatically. +A redirect is a navigation decision, not an authentication or revocation mechanism. -### Security Considerations +### Compatibility -Credential delivery must be compatible with the selected authentication mode, application profile, and deployment topology. +Surrogate transport must be compatible with the selected authentication mode, application profile, and deployment topology. -Browser cookie restrictions, CORS policies, trusted origins, and token storage behavior remain relevant regardless of the selected transport. +Applications using custom cookie or header handling should ensure that their request-side behavior matches the effective transport configuration. -For additional client-side behavior, see [Authentication](/docs/client-sdk/authentication). +For the distinction between surrogates, tokens, and transport, see [Core Concepts](/docs/fundamentals/core-concepts). ## 23. Diagnostics Options diff --git a/docs/content/fundamentals/application-profiles.md b/docs/content/fundamentals/application-profiles.md index 5ee5754b..8908c6cb 100644 --- a/docs/content/fundamentals/application-profiles.md +++ b/docs/content/fundamentals/application-profiles.md @@ -1,6 +1,6 @@ --- title: Application Profiles -order: 5 +order: 6 group: fundamentals --- diff --git a/docs/content/fundamentals/auth-model.md b/docs/content/fundamentals/auth-model.md index 388536c8..061c7597 100644 --- a/docs/content/fundamentals/auth-model.md +++ b/docs/content/fundamentals/auth-model.md @@ -1,6 +1,6 @@ --- title: Authentication Model -order: 2 +order: 3 group: fundamentals --- diff --git a/docs/content/fundamentals/auth-modes.md b/docs/content/fundamentals/auth-modes.md index 10c32e5e..24fbcfb0 100644 --- a/docs/content/fundamentals/auth-modes.md +++ b/docs/content/fundamentals/auth-modes.md @@ -1,6 +1,6 @@ --- title: Authentication Modes -order: 4 +order: 5 group: fundamentals --- diff --git a/docs/content/fundamentals/core-concepts.md b/docs/content/fundamentals/core-concepts.md new file mode 100644 index 00000000..d27cd47f --- /dev/null +++ b/docs/content/fundamentals/core-concepts.md @@ -0,0 +1,157 @@ +--- +title: Core Concepts +order: 2 +group: fundamentals +--- + +# Core Concepts + +Authentication is more than signing in, issuing a token, or checking whether a request is authorized. It is an ongoing relationship between an identity, an application, and the authority responsible for establishing trust. + +UltimateAuth builds this relationship around a small set of well-defined concepts. These concepts remain consistent across different applications, authentication modes, and deployment architectures. + +Understanding them makes it easier to reason about authentication without getting lost in its implementation details. + +## Identity, Identifier, and Credential + +Authentication begins with three closely related but distinct concepts. + +| Concept | Meaning | +|---|---| +| **Identity** | Who the user is within the system. | +| **Identifier** | How the user is recognized, such as a username or email address. | +| **Credential** | What the user presents to establish proof of their identity. | + +An identifier helps the system find an identity. A credential helps establish trust in that identity. + +Keeping these concepts separate allows an identity to evolve independently of the identifiers and credentials associated with it. + +## Surrogate — Continuing Authentication + +Once an identity has been authenticated, repeatedly presenting the original credential would be unnecessary and would increase its exposure. + +The concept of a **surrogate** aims to address this. + +A surrogate is system-issued secondary authentication data that substitutes for the original credential during subsequent authenticated interactions. + +Think of a surrogate as a stunt double. Instead of exposing the original actor to every risky scene, a substitute takes their place. Similarly, a surrogate allows authentication to continue without repeatedly exposing the original credential. + +Unlike the original credential, a surrogate can have its own lifetime, restrictions, and renewal rules. Depending on the authentication mode, it may also be independently invalidated. + +Users do not need to know, understand, or remember their surrogates. UltimateAuth and the participating applications manage them on the user's behalf. + +### Surrogates and Tokens + +A **surrogate** describes the role of authentication data. A **token** is its concrete representation. + +UltimateAuth recognizes three kinds of authentication surrogates: + +| Surrogate | Purpose | +|---|---| +| **Session ID** | References a server-managed authenticated session. | +| **Access Token** | Provides authentication for subsequent requests. | +| **Refresh Token** | Renews authentication without presenting the original credential again. | + +Not every authentication mode uses all three kinds. + +A token may be opaque or self-contained, such as a JWT. Its format does not define its purpose. + +Similarly, a session identifier carried only as metadata is not a surrogate unless it can itself be used for authentication. + +## Authority and Lineage + +Authentication requires an **authority** responsible for establishing trust and defining the rules under which that trust continues. + +In UltimateAuth, the authentication authority governs authentication, token issuance, and the applicable lifecycle policies. + +Authority does not necessarily require a server-side lookup for every request. Different authentication modes allow trust to be evaluated in different ways. + +When server-managed authentication continuity is required, UltimateAuth organizes it through a structure called **lineage**. + +Lineage consists of three levels: + +- **Root** — The user-level authentication authority. +- **Chain** — A continuous authentication lifecycle, typically associated with a device context. +- **Session** — An individual authenticated instance within a chain. + +This structure allows UltimateAuth to distinguish between renewing a session, ending a particular authentication lifecycle, and managing authentication at the user level. + +Not every authentication mode requires lineage. + +## Flow, Mode, and Application Profile + +UltimateAuth separates three dimensions of authentication that are often tightly coupled in traditional implementations. + +| Concept | Question it answers | +|---|---| +| **Flow** | What authentication operation is taking place? | +| **Mode** | How is authentication established and maintained? | +| **Application Profile** | What kind of application is participating? | + +A login, refresh, or logout is a **flow**. + +PureOpaque, Hybrid, SemiHybrid, and PureJwt are authentication **modes**. + +Blazor, .NET MAUI, web servers, and Resource APIs represent different **application profiles**. + +These dimensions work together without being treated as the same concern. A login remains a login regardless of the selected authentication mode or the application initiating it. + +This separation is what allows UltimateAuth to provide a unified authentication experience across different environments. + +## Transport + +Authentication data needs a way to travel between participating applications. + +**Transport** defines how a surrogate is carried, such as through an HTTP cookie or header. + +Transport is independent of the surrogate's purpose and token format. An access token does not become a different kind of surrogate simply because it is transported through a cookie instead of a header. + +UltimateAuth uses application-aware defaults to reduce configuration complexity while allowing developers to customize transport when their architecture requires it. + +## Validation, Authorization, and Policy + +Receiving authentication data does not automatically establish trust. + +UltimateAuth distinguishes between three responsibilities: + +- **Validation** determines whether authentication evidence can be trusted. +- **Authorization** determines whether an authenticated identity is permitted to perform an operation. +- **Policy** defines the rules and conditions under which these decisions are made. + +This distinction allows authentication to remain consistent while applications define their own security requirements. + +## Tenant and Device + +Authentication also takes place within a context. + +A **tenant** represents an isolation boundary within an application or system. + +A **device** represents the client context associated with an authenticated interaction. It is not necessarily a physical device; it may represent a browser, an application installation, or another client environment. + +UltimateAuth treats tenant and device context as first-class architectural concerns rather than features that must be added around authentication afterward. + +## Bringing It All Together + +Consider a user signing in to an application. + +The user provides an identifier and a credential. The authentication authority establishes trust in the identity and issues the appropriate surrogates. Those surrogates are transported according to the application's configuration and validated during subsequent interactions. + +Depending on the authentication mode, UltimateAuth may also maintain a server-managed lineage to govern authentication continuity. + +The application can then make authorization decisions without requiring the user to repeatedly prove their identity. + +The underlying mechanisms may differ, but the conceptual model remains the same. + +## One Model, Different Applications + +The purpose of these concepts is not to introduce more terminology for developers to memorize. + +It is to make authentication easier to understand, configure, and reason about. + +UltimateAuth aims to keep the developer experience simple without making the underlying security architecture simplistic. By separating concerns that have different responsibilities, it allows applications to evolve without requiring authentication to be redesigned each time. + +You do not need to understand every internal mechanism to start using UltimateAuth. These concepts provide a foundation that becomes increasingly useful as your application grows. + +## What's Next? + +Explore how these concepts work together in the [Authentication Model](/docs/fundamentals/auth-model). diff --git a/docs/content/fundamentals/flow-based-auth.md b/docs/content/fundamentals/flow-based-auth.md index 5034555d..c95c85b1 100644 --- a/docs/content/fundamentals/flow-based-auth.md +++ b/docs/content/fundamentals/flow-based-auth.md @@ -1,6 +1,6 @@ --- title: Flow-Based Authentication -order: 3 +order: 4 group: fundamentals --- diff --git a/docs/content/fundamentals/request-lifecycle.md b/docs/content/fundamentals/request-lifecycle.md index 6292231b..f426a04e 100644 --- a/docs/content/fundamentals/request-lifecycle.md +++ b/docs/content/fundamentals/request-lifecycle.md @@ -1,6 +1,6 @@ --- title: Request Lifecycle -order: 7 +order: 8 group: fundamentals --- diff --git a/docs/content/fundamentals/runtime-architecture.md b/docs/content/fundamentals/runtime-architecture.md index 5a0f34fa..5b895571 100644 --- a/docs/content/fundamentals/runtime-architecture.md +++ b/docs/content/fundamentals/runtime-architecture.md @@ -1,6 +1,6 @@ --- title: Runtime Architecture -order: 6 +order: 7 group: fundamentals --- @@ -20,7 +20,7 @@ At a high level, UltimateAuth consists of several cooperating layers: - **Core:** Shared authentication contracts, models, and foundational abstractions. - **Server:** Authentication operations, security decisions, credential management, and persistence coordination. -- **Client:** Client-side integration, authentication requests, and credential lifecycle handling. +- **Client:** Client-side integration, authentication requests, and surrogate lifecycle handling. - **UAuthHub:** The application hosting UltimateAuth's authentication endpoints and services. - **Resource applications:** Applications and APIs that consume authenticated identity and enforce authorization. @@ -103,7 +103,7 @@ Its responsibilities include: - Session and token lifecycle operations. - Authentication security decisions. - Coordination with persistence providers. -- Credential issuance and validation. +- Surrogate issuance and validation. - Integration with server-side authorization infrastructure. The Server layer contains multiple cooperating services rather than one universal authentication engine responsible for every decision. @@ -125,7 +125,7 @@ Depending on the supported runtime and configuration, client integration may han - Initiating authentication flows. - Communicating with UAuthHub. - Processing authentication outcomes. -- Managing supported credential delivery mechanisms. +- Managing supported surrogate delivery mechanisms. - Coordinating authentication state with the application. - Integrating authenticated requests with protected resources. @@ -145,7 +145,7 @@ A Blazor Server application executes application logic on the server while maint UltimateAuth accounts for these differences through runtime-specific integrations and Application Profiles. -The authentication model remains shared even when the implementation of credential transport or application state differs. +The authentication model remains shared even when the implementation of surrogate transport or application state differs. See [Application Profiles](/docs/fundamentals/application-profiles). @@ -161,7 +161,7 @@ Depending on the deployment, UAuthHub can be responsible for: - Resolving the applicable tenant and authentication context. - Executing authentication flows. - Managing credentials and sessions. -- Issuing authentication credentials. +- Issuing authentication surrogates. - Applying configured authentication policies. - Exposing the supported authentication endpoints. @@ -216,14 +216,14 @@ UltimateAuth supports three validation paths across its four authentication mode #### Server-authoritative validation -PureOpaque and Hybrid require authoritative validation of the presented opaque session credential. +PureOpaque and Hybrid require authoritative validation of the presented opaque session ID. In a distributed deployment, a Resource API delegates session validation to UAuthHub. ```text Client | - | Opaque session credential + | Opaque session ID v Resource API | @@ -311,7 +311,7 @@ Authentication establishes who the caller is. Authorization determines whether that caller may perform the requested operation. -A valid authentication credential does not automatically grant permission to every resource. +A valid authentication evidence does not automatically grant permission to every resource. Resource applications must continue to enforce their authorization requirements through the applicable framework and application policies. @@ -369,9 +369,9 @@ A distributed deployment separates the authentication host from one or more reso Application Services ``` -In this model, clients communicate with UAuthHub for the applicable authentication operations and access resource APIs using the supported credentials. +In this model, clients communicate with UAuthHub for the applicable authentication operations and access resource APIs using the supported surrogates. -Resource APIs validate those credentials according to the configured authentication mode. +Resource APIs validate those surrogates according to the configured authentication mode. This architecture supports independently deployed applications while maintaining shared authentication policies and identity infrastructure. @@ -489,7 +489,7 @@ MAUI Application │ ▼ │ UAuthHub │ - ├── Secure Credential Storage + ├── Secure Token Storage │ └── Resource API Client │ @@ -497,9 +497,9 @@ MAUI Application Resource API ``` -Native applications can use platform-specific secure storage for sensitive credentials. +Native applications can use platform-specific secure storage for sensitive tokens. -Their credential delivery and persistence requirements differ from browser applications. +Their surrogate transport and persistence requirements differ from browser applications. Hybrid can provide a suitable model for applications requiring refresh-token continuity and centralized session control. @@ -521,7 +521,7 @@ For example, Blazor Server and Blazor WebAssembly applications may share: At the same time, they may require different implementations for: -- Credential storage. +- Token storage. - HTTP communication. - Browser interaction. - Server-side service access. @@ -575,7 +575,7 @@ For example, PureOpaque and Hybrid require session infrastructure for authentica SemiHybrid requires session infrastructure for authoritative validation and lifecycle management, but Standard JWT validation in a Resource API does not require access to that infrastructure. -PureJwt does not require session lineage infrastructure. When refresh tokens are enabled, it still requires refresh-token persistence for secure credential renewal and revocation. +PureJwt does not require session lineage infrastructure. When refresh tokens are enabled, it still requires refresh-token persistence for secure token renewal and revocation. The architecture must preserve these distinctions. diff --git a/docs/content/migration/v0.2.0.md b/docs/content/migration/v0.2.0.md index 3e862b1d..e2303711 100644 --- a/docs/content/migration/v0.2.0.md +++ b/docs/content/migration/v0.2.0.md @@ -41,10 +41,10 @@ The following table focuses on commonly accessed public APIs and configuration p | `ClientProfileModes` | `ApplicationProfileModes` | | `IClientProfileDetector` | `IApplicationProfileDetector` | | `IFlowClient.LoginAsync(...)` returning `Task` | `IFlowClient.LoginAsync(...)` returning `Task` | -| `TokenResponseMode` | `GrantDeliveryMode` | -| `AuthResponse.SessionIdDelivery` | `GrantDelivery.Session` | -| `AuthResponse.AccessTokenDelivery` | `GrantDelivery.AccessToken` | -| `AuthResponse.RefreshTokenDelivery` | `GrantDelivery.RefreshToken` | +| `TokenResponseMode` | `SurrogateTransport` | +| `AuthResponse.SessionIdDelivery` | `Transport.SessionId` | +| `AuthResponse.AccessTokenDelivery` | `Transport.AccessToken` | +| `AuthResponse.RefreshTokenDelivery` | `Transport.RefreshToken` | | `AuthResponse.Login` | `Redirect.Login` | | `AuthResponse.Logout` | `Redirect.Logout` | | `ResourceApi.UAuthHubBaseUrl` | `ResourceApi.Hub.BaseUrl` | @@ -695,88 +695,111 @@ Applications relying on automatic resolution can keep their existing approach, b Client-supplied profile information must not be treated as proof of application identity or trust. -## 17. Authentication Response and Grant Delivery Redesign -**Breaking configuration change in the PureJwt implementation** +## 17. Surrogate Model and Transport Configuration -The former `AuthResponse` configuration has been replaced by two independent groups: +UltimateAuth 0.2.0 introduces a unified surrogate model. -- `GrantDelivery` configures how authentication credentials are returned. -- `Redirect` configures navigation after login and logout. +A surrogate represents system-issued secondary authentication data used to continue authentication without repeatedly presenting the original credential. -The legacy `UAuthServerOptions.AuthResponse` property is obsolete and throws `NotSupportedException` when accessed. +Session IDs used for authentication, access tokens, and refresh tokens are represented by this model. -Applications that explicitly configured authentication responses must update those settings. +See [Core Concepts](/docs/fundamentals/core-concepts) for an introduction to the terminology. -### Credential delivery +### Authentication Response Configuration -**Before:** +The former `AuthResponse` configuration has been replaced by two independent configuration groups: + +- `Transport` configures how authentication surrogates are carried. +- `Redirect` configures authentication-related navigation. + +The legacy `UAuthServerOptions.AuthResponse` property has been removed. + +### Configure Surrogate Transport + +Before: ```csharp options.AuthResponse.AccessTokenDelivery.Mode = TokenResponseMode.Header; ``` -**After:** +After: ```csharp -options.GrantDelivery.AccessToken.Mode = GrantDeliveryMode.Header; +options.Transport.AccessToken.Mode = SurrogateTransport.Header; ``` -A global preference is also available: +A global transport preference can also be configured: ```csharp -options.GrantDelivery.Default = GrantDeliveryMode.Cookie; +options.Transport.Default = SurrogateTransport.Cookie; ``` -Individual grant settings take precedence over the global preference. +Individual surrogate settings take precedence over the global preference. -When no explicit delivery preference is configured, UltimateAuth uses the effective authentication mode and application profile to select its defaults. +When no explicit preference is configured, UltimateAuth uses the effective authentication mode and application profile to determine the applicable defaults. -`GrantDeliveryMode` replaces `TokenResponseMode`. +### Transport Restrictions -The configuration is intentionally more restrictive: +- Transport settings do not enable unsupported surrogate kinds. +- Required surrogate transports cannot be disabled using `SurrogateTransport.None`. +- `SurrogateTransport.Body` is not currently supported. +- Header names and formats can be customized through the corresponding transport options. -- Delivery settings do not create credentials that are unavailable in the selected authentication mode. -- A required grant cannot be disabled using `GrantDeliveryMode.None`. -- `GrantDeliveryMode.Body` is not supported by the current grant delivery resolver. -- Header names and formats can be customized through the corresponding grant options. -- Cookie attributes remain configurable through `options.Cookie`. +Applications using built-in defaults generally do not need to configure surrogate transport explicitly. -Applications using built-in response defaults generally do not need to configure grant delivery explicitly. +Applications using custom cookie or header handling should verify compatibility between the issuing server and receiving applications. -Applications using custom cookie or header handling should verify that their request-side credential resolution matches the configured response delivery. +### Redirect Configuration -### Login and logout redirects - -**Before:** +Before: ```csharp options.AuthResponse.Login.SuccessRedirect = "/dashboard"; options.AuthResponse.Logout.SuccessRedirect = "/"; ``` -**After:** +After: ```csharp options.Redirect.Login.SuccessRedirect = "/dashboard"; options.Redirect.Logout.SuccessRedirect = "/"; ``` -Redirect configuration no longer controls credential delivery. +Redirect configuration is independent of surrogate transport. + +### Resource API Configuration -The legacy `LoginRedirectOptions` properties `FailureQueryKey`, `CodeQueryKey`, `FailureCodes`, `IncludeLockoutTiming`, and `IncludeRemainingAttempts` have been removed. +Resource API transport settings now use a shared configuration type. -Applications that used these options must remove the corresponding configuration and adapt to the supported redirect behavior. +```csharp +options.Auth.SessionId.Mode = SurrogateTransport.Cookie; +options.Auth.AccessToken.Mode = SurrogateTransport.Header; +``` -For authentication failure disclosure, review the `Login.IncludeFailureDetails` setting and the security considerations described in Section 8. +Session ID and access token transport settings are represented by `UAuthResourceSurrogateTransportOptions`. -### Automatic mode resolution +Only the settings relevant to the selected transport are required. -The selected authentication mode now determines which grants are available before delivery configuration is applied. +### Preview API Changes -Do not assume that selecting cookie or header delivery changes the authentication mode or the issued token format. +Applications migrating from earlier 0.2.0 preview versions should also update the following API references: -Review applications that previously depended on response configuration to override mode-specific credential behavior. +| Previous preview API | New API | +|---|---| +| `GrantKind` | `SurrogateKind` | +| `GrantDeliveryMode` | `SurrogateTransport` | +| `GrantDeliveryOptions` | `SurrogateTransportOptions` | +| `UAuthGrantDeliveryOptions` | `UAuthSurrogateTransportOptions` | +| `EffectiveGrantDelivery` | `EffectiveSurrogateTransport` | +| `HeaderTokenFormat` | `HeaderValueFormat` | +| `options.GrantDelivery.Session` | `options.Transport.SessionId` | +| `options.GrantDelivery.AccessToken` | `options.Transport.AccessToken` | +| `options.GrantDelivery.RefreshToken` | `options.Transport.RefreshToken` | + +The authentication mode determines surrogate availability and token format. Transport configuration does not change the authentication mode. + +Custom authentication integrations should review their surrogate resolution, response writing, and effective transport contracts. ## 18. Production Cryptographic Key Configuration diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/login-flow.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/login-flow.json index 312bfa7c..3f86b327 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/login-flow.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/login-flow.json @@ -1,7 +1,7 @@ { "Slug": "auth-flows/login-flow", "Title": "Login", - "Html": "\n\u003Cp\u003ELogging in is often described as a simple exchange: verify a password, issue a token, and consider the user authenticated. That description leaves out the part that matters most over time: \u003Cstrong\u003Ewhat exactly has been established and how can it be managed or revoked?\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth treats login as a \u003Cstrong\u003Econtrolled session-establishment flow\u003C/strong\u003E. Credential verification is essential, but it is only one stage. A successful login connects an authenticated user to a tenant, a device context, a session hierarchy, and the security state that governs future requests.\u003C/p\u003E\n\u003Cp\u003EThe central idea is straightforward:\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003ELogin establishes a session. Tokens, when enabled, are credentials issued in connection with that session\u2014not the session itself.\u003C/strong\u003E\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Cp\u003EThis distinction shapes how UltimateAuth handles device awareness, session continuity, token issuance, revocation, and authentication policy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022from-a-login-response-to-an-authentication-lifecycle\u0022\u003EFrom a login response to an authentication lifecycle\u003C/h2\u003E\n\u003Cp\u003EIn a token-centric design, login is frequently treated as the moment a token is minted. The token then becomes the primary artifact developers reason about. This works for simple scenarios, but it can make questions about devices, concurrent logins, global sign-out, and session continuity harder to express consistently.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth starts with the authentication lifecycle instead. It separates four responsibilities:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003E\u003Cstrong\u003EIdentity resolution:\u003C/strong\u003E determine which user is attempting to authenticate.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EAuthentication and security evaluation:\u003C/strong\u003E verify the credential and decide whether the attempt is allowed.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESession establishment:\u003C/strong\u003E create a managed authentication instance in the appropriate device and user context.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ECredential delivery:\u003C/strong\u003E optionally issue access and refresh tokens and deliver the applicable credentials according to the server mode and application profile.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThese responsibilities are related, but they are not interchangeable. In particular, a valid password does not by itself create a session, and a token is not the sole source of authentication state.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-session-hierarchy\u0022\u003EThe session hierarchy\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth models authentication through a hierarchy:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUser\n\u2514\u2500\u2500 Root\n \u251C\u2500\u2500 Chain (Device A)\n \u2502 \u251C\u2500\u2500 Session 1\n \u2502 \u2514\u2500\u2500 Session 2\n \u2514\u2500\u2500 Chain (Device B)\n \u2514\u2500\u2500 Session 3\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach level answers a different question:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ELevel\u003C/th\u003E\n\u003Cth\u003EResponsibility\u003C/th\u003E\n\u003Cth\u003EWhy it matters\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EUser\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EThe identity being authenticated\u003C/td\u003E\n\u003Ctd\u003ELogin identifiers can change without changing the user\u0027s internal identity.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERoot\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EThe user-level session hierarchy\u003C/td\u003E\n\u003Ctd\u003EProvides a shared context for authentication across devices.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EChain\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EA device-associated sequence of sessions\u003C/td\u003E\n\u003Ctd\u003EAllows the system to reason about continuity and device-scoped authentication.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESession\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EA particular issued authentication instance\u003C/td\u003E\n\u003Ctd\u003EProvides the concrete session identity to which authentication credentials can be related.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe hierarchy is a \u003Cstrong\u003Elogical model\u003C/strong\u003E, not a claim that every login inserts a new root or chain. A login can continue an existing active chain for the same user and device. The session subsystem determines how the resulting session is issued and persisted.\u003C/p\u003E\n\u003Cp\u003EA chain is best understood as a \u003Cstrong\u003Edevice-associated authentication lifecycle\u003C/strong\u003E, rather than as the physical device itself. The quality and stability of device identification depend on the configured device context.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022how-a-login-proceeds\u0022\u003EHow a login proceeds\u003C/h2\u003E\n\u003Cp\u003EThe standard password login flow can be viewed as the following pipeline:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EClient request\n \u2502\n \u25BC\nResolve authentication flow context\n \u2502 Tenant \u00B7 device \u00B7 effective mode \u00B7 application profile\n \u25BC\nResolve identifier \u2192 UserKey\n \u2502\n \u25BC\nCheck user eligibility and security state\n \u2502\n \u25BC\nValidate credential using registered providers\n \u2502\n \u25BC\nFind an eligible active chain for this user/device\n \u2502\n \u25BC\nLoginAuthority decision\n \u251C\u2500\u2500 Deny \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25BA Failure / lockout handling\n \u251C\u2500\u2500 Challenge \u2500\u2500\u2500\u2500\u25BA Continuation required\n \u2514\u2500\u2500 Allow\n \u2502\n \u25BC\n Establish session\n \u2502\n \u25BC\n Optionally issue access/refresh tokens\n \u2502\n \u25BC\n Dispatch login event\n \u2502\n \u25BC\n Deliver credentials / redirect or OK\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis diagram shows the responsibilities in the current flow. Some security-state operations, such as recording failed attempts, happen as part of processing a rejected login. Therefore, \u003Cstrong\u003Ethe authority decision precedes session issuance, not every possible state mutation\u003C/strong\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resolve-the-authentication-context\u0022\u003E1. Resolve the authentication context\u003C/h3\u003E\n\u003Cp\u003EBefore credential validation, UltimateAuth operates within an \u003Ccode\u003EAuthFlowContext\u003C/code\u003E. This context provides the effective tenant, device information, authentication mode, application profile, and applicable server options.\u003C/p\u003E\n\u003Cp\u003EThat context matters because the same logical login operation can have different delivery and session requirements depending on how the application is hosted and which kind of client is connecting. Login should not need to be reimplemented for each application style.\u003C/p\u003E\n\u003Cp\u003EA resolvable device ID is required by the current login orchestrator. If device identification cannot be resolved, login cannot proceed to normal session establishment.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resolve-the-login-identifier\u0022\u003E2. Resolve the login identifier\u003C/h3\u003E\n\u003Cp\u003EA user may identify themselves with a username, email address, or another identifier supported by the configured resolver. UltimateAuth translates that external identifier into an internal \u003Ccode\u003EUserKey\u003C/code\u003E through \u003Ccode\u003EILoginIdentifierResolver\u003C/code\u003E.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUser-provided identifier\n \u2502\n \u25BC\nILoginIdentifierResolver\n \u2502\n \u25BC\n UserKey\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe internal user key, not the original text entered into the login form, becomes the stable reference used by the rest of the authentication flow. This helps keep \u003Cstrong\u003Ehow a user signs in\u003C/strong\u003E separate from \u003Cstrong\u003Ewho that user is\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe identifiers actually accepted depend on the configured resolver and user data; support for a particular identifier format should not be assumed without configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022check-eligibility-and-security-state\u0022\u003E3. Check eligibility and security state\u003C/h3\u003E\n\u003Cp\u003EOnce the user is resolved, the login orchestrator retrieves their runtime state. The current implementation requires the user to exist, be permitted to authenticate (\u003Ccode\u003ECanAuthenticate\u003C/code\u003E), and not be deleted (\u003Ccode\u003EIsDeleted\u003C/code\u003E).\u003C/p\u003E\n\u003Cp\u003EIt also examines two security scopes:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EAccount state:\u003C/strong\u003E security conditions associated with the account as a whole.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EFactor state:\u003C/strong\u003E security conditions associated with the credential type being used.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EAn existing account or factor lock can stop the attempt before credential validation proceeds. Failed attempts, lockout duration, failure windows, and lock extension are governed by login options.\u003C/p\u003E\n\u003Cp\u003EThis separation is intentional: a credential can be correct while the account is not currently eligible to authenticate.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validate-the-credential\u0022\u003E4. Validate the credential\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth delegates credential verification to registered credential providers rather than embedding password comparison directly into the login orchestrator.\u003C/p\u003E\n\u003Cp\u003EFor the current standard HTTP login endpoint, the credential type is \u003Cstrong\u003EPassword\u003C/strong\u003E. The orchestrator also rejects unsupported credential types in this path. The provider architecture is extensible, but that extensibility should not be confused with a promise that OTP, passkeys, or external identity providers all use this exact password-login endpoint in v0.1.0.\u003C/p\u003E\n\u003Cp\u003EFor eligible credentials, the orchestrator checks that the credential matches the requested type, has not been deleted, is usable under its security rules, and validates the submitted secret through its provider.\u003C/p\u003E\n\u003Cp\u003EThis gives the login flow a stable orchestration model while keeping credential-specific verification behind dedicated abstractions.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022dummy-password-verification\u0022\u003EDummy Password Verification\u003C/h3\u003E\n\u003Cp\u003EAuthentication paths that skip password verification can complete with a different computational cost from paths that validate an existing password credential. This can create observable timing differences.\u003C/p\u003E\n\u003Cp\u003ETo reduce this discrepancy, UltimateAuth performs dummy password verification when no real password verification occurs, including cases involving unknown identifiers, ineligible accounts, account or factor lockouts, and missing usable credentials.\u003C/p\u003E\n\u003Cp\u003EThe dummy hash is generated using the configured password hasher and cached for reuse. Its verification result is always ignored and can never authorize a login.\u003C/p\u003E\n\u003Cp\u003EThis mitigation does \u003Cstrong\u003Enot\u003C/strong\u003E guarantee constant-time authentication. Identifier resolution, storage access, historical hash parameters, lockout processing, and server scheduling may still produce timing differences.\u003C/p\u003E\n\u003Cp\u003EBoth real and dummy verification share the same resource protection mechanism. See \u003Ca href=\u0022/docs/security/concurrency-limiting\u0022\u003EConcurrency Limiting\u003C/a\u003E for capacity and queue configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resolve-device-associated-session-continuity\u0022\u003E5. Resolve device-associated session continuity\u003C/h3\u003E\n\u003Cp\u003EBefore the authority decision, the orchestrator looks for a session chain associated with the resolved user and device. If a chain exists and its state is active under the configured idle timeout, its \u003Ccode\u003EChainId\u003C/code\u003E can be carried into session issuance.\u003C/p\u003E\n\u003Cp\u003EConceptually:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003ESame user \u002B known device \u002B active chain\n \u2502\n \u25BC\n Continue with that ChainId\n\nNo eligible active chain\n \u2502\n \u25BC\n Session subsystem establishes\n the appropriate new chain\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis enables device-aware continuity without reducing a login to \u201Cissue another unrelated token.\u201D The session subsystem remains responsible for the exact creation and persistence behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022make-the-authority-decision\u0022\u003E6. Make the authority decision\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003ELoginAuthority\u003C/code\u003E evaluates the login attempt and returns one of three outcomes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EDecision\u003C/th\u003E\n\u003Cth\u003EMeaning\u003C/th\u003E\n\u003Cth\u003ESession issued?\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EAllow\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EThe attempt may proceed to session establishment.\u003C/td\u003E\n\u003Ctd\u003EYes, if the remaining issuance steps succeed.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EDeny\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication is rejected.\u003C/td\u003E\n\u003Ctd\u003ENo.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EChallenge\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAn additional step or continuation is required.\u003C/td\u003E\n\u003Ctd\u003ENo, not from this login attempt.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe current default authority considers user existence, lockout, reauthentication requirements, and credential validity. The broader flow also performs eligibility and lockout checks before invoking the authority.\u003C/p\u003E\n\u003Cp\u003EA challenge is represented through a \u003Ccode\u003ELoginContinuation\u003C/code\u003E; the current orchestrator uses an MFA continuation type for its challenge branch. This represents a requirement to continue authentication, \u003Cstrong\u003Enot proof that an MFA exchange has already completed\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EFor rejected attempts, the orchestrator may record a failed factor attempt and return lockout or remaining-attempt information when the corresponding disclosure option is enabled. Applications should treat these details as policy-controlled rather than universally available.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022establish-the-session\u0022\u003E7. Establish the session\u003C/h3\u003E\n\u003Cp\u003EOnly an allowed, successfully validated \u003Cstrong\u003Ecommit\u003C/strong\u003E login proceeds to session issuance.\u003C/p\u003E\n\u003Cp\u003EThe orchestrator first records a successful factor authentication (unless explicitly suppressed by an internal execution option), then obtains user claims through \u003Ccode\u003EIUserClaimsProvider\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EIt constructs a \u003Ccode\u003ESessionIssuanceContext\u003C/code\u003E containing the tenant, user key, device, claims, effective mode, session options, and any eligible existing chain ID. The context is passed to \u003Ccode\u003EISessionOrchestrator\u003C/code\u003E using a login-session creation command.\u003C/p\u003E\n\u003Cp\u003EThis is the decisive transition:\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003EThe user has not merely supplied a valid secret; the system has established a managed authentication session.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Cp\u003EThe resulting session has its own identity. That identity is available to the later token-issuance and response-delivery stages.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022issue-tokens-when-permitted\u0022\u003E8. Issue tokens when permitted\u003C/h3\u003E\n\u003Cp\u003EAfter session issuance, access and refresh tokens may be requested from the token issuer. The current orchestrator issues them only when \u003Ccode\u003ELoginRequest.RequestTokens\u003C/code\u003E is true.\u003C/p\u003E\n\u003Cp\u003EFor the HTTP login endpoint, however, the server derives that setting from \u003Ccode\u003EAuthFlowContext.AllowsTokenIssuance\u003C/code\u003E. A client cannot force token issuance merely by placing \u003Ccode\u003ERequestTokens: true\u003C/code\u003E in its submitted payload.\u003C/p\u003E\n\u003Cp\u003EWhen issuance is enabled:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe access token is issued in the context of the authenticated user and issued session.\u003C/li\u003E\n\u003Cli\u003ERefresh-token issuance is requested with persistence enabled.\u003C/li\u003E\n\u003Cli\u003EBoth issuance paths operate with the tenant, user key, session ID, chain ID, and claims context.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EDepending on the effective mode and issuer behavior, an individual token type may be absent. \u003Cstrong\u003ESuccessful login and token issuance are deliberately separate concepts.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022dispatch-the-login-event-and-deliver-the-response\u0022\u003E9. Dispatch the login event and deliver the response\u003C/h3\u003E\n\u003Cp\u003EFollowing successful session and optional token issuance, UltimateAuth dispatches a \u003Ccode\u003EUserLoggedInContext\u003C/code\u003E event containing the tenant, user key, time, device, and session ID.\u003C/p\u003E\n\u003Cp\u003EThe HTTP endpoint then delegates credential delivery to \u003Ccode\u003EICredentialResponseWriter\u003C/code\u003E. Session ID, access token, and refresh token are handled as distinct grant kinds. Delivery is resolved using the effective mode, authentication flow, application profile, and server configuration.\u003C/p\u003E\n\u003Cp\u003EDepending on configuration, the HTTP response may complete with \u003Ccode\u003E200 OK\u003C/code\u003E or a success redirect. A rejected login may produce \u003Ccode\u003E401 Unauthorized\u003C/code\u003E or a configured failure redirect.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant for v0.1.0:\u003C/strong\u003E \u003Ccode\u003ETokenResponseMode.Body\u003C/code\u003E is currently unsupported and rejected during response resolution. Do not assume that the HTTP login endpoint returns a JSON object containing the issued tokens. Consult the configured delivery modes and application profile instead.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022trylogin-evaluate-without-establishing-a-session\u0022\u003ETryLogin: evaluate without establishing a session\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth distinguishes \u003Cstrong\u003Epreviewing a login\u003C/strong\u003E from \u003Cstrong\u003Ecommitting a login\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ETryLogin\u003C/code\u003E runs the authentication evaluation in preview mode. It can indicate whether credentials would pass the current checks, report permitted failure information, and return a continuation requirement. It does \u003Cstrong\u003Enot\u003C/strong\u003E issue a session or tokens.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EBehavior\u003C/th\u003E\n\u003Cth\u003ETryLogin (Preview)\u003C/th\u003E\n\u003Cth\u003ELogin (Commit)\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResolve identifier and evaluate credentials\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EApply applicable failure-attempt handling\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EReset factor failure state on success\u003C/td\u003E\n\u003Ctd\u003ENo\u003C/td\u003E\n\u003Ctd\u003EYes, normally\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECreate a session\u003C/td\u003E\n\u003Ctd\u003ENo\u003C/td\u003E\n\u003Ctd\u003EYes, on success\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EIssue tokens\u003C/td\u003E\n\u003Ctd\u003ENo\u003C/td\u003E\n\u003Ctd\u003EOptional\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EReturn a preview receipt\u003C/td\u003E\n\u003Ctd\u003EPossible\u003C/td\u003E\n\u003Ctd\u003EConsumes a matching receipt, if supplied\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EOn a successful preview, the server can create a short-lived \u003Ccode\u003EPreviewReceipt\u003C/code\u003E. That receipt is associated with the user, tenant, credential type, device, identifier, application profile, and a fingerprint of the submitted login material.\u003C/p\u003E\n\u003Cp\u003EWhen a subsequent commit request includes a matching receipt, the server consumes it and can suppress a duplicate failed-attempt registration for that commit. \u003Cstrong\u003EThe receipt is not a replacement for the password\u003C/strong\u003E: the commit path still performs credential validation.\u003C/p\u003E\n\u003Cp\u003EThis separation is useful when an application needs to assess login readiness or guide a user through an authentication experience without establishing a session prematurely.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-awareness-and-session-management\u0022\u003EDevice awareness and session management\u003C/h2\u003E\n\u003Cp\u003EBecause login produces a managed session within a device-associated chain, UltimateAuth can model authentication beyond a single browser token:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EMultiple devices:\u003C/strong\u003E a user can have separate chains associated with distinct device contexts.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESession continuity:\u003C/strong\u003E an active chain can be considered when the same user signs in again from the same device.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ETargeted session management:\u003C/strong\u003E session and chain identities give downstream operations a way to distinguish authentication instances and device-associated lifecycles.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EBroader revocation:\u003C/strong\u003E the hierarchy provides the foundation for operations that affect more than one session.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe exact scope and availability of logout and revocation operations are defined by their own APIs and policies. Login establishes the identities those operations can act upon; it does not by itself specify every revocation behavior.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-is-part-of-the-flow-not-an-afterthought\u0022\u003ESecurity is part of the flow, not an afterthought\u003C/h2\u003E\n\u003Cp\u003ESeveral security properties follow from this design:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUser eligibility is separate from credential correctness.\u003C/strong\u003E A valid secret does not override a disabled, deleted, or locked account.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EFailed attempts are tracked as security state.\u003C/strong\u003E Lockout behavior is configurable and can be evaluated before session issuance.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDevice context participates in session establishment.\u003C/strong\u003E The system can distinguish device-associated chains rather than treating all logins as anonymous token issuance events.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESession issuance follows an explicit decision.\u003C/strong\u003E A denied or challenged login does not proceed to normal session creation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EResponse delivery is policy-driven.\u003C/strong\u003E Whether a session credential or token is delivered\u2014and by which supported mechanism\u2014is determined by the effective server flow, not solely by a client request.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EThe hierarchy supports later lifecycle enforcement.\u003C/strong\u003E Token validation, session validity, security-version checks, refresh behavior, and revocation are related concerns, but their exact enforcement belongs to those respective flows. They should not be mistaken for checks all performed inside the login method itself.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-useful-mental-model\u0022\u003EA useful mental model\u003C/h2\u003E\n\u003Cp\u003EThink of login as the moment UltimateAuth establishes a \u003Cstrong\u003Emanaged, device-aware authentication relationship\u003C/strong\u003E between a user and an application.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EIdentity \u002B Valid Credential \u002B Security Decision\n \u2502\n \u25BC\n Managed Session\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC\n Session identity Optional tokens\n \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u25BC\n Ongoing auth lifecycle\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe session is the managed authentication instance. Tokens, where used, are credentials associated with that instance. They can be issued, refreshed, and validated without redefining what a login means.\u003C/p\u003E\n\u003Cp\u003EThis is the shift UltimateAuth is designed to make: \u003Cstrong\u003Efrom login as token generation to login as lifecycle-aware session establishment\u003C/strong\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022key-takeaways\u0022\u003EKey takeaways\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ELogin is a flow, not a single credential-check function.\u003C/strong\u003E Identity resolution, eligibility, security evaluation, session issuance, and delivery are separate stages.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EThe hierarchy is \u003Ccode\u003EUser \u2192 Root \u2192 Chain \u2192 Session\u003C/code\u003E.\u003C/strong\u003E It expresses user-level, device-associated, and individual session lifecycles.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EA successful login establishes a session.\u003C/strong\u003E It does not necessarily create a new root or chain each time.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ETokens are optional.\u003C/strong\u003E Issuance is governed by the effective mode and server policy.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ETryLogin is not Login.\u003C/strong\u003E Preview evaluates an attempt without issuing a session; commit establishes one.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EThe authority controls admission to session issuance.\u003C/strong\u003E Security-state handling can also occur before and after that decision.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EDevice context matters.\u003C/strong\u003E Session continuity and downstream session management are built around it.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003ENext step\u003C/h2\u003E\n\u003Cp\u003EContinue to \u003Cstrong\u003ERefresh Flow\u003C/strong\u003E to learn how UltimateAuth extends or rotates authentication credentials while preserving the relationship to the managed session lifecycle.\u003C/p\u003E\n", + "Html": "\n\u003Cp\u003ELogging in is often described as a simple exchange: verify a password, issue a token, and consider the user authenticated. That description leaves out the part that matters most over time: \u003Cstrong\u003Ewhat exactly has been established and how can it be managed or revoked?\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth treats login as a controlled authentication-establishment flow.\u003C/p\u003E\n\u003Cp\u003ECredential verification is essential, but it is only one stage. A successful login establishes trust in an identity within a tenant and device context, according to the effective authentication mode.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003ELogin establishes authentication. Surrogates allow that authentication to continue without repeatedly presenting the original credential.\u003C/strong\u003E\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Cp\u003ESession-managed modes also establish the applicable session lineage.\u003C/p\u003E\n\u003Cp\u003EThis distinction shapes how UltimateAuth handles device awareness, session continuity, token issuance, revocation, and authentication policy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022from-a-login-response-to-an-authentication-lifecycle\u0022\u003EFrom a login response to an authentication lifecycle\u003C/h2\u003E\n\u003Cp\u003EIn a token-centric design, login is frequently treated as the moment a token is minted. The token then becomes the primary artifact developers reason about. This works for simple scenarios, but it can make questions about devices, concurrent logins, global sign-out, and session continuity harder to express consistently.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth starts with the authentication lifecycle instead. It separates four responsibilities:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003E\u003Cstrong\u003EIdentity resolution:\u003C/strong\u003E determine which user is attempting to authenticate.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESurrogate issuance and transport:\u003C/strong\u003E issue the applicable tokens and transport them according to the effective authentication mode and application profile.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESession establishment:\u003C/strong\u003E create a managed authentication instance in the appropriate device and user context.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ECredential delivery:\u003C/strong\u003E optionally issue access and refresh tokens and deliver the applicable credentials according to the server mode and application profile.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThese responsibilities are related, but they are not interchangeable. In particular, a valid password does not by itself create a session, and a token is not the sole source of authentication state.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-session-hierarchy\u0022\u003EThe session hierarchy\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth models authentication through a hierarchy:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUser\n\u2514\u2500\u2500 Root\n \u251C\u2500\u2500 Chain (Device A)\n \u2502 \u251C\u2500\u2500 Session 1\n \u2502 \u2514\u2500\u2500 Session 2\n \u2514\u2500\u2500 Chain (Device B)\n \u2514\u2500\u2500 Session 3\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach level answers a different question:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ELevel\u003C/th\u003E\n\u003Cth\u003EResponsibility\u003C/th\u003E\n\u003Cth\u003EWhy it matters\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EUser\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EThe identity being authenticated\u003C/td\u003E\n\u003Ctd\u003ELogin identifiers can change without changing the user\u0027s internal identity.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERoot\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EThe user-level session hierarchy\u003C/td\u003E\n\u003Ctd\u003EProvides a shared context for authentication across devices.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EChain\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EA device-associated sequence of sessions\u003C/td\u003E\n\u003Ctd\u003EAllows the system to reason about continuity and device-scoped authentication.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESession\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EA particular issued authentication instance\u003C/td\u003E\n\u003Ctd\u003EProvides the concrete session identity to which authentication credentials can be related.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe hierarchy is a \u003Cstrong\u003Elogical model\u003C/strong\u003E, not a claim that every login inserts a new root or chain. A login can continue an existing active chain for the same user and device. The session subsystem determines how the resulting session is issued and persisted.\u003C/p\u003E\n\u003Cp\u003EA chain is best understood as a \u003Cstrong\u003Edevice-associated authentication lifecycle\u003C/strong\u003E, rather than as the physical device itself. The quality and stability of device identification depend on the configured device context.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022how-a-login-proceeds\u0022\u003EHow a login proceeds\u003C/h2\u003E\n\u003Cp\u003EThe standard password login flow can be viewed as the following pipeline:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EClient request\n \u2502\n \u25BC\nResolve authentication flow context\n \u2502 Tenant \u00B7 device \u00B7 effective mode \u00B7 application profile\n \u25BC\nResolve identifier \u2192 UserKey\n \u2502\n \u25BC\nCheck user eligibility and security state\n \u2502\n \u25BC\nValidate credential using registered providers\n \u2502\n \u25BC\nFind an eligible active chain for this user/device\n \u2502\n \u25BC\nLoginAuthority decision\n \u251C\u2500\u2500 Deny \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25BA Failure / lockout handling\n \u251C\u2500\u2500 Challenge \u2500\u2500\u2500\u2500\u25BA Continuation required\n \u2514\u2500\u2500 Allow\n \u2502\n \u25BC\n Establish session\n \u2502\n \u25BC\n Optionally issue access/refresh tokens\n \u2502\n \u25BC\n Dispatch login event\n \u2502\n \u25BC\n Deliver credentials / redirect or OK\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis diagram shows the responsibilities in the current flow. Some security-state operations, such as recording failed attempts, happen as part of processing a rejected login. Therefore, \u003Cstrong\u003Ethe authority decision precedes session issuance, not every possible state mutation\u003C/strong\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resolve-the-authentication-context\u0022\u003E1. Resolve the authentication context\u003C/h3\u003E\n\u003Cp\u003EBefore credential validation, UltimateAuth operates within an \u003Ccode\u003EAuthFlowContext\u003C/code\u003E. This context provides the effective tenant, device information, authentication mode, application profile, and applicable server options.\u003C/p\u003E\n\u003Cp\u003EThat context matters because the same logical login operation can have different delivery and session requirements depending on how the application is hosted and which kind of client is connecting. Login should not need to be reimplemented for each application style.\u003C/p\u003E\n\u003Cp\u003EA resolvable device ID is required by the current login orchestrator. If device identification cannot be resolved, login cannot proceed to normal session establishment.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resolve-the-login-identifier\u0022\u003E2. Resolve the login identifier\u003C/h3\u003E\n\u003Cp\u003EA user may identify themselves with a username, email address, or another identifier supported by the configured resolver. UltimateAuth translates that external identifier into an internal \u003Ccode\u003EUserKey\u003C/code\u003E through \u003Ccode\u003EILoginIdentifierResolver\u003C/code\u003E.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUser-provided identifier\n \u2502\n \u25BC\nILoginIdentifierResolver\n \u2502\n \u25BC\n UserKey\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe internal user key, not the original text entered into the login form, becomes the stable reference used by the rest of the authentication flow. This helps keep \u003Cstrong\u003Ehow a user signs in\u003C/strong\u003E separate from \u003Cstrong\u003Ewho that user is\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe identifiers actually accepted depend on the configured resolver and user data; support for a particular identifier format should not be assumed without configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022check-eligibility-and-security-state\u0022\u003E3. Check eligibility and security state\u003C/h3\u003E\n\u003Cp\u003EOnce the user is resolved, the login orchestrator retrieves their runtime state. The current implementation requires the user to exist, be permitted to authenticate (\u003Ccode\u003ECanAuthenticate\u003C/code\u003E), and not be deleted (\u003Ccode\u003EIsDeleted\u003C/code\u003E).\u003C/p\u003E\n\u003Cp\u003EIt also examines two security scopes:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EAccount state:\u003C/strong\u003E security conditions associated with the account as a whole.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EFactor state:\u003C/strong\u003E security conditions associated with the credential type being used.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EAn existing account or factor lock can stop the attempt before credential validation proceeds. Failed attempts, lockout duration, failure windows, and lock extension are governed by login options.\u003C/p\u003E\n\u003Cp\u003EThis separation is intentional: a credential can be correct while the account is not currently eligible to authenticate.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validate-the-credential\u0022\u003E4. Validate the credential\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth delegates credential verification to registered credential providers rather than embedding password comparison directly into the login orchestrator.\u003C/p\u003E\n\u003Cp\u003EFor the current standard HTTP login endpoint, the credential type is \u003Cstrong\u003EPassword\u003C/strong\u003E. The orchestrator also rejects unsupported credential types in this path. The provider architecture is extensible, but that extensibility should not be confused with a promise that OTP, passkeys, or external identity providers all use this exact password-login endpoint in v0.1.0.\u003C/p\u003E\n\u003Cp\u003EFor eligible credentials, the orchestrator checks that the credential matches the requested type, has not been deleted, is usable under its security rules, and validates the submitted secret through its provider.\u003C/p\u003E\n\u003Cp\u003EThis gives the login flow a stable orchestration model while keeping credential-specific verification behind dedicated abstractions.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022dummy-password-verification\u0022\u003EDummy Password Verification\u003C/h3\u003E\n\u003Cp\u003EAuthentication paths that skip password verification can complete with a different computational cost from paths that validate an existing password credential. This can create observable timing differences.\u003C/p\u003E\n\u003Cp\u003ETo reduce this discrepancy, UltimateAuth performs dummy password verification when no real password verification occurs, including cases involving unknown identifiers, ineligible accounts, account or factor lockouts, and missing usable credentials.\u003C/p\u003E\n\u003Cp\u003EThe dummy hash is generated using the configured password hasher and cached for reuse. Its verification result is always ignored and can never authorize a login.\u003C/p\u003E\n\u003Cp\u003EThis mitigation does \u003Cstrong\u003Enot\u003C/strong\u003E guarantee constant-time authentication. Identifier resolution, storage access, historical hash parameters, lockout processing, and server scheduling may still produce timing differences.\u003C/p\u003E\n\u003Cp\u003EBoth real and dummy verification share the same resource protection mechanism. See \u003Ca href=\u0022/docs/security/concurrency-limiting\u0022\u003EConcurrency Limiting\u003C/a\u003E for capacity and queue configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resolve-device-associated-session-continuity\u0022\u003E5. Resolve device-associated session continuity\u003C/h3\u003E\n\u003Cp\u003EBefore the authority decision, the orchestrator looks for a session chain associated with the resolved user and device. If a chain exists and its state is active under the configured idle timeout, its \u003Ccode\u003EChainId\u003C/code\u003E can be carried into session issuance.\u003C/p\u003E\n\u003Cp\u003EConceptually:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003ESame user \u002B known device \u002B active chain\n \u2502\n \u25BC\n Continue with that ChainId\n\nNo eligible active chain\n \u2502\n \u25BC\n Session subsystem establishes\n the appropriate new chain\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis enables device-aware continuity without reducing a login to \u201Cissue another unrelated token.\u201D The session subsystem remains responsible for the exact creation and persistence behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022make-the-authority-decision\u0022\u003E6. Make the authority decision\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003ELoginAuthority\u003C/code\u003E evaluates the login attempt and returns one of three outcomes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EDecision\u003C/th\u003E\n\u003Cth\u003EMeaning\u003C/th\u003E\n\u003Cth\u003ESession issued?\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EAllow\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EThe attempt may proceed to session establishment.\u003C/td\u003E\n\u003Ctd\u003EYes, if the remaining issuance steps succeed.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EDeny\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication is rejected.\u003C/td\u003E\n\u003Ctd\u003ENo.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EChallenge\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAn additional step or continuation is required.\u003C/td\u003E\n\u003Ctd\u003ENo, not from this login attempt.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe current default authority considers user existence, lockout, reauthentication requirements, and credential validity. The broader flow also performs eligibility and lockout checks before invoking the authority.\u003C/p\u003E\n\u003Cp\u003EA challenge is represented through a \u003Ccode\u003ELoginContinuation\u003C/code\u003E; the current orchestrator uses an MFA continuation type for its challenge branch. This represents a requirement to continue authentication, \u003Cstrong\u003Enot proof that an MFA exchange has already completed\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EFor rejected attempts, the orchestrator may record a failed factor attempt and return lockout or remaining-attempt information when the corresponding disclosure option is enabled. Applications should treat these details as policy-controlled rather than universally available.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022establish-the-session\u0022\u003E7. Establish the session\u003C/h3\u003E\n\u003Cp\u003EOnly an allowed, successfully validated \u003Cstrong\u003Ecommit\u003C/strong\u003E login proceeds to session issuance.\u003C/p\u003E\n\u003Cp\u003EThe orchestrator first records a successful factor authentication (unless explicitly suppressed by an internal execution option), then obtains user claims through \u003Ccode\u003EIUserClaimsProvider\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EIt constructs a \u003Ccode\u003ESessionIssuanceContext\u003C/code\u003E containing the tenant, user key, device, claims, effective mode, session options, and any eligible existing chain ID. The context is passed to \u003Ccode\u003EISessionOrchestrator\u003C/code\u003E using a login-session creation command.\u003C/p\u003E\n\u003Cp\u003EThis is the decisive transition:\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003EThe user has not merely supplied a valid secret; the system has established a managed authentication session.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Cp\u003EThe resulting session has its own identity. That identity is available to the later token-issuance and response-delivery stages.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022issue-tokens-when-permitted\u0022\u003E8. Issue tokens when permitted\u003C/h3\u003E\n\u003Cp\u003EAfter session issuance, access and refresh tokens may be requested from the token issuer. The current orchestrator issues them only when \u003Ccode\u003ELoginRequest.RequestTokens\u003C/code\u003E is true.\u003C/p\u003E\n\u003Cp\u003EFor the HTTP login endpoint, however, the server derives that setting from \u003Ccode\u003EAuthFlowContext.AllowsTokenIssuance\u003C/code\u003E. A client cannot force token issuance merely by placing \u003Ccode\u003ERequestTokens: true\u003C/code\u003E in its submitted payload.\u003C/p\u003E\n\u003Cp\u003EWhen issuance is enabled:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe access token is issued in the context of the authenticated user and issued session.\u003C/li\u003E\n\u003Cli\u003ERefresh-token issuance is requested with persistence enabled.\u003C/li\u003E\n\u003Cli\u003EBoth issuance paths operate with the tenant, user key, session ID, chain ID, and claims context.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EDepending on the effective mode and issuer behavior, an individual token type may be absent. \u003Cstrong\u003ESuccessful login and token issuance are deliberately separate concepts.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022dispatch-the-login-event-and-deliver-the-response\u0022\u003E9. Dispatch the login event and deliver the response\u003C/h3\u003E\n\u003Cp\u003EThe HTTP endpoint delegates surrogate transport to \u003Ccode\u003EISurrogateResponseWriter\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003ESession ID, access token, and refresh token are handled as distinct surrogate kinds. Their effective transports are determined by the authentication mode, flow, application profile, and server configuration.\u003C/p\u003E\n\u003Cp\u003EDepending on configuration, the HTTP response may complete with \u003Ccode\u003E200 OK\u003C/code\u003E or a success redirect. A rejected login may produce \u003Ccode\u003E401 Unauthorized\u003C/code\u003E or a configured failure redirect.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E \u003Ccode\u003ESurrogateTransport.Body\u003C/code\u003E is currently unsupported. Do not assume that the HTTP login endpoint returns a JSON object containing the issued tokens.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022trylogin-evaluate-without-establishing-a-session\u0022\u003ETryLogin: evaluate without establishing a session\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth distinguishes \u003Cstrong\u003Epreviewing a login\u003C/strong\u003E from \u003Cstrong\u003Ecommitting a login\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ETryLogin\u003C/code\u003E runs the authentication evaluation in preview mode. It can indicate whether credentials would pass the current checks, report permitted failure information, and return a continuation requirement. It does \u003Cstrong\u003Enot\u003C/strong\u003E issue a session or tokens.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EBehavior\u003C/th\u003E\n\u003Cth\u003ETryLogin (Preview)\u003C/th\u003E\n\u003Cth\u003ELogin (Commit)\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResolve identifier and evaluate credentials\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EApply applicable failure-attempt handling\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EReset factor failure state on success\u003C/td\u003E\n\u003Ctd\u003ENo\u003C/td\u003E\n\u003Ctd\u003EYes, normally\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECreate a session\u003C/td\u003E\n\u003Ctd\u003ENo\u003C/td\u003E\n\u003Ctd\u003EYes, on success\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EIssue tokens\u003C/td\u003E\n\u003Ctd\u003ENo\u003C/td\u003E\n\u003Ctd\u003EOptional\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EReturn a preview receipt\u003C/td\u003E\n\u003Ctd\u003EPossible\u003C/td\u003E\n\u003Ctd\u003EConsumes a matching receipt, if supplied\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EOn a successful preview, the server can create a short-lived \u003Ccode\u003EPreviewReceipt\u003C/code\u003E. That receipt is associated with the user, tenant, credential type, device, identifier, application profile, and a fingerprint of the submitted login material.\u003C/p\u003E\n\u003Cp\u003EWhen a subsequent commit request includes a matching receipt, the server consumes it and can suppress a duplicate failed-attempt registration for that commit. \u003Cstrong\u003EThe receipt is not a replacement for the password\u003C/strong\u003E: the commit path still performs credential validation.\u003C/p\u003E\n\u003Cp\u003EThis separation is useful when an application needs to assess login readiness or guide a user through an authentication experience without establishing a session prematurely.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-awareness-and-session-management\u0022\u003EDevice awareness and session management\u003C/h2\u003E\n\u003Cp\u003EBecause login produces a managed session within a device-associated chain, UltimateAuth can model authentication beyond a single browser token:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EMultiple devices:\u003C/strong\u003E a user can have separate chains associated with distinct device contexts.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESession continuity:\u003C/strong\u003E an active chain can be considered when the same user signs in again from the same device.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ETargeted session management:\u003C/strong\u003E session and chain identities give downstream operations a way to distinguish authentication instances and device-associated lifecycles.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EBroader revocation:\u003C/strong\u003E the hierarchy provides the foundation for operations that affect more than one session.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe exact scope and availability of logout and revocation operations are defined by their own APIs and policies. Login establishes the identities those operations can act upon; it does not by itself specify every revocation behavior.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-is-part-of-the-flow-not-an-afterthought\u0022\u003ESecurity is part of the flow, not an afterthought\u003C/h2\u003E\n\u003Cp\u003ESeveral security properties follow from this design:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUser eligibility is separate from credential correctness.\u003C/strong\u003E A valid secret does not override a disabled, deleted, or locked account.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EFailed attempts are tracked as security state.\u003C/strong\u003E Lockout behavior is configurable and can be evaluated before session issuance.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDevice context participates in session establishment.\u003C/strong\u003E The system can distinguish device-associated chains rather than treating all logins as anonymous token issuance events.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESession issuance follows an explicit decision.\u003C/strong\u003E A denied or challenged login does not proceed to normal session creation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EResponse delivery is policy-driven.\u003C/strong\u003E Whether a session credential or token is delivered\u2014and by which supported mechanism\u2014is determined by the effective server flow, not solely by a client request.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EThe hierarchy supports later lifecycle enforcement.\u003C/strong\u003E Token validation, session validity, security-version checks, refresh behavior, and revocation are related concerns, but their exact enforcement belongs to those respective flows. They should not be mistaken for checks all performed inside the login method itself.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-useful-mental-model\u0022\u003EA useful mental model\u003C/h2\u003E\n\u003Cp\u003EThink of login as the moment UltimateAuth establishes a \u003Cstrong\u003Emanaged, device-aware authentication relationship\u003C/strong\u003E between a user and an application.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EIdentity \u002B Valid Credential \u002B Security Decision\n \u2502\n \u25BC\n Managed Session\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC\n Session identity Optional tokens\n \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u25BC\n Ongoing auth lifecycle\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA session represents a managed authentication instance where session lineage is used.\u003C/p\u003E\n\u003Cp\u003ESurrogates represent the authentication data used to continue authenticated interactions. Their issuance and validation depend on the effective authentication mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022key-takeaways\u0022\u003EKey takeaways\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ELogin is a flow, not a single credential-check function.\u003C/strong\u003E Identity resolution, eligibility, security evaluation, session issuance, and delivery are separate stages.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EThe hierarchy is \u003Ccode\u003EUser \u2192 Root \u2192 Chain \u2192 Session\u003C/code\u003E.\u003C/strong\u003E It expresses user-level, device-associated, and individual session lifecycles.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EA successful login establishes a session.\u003C/strong\u003E It does not necessarily create a new root or chain each time.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ETokens are optional.\u003C/strong\u003E Issuance is governed by the effective mode and server policy.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ETryLogin is not Login.\u003C/strong\u003E Preview evaluates an attempt without issuing a session; commit establishes one.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EThe authority controls admission to session issuance.\u003C/strong\u003E Security-state handling can also occur before and after that decision.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EDevice context matters.\u003C/strong\u003E Session continuity and downstream session management are built around it.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003ENext step\u003C/h2\u003E\n\u003Cp\u003EContinue to \u003Cstrong\u003ERefresh Flow\u003C/strong\u003E to learn how UltimateAuth extends or rotates authentication credentials while preserving the relationship to the managed session lifecycle.\u003C/p\u003E\n", "Headings": [ { "Id": "from-a-login-response-to-an-authentication-lifecycle", @@ -99,6 +99,6 @@ "Level": 0 } ], - "SourceHash": "F61EE7FAF00EB1CDB65724DAD641B090C97FBE358943BBBC6ED5FDD4963F2020", + "SourceHash": "15670BAB09610825D1800E56BF6960798EF1DEA7914F52F634BF823CCB563680", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/overview.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/overview.json index 9819283f..a6b85f01 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/overview.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/overview.json @@ -1,7 +1,7 @@ { "Slug": "auth-flows/overview", "Title": "Auth-Flows Overview", - "Html": "\n\u003Cp\u003EAuthentication is often described as a collection of endpoints: one accepts a password, another renews a token, and another clears a cookie. Those endpoints are useful interfaces, but they are not the security model.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUltimateAuth treats authentication as a set of controlled flows operating within an explicitly resolved security context.\u003C/strong\u003E A flow represents an intention\u2014establish access, continue it, or terminate it\u2014and the server determines which rules, state, and delivery behavior apply before executing that intention.\u003C/p\u003E\n\u003Cp\u003EThis distinction matters because the same request can have different legitimate outcomes depending on the tenant, authentication mode, application profile, device, current session, and server policy. A flow should not have to guess those values independently.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-flow-is-more-than-an-endpoint\u0022\u003EA flow is more than an endpoint\u003C/h2\u003E\n\u003Cp\u003EAn endpoint receives an HTTP request. A flow describes what the request is attempting to do and provides a consistent context for the operation.\u003C/p\u003E\n\u003Cp\u003EIn UltimateAuth, the HTTP boundary, context resolution, domain orchestration, authorization decisions, persistence, and response delivery have separate responsibilities. This makes authentication behavior easier to reason about without forcing every flow to use exactly the same internal implementation.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003ECore principle:\u003C/strong\u003E Resolve the security context first. Make decisions against authoritative state. Commit only the changes permitted by the flow. Then deliver the outcome in the form appropriate for the client.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-request-to-result-pipeline\u0022\u003EThe request-to-result pipeline\u003C/h2\u003E\n\u003Cp\u003EThe following sequence describes the common \u003Cstrong\u003EHTTP auth-flow boundary\u003C/strong\u003E. Individual flows have additional steps, and their internal order may differ.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EIncoming HTTP request\n |\n v\nUltimateAuth Middleware Pipeline\n |\n \u002B-- TenantMiddleware\n | - Resolve tenant context\n | - Store tenant context in HttpContext\n |\n \u002B-- SessionResolutionMiddleware\n | - Resolve session identifier\n | - Build SessionContext (or anonymous context)\n |\n \u002B-- UserMiddleware\n | - Resolve user context through IUserAccessor\n |\n |-- ASP.NET Core Authentication and Authorization Middleware (Optional)\n |\n v\nRequest Context Prepared\n |\n v\nEndpoint metadata (AuthFlowType)\n |\n v\nAuthFlowEndpointFilter\n |\n v\nAuthFlow.BeginAsync(...)\n |\n v\nAuthFlowContextFactory\n - Read tenant, session, and user contexts\n - Resolve application profile and effective server options\n - Determine effective authentication mode\n - Resolve primary token kind and response delivery policy\n - Resolve device context and return URL\n - Validate existing session where applicable\n - Reject invalid or unresolved tenant\n |\n v\nAuthFlowContext (request-scoped)\n |\n v\nEndpoint handler and flow-specific validation\n |\n v\nFlow service / orchestrator\n |\n v\nSecurity and authorization decisions\n |\n v\nPermitted state transitions and optional token operations\n |\n v\nResponse delivery, optional redirect, and flow events\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is a \u003Cstrong\u003Econceptual pipeline\u003C/strong\u003E, not a promise that every flow creates a session, issues a token, or dispatches the same events. Nor is there one universal authority method that all flows invoke identically.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-request-identifies-the-flow\u0022\u003E1. A request identifies the flow\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth endpoints can carry \u003Ccode\u003EAuthFlowMetadata\u003C/code\u003E describing the \u003Ccode\u003EAuthFlowType\u003C/code\u003E. The \u003Ccode\u003EAuthFlowEndpointFilter\u003C/code\u003E reads that metadata and invokes \u003Ccode\u003EIAuthFlow.BeginAsync(...)\u003C/code\u003E before the endpoint handler executes.\u003C/p\u003E\n\u003Cp\u003EThis is an important boundary: the endpoint does not need to assemble its own authentication environment from scattered headers, cookies, and settings.\u003C/p\u003E\n\u003Cp\u003EThe filter initializes the flow context; it does \u003Cstrong\u003Enot\u003C/strong\u003E, by itself, validate a password, authorize every operation, or mutate the session store. Those responsibilities belong to the appropriate downstream components.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-server-constructs-authflowcontext\u0022\u003E2. The server constructs \u003Ccode\u003EAuthFlowContext\u003C/code\u003E\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthFlowContextFactory\u003C/code\u003E resolves the inputs that govern how the operation must behave. The resulting context includes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EContext value\u003C/th\u003E\n\u003Cth\u003EWhy it matters\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EFlowType\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifies the intended authentication operation.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEstablishes the tenant boundary for state and decisions.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDescribes the kind of application interacting with the server.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEffectiveMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDetermines the authentication model actually in force for this request.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESupplies the effective server policy.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPrimaryTokenKind\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifies the primary credential/token kind for the effective mode.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDevice\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECarries the resolved device context.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECarries validated session security context when available.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIsAuthenticated\u003C/code\u003E / \u003Ccode\u003EUserKey\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERepresent the resolved authentication identity for this request.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResponse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDescribes effective credential delivery and redirect behavior.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReturnUrlInfo\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECarries parsed navigation intent for applicable browser flows.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe factory rejects unresolved or invalid tenant context and disallowed authentication modes. When a session context is present, it invokes session validation. For session-authoritative modes such as \u003Ccode\u003EPureOpaque\u003C/code\u003E and \u003Ccode\u003EHybrid\u003C/code\u003E, that validation also affects the resolved authentication state.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EThe context is resolved, not blindly trusted.\u003C/strong\u003E Request-provided information may influence resolution, but the effective mode, policy, identity, and session validity are determined by server-side components.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-context-is-made-available-to-the-handler\u0022\u003E3. The context is made available to the handler\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthFlow.BeginAsync\u003C/code\u003E stores the created context through the request-scoped \u003Ccode\u003EAuthFlowContextAccessor\u003C/code\u003E. The endpoint handler can then access the same resolved context rather than reconstructing it.\u003C/p\u003E\n\u003Cp\u003EThis creates a shared vocabulary across the HTTP boundary: the handler and downstream services work with the same tenant, mode, device, and response policy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022flow-specific-validation-and-orchestration-begin\u0022\u003E4. Flow-specific validation and orchestration begin\u003C/h3\u003E\n\u003Cp\u003EOnce the context exists, the endpoint handler reads and validates the operation-specific request. For example, login needs an identifier and secret; logout needs an applicable session or target scope; refresh needs valid renewal material.\u003C/p\u003E\n\u003Cp\u003EThe handler delegates the actual operation to the relevant flow service or orchestrator. Those components coordinate credential checks, session operations, token operations, and state transitions as appropriate.\u003C/p\u003E\n\u003Cp\u003EThere is no benefit in pretending these operations are identical. \u003Cstrong\u003ETheir shared architecture is the context and security boundary; their individual state transitions remain purpose-specific.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022decisions-are-evaluated-against-authoritative-state\u0022\u003E5. Decisions are evaluated against authoritative state\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth distinguishes between what a client \u003Cem\u003Epresents\u003C/em\u003E and what the system \u003Cem\u003Eknows\u003C/em\u003E.\u003C/p\u003E\n\u003Cp\u003EA cookie, bearer token, device identifier, or user-supplied value is evidence or input\u2014not automatically the source of truth. The relevant authoritative data comes from server-managed user, credential, authentication-security, and session state, subject to the active authentication mode.\u003C/p\u003E\n\u003Cp\u003EFor session-backed flows, the hierarchy is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUser\n \u2514\u2500\u2500 Root\n \u2514\u2500\u2500 Chain (device-associated lifecycle)\n \u2514\u2500\u2500 Session (authentication instance)\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe root, chain, and session provide distinct scopes for continuity, validation, and invalidation. Tokens and cookies can represent access to that state, but should not be confused with the underlying lifecycle.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EMode distinction:\u003C/strong\u003E Do not assume that every mode has identical persistence or session-issuance behavior. In particular, \u003Ccode\u003EPureJwt\u003C/code\u003E is not a session-issuance mode in the current session issuer. The effective mode determines which state and proof are authoritative for a given operation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022only-permitted-transitions-are-committed\u0022\u003E6. Only permitted transitions are committed\u003C/h3\u003E\n\u003Cp\u003EA successful authentication operation may create a session, rotate or touch existing state, revoke access, or leave persistent state unchanged. The actual effect depends on the flow and mode.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ELogin verifies credentials and, in session-issuing modes, establishes a session before optionally issuing tokens.\u003C/li\u003E\n\u003Cli\u003ERefresh evaluates existing renewal authority and applies its configured continuation behavior; it is not simply a request to mint another token.\u003C/li\u003E\n\u003Cli\u003ELogout ends access at the relevant scope, while revoke represents irreversible invalidation of the revoked object or hierarchy scope.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EWhere a session command passes through \u003Ccode\u003EUAuthSessionOrchestrator\u003C/code\u003E, \u003Ccode\u003EIAuthAuthority\u003C/code\u003E makes an allow, deny, or challenge decision before the session issuer executes that command. Other operations use their own relevant decision and access orchestration paths.\u003C/p\u003E\n\u003Cp\u003EThis separation helps prevent HTTP transport details from becoming security policy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-outcome-is-delivered-according-to-policy\u0022\u003E7. The outcome is delivered according to policy\u003C/h3\u003E\n\u003Cp\u003EA successful domain operation and the HTTP response carrying its outcome are different concerns.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthResponseResolver\u003C/code\u003E derives the effective response configuration from the authentication mode, flow type, application profile, and server options. It binds applicable cookie settings and validates the delivery configuration before the endpoint performs the operation.\u003C/p\u003E\n\u003Cp\u003EThis means a flow can use the same underlying authentication semantics while producing a client-appropriate HTTP outcome\u2014for example, a response with managed cookies or a browser redirect when configured.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ECurrent implementation note:\u003C/strong\u003E \u003Ccode\u003ETokenResponseMode.Body\u003C/code\u003E credential delivery is explicitly unsupported by the response resolver. Do not assume that access or refresh credentials are returned in a JSON response body.\u003C/p\u003E\n\u003Cp\u003EA redirect is a navigation decision, \u003Cstrong\u003Enot\u003C/strong\u003E an authentication or revocation mechanism. It can return a browser to the application after login or logout; the underlying security operation must stand independently of whether the browser follows the redirect.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-authflowcontext-matters\u0022\u003EWhy \u003Ccode\u003EAuthFlowContext\u003C/code\u003E matters\u003C/h2\u003E\n\u003Cp\u003EWithout a shared flow context, individual endpoints tend to make their own assumptions: which tenant is active, whether a cookie represents an authenticated session, which token type is expected, whether a client should receive cookies, and where to navigate afterward.\u003C/p\u003E\n\u003Cp\u003EThose assumptions drift as applications add multiple clients, devices, tenants, or authentication modes.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth instead resolves these questions at the flow boundary. That provides three practical benefits:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003E\u003Cstrong\u003EConsistency.\u003C/strong\u003E The same effective policy is available throughout the operation.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESeparation of concerns.\u003C/strong\u003E Endpoint handlers handle HTTP; orchestrators coordinate security-relevant work; response components handle delivery.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EExtensibility.\u003C/strong\u003E New application profiles and flow behaviors can integrate with established boundaries instead of duplicating authentication plumbing.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EA context is not an authorization bypass. Possessing an \u003Ccode\u003EAuthFlowContext\u003C/code\u003E does not imply that the requested operation has been approved.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022source-of-truth-proof-versus-state\u0022\u003ESource of truth: proof versus state\u003C/h2\u003E\n\u003Cp\u003EA useful mental model is to distinguish \u003Cstrong\u003Eproof\u003C/strong\u003E, \u003Cstrong\u003Epolicy\u003C/strong\u003E, and \u003Cstrong\u003Estate\u003C/strong\u003E:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConcept\u003C/th\u003E\n\u003Cth\u003EExamples\u003C/th\u003E\n\u003Cth\u003EResponsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProof\u003C/td\u003E\n\u003Ctd\u003EPassword, session identifier, access token, refresh token\u003C/td\u003E\n\u003Ctd\u003EPresents evidence for an operation.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPolicy\u003C/td\u003E\n\u003Ctd\u003EEffective mode, server options, authority decisions\u003C/td\u003E\n\u003Ctd\u003EDetermines what is permitted.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EState\u003C/td\u003E\n\u003Ctd\u003EUser eligibility, credential records, security state, session root/chain/session\u003C/td\u003E\n\u003Ctd\u003EDetermines the authoritative lifecycle and validity where applicable.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDelivery\u003C/td\u003E\n\u003Ctd\u003ECookies, supported response modes, redirect\u003C/td\u003E\n\u003Ctd\u003ECommunicates the result to the client.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EA valid-looking token is not, by itself, permission to ignore revocation, tenant boundaries, session state, or mode-specific validation. Conversely, not every authentication mode is built around a persisted session hierarchy. The authoritative checks must match the configured model.\u003C/p\u003E\n\u003Cp\u003EThis distinction is central to UltimateAuth\u0027s vision: \u003Cstrong\u003Eauthentication is not the possession of a string; it is the outcome of a controlled security process.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022built-in-flows-at-a-glance\u0022\u003EBuilt-in flows at a glance\u003C/h2\u003E\n\u003Cp\u003EThe following pages explain each operation in detail. This overview focuses on their roles within the shared model.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EFlow\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003Cth\u003EPractical outcome\u003C/th\u003E\n\u003Cth\u003EGuide\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ELogin\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EEstablish authenticated access from acceptable credentials.\u003C/td\u003E\n\u003Ctd\u003ECreates a valid authentication session in session-issuing modes; may issue tokens according to policy.\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/auth-flows/login-flow\u0022\u003ELogin Flow\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERefresh\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EContinue an existing authentication relationship using renewal authority.\u003C/td\u003E\n\u003Ctd\u003EMaintains or renews access according to mode, validation, and configured refresh behavior.\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/auth-flows/refresh-flow\u0022\u003ERefresh Flow\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ELogout\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EEnd access at the applicable session or device scope.\u003C/td\u003E\n\u003Ctd\u003ETerminates authentication access and handles configured client cleanup/navigation.\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/auth-flows/logout-flow\u0022\u003ELogout Flow\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese flows are related but not interchangeable. Login establishes access; refresh continues it; logout terminates it. Revocation operations provide stronger invalidation controls for the relevant security scope.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022concepts-shared-by-the-flows\u0022\u003EConcepts shared by the flows\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConcept\u003C/th\u003E\n\u003Cth\u003EWhat it contributes\u003C/th\u003E\n\u003Cth\u003EGuide\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESession lifecycle\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ERoot, chain, and session relationships; creation, continuity, expiry, and invalidation.\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/sessions-devices/session-lifecycle\u0022\u003ESession Lifecycle\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EToken behavior\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAccess and refresh credentials, validation, renewal, and mode-specific behavior.\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/security/token-security\u0022\u003EToken Behavior\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EDevice management\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EDevice-associated chains, multi-device access, and targeted termination.\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/sessions-devices/device-management\u0022\u003EDevice Management\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-this-design-enables-in-real-applications\u0022\u003EWhat this design enables in real applications\u003C/h2\u003E\n\u003Cp\u003EConsider an application with a browser front end, a mobile client, and an administrative interface. They may share the same user identity system, but they do not necessarily have the same credential delivery needs or session behavior.\u003C/p\u003E\n\u003Cp\u003EA flow-driven architecture lets the server establish the applicable context first and then run the requested operation under that context. Developers can reason about \u003Cstrong\u003Ewhat authentication action is taking place\u003C/strong\u003E separately from \u003Cstrong\u003Ehow the resulting credentials or navigation are delivered\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EIt also makes security-sensitive behavior easier to locate: tenant and mode resolution occur at the boundary, domain validation happens in the flow, session operations use dedicated infrastructure, and response policy is resolved independently.\u003C/p\u003E\n\u003Cp\u003EThis is the larger goal of UltimateAuth\u0027s unified model\u2014not to make every authentication operation identical, but to make their differences explicit, controlled, and composable.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022key-takeaways\u0022\u003EKey takeaways\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EAn auth flow is a controlled operation\u003C/strong\u003E, not merely an HTTP endpoint.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003E\u003Ccode\u003EAuthFlowEndpointFilter\u003C/code\u003E initializes the request context\u003C/strong\u003E for endpoints carrying flow metadata.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003E\u003Ccode\u003EAuthFlowContext\u003C/code\u003E resolves tenant, mode, application profile, device, identity/session information, and response policy\u003C/strong\u003E before the handler executes.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EProof is not the source of truth.\u003C/strong\u003E Validation depends on authoritative state and the effective authentication mode.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EAuthority and orchestration are distinct responsibilities.\u003C/strong\u003E The exact checks and state transitions vary by flow.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ECredential delivery and redirects are outcomes\u003C/strong\u003E, not substitutes for security decisions.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ELogin, refresh, and logout share a model without sharing identical execution paths.\u003C/strong\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003ENext step\u003C/h2\u003E\n\u003Cp\u003EStart with \u003Ca href=\u0022/docs/auth-flows/login-flow\u0022\u003ELogin Flow\u003C/a\u003E to see how UltimateAuth turns validated credentials into controlled authenticated access.\u003C/p\u003E\n", + "Html": "\n\u003Cp\u003EAuthentication is often described as a collection of endpoints: one accepts a password, another renews a token, and another clears a cookie. Those endpoints are useful interfaces, but they are not the security model.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUltimateAuth treats authentication as a set of controlled flows operating within an explicitly resolved security context.\u003C/strong\u003E A flow represents an intention\u2014establish access, continue it, or terminate it\u2014and the server determines which rules, state, and delivery behavior apply before executing that intention.\u003C/p\u003E\n\u003Cp\u003EThis distinction matters because the same request can have different legitimate outcomes depending on the tenant, authentication mode, application profile, device, current session, and server policy. A flow should not have to guess those values independently.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-flow-is-more-than-an-endpoint\u0022\u003EA flow is more than an endpoint\u003C/h2\u003E\n\u003Cp\u003EAn endpoint receives an HTTP request. A flow describes what the request is attempting to do and provides a consistent context for the operation.\u003C/p\u003E\n\u003Cp\u003EIn UltimateAuth, the HTTP boundary, context resolution, domain orchestration, authorization decisions, persistence, and response delivery have separate responsibilities. This makes authentication behavior easier to reason about without forcing every flow to use exactly the same internal implementation.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003ECore principle:\u003C/strong\u003E Resolve the security context first. Make decisions against authoritative state. Commit only the changes permitted by the flow. Then deliver the outcome in the form appropriate for the client.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-request-to-result-pipeline\u0022\u003EThe request-to-result pipeline\u003C/h2\u003E\n\u003Cp\u003EThe following sequence describes the common \u003Cstrong\u003EHTTP auth-flow boundary\u003C/strong\u003E. Individual flows have additional steps, and their internal order may differ.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EIncoming HTTP request\n |\n v\nUltimateAuth Middleware Pipeline\n |\n \u002B-- TenantMiddleware\n | - Resolve tenant context\n | - Store tenant context in HttpContext\n |\n \u002B-- SessionResolutionMiddleware\n | - Resolve session identifier\n | - Build SessionContext (or anonymous context)\n |\n \u002B-- UserMiddleware\n | - Resolve user context through IUserAccessor\n |\n |-- ASP.NET Core Authentication and Authorization Middleware (Optional)\n |\n v\nRequest Context Prepared\n |\n v\nEndpoint metadata (AuthFlowType)\n |\n v\nAuthFlowEndpointFilter\n |\n v\nAuthFlow.BeginAsync(...)\n |\n v\nAuthFlowContextFactory\n - Read tenant, session, and user contexts\n - Resolve application profile and effective server options\n - Determine effective authentication mode\n - Resolve primary surrogate kind and effective transport\n - Resolve device context and return URL\n - Validate existing session where applicable\n - Reject invalid or unresolved tenant\n |\n v\nAuthFlowContext (request-scoped)\n |\n v\nEndpoint handler and flow-specific validation\n |\n v\nFlow service / orchestrator\n |\n v\nSecurity and authorization decisions\n |\n v\nPermitted state transitions and optional token operations\n |\n v\nResponse delivery, optional redirect, and flow events\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is a \u003Cstrong\u003Econceptual pipeline\u003C/strong\u003E, not a promise that every flow creates a session, issues a token, or dispatches the same events. Nor is there one universal authority method that all flows invoke identically.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-request-identifies-the-flow\u0022\u003E1. A request identifies the flow\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth endpoints can carry \u003Ccode\u003EAuthFlowMetadata\u003C/code\u003E describing the \u003Ccode\u003EAuthFlowType\u003C/code\u003E. The \u003Ccode\u003EAuthFlowEndpointFilter\u003C/code\u003E reads that metadata and invokes \u003Ccode\u003EIAuthFlow.BeginAsync(...)\u003C/code\u003E before the endpoint handler executes.\u003C/p\u003E\n\u003Cp\u003EThis is an important boundary: the endpoint does not need to assemble its own authentication environment from scattered headers, cookies, and settings.\u003C/p\u003E\n\u003Cp\u003EThe filter initializes the flow context; it does \u003Cstrong\u003Enot\u003C/strong\u003E, by itself, validate a password, authorize every operation, or mutate the session store. Those responsibilities belong to the appropriate downstream components.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-server-constructs-authflowcontext\u0022\u003E2. The server constructs \u003Ccode\u003EAuthFlowContext\u003C/code\u003E\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthFlowContextFactory\u003C/code\u003E resolves the inputs that govern how the operation must behave. The resulting context includes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EContext value\u003C/th\u003E\n\u003Cth\u003EWhy it matters\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EFlowType\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifies the intended authentication operation.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEstablishes the tenant boundary for state and decisions.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDescribes the kind of application interacting with the server.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEffectiveMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDetermines the authentication model actually in force for this request.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESupplies the effective server policy.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPrimarySurrogateKind\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifies the primary surrogate for the effective authentication mode.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResponse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDescribes effective surrogate transport and redirect behavior.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDevice\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECarries the resolved device context.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECarries validated session security context when available.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIsAuthenticated\u003C/code\u003E / \u003Ccode\u003EUserKey\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERepresent the resolved authentication identity for this request.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReturnUrlInfo\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECarries parsed navigation intent for applicable browser flows.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe factory rejects unresolved or invalid tenant context and disallowed authentication modes. When a session context is present, it invokes session validation. For session-authoritative modes such as \u003Ccode\u003EPureOpaque\u003C/code\u003E and \u003Ccode\u003EHybrid\u003C/code\u003E, that validation also affects the resolved authentication state.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EThe context is resolved, not blindly trusted.\u003C/strong\u003E Request-provided information may influence resolution, but the effective mode, policy, identity, and session validity are determined by server-side components.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-context-is-made-available-to-the-handler\u0022\u003E3. The context is made available to the handler\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthFlow.BeginAsync\u003C/code\u003E stores the created context through the request-scoped \u003Ccode\u003EAuthFlowContextAccessor\u003C/code\u003E. The endpoint handler can then access the same resolved context rather than reconstructing it.\u003C/p\u003E\n\u003Cp\u003EThis creates a shared vocabulary across the HTTP boundary: the handler and downstream services work with the same tenant, mode, device, and response policy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022flow-specific-validation-and-orchestration-begin\u0022\u003E4. Flow-specific validation and orchestration begin\u003C/h3\u003E\n\u003Cp\u003EOnce the context exists, the endpoint handler reads and validates the operation-specific request. For example, login needs an identifier and secret; logout needs an applicable session or target scope; refresh needs valid renewal material.\u003C/p\u003E\n\u003Cp\u003EThe handler delegates the actual operation to the relevant flow service or orchestrator. Those components coordinate credential checks, session operations, token operations, and state transitions as appropriate.\u003C/p\u003E\n\u003Cp\u003EThere is no benefit in pretending these operations are identical. \u003Cstrong\u003ETheir shared architecture is the context and security boundary; their individual state transitions remain purpose-specific.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022decisions-are-evaluated-against-authoritative-state\u0022\u003E5. Decisions are evaluated against authoritative state\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth distinguishes between what a client \u003Cem\u003Epresents\u003C/em\u003E and what the system \u003Cem\u003Eknows\u003C/em\u003E.\u003C/p\u003E\n\u003Cp\u003EA cookie, bearer token, device identifier, or user-supplied value is evidence or input\u2014not automatically the source of truth. The relevant authoritative data comes from server-managed user, credential, authentication-security, and session state, subject to the active authentication mode.\u003C/p\u003E\n\u003Cp\u003EFor session-backed flows, the hierarchy is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUser\n \u2514\u2500\u2500 Root\n \u2514\u2500\u2500 Chain (device-associated lifecycle)\n \u2514\u2500\u2500 Session (authentication instance)\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe root, chain, and session provide distinct scopes for continuity, validation, and invalidation. Tokens and cookies can represent access to that state, but should not be confused with the underlying lifecycle.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EMode distinction:\u003C/strong\u003E Do not assume that every mode has identical persistence or session-issuance behavior. In particular, \u003Ccode\u003EPureJwt\u003C/code\u003E is not a session-issuance mode in the current session issuer. The effective mode determines which state and proof are authoritative for a given operation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022only-permitted-transitions-are-committed\u0022\u003E6. Only permitted transitions are committed\u003C/h3\u003E\n\u003Cp\u003EA successful authentication operation may create a session, rotate or touch existing state, revoke access, or leave persistent state unchanged. The actual effect depends on the flow and mode.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ELogin verifies credentials and, in session-issuing modes, establishes a session before optionally issuing tokens.\u003C/li\u003E\n\u003Cli\u003ERefresh evaluates existing renewal authority and applies its configured continuation behavior; it is not simply a request to mint another token.\u003C/li\u003E\n\u003Cli\u003ELogout ends access at the relevant scope, while revoke represents irreversible invalidation of the revoked object or hierarchy scope.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EWhere a session command passes through \u003Ccode\u003EUAuthSessionOrchestrator\u003C/code\u003E, \u003Ccode\u003EIAuthAuthority\u003C/code\u003E makes an allow, deny, or challenge decision before the session issuer executes that command. Other operations use their own relevant decision and access orchestration paths.\u003C/p\u003E\n\u003Cp\u003EThis separation helps prevent HTTP transport details from becoming security policy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-outcome-is-delivered-according-to-policy\u0022\u003E7. The outcome is delivered according to policy\u003C/h3\u003E\n\u003Cp\u003EA successful domain operation and the HTTP response carrying its outcome are different concerns.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthResponseResolver\u003C/code\u003E derives the effective response configuration from the authentication mode, flow type, application profile, and server options.\u003C/p\u003E\n\u003Cp\u003EIt resolves the applicable surrogate transports, binds cookie settings, and validates transport compatibility before the endpoint performs the operation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ECurrent implementation note:\u003C/strong\u003E \u003Ccode\u003ESurrogateTransport.Body\u003C/code\u003E is not supported. Do not assume that access or refresh tokens are returned in a JSON response body.\u003C/p\u003E\n\u003Cp\u003EA redirect is a navigation decision, \u003Cstrong\u003Enot\u003C/strong\u003E an authentication or revocation mechanism. It can return a browser to the application after login or logout; the underlying security operation must stand independently of whether the browser follows the redirect.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-authflowcontext-matters\u0022\u003EWhy \u003Ccode\u003EAuthFlowContext\u003C/code\u003E matters\u003C/h2\u003E\n\u003Cp\u003EWithout a shared flow context, individual endpoints tend to make their own assumptions: which tenant is active, whether a cookie represents an authenticated session, which token type is expected, whether a client should receive cookies, and where to navigate afterward.\u003C/p\u003E\n\u003Cp\u003EThose assumptions drift as applications add multiple clients, devices, tenants, or authentication modes.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth instead resolves these questions at the flow boundary. That provides three practical benefits:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003E\u003Cstrong\u003EConsistency.\u003C/strong\u003E The same effective policy is available throughout the operation.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESeparation of concerns.\u003C/strong\u003E Endpoint handlers handle HTTP; orchestrators coordinate security-relevant work; response components handle delivery.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EExtensibility.\u003C/strong\u003E New application profiles and flow behaviors can integrate with established boundaries instead of duplicating authentication plumbing.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EA context is not an authorization bypass. Possessing an \u003Ccode\u003EAuthFlowContext\u003C/code\u003E does not imply that the requested operation has been approved.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022source-of-truth-proof-versus-state\u0022\u003ESource of truth: proof versus state\u003C/h2\u003E\n\u003Cp\u003EA useful mental model is to distinguish \u003Cstrong\u003Eproof\u003C/strong\u003E, \u003Cstrong\u003Epolicy\u003C/strong\u003E, and \u003Cstrong\u003Estate\u003C/strong\u003E:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConcept\u003C/th\u003E\n\u003Cth\u003EExamples\u003C/th\u003E\n\u003Cth\u003EResponsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProof\u003C/td\u003E\n\u003Ctd\u003EPassword, session identifier, access token, refresh token\u003C/td\u003E\n\u003Ctd\u003EPresents evidence for an operation.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPolicy\u003C/td\u003E\n\u003Ctd\u003EEffective mode, server options, authority decisions\u003C/td\u003E\n\u003Ctd\u003EDetermines what is permitted.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EState\u003C/td\u003E\n\u003Ctd\u003EUser eligibility, credential records, security state, session root/chain/session\u003C/td\u003E\n\u003Ctd\u003EDetermines the authoritative lifecycle and validity where applicable.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDelivery\u003C/td\u003E\n\u003Ctd\u003ECookies, supported response modes, redirect\u003C/td\u003E\n\u003Ctd\u003ECommunicates the result to the client.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ETransport\u003C/td\u003E\n\u003Ctd\u003ECookies and HTTP headers\u003C/td\u003E\n\u003Ctd\u003ECarries authentication surrogates between applications.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERedirect\u003C/td\u003E\n\u003Ctd\u003ENavigation behavior\u003C/td\u003E\n\u003Ctd\u003ECommunicates the navigation outcome to the client.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EA valid-looking token is not, by itself, permission to ignore revocation, tenant boundaries, session state, or mode-specific validation. Conversely, not every authentication mode is built around a persisted session hierarchy. The authoritative checks must match the configured model.\u003C/p\u003E\n\u003Cp\u003EThis distinction is central to UltimateAuth\u0027s vision: \u003Cstrong\u003Eauthentication is not the possession of a string; it is the outcome of a controlled security process.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022built-in-flows-at-a-glance\u0022\u003EBuilt-in flows at a glance\u003C/h2\u003E\n\u003Cp\u003EThe following pages explain each operation in detail. This overview focuses on their roles within the shared model.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EFlow\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003Cth\u003EPractical outcome\u003C/th\u003E\n\u003Cth\u003EGuide\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ELogin\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EEstablish authenticated access from acceptable credentials.\u003C/td\u003E\n\u003Ctd\u003ECreates a valid authentication session in session-issuing modes; may issue tokens according to policy.\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/auth-flows/login-flow\u0022\u003ELogin Flow\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERefresh\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EContinue an existing authentication relationship using renewal authority.\u003C/td\u003E\n\u003Ctd\u003EMaintains or renews access according to mode, validation, and configured refresh behavior.\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/auth-flows/refresh-flow\u0022\u003ERefresh Flow\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ELogout\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EEnd access at the applicable session or device scope.\u003C/td\u003E\n\u003Ctd\u003ETerminates authentication access and handles configured client cleanup/navigation.\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/auth-flows/logout-flow\u0022\u003ELogout Flow\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese flows are related but not interchangeable. Login establishes access; refresh continues it; logout terminates it. Revocation operations provide stronger invalidation controls for the relevant security scope.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022concepts-shared-by-the-flows\u0022\u003EConcepts shared by the flows\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConcept\u003C/th\u003E\n\u003Cth\u003EWhat it contributes\u003C/th\u003E\n\u003Cth\u003EGuide\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESession lifecycle\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ERoot, chain, and session relationships; creation, continuity, expiry, and invalidation.\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/sessions-devices/session-lifecycle\u0022\u003ESession Lifecycle\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EToken behavior\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAccess and refresh credentials, validation, renewal, and mode-specific behavior.\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/security/token-security\u0022\u003EToken Behavior\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EDevice management\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EDevice-associated chains, multi-device access, and targeted termination.\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/sessions-devices/device-management\u0022\u003EDevice Management\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-this-design-enables-in-real-applications\u0022\u003EWhat this design enables in real applications\u003C/h2\u003E\n\u003Cp\u003EConsider an application with a browser front end, a mobile client, and an administrative interface. They may share the same user identity system, but they do not necessarily have the same credential delivery needs or session behavior.\u003C/p\u003E\n\u003Cp\u003EA flow-driven architecture lets the server establish the applicable context first and then run the requested operation under that context. Developers can reason about \u003Cstrong\u003Ewhat authentication action is taking place\u003C/strong\u003E separately from \u003Cstrong\u003Ehow the resulting credentials or navigation are delivered\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EIt also makes security-sensitive behavior easier to locate: tenant and mode resolution occur at the boundary, domain validation happens in the flow, session operations use dedicated infrastructure, and response policy is resolved independently.\u003C/p\u003E\n\u003Cp\u003EThis is the larger goal of UltimateAuth\u0027s unified model\u2014not to make every authentication operation identical, but to make their differences explicit, controlled, and composable.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022key-takeaways\u0022\u003EKey takeaways\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EAn auth flow is a controlled operation\u003C/strong\u003E, not merely an HTTP endpoint.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003E\u003Ccode\u003EAuthFlowEndpointFilter\u003C/code\u003E initializes the request context\u003C/strong\u003E for endpoints carrying flow metadata.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003E\u003Ccode\u003EAuthFlowContext\u003C/code\u003E resolves tenant, mode, application profile, device, identity/session information, and response policy\u003C/strong\u003E before the handler executes.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EProof is not the source of truth.\u003C/strong\u003E Validation depends on authoritative state and the effective authentication mode.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EAuthority and orchestration are distinct responsibilities.\u003C/strong\u003E The exact checks and state transitions vary by flow.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESurrogate transport and redirects are outcomes\u003C/strong\u003E, not substitutes for security decisions.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ELogin, refresh, and logout share a model without sharing identical execution paths.\u003C/strong\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003ENext step\u003C/h2\u003E\n\u003Cp\u003EStart with \u003Ca href=\u0022/docs/auth-flows/login-flow\u0022\u003ELogin Flow\u003C/a\u003E to see how UltimateAuth turns validated credentials into controlled authenticated access.\u003C/p\u003E\n", "Headings": [ { "Id": "a-flow-is-more-than-an-endpoint", @@ -84,6 +84,6 @@ "Level": 0 } ], - "SourceHash": "4A81DF17C4E50C1790B363F7635113E0B8FDAD29B54057A7018BBC9D309A3E1F", + "SourceHash": "62F27DFE6AC990EB997651080B101543A6AB4527579EEE08041DDC8F6A03633A", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/refresh-flow.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/refresh-flow.json index ddb987a7..3da6ac7e 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/refresh-flow.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/refresh-flow.json @@ -1,7 +1,7 @@ { "Slug": "auth-flows/refresh-flow", "Title": "Refresh", - "Html": "\n\u003Cp\u003ERefresh is how an existing authentication context continues without asking the user to authenticate again. In UltimateAuth, it is not synonymous with issuing a new access token: the operation depends on the active authentication mode and on whether the context is represented by a server-side session, refresh credentials, or both.\u003C/p\u003E\n\u003Cp\u003EA successful refresh preserves the authenticated identity and its continuity. It does \u003Cstrong\u003Enot\u003C/strong\u003E prove the user\u0027s credentials again, create a new login, or necessarily extend every lifetime associated with the authentication.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003EThis guide describes server-side refresh execution.\u003C/p\u003E\n\u003Cp\u003EFor client-side scheduling, proactive renewal, reactive recovery, background refresh, and concurrent request coordination, see \u003Ca href=\u0022/docs/client-sdk/automatic-refresh\u0022\u003EAutomatic Refresh\u003C/a\u003E.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-model-continuity-not-a-second-login\u0022\u003EThe model: continuity, not a second login\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth distinguishes three related operations:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EAuthentication\u003C/strong\u003E establishes a new authenticated context after the required proof is accepted.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ERefresh\u003C/strong\u003E attempts to continue an already established context, subject to its current validity and security policies.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EReauthentication\u003C/strong\u003E establishes trust again when continuation is unavailable or no longer permitted.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThis distinction matters for both security and client behavior. A refresh request can fail because a session expired, a refresh credential is invalid or consumed, the device context does not match, or the underlying chain is no longer usable. The client should treat an unsuccessful refresh as a need to authenticate again, not as an invitation to retry the same credential indefinitely.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-dependent-strategies\u0022\u003EMode-dependent strategies\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EMode\u003C/th\u003E\n\u003Cth\u003EContinuation mechanism\u003C/th\u003E\n\u003Cth\u003ERequired state\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003Ctd\u003ESession touch\u003C/td\u003E\n\u003Ctd\u003EValid authoritative session\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003ESession-backed refresh-token rotation\u003C/td\u003E\n\u003Ctd\u003EValid session and refresh token\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003EJWT renewal with authoritative session validation\u003C/td\u003E\n\u003Ctd\u003EValid session-bound refresh token and session lineage\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ESession-independent refresh-token rotation\u003C/td\u003E\n\u003Ctd\u003EValid refresh token and refresh chain\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe authentication mode determines how authentication continuity is maintained.\u003C/p\u003E\n\u003Cp\u003EThe application uses the same refresh API regardless of the selected mode.\u003C/p\u003E\n\u003Cp\u003ERefresh-token-based continuation is available when refresh-token issuance is enabled for the effective mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-refresh-without-a-session\u0022\u003EPureJwt: refresh without a session\u003C/h3\u003E\n\u003Cp\u003EPureJwt uses a persisted refresh-token chain without requiring an authentication session.\u003C/p\u003E\n\u003Cp\u003EThe refresh operation:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EValidates the refresh token, tenant, and device binding.\u003C/li\u003E\n\u003Cli\u003EVerifies that the token is associated with a valid refresh chain and is not session-bound.\u003C/li\u003E\n\u003Cli\u003EResolves the authenticated user\u0027s current identity information and claims.\u003C/li\u003E\n\u003Cli\u003EGenerates replacement access and refresh credentials.\u003C/li\u003E\n\u003Cli\u003EAtomically consumes the previous refresh token and persists its replacement.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThe new JWT access token can be validated independently by Resource APIs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022concurrent-requests-and-replay-protection\u0022\u003EConcurrent requests and replay protection\u003C/h3\u003E\n\u003Cp\u003EA consumed refresh token cannot be used for another successful rotation.\u003C/p\u003E\n\u003Cp\u003EThe configured concurrent-request window distinguishes likely overlapping refresh requests from later reuse attempts.\u003C/p\u003E\n\u003Cp\u003EReuse outside that window can revoke the associated refresh chain.\u003C/p\u003E\n\u003Cp\u003EFor PureJwt, this revocation does not require a Session or SessionChain record.\u003C/p\u003E\n\u003Cp\u003EPreviously issued JWT access tokens are not automatically invalidated by refresh-token rotation or refresh-chain revocation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-touch\u0022\u003ESession touch\u003C/h2\u003E\n\u003Cp\u003EA session touch is a controlled update to existing server-side authentication state. It does not issue a replacement credential or create a new session.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003ESession ID\n \u2192 Validate session, chain and device context\n \u2192 Recheck active state and chain/session relationship\n \u2192 Touch if policy requires\n \u2192 Continue with the same session ID\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIn \u003Ccode\u003EPureOpaque\u003C/code\u003E, the refresh flow requires a session ID. The session validator checks the session against the current tenant, device context and session options. The touch service then reloads the session and chain from the store and checks that they are still active and consistent, including the chain\u0027s active session, tenant, user and chain identifiers.\u003C/p\u003E\n\u003Cp\u003ETouch behavior is governed by the effective session options:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003ETouchInterval\u003C/code\u003E avoids writing activity state on every request. If the interval has not elapsed, the operation may succeed as \u003Cstrong\u003ENoOp\u003C/strong\u003E.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ETouchMode\u003C/code\u003E is \u003Ccode\u003EIfNeeded\u003C/code\u003E by default; \u003Ccode\u003EForce\u003C/code\u003E requests a touch even when the normal interval has not elapsed.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ESession.SlidingExpiration\u003C/code\u003E allows an eligible touch to extend session expiration using the configured \u003Ccode\u003EToken.SessionIdLifetime\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EAn absolute chain expiration remains an upper bound; sliding expiration cannot extend the session beyond it.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EIdleTimeout\u003C/code\u003E participates in chain-state validation. An idle or otherwise inactive chain cannot be revived merely by touching it.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA successful \u003Cstrong\u003ENoOp\u003C/strong\u003E is not a failed refresh: the existing state was valid, but no persistence update was necessary. Likewise, a touch is not an unconditional promise to extend the session\u0027s expiry; that depends on policy and the absolute limit.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-token-rotation\u0022\u003ERefresh-token rotation\u003C/h2\u003E\n\u003Cp\u003ERotation replaces a valid refresh credential while preserving its association with the existing authentication context.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003ERefresh token\n \u2192 Validate token, tenant, device and expected session (if supplied)\n \u2192 Resolve user, session and chain\n \u2192 Prepare replacement refresh/access tokens\n \u2192 Atomically consume old refresh token and store replacement\n \u2192 Return new credentials\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe rotation service first rejects modes or configurations that do not permit refresh-token issuance (\u003Ccode\u003EPureOpaque\u003C/code\u003E or \u003Ccode\u003EIssueRefreshToken = false\u003C/code\u003E). It then validates the presented credential and its context. The replacement refresh token and access token are prepared before the existing token is consumed. Persistence uses the refresh-token store\u0027s execution boundary and \u003Ccode\u003ETryConsumeAsync\u003C/code\u003E, so competing requests cannot both successfully consume the same old token.\u003C/p\u003E\n\u003Cp\u003ERotation preserves the validated user, session and chain association; it is \u003Cstrong\u003Enot\u003C/strong\u003E a new authentication or a new session. Claims for the replacement access token are obtained through the configured claims provider.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022reuse-and-concurrent-requests\u0022\u003EReuse and concurrent requests\u003C/h3\u003E\n\u003Cp\u003EA consumed refresh token cannot be used again to obtain another replacement. UltimateAuth distinguishes two situations:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ELikely concurrent request:\u003C/strong\u003E if a consumed token has a recorded replacement and the second request falls within \u003Ccode\u003ERefreshTokenConcurrentRequestWindow\u003C/code\u003E, the second rotation is rejected without treating it as a confirmed replay.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EReplay outside that window:\u003C/strong\u003E the rotation service revokes the associated refresh-token chain, or tokens associated with the session when a chain identifier is unavailable.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThis distinction reduces destructive responses to ordinary client-side concurrency while retaining a response to suspicious reuse. The concurrency window is \u003Cstrong\u003Enot\u003C/strong\u003E a grace period in which the old token may be exchanged again: the second request still fails.\u003C/p\u003E\n\u003Cp\u003EThe rotation implementation shown here revokes refresh-token state. Do not interpret that as an unconditional guarantee that every related server-side session is also revoked; session invalidation is a separate concern.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022how-each-mode-executes\u0022\u003EHow each mode executes\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022pureopaque-session-continuation\u0022\u003EPureOpaque: session continuation\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E has no refresh-token rotation step. The endpoint resolves the existing session from the authentication flow context, validates it and performs a conditional touch. It returns \u003Ccode\u003ETouched\u003C/code\u003E when state was updated or \u003Ccode\u003ENoOp\u003C/code\u003E when the valid session required no update.\u003C/p\u003E\n\u003Cp\u003ENo access token or refresh token is issued. The existing session ID remains the credential representing the continued context.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022hybrid-session-and-token-continuity\u0022\u003EHybrid: session and token continuity\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EHybrid\u003C/code\u003E requires \u003Cstrong\u003Eboth\u003C/strong\u003E a valid session ID and a refresh token. The flow:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EValidates the session and device context.\u003C/li\u003E\n\u003Cli\u003EPerforms the session touch operation according to policy.\u003C/li\u003E\n\u003Cli\u003EValidates and rotates the refresh token, requiring it to match the expected session.\u003C/li\u003E\n\u003Cli\u003EReturns the existing session ID together with replacement access and refresh tokens.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThe order is important: \u003Cstrong\u003Esession touch happens before token rotation\u003C/strong\u003E in the current implementation. These operations are not presented as one cross-store transaction. If rotation subsequently fails, the refresh response fails, although a preceding session touch may already have been persisted. This should not be described as an all-or-nothing operation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022semihybrid-jwt-and-session-continuity\u0022\u003ESemiHybrid: JWT and session continuity\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid combines JWT access-token renewal with authoritative session lifecycle management.\u003C/p\u003E\n\u003Cp\u003EThe refresh operation:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EValidates the presented refresh token.\u003C/li\u003E\n\u003Cli\u003EResolves its associated user, tenant, device and session lineage.\u003C/li\u003E\n\u003Cli\u003EValidates the authoritative session state.\u003C/li\u003E\n\u003Cli\u003EApplies eligible session touch behavior.\u003C/li\u003E\n\u003Cli\u003EGenerates replacement access and refresh tokens.\u003C/li\u003E\n\u003Cli\u003EAtomically consumes the previous refresh token and persists its replacement.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThe replacement JWT retains its association with the existing session lineage.\u003C/p\u003E\n\u003Cp\u003EA successful refresh does not create a new authentication session.\u003C/p\u003E\n\u003Cp\u003EThe session identifier remains metadata and is not delivered as an opaque authentication credential.\u003C/p\u003E\n\u003Cp\u003EAn expired access token does not prevent renewal when the refresh credential and its associated session lineage remain valid.\u003C/p\u003E\n\u003Cp\u003EHowever, a revoked, expired, or otherwise invalid session cannot be renewed through refresh.\u003C/p\u003E\n\u003Cp\u003ESession touch and refresh-token rotation are separate persistence operations. They should not be interpreted as one cross-store transaction.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-session-independent-token-continuity\u0022\u003EPureJwt: session-independent token continuity\u003C/h3\u003E\n\u003Cp\u003EPureJwt refresh validates the refresh credential and its associated refresh chain without resolving an authentication session.\u003C/p\u003E\n\u003Cp\u003EThe previous refresh token is consumed and replaced together with a new JWT access token.\u003C/p\u003E\n\u003Cp\u003ENo session root, session chain, or authentication session is created as part of this operation.\u003C/p\u003E\n\u003Cp\u003EPreviously issued access tokens remain subject to their own expiration and validation requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022request-resolution-and-response-delivery\u0022\u003ERequest resolution and response delivery\u003C/h2\u003E\n\u003Cp\u003EThe refresh endpoint uses the effective \u003Ccode\u003EAuthFlowContext\u003C/code\u003E to resolve the authentication mode, tenant, device and available authentication context.\u003C/p\u003E\n\u003Cp\u003EIn PureOpaque and Hybrid, the session credential participates in authentication continuation.\u003C/p\u003E\n\u003Cp\u003EIn SemiHybrid, the refresh credential identifies the associated session lineage, which must be validated authoritatively.\u003C/p\u003E\n\u003Cp\u003EIn PureJwt, continuation is based on the session-independent refresh chain.\u003C/p\u003E\n\u003Cp\u003ERefresh-token input is resolved exclusively from the effective refresh grant delivery configuration.\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EWhen cookie delivery is active, the configured refresh cookie is used.\u003C/li\u003E\n\u003Cli\u003EWhen header delivery is active, the configured refresh request header and header format are used.\u003C/li\u003E\n\u003Cli\u003EWhen refresh grant delivery is disabled, no refresh credential is resolved.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe default refresh credential name is \u003Ccode\u003Euar\u003C/code\u003E for both cookie and header delivery.\u003C/p\u003E\n\u003Cp\u003EThe \u003Ccode\u003EX-Refresh-Token\u003C/code\u003E header is not an implicit credential source. It is accepted only when explicitly configured as the refresh grant header.\u003C/p\u003E\n\u003Cp\u003EMissing, malformed, or duplicate refresh credentials are rejected without falling back to another transport.\u003C/p\u003E\n\u003Cp\u003EOn success, the endpoint chooses a \u003Cstrong\u003Eprimary credential\u003C/strong\u003E according to the refresh response policy, rather than automatically writing every credential returned by the flow. The refresh token is written separately when permitted by the response policy and when a replacement exists. Actual cookie/header placement is determined by the effective response configuration and application profile.\u003C/p\u003E\n\u003Cp\u003EThe HTTP endpoint returns \u003Cstrong\u003E\u003Ccode\u003E204 No Content\u003C/code\u003E\u003C/strong\u003E on successful refresh and \u003Cstrong\u003E\u003Ccode\u003E401 Unauthorized\u003C/code\u003E\u003C/strong\u003E when continuation fails. Clients should obtain credentials from the configured response delivery mechanism rather than expecting a JSON token payload. When \u003Ccode\u003EDiagnostics.EnableRefreshDetails\u003C/code\u003E is enabled, the endpoint also writes the refresh outcome through its diagnostic response writer.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022outcomes-and-client-expectations\u0022\u003EOutcomes and client expectations\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOutcome\u003C/th\u003E\n\u003Cth\u003EMeaning\u003C/th\u003E\n\u003Cth\u003EClient interpretation\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENoOp\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EExisting session is valid; no touch was necessary\u003C/td\u003E\n\u003Ctd\u003EContinue normally\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETouched\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EExisting session activity was updated\u003C/td\u003E\n\u003Ctd\u003EContinue normally\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERotated\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh token was consumed and replacement credentials issued\u003C/td\u003E\n\u003Ctd\u003EReplace stored credentials with the new values\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauthRequired\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EThe flow could not safely continue\u003C/td\u003E\n\u003Ctd\u003EStop using the failed refresh credential and require authentication\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003ERefreshFlowResult\u003C/code\u003E also recognizes \u003Ccode\u003ESuccess\u003C/code\u003E as a successful outcome, although the mode-specific branches described above return \u003Ccode\u003ENoOp\u003C/code\u003E, \u003Ccode\u003ETouched\u003C/code\u003E, \u003Ccode\u003ERotated\u003C/code\u003E or \u003Ccode\u003EReauthRequired\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe UltimateAuth Client SDK coordinates refresh attempts through a shared single-flight mechanism within the current client scope.\u003C/p\u003E\n\u003Cp\u003ECustom clients should implement appropriate refresh coordination to avoid unnecessary concurrent rotation attempts.\u003C/p\u003E\n\u003Cp\u003EServer-side rotation and replay protection remain necessary across independent client scopes, applications, and devices.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-boundaries\u0022\u003ESecurity boundaries\u003C/h2\u003E\n\u003Cp\u003ERefresh continues existing trust only while the relevant state remains valid:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ESession and chain checks:\u003C/strong\u003E session-based paths validate active state, tenant, user, chain and session relationships.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EDevice context:\u003C/strong\u003E session and refresh-token validation receive the current device context; mismatches can prevent continuation.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESingle-use refresh tokens:\u003C/strong\u003E successful rotation consumes the old credential and persists a replacement.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EReplay response:\u003C/strong\u003E suspicious reuse can revoke refresh-token state associated with the chain or session.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EExpiration:\u003C/strong\u003E idle, session, chain and refresh-token validity rules can end continuation. Refresh does not bypass those limits.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EIssuance policy:\u003C/strong\u003E \u003Ccode\u003EIssueRefreshToken = false\u003C/code\u003E prevents rotation before the old token is consumed.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese controls complement one another. A refresh token should be treated as a sensitive credential, not as a harmless request to generate another access token.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022summary\u0022\u003ESummary\u003C/h2\u003E\n\u003Cp\u003EThe useful distinction is not simply \u003Cem\u003Estateful versus stateless\u003C/em\u003E. It is \u003Cstrong\u003Ewhat must remain valid for authentication to continue\u003C/strong\u003E:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E continues an existing server-side session, with conditional activity updates.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EHybrid\u003C/code\u003E requires session validity and successful refresh-token rotation.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ESemiHybrid\u003C/code\u003E describes JWT renewal with server-managed lifecycle state.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EPureJwt\u003C/code\u003E rotates refresh credentials through a session-independent refresh chain.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003ERefresh does not authenticate a user again. It extends the usefulness of an already established authentication context only within the boundaries of the selected mode and configured security policies.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003ENext step\u003C/h2\u003E\n\u003Cp\u003EContinue to \u003Ca href=\u0022./logout-flow\u0022\u003ELogout Flow\u003C/a\u003E.\u003C/p\u003E\n", + "Html": "\n\u003Cp\u003ERefresh is how an existing authentication context continues without asking the user to authenticate again. In UltimateAuth, it is not synonymous with issuing a new access token: the operation depends on the active authentication mode and on whether the context is represented by a server-side session, refresh token, or both.\u003C/p\u003E\n\u003Cp\u003EA successful refresh preserves the authenticated identity and its continuity. It does \u003Cstrong\u003Enot\u003C/strong\u003E prove the user\u0027s credentials again, create a new login, or necessarily extend every lifetime associated with the authentication.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003EThis guide describes server-side refresh execution.\u003C/p\u003E\n\u003Cp\u003EFor client-side scheduling, proactive renewal, reactive recovery, background refresh, and concurrent request coordination, see \u003Ca href=\u0022/docs/client-sdk/automatic-refresh\u0022\u003EAutomatic Refresh\u003C/a\u003E.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-model-continuity-not-a-second-login\u0022\u003EThe model: continuity, not a second login\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth distinguishes three related operations:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EAuthentication\u003C/strong\u003E establishes a new authenticated context after the required proof is accepted.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ERefresh\u003C/strong\u003E attempts to continue an already established context, subject to its current validity and security policies.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EReauthentication\u003C/strong\u003E establishes trust again when continuation is unavailable or no longer permitted.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThis distinction matters for both security and client behavior. A refresh request can fail because a session expired, a refresh token is invalid or consumed, the device context does not match, or the underlying chain is no longer usable. The client should treat an unsuccessful refresh as a need to authenticate again, not as an invitation to retry the same credential indefinitely.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-dependent-strategies\u0022\u003EMode-dependent strategies\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EMode\u003C/th\u003E\n\u003Cth\u003EContinuation mechanism\u003C/th\u003E\n\u003Cth\u003ERequired state\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003Ctd\u003ESession touch\u003C/td\u003E\n\u003Ctd\u003EValid authoritative session\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003ESession-backed refresh-token rotation\u003C/td\u003E\n\u003Ctd\u003EValid session and refresh token\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003EJWT renewal with authoritative session validation\u003C/td\u003E\n\u003Ctd\u003EValid session-bound refresh token and session lineage\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ESession-independent refresh-token rotation\u003C/td\u003E\n\u003Ctd\u003EValid refresh token and refresh chain\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe authentication mode determines how authentication continuity is maintained.\u003C/p\u003E\n\u003Cp\u003EThe application uses the same refresh API regardless of the selected mode.\u003C/p\u003E\n\u003Cp\u003ERefresh-token-based continuation is available when refresh-token issuance is enabled for the effective mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-refresh-without-a-session\u0022\u003EPureJwt: refresh without a session\u003C/h3\u003E\n\u003Cp\u003EPureJwt uses a persisted refresh-token chain without requiring an authentication session.\u003C/p\u003E\n\u003Cp\u003EThe refresh operation:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EValidates the refresh token, tenant, and device binding.\u003C/li\u003E\n\u003Cli\u003EVerifies that the token is associated with a valid refresh chain and is not session-bound.\u003C/li\u003E\n\u003Cli\u003EResolves the authenticated user\u0027s current identity information and claims.\u003C/li\u003E\n\u003Cli\u003EGenerates replacement access and refresh tokens.\u003C/li\u003E\n\u003Cli\u003EAtomically consumes the previous refresh token and persists its replacement.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThe new JWT access token can be validated independently by Resource APIs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022concurrent-requests-and-replay-protection\u0022\u003EConcurrent requests and replay protection\u003C/h3\u003E\n\u003Cp\u003EA consumed refresh token cannot be used for another successful rotation.\u003C/p\u003E\n\u003Cp\u003EThe configured concurrent-request window distinguishes likely overlapping refresh requests from later reuse attempts.\u003C/p\u003E\n\u003Cp\u003EReuse outside that window can revoke the associated refresh chain.\u003C/p\u003E\n\u003Cp\u003EFor PureJwt, this revocation does not require a Session or SessionChain record.\u003C/p\u003E\n\u003Cp\u003EPreviously issued JWT access tokens are not automatically invalidated by refresh-token rotation or refresh-chain revocation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-touch\u0022\u003ESession touch\u003C/h2\u003E\n\u003Cp\u003EA session touch is a controlled update to existing server-side authentication state. It does not issue a replacement credential or create a new session.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003ESession ID\n \u2192 Validate session, chain and device context\n \u2192 Recheck active state and chain/session relationship\n \u2192 Touch if policy requires\n \u2192 Continue with the same session ID\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIn \u003Ccode\u003EPureOpaque\u003C/code\u003E, the refresh flow requires a session ID. The session validator checks the session against the current tenant, device context and session options. The touch service then reloads the session and chain from the store and checks that they are still active and consistent, including the chain\u0027s active session, tenant, user and chain identifiers.\u003C/p\u003E\n\u003Cp\u003ETouch behavior is governed by the effective session options:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003ETouchInterval\u003C/code\u003E avoids writing activity state on every request. If the interval has not elapsed, the operation may succeed as \u003Cstrong\u003ENoOp\u003C/strong\u003E.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ETouchMode\u003C/code\u003E is \u003Ccode\u003EIfNeeded\u003C/code\u003E by default; \u003Ccode\u003EForce\u003C/code\u003E requests a touch even when the normal interval has not elapsed.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ESession.SlidingExpiration\u003C/code\u003E allows an eligible touch to extend session expiration using the configured \u003Ccode\u003EToken.SessionIdLifetime\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EAn absolute chain expiration remains an upper bound; sliding expiration cannot extend the session beyond it.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EIdleTimeout\u003C/code\u003E participates in chain-state validation. An idle or otherwise inactive chain cannot be revived merely by touching it.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA successful \u003Cstrong\u003ENoOp\u003C/strong\u003E is not a failed refresh: the existing state was valid, but no persistence update was necessary. Likewise, a touch is not an unconditional promise to extend the session\u0027s expiry; that depends on policy and the absolute limit.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-token-rotation\u0022\u003ERefresh-token rotation\u003C/h2\u003E\n\u003Cp\u003ERotation replaces a valid refresh token while preserving its association with the existing authentication context.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003ERefresh token\n \u2192 Validate token, tenant, device and expected session (if supplied)\n \u2192 Resolve user, session and chain\n \u2192 Prepare replacement refresh/access tokens\n \u2192 Atomically consume old refresh token and store replacement\n \u2192 Return new credentials\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe rotation service first rejects modes or configurations that do not permit refresh-token issuance (\u003Ccode\u003EPureOpaque\u003C/code\u003E or \u003Ccode\u003EIssueRefreshToken = false\u003C/code\u003E). It then validates the presented credential and its context. The replacement refresh token and access token are prepared before the existing token is consumed. Persistence uses the refresh-token store\u0027s execution boundary and \u003Ccode\u003ETryConsumeAsync\u003C/code\u003E, so competing requests cannot both successfully consume the same old token.\u003C/p\u003E\n\u003Cp\u003ERotation preserves the validated user, session and chain association; it is \u003Cstrong\u003Enot\u003C/strong\u003E a new authentication or a new session. Claims for the replacement access token are obtained through the configured claims provider.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022reuse-and-concurrent-requests\u0022\u003EReuse and concurrent requests\u003C/h3\u003E\n\u003Cp\u003EA consumed refresh token cannot be used again to obtain another replacement. UltimateAuth distinguishes two situations:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ELikely concurrent request:\u003C/strong\u003E if a consumed token has a recorded replacement and the second request falls within \u003Ccode\u003ERefreshTokenConcurrentRequestWindow\u003C/code\u003E, the second rotation is rejected without treating it as a confirmed replay.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EReplay outside that window:\u003C/strong\u003E the rotation service revokes the associated refresh-token chain, or tokens associated with the session when a chain identifier is unavailable.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThis distinction reduces destructive responses to ordinary client-side concurrency while retaining a response to suspicious reuse. The concurrency window is \u003Cstrong\u003Enot\u003C/strong\u003E a grace period in which the old token may be exchanged again: the second request still fails.\u003C/p\u003E\n\u003Cp\u003EThe rotation implementation shown here revokes refresh-token state. Do not interpret that as an unconditional guarantee that every related server-side session is also revoked; session invalidation is a separate concern.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022how-each-mode-executes\u0022\u003EHow each mode executes\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022pureopaque-session-continuation\u0022\u003EPureOpaque: session continuation\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E has no refresh-token rotation step. The endpoint resolves the existing session from the authentication flow context, validates it and performs a conditional touch. It returns \u003Ccode\u003ETouched\u003C/code\u003E when state was updated or \u003Ccode\u003ENoOp\u003C/code\u003E when the valid session required no update.\u003C/p\u003E\n\u003Cp\u003ENo access token or refresh token is issued. The existing session ID remains the credential representing the continued context.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022hybrid-session-and-token-continuity\u0022\u003EHybrid: session and token continuity\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EHybrid\u003C/code\u003E requires \u003Cstrong\u003Eboth\u003C/strong\u003E a valid session ID and a refresh token. The flow:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EValidates the session and device context.\u003C/li\u003E\n\u003Cli\u003EPerforms the session touch operation according to policy.\u003C/li\u003E\n\u003Cli\u003EValidates and rotates the refresh token, requiring it to match the expected session.\u003C/li\u003E\n\u003Cli\u003EReturns the existing session ID together with replacement access and refresh tokens.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThe order is important: \u003Cstrong\u003Esession touch happens before token rotation\u003C/strong\u003E in the current implementation. These operations are not presented as one cross-store transaction. If rotation subsequently fails, the refresh response fails, although a preceding session touch may already have been persisted. This should not be described as an all-or-nothing operation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022semihybrid-jwt-and-session-continuity\u0022\u003ESemiHybrid: JWT and session continuity\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid combines JWT access-token renewal with authoritative session lifecycle management.\u003C/p\u003E\n\u003Cp\u003EThe refresh operation:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EValidates the presented refresh token.\u003C/li\u003E\n\u003Cli\u003EResolves its associated user, tenant, device and session lineage.\u003C/li\u003E\n\u003Cli\u003EValidates the authoritative session state.\u003C/li\u003E\n\u003Cli\u003EApplies eligible session touch behavior.\u003C/li\u003E\n\u003Cli\u003EGenerates replacement access and refresh tokens.\u003C/li\u003E\n\u003Cli\u003EAtomically consumes the previous refresh token and persists its replacement.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThe replacement JWT retains its association with the existing session lineage.\u003C/p\u003E\n\u003Cp\u003EA successful refresh does not create a new authentication session.\u003C/p\u003E\n\u003Cp\u003EThe session identifier remains metadata and is not delivered as an opaque authentication credential.\u003C/p\u003E\n\u003Cp\u003EAn expired access token does not prevent renewal when the refresh token and its associated session lineage remain valid.\u003C/p\u003E\n\u003Cp\u003EHowever, a revoked, expired, or otherwise invalid session cannot be renewed through refresh.\u003C/p\u003E\n\u003Cp\u003ESession touch and refresh-token rotation are separate persistence operations. They should not be interpreted as one cross-store transaction.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-session-independent-token-continuity\u0022\u003EPureJwt: session-independent token continuity\u003C/h3\u003E\n\u003Cp\u003EPureJwt refresh validates the refresh token and its associated refresh chain without resolving an authentication session.\u003C/p\u003E\n\u003Cp\u003EThe previous refresh token is consumed and replaced together with a new JWT access token.\u003C/p\u003E\n\u003Cp\u003ENo session root, session chain, or authentication session is created as part of this operation.\u003C/p\u003E\n\u003Cp\u003EPreviously issued access tokens remain subject to their own expiration and validation requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022request-resolution-and-response-transport\u0022\u003ERequest Resolution and Response Transport\u003C/h2\u003E\n\u003Cp\u003EThe effective authentication mode determines how authentication continuity is established.\u003C/p\u003E\n\u003Cp\u003EIn PureOpaque and Hybrid, the session ID participates in authentication continuation.\u003C/p\u003E\n\u003Cp\u003EIn SemiHybrid, the refresh token identifies the associated session lineage, which must be validated authoritatively.\u003C/p\u003E\n\u003Cp\u003EPureJwt uses a session-independent refresh chain.\u003C/p\u003E\n\u003Cp\u003ERefresh tokens are resolved exclusively from their effective transport configuration.\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EWhen cookie transport is active, the configured refresh cookie is used.\u003C/li\u003E\n\u003Cli\u003EWhen header transport is active, the configured request header and header format are used.\u003C/li\u003E\n\u003Cli\u003EWhen refresh token transport is disabled, no refresh token is resolved.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe default refresh token name is \u003Ccode\u003Euar\u003C/code\u003E for both cookie and header transport.\u003C/p\u003E\n\u003Cp\u003EThe \u003Ccode\u003EX-Refresh-Token\u003C/code\u003E header is not an implicit token source. It is accepted only when explicitly configured.\u003C/p\u003E\n\u003Cp\u003EMissing, malformed, or duplicate refresh tokens are rejected without falling back to another transport.\u003C/p\u003E\n\u003Cp\u003EOn success, the endpoint selects the applicable primary surrogate according to the refresh response policy. A replacement refresh token is written separately when permitted by the policy and when one has been issued.\u003C/p\u003E\n\u003Cp\u003EThe HTTP endpoint returns \u003Cstrong\u003E\u003Ccode\u003E204 No Content\u003C/code\u003E\u003C/strong\u003E on successful refresh and \u003Cstrong\u003E\u003Ccode\u003E401 Unauthorized\u003C/code\u003E\u003C/strong\u003E when continuation fails.\u003C/p\u003E\n\u003Cp\u003EClients obtain newly issued tokens through the effective transport configuration rather than expecting a JSON token payload.\u003C/p\u003E\n\u003Cp\u003EWhen \u003Ccode\u003EDiagnostics.EnableRefreshDetails\u003C/code\u003E is enabled, the endpoint also writes the refresh outcome through its diagnostic response writer.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022outcomes-and-client-expectations\u0022\u003EOutcomes and client expectations\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOutcome\u003C/th\u003E\n\u003Cth\u003EMeaning\u003C/th\u003E\n\u003Cth\u003EClient interpretation\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENoOp\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EExisting session is valid; no touch was necessary\u003C/td\u003E\n\u003Ctd\u003EContinue normally\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETouched\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EExisting session activity was updated\u003C/td\u003E\n\u003Ctd\u003EContinue normally\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERotated\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh token was consumed and replacement surrogates issued\u003C/td\u003E\n\u003Ctd\u003EReplace stored surrogates with the new values\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauthRequired\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EThe flow could not safely continue\u003C/td\u003E\n\u003Ctd\u003EStop using the failed refresh token and require authentication\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003ERefreshFlowResult\u003C/code\u003E also recognizes \u003Ccode\u003ESuccess\u003C/code\u003E as a successful outcome, although the mode-specific branches described above return \u003Ccode\u003ENoOp\u003C/code\u003E, \u003Ccode\u003ETouched\u003C/code\u003E, \u003Ccode\u003ERotated\u003C/code\u003E or \u003Ccode\u003EReauthRequired\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe UltimateAuth Client SDK coordinates refresh attempts through a shared single-flight mechanism within the current client scope.\u003C/p\u003E\n\u003Cp\u003ECustom clients should implement appropriate refresh coordination to avoid unnecessary concurrent rotation attempts.\u003C/p\u003E\n\u003Cp\u003EServer-side rotation and replay protection remain necessary across independent client scopes, applications, and devices.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-boundaries\u0022\u003ESecurity boundaries\u003C/h2\u003E\n\u003Cp\u003ERefresh continues existing trust only while the relevant state remains valid:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ESession and chain checks:\u003C/strong\u003E session-based paths validate active state, tenant, user, chain and session relationships.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EDevice context:\u003C/strong\u003E session and refresh-token validation receive the current device context; mismatches can prevent continuation.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESingle-use refresh tokens:\u003C/strong\u003E successful rotation consumes the old credential and persists a replacement.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EReplay response:\u003C/strong\u003E suspicious reuse can revoke refresh-token state associated with the chain or session.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EExpiration:\u003C/strong\u003E idle, session, chain and refresh-token validity rules can end continuation. Refresh does not bypass those limits.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EIssuance policy:\u003C/strong\u003E \u003Ccode\u003EIssueRefreshToken = false\u003C/code\u003E prevents rotation before the old token is consumed.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese controls complement one another. A refresh token should be treated as a sensitive credential, not as a harmless request to generate another access token.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022summary\u0022\u003ESummary\u003C/h2\u003E\n\u003Cp\u003EThe useful distinction is not simply \u003Cem\u003Estateful versus stateless\u003C/em\u003E. It is \u003Cstrong\u003Ewhat must remain valid for authentication to continue\u003C/strong\u003E:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E continues an existing server-side session, with conditional activity updates.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EHybrid\u003C/code\u003E requires session validity and successful refresh-token rotation.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ESemiHybrid\u003C/code\u003E describes JWT renewal with server-managed lifecycle state.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EPureJwt\u003C/code\u003E rotates refresh tokens through a session-independent refresh chain.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003ERefresh does not authenticate a user again. It extends the usefulness of an already established authentication context only within the boundaries of the selected mode and configured security policies.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003ENext step\u003C/h2\u003E\n\u003Cp\u003EContinue to \u003Ca href=\u0022./logout-flow\u0022\u003ELogout Flow\u003C/a\u003E.\u003C/p\u003E\n", "Headings": [ { "Id": "the-model-continuity-not-a-second-login", @@ -64,8 +64,8 @@ "Level": 1 }, { - "Id": "request-resolution-and-response-delivery", - "Text": "Request resolution and response delivery", + "Id": "request-resolution-and-response-transport", + "Text": "Request Resolution and Response Transport", "Level": 0 }, { @@ -89,6 +89,6 @@ "Level": 0 } ], - "SourceHash": "AA20B576060982167415BCA0861B5C0878FA493935093448C365DC94C7F0C97E", + "SourceHash": "9C030B8CD87FE9CD31822421278D07893B040C48B9C383AAAAF148D83097CC71", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/advanced-configuration.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/advanced-configuration.json index 55060769..b0622451 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/advanced-configuration.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/advanced-configuration.json @@ -1,7 +1,7 @@ { "Slug": "configuration/advanced-configuration", "Title": "Advanced Configuration", - "Html": "\n\u003Cp\u003EUltimateAuth supports advanced customization of authentication behavior through effective server options, authentication mode resolution, dependency injection, custom infrastructure, and lifecycle events.\u003C/p\u003E\n\u003Cp\u003EThese mechanisms serve different purposes:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EOptions\u003C/strong\u003E define configurable behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EEffective options\u003C/strong\u003E adapt that behavior to the selected authentication mode.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EResolvers\u003C/strong\u003E determine information required by authentication flows.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EAuthorities and validators\u003C/strong\u003E participate in security decisions.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EStores\u003C/strong\u003E persist authentication and application state.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EEvents\u003C/strong\u003E allow applications to react to completed operations.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EMost applications should begin with the standard Server and Client options. Advanced customization becomes useful when an application needs specialized authentication behavior, custom infrastructure, or integration with existing systems.\u003C/p\u003E\n\u003Cp\u003EThis guide explains the supported extension mechanisms, their execution order, and the security boundaries developers must preserve.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-versus-extensibility\u0022\u003E1. Configuration Versus Extensibility\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth distinguishes between configuring existing behavior and replacing an implementation.\u003C/p\u003E\n\u003Cp\u003EFor example, changing a session lifetime is configuration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EProviding a custom clock is an infrastructure extension:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddSingleton\u0026lt;IClock, ApplicationClock\u0026gt;();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EApplicationClock\u003C/code\u003E is an implementation supplied by your application.\u003C/p\u003E\n\u003Cp\u003EThese approaches are not interchangeable.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ERequirement\u003C/th\u003E\n\u003Cth\u003ERecommended mechanism\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EChange session lifetime\u003C/td\u003E\n\u003Ctd\u003EServer options\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EChange token lifetime for a specific mode\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EConfigureMode()\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESelect authentication mode differently\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIEffectiveAuthModeResolver\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResolve tenants from a custom source\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EITenantIdResolver\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECustomize login decisions\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EILoginAuthority\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESupply signing keys\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIJwtSigningKeyProvider\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPersist sessions in another backend\u003C/td\u003E\n\u003Ctd\u003EStore implementation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EReact to successful login\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthEvents\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAdd application-specific access rules\u003C/td\u003E\n\u003Ctd\u003EPolicies\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EPrefer the most specific supported mechanism rather than replacing an entire authentication component.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022understanding-effective-server-options\u0022\u003E2. Understanding Effective Server Options\u003C/h2\u003E\n\u003Cp\u003EThe server does not necessarily use the original \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E instance unchanged for every authentication flow.\u003C/p\u003E\n\u003Cp\u003EInstead, UltimateAuth can resolve an effective configuration based on the application profile and authentication mode.\u003C/p\u003E\n\u003Cp\u003EThe relevant types are:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EIEffectiveServerOptionsProvider\nEffectiveUAuthServerOptions\nIEffectiveAuthModeResolver\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configured-options\u0022\u003EConfigured Options\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E represents the application\u0027s configured server settings.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n options.Token.Issuer = \u0026quot;MyApplication\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese settings form the base configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022effective-options\u0022\u003EEffective Options\u003C/h3\u003E\n\u003Cp\u003EThe provider produces an \u003Ccode\u003EEffectiveUAuthServerOptions\u003C/code\u003E instance containing:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic sealed class EffectiveUAuthServerOptions\n{\n public UAuthMode Mode { get; init; }\n public UAuthServerOptions Options { get; init; } = default!;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EMode\u003C/code\u003E identifies the resolved authentication mode.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EOptions\u003C/code\u003E contains the effective server configuration for that mode.\u003C/p\u003E\n\u003Cp\u003EThe effective configuration is derived from the original settings rather than replacing the application\u0027s registered options globally.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022effective-configuration-resolution\u0022\u003E3. Effective Configuration Resolution\u003C/h2\u003E\n\u003Cp\u003EThe current \u003Ccode\u003EEffectiveServerOptionsProvider\u003C/code\u003E follows this sequence:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EConfigured UAuthServerOptions\n |\n v\n Resolve mode\n |\n v\n Clone base options\n |\n v\n Apply mode defaults\n |\n v\n Apply ConfigureMode override\n |\n v\n EffectiveUAuthServerOptions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIn simplified form:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar original = baseOptions.Value;\n\nvar mode = modeResolver.Resolve(applicationProfile);\n\nvar options = original.Clone();\n\nConfigureDefaults.ApplyModeDefaults(mode, options);\n\nif (original.ModeConfigurations.TryGetValue(mode, out var configure))\n{\n configure(options);\n}\n\nreturn new EffectiveUAuthServerOptions\n{\n Mode = mode,\n Options = options\n};\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis execution order is important.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EMode defaults are applied after the original configuration is cloned.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EConsequently, certain values configured globally may be replaced by mode-specific defaults.\u003C/p\u003E\n\u003Cp\u003EExplicit mode overrides are applied last.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-changes-between-requests\u0022\u003EWhat Changes Between Requests?\u003C/h3\u003E\n\u003Cp\u003EDifferent application profiles can resolve to different authentication modes.\u003C/p\u003E\n\u003Cp\u003EThe provider therefore can produce different effective configurations for different application profiles.\u003C/p\u003E\n\u003Cp\u003EHowever, this does not mean every setting is independently recalculated from arbitrary request data.\u003C/p\u003E\n\u003Cp\u003EIn the current implementation, mode selection is based on the supplied \u003Ccode\u003EUAuthApplicationProfile\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe provider also accepts tenant context, but the default effective-options construction does not apply an additional tenant-specific configuration override.\u003C/p\u003E\n\u003Cp\u003EApplications should not assume that per-tenant options customization exists automatically.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-authentication-mode-resolution\u0022\u003E4. Default Authentication Mode Resolution\u003C/h2\u003E\n\u003Cp\u003EThe default \u003Ccode\u003EEffectiveAuthModeResolver\u003C/code\u003E maps application profiles to authentication modes.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication Profile\u003C/th\u003E\n\u003Cth\u003EDefault Mode\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EBlazorServer\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EWebServer\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EBlazorWasm\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaui\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthHub\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EApi\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EOther / unknown\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese mappings describe the current default resolver.\u003C/p\u003E\n\u003Cp\u003EThey do not imply that every resolved mode is fully supported in the current release.\u003C/p\u003E\n\u003Cp\u003EApplications should verify that their application profiles resolve to a supported authentication mode before deploying.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022allowedmodes-is-not-a-mode-selector\u0022\u003EAllowedModes Is Not a Mode Selector\u003C/h3\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AllowedModes =\n [\n UAuthMode.PureOpaque,\n UAuthMode.Hybrid\n ];\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis restricts which modes are allowed.\u003C/p\u003E\n\u003Cp\u003EIt does not instruct the resolver to choose \u003Ccode\u003EHybrid\u003C/code\u003E for every client.\u003C/p\u003E\n\u003Cp\u003EMode selection and mode restrictions are separate responsibilities.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-authentication-modes\u0022\u003E5. Configure Authentication Modes\u003C/h2\u003E\n\u003Cp\u003EUse the public \u003Ccode\u003EConfigureMode()\u003C/code\u003E extension to customize settings for a particular authentication mode.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ConfigureMode(UAuthMode.Hybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(5);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configuration changes the effective access token lifetime for \u003Ccode\u003EHybrid\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EIt does not change the effective \u003Ccode\u003EPureOpaque\u003C/code\u003E configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-configuremode-matters\u0022\u003EWhy ConfigureMode Matters\u003C/h3\u003E\n\u003Cp\u003EConsider this configuration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(30);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe current \u003Ccode\u003EHybrid\u003C/code\u003E mode defaults explicitly set:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EToken.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EBecause mode defaults are applied after the base options are cloned, the effective \u003Ccode\u003EHybrid\u003C/code\u003E access token lifetime becomes ten minutes rather than thirty.\u003C/p\u003E\n\u003Cp\u003ETo override that behavior, use:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ConfigureMode(UAuthMode.Hybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(30);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe explicit mode override is applied after the mode defaults.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-multiple-modes\u0022\u003EConfigure Multiple Modes\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ConfigureMode(UAuthMode.Hybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n });\n\n options.ConfigureMode(UAuthMode.PureOpaque, mode =\u0026gt;\n {\n mode.Session.IdleTimeout = TimeSpan.FromDays(3);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach override is associated with its specified mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important-limitations\u0022\u003EImportant Limitations\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EConfigureMode()\u003C/code\u003E configures the effective options for a mode.\u003C/p\u003E\n\u003Cp\u003EIt does not:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EEnable an unsupported authentication mode.\u003C/li\u003E\n\u003Cli\u003EBypass the server\u0027s allowed-mode restrictions.\u003C/li\u003E\n\u003Cli\u003EReplace the authentication mode resolver.\u003C/li\u003E\n\u003Cli\u003EAutomatically create a tenant-specific configuration.\u003C/li\u003E\n\u003Cli\u003EGuarantee that every combination of effective settings is safe.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe current implementation applies mode overrides during effective-options resolution.\u003C/p\u003E\n\u003Cp\u003EDo not assume that every mode-specific combination receives the same startup validation as the original \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E instance.\u003C/p\u003E\n\u003Cp\u003ETest mode overrides carefully, especially when changing token issuance, session lifetimes, or credential delivery.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-defaults\u0022\u003E6. Mode Defaults\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth applies authentication-mode-specific defaults when resolving effective server options.\u003C/p\u003E\n\u003Cp\u003EThese defaults adapt the authentication infrastructure to the selected mode without requiring mode-specific application code.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-defined-credential-behavior\u0022\u003EMode-defined credential behavior\u003C/h3\u003E\n\u003Cp\u003EThe effective authentication mode determines which credential types are issued and how they participate in authentication.\u003C/p\u003E\n\u003Cp\u003EJWT and opaque credential issuance are not independent mode-selection flags.\u003C/p\u003E\n\u003Cp\u003EApplications select the authentication strategy through \u003Ccode\u003EAuthMode\u003C/code\u003E or \u003Ccode\u003EApplicationProfileModes\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-specific-configuration-behavior\u0022\u003EMode-specific configuration behavior\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EMode\u003C/th\u003E\n\u003Cth\u003ERelevant defaults\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003Ctd\u003ESession-based continuation, longer default idle timeout and touch interval\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003EAuthoritative session validation with separate token lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003EJWT authentication with server-managed session lineage\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ESession-independent JWT authentication without session touch\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EMode defaults also configure applicable credential delivery and cookie lifetime behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022global-values-and-mode-overrides\u0022\u003EGlobal values and mode overrides\u003C/h3\u003E\n\u003Cp\u003EToken lifetimes can be configured globally.\u003C/p\u003E\n\u003Cp\u003EMode-specific overrides allow applications to customize the effective configuration for particular authentication modes.\u003C/p\u003E\n\u003Cp\u003EThe effective configuration is resolved from the configured values, applicable mode defaults, and explicit mode-specific overrides.\u003C/p\u003E\n\u003Cp\u003EUse \u003Ccode\u003EConfigureMode()\u003C/code\u003E when a configuration value must differ between authentication modes.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E for the available token and session properties.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-requirements-are-independent-of-mode-selection\u0022\u003EValidation requirements are independent of mode selection\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid supports Standard and HubValidated authentication requirements without introducing additional authentication modes.\u003C/p\u003E\n\u003Cp\u003EThe validation requirement determines whether a particular operation needs authoritative session validation.\u003C/p\u003E\n\u003Cp\u003EThis allows applications to tune authentication behavior without introducing mode-specific client integration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022inspect-effective-options\u0022\u003E7. Inspect Effective Options\u003C/h2\u003E\n\u003Cp\u003EAdvanced integrations can use \u003Ccode\u003EIEffectiveServerOptionsProvider\u003C/code\u003E to inspect configured and effective server options.\u003C/p\u003E\n\u003Cp\u003EThe interface exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic interface IEffectiveServerOptionsProvider\n{\n UAuthServerOptions GetOriginal(HttpContext context);\n EffectiveUAuthServerOptions GetEffective(HttpContext context, UAuthApplicationProfile applicationProfile);\n EffectiveUAuthServerOptions GetEffective(TenantKey tenant, UAuthApplicationProfile applicationProfile);\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022inspect-the-original-configuration\u0022\u003EInspect the Original Configuration\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar original = provider.GetOriginal(httpContext);\nvar configuredLifetime = original.Token.AccessTokenLifetime;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022inspect-the-effective-configuration\u0022\u003EInspect the Effective Configuration\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar effective = provider.GetEffective(httpContext, UAuthApplicationProfile.BlazorWasm);\nvar mode = effective.Mode;\nvar lifetime = effective.Options.Token.AccessTokenLifetime;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is useful when diagnosing unexpected differences between configured and runtime behavior.\u003C/p\u003E\n\u003Cp\u003EFor example, a globally configured access token lifetime may differ from the effective value because a mode template overrides it.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022do-not-mutate-the-original-options\u0022\u003EDo Not Mutate the Original Options\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EGetOriginal()\u003C/code\u003E returns the original options instance.\u003C/p\u003E\n\u003Cp\u003ETreat it as read-only application configuration.\u003C/p\u003E\n\u003Cp\u003ERuntime customization should use the supported configuration mechanisms rather than mutating registered options during requests.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-authentication-mode-resolution\u0022\u003E8. Custom Authentication Mode Resolution\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EIEffectiveAuthModeResolver\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe interface contains:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic interface IEffectiveAuthModeResolver\n{\n UAuthMode Resolve(UAuthApplicationProfile applicationProfile);\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe default implementation selects the mode using the application profile.\u003C/p\u003E\n\u003Cp\u003EAn application can provide its own resolver when the default mapping does not meet its requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-resolver-example\u0022\u003ECustom Resolver Example\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic sealed class ApplicationAuthModeResolver : IEffectiveAuthModeResolver\n{\n public UAuthMode Resolve(UAuthApplicationProfile applicationProfile)\n {\n return applicationProfile switch\n {\n UAuthApplicationProfile.BlazorServer =\u0026gt; UAuthMode.PureOpaque,\n UAuthApplicationProfile.BlazorWasm =\u0026gt; UAuthMode.Hybrid,\n UAuthApplicationProfile.Maui =\u0026gt; UAuthMode.Hybrid,\n\n _ =\u0026gt; UAuthMode.Hybrid\n };\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister the implementation:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddSingleton\u0026lt;IEffectiveAuthModeResolver, ApplicationAuthModeResolver\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server registers its default resolver using \u003Ccode\u003ETryAddSingleton\u003C/code\u003E, so an existing registration can take precedence.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-considerations\u0022\u003ESecurity Considerations\u003C/h3\u003E\n\u003Cp\u003EThe custom resolver must return a mode compatible with the server\u0027s supported modes and security requirements.\u003C/p\u003E\n\u003Cp\u003EDo not choose authentication modes based solely on untrusted client-provided values without appropriate validation.\u003C/p\u003E\n\u003Cp\u003EAlso note that the current resolver interface receives an application profile, not an arbitrary HTTP request context.\u003C/p\u003E\n\u003Cp\u003EFor more complex context-dependent selection, additional application integration may be necessary.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022dependency-injection-extension-points\u0022\u003E9. Dependency Injection Extension Points\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth registers many internal services through dependency injection.\u003C/p\u003E\n\u003Cp\u003ESeveral default registrations use \u003Ccode\u003ETryAddScoped\u003C/code\u003E or \u003Ccode\u003ETryAddSingleton\u003C/code\u003E, allowing applications to supply an implementation before the default registration is added.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;ISessionValidator, ApplicationSessionValidator\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe application-defined validator is registered before the UltimateAuth server\u0027s default registration.\u003C/p\u003E\n\u003Cp\u003EBecause the server uses \u003Ccode\u003ETryAddScoped\u003C/code\u003E for this service, it does not add its default implementation when an existing registration is present.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022registration-order-matters\u0022\u003ERegistration Order Matters\u003C/h3\u003E\n\u003Cp\u003EFor services registered using \u003Ccode\u003ETryAdd...\u003C/code\u003E, prefer:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;ISessionValidator, ApplicationSessionValidator\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDo not assume that registering a replacement after the server will always produce the same behavior.\u003C/p\u003E\n\u003Cp\u003EThe result depends on the service\u0027s registration pattern and how it is resolved.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022not-every-service-is-replaceable-in-the-same-way\u0022\u003ENot Every Service Is Replaceable in the Same Way\u003C/h3\u003E\n\u003Cp\u003ESome UltimateAuth services use ordinary \u003Ccode\u003EAddSingleton\u003C/code\u003E or \u003Ccode\u003EAddScoped\u003C/code\u003E registrations.\u003C/p\u003E\n\u003Cp\u003EOthers use \u003Ccode\u003ETryAdd...\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003ESome are registered as collections.\u003C/p\u003E\n\u003Cp\u003EThese patterns have different override semantics.\u003C/p\u003E\n\u003Cp\u003ETherefore, do not assume that every internal service can be replaced safely or that every replacement preserves the intended security behavior.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-login-authority\u0022\u003E10. Custom Login Authority\u003C/h2\u003E\n\u003Cp\u003EThe login authority participates in deciding whether a login attempt is permitted.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EILoginAuthority\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe interface is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic interface ILoginAuthority\n{\n LoginDecision Decide(LoginDecisionContext context);\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAn application can implement its own login decision logic.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic sealed class ApplicationLoginAuthority : ILoginAuthority\n{\n public LoginDecision Decide(LoginDecisionContext context)\n {\n // Evaluate application-specific login rules.\n // Return a valid LoginDecision.\n throw new NotImplementedException();\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe example illustrates the extension contract; it is not a usable implementation.\u003C/p\u003E\n\u003Cp\u003ERegister the implementation:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;ILoginAuthority, ApplicationLoginAuthority\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important-security-boundary\u0022\u003EImportant Security Boundary\u003C/h3\u003E\n\u003Cp\u003EReplacing the login authority changes a security decision component.\u003C/p\u003E\n\u003Cp\u003EThe replacement must preserve required authentication checks and correctly handle all decision outcomes.\u003C/p\u003E\n\u003Cp\u003EDo not replace the authority merely to add logging, notifications, or metrics.\u003C/p\u003E\n\u003Cp\u003EUse lifecycle events for those purposes.\u003C/p\u003E\n\u003Cp\u003EIf the application only needs additional access rules, consider the policy system before replacing a core authority.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorities-policies-and-invariants\u0022\u003E11. Authorities, Policies, and Invariants\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates different responsibilities within its security architecture.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorities\u0022\u003EAuthorities\u003C/h3\u003E\n\u003Cp\u003EAuthorities evaluate security decisions.\u003C/p\u003E\n\u003Cp\u003EExamples include:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EIAuthAuthority\nIAccessAuthority\nILoginAuthority\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022policies\u0022\u003EPolicies\u003C/h3\u003E\n\u003Cp\u003EPolicies define application-specific rules used by the authorization system.\u003C/p\u003E\n\u003Cp\u003EThey should be the preferred extension mechanism when the requirement is to add or refine access rules.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022invariants\u0022\u003EInvariants\u003C/h3\u003E\n\u003Cp\u003EInvariants enforce foundational security requirements.\u003C/p\u003E\n\u003Cp\u003EThe server registers invariants including:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EDeviceRequiredInvariant\nExpiredSessionInvariant\nInvalidOrRevokedSessionInvariant\nTenantResolvedInvariant\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese are registered as a collection of \u003Ccode\u003EIAuthorityInvariant\u003C/code\u003E implementations.\u003C/p\u003E\n\u003Cp\u003EUnlike ordinary application policies, security invariants protect fundamental authentication requirements.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDo not remove or bypass invariants to make a custom authentication flow succeed.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EFor example, an expired or revoked session should not become valid merely because a custom access policy grants permission.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-tenant-resolution\u0022\u003E12. Custom Tenant Resolution\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports route, header, and host-based tenant resolution.\u003C/p\u003E\n\u003Cp\u003EThese mechanisms are controlled through server options.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.MultiTenant.EnableHeader = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor applications with a different tenant identification strategy, UltimateAuth exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EITenantIdResolver\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server\u0027s default registration uses \u003Ccode\u003ETryAddSingleton\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EA custom resolver can therefore be registered before the server:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddSingleton\u0026lt;ITenantIdResolver, ApplicationTenantIdResolver\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EApplicationTenantIdResolver\u003C/code\u003E represents an application-defined implementation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022when-to-use-a-custom-resolver\u0022\u003EWhen to Use a Custom Resolver\u003C/h3\u003E\n\u003Cp\u003EA custom tenant resolver may be appropriate when tenants are identified through:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAn application-specific host naming convention.\u003C/li\u003E\n\u003Cli\u003EA trusted gateway-provided tenant identifier.\u003C/li\u003E\n\u003Cli\u003EA custom routing structure.\u003C/li\u003E\n\u003Cli\u003EAn existing tenant management system.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-considerations-1\u0022\u003ESecurity Considerations\u003C/h3\u003E\n\u003Cp\u003ETenant identification is not the same as tenant authorization.\u003C/p\u003E\n\u003Cp\u003EThe server must still verify that the authenticated user or application is allowed to access the resolved tenant.\u003C/p\u003E\n\u003Cp\u003ENever trust arbitrary tenant identifiers supplied by clients without applying the required validation and isolation rules.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-session-and-device-resolution\u0022\u003E13. Custom Session and Device Resolution\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates session identifier resolution from session validation.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EISessionIdResolver\nISessionValidator\nIDeviceResolver\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese interfaces have different responsibilities.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EComponent\u003C/th\u003E\n\u003Cth\u003EResponsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EISessionIdResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDetermine which session identifier is supplied\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EISessionValidator\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EValidate the session\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIDeviceResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve device information\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe server resolves authentication credentials through a unified, mode-aware credential resolution mechanism.\u003C/p\u003E\n\u003Cp\u003EThe effective authentication mode determines the primary credential, while the effective grant delivery configuration determines its transport.\u003C/p\u003E\n\u003Cp\u003EEach grant is resolved exclusively from its configured cookie or request header. Alternative credential sources are not used as fallbacks.\u003C/p\u003E\n\u003Cp\u003EThis keeps credential resolution consistent across authentication handlers, session context resolution, validation endpoints, and refresh flows.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-session-validator\u0022\u003ECustom Session Validator\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;ISessionValidator, ApplicationSessionValidator\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA custom validator must preserve the relevant expiration, revocation, and security-state checks.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-device-resolver\u0022\u003ECustom Device Resolver\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;IDeviceResolver, ApplicationDeviceResolver\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDevice resolution may affect session identification and security decisions.\u003C/p\u003E\n\u003Cp\u003ECustom implementations should produce consistent, trustworthy device information.\u003C/p\u003E\n\u003Cp\u003EAvoid replacing these services unless the application\u0027s requirements cannot be met through standard options.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-stores\u0022\u003E14. Custom Stores\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates domain behavior from persistence through store interfaces.\u003C/p\u003E\n\u003Cp\u003EExamples include:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EISessionStore\nIRefreshTokenStore\nIRoleStore\nIUserRoleStore\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ESome stores are resolved through corresponding factory interfaces.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides persistence implementations in separate packages, including in-memory and Entity Framework Core implementations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-a-store-implementation\u0022\u003EChoosing a Store Implementation\u003C/h3\u003E\n\u003Cp\u003EUse in-memory implementations for suitable development, testing, or demonstration scenarios.\u003C/p\u003E\n\u003Cp\u003EUse durable persistence for production authentication state that must survive process restarts or be shared across application instances.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-store-requirements\u0022\u003ECustom Store Requirements\u003C/h3\u003E\n\u003Cp\u003EA custom store must preserve the semantics expected by the authentication services.\u003C/p\u003E\n\u003Cp\u003EDepending on the store, these may include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECorrect session expiration handling.\u003C/li\u003E\n\u003Cli\u003EReliable revocation state.\u003C/li\u003E\n\u003Cli\u003ERefresh token consumption and replay protection.\u003C/li\u003E\n\u003Cli\u003EConsistent user and tenant scoping.\u003C/li\u003E\n\u003Cli\u003EAppropriate concurrency behavior.\u003C/li\u003E\n\u003Cli\u003EAtomic state transitions where required.\u003C/li\u003E\n\u003Cli\u003ECorrect deletion and lifecycle behavior.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor example, refresh token rotation may depend on preventing two concurrent requests from successfully consuming the same token.\u003C/p\u003E\n\u003Cp\u003EA store implementation that does not enforce the required concurrency semantics can undermine the security of the refresh flow.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022store-registration\u0022\u003EStore Registration\u003C/h3\u003E\n\u003Cp\u003ECustom store registration depends on the specific store interface and its factory.\u003C/p\u003E\n\u003Cp\u003EDo not assume that replacing one store interface is sufficient when the runtime resolves stores through a factory.\u003C/p\u003E\n\u003Cp\u003EUse the relevant domain package\u0027s documented registration pattern.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-lifecycle-events\u0022\u003E15. Authentication Lifecycle Events\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth provides application-wide authentication event hooks through:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EUAuthEvents\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese hooks allow applications to react to authentication lifecycle events without replacing the authentication flow.\u003C/p\u003E\n\u003Cp\u003EThe current event options expose:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EOnAnyEvent\nOnUserLoggedIn\nOnUserLoggedOut\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-event\u0022\u003ELogin Event\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Events.OnUserLoggedIn = context =\u0026gt;\n {\n // Record a successful login.\n return Task.CompletedTask;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-event\u0022\u003ELogout Event\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Events.OnUserLoggedOut = context =\u0026gt;\n {\n // Record a logout event.\n return Task.CompletedTask;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022global-event-hook\u0022\u003EGlobal Event Hook\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Events.OnAnyEvent = context =\u0026gt;\n {\n // Process an authentication event.\n return Task.CompletedTask;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe global hook receives an \u003Ccode\u003EIAuthEventContext\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022appropriate-event-uses\u0022\u003EAppropriate Event Uses\u003C/h3\u003E\n\u003Cp\u003ELifecycle events are suitable for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAudit logging.\u003C/li\u003E\n\u003Cli\u003EApplication metrics.\u003C/li\u003E\n\u003Cli\u003EMonitoring.\u003C/li\u003E\n\u003Cli\u003ENotifications.\u003C/li\u003E\n\u003Cli\u003ELightweight post-operation integration.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThey should not be used to implement critical authentication checks.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022events-are-not-decision-hooks\u0022\u003EEvents Are Not Decision Hooks\u003C/h3\u003E\n\u003Cp\u003EThe documented event delegates run after their corresponding successful operations.\u003C/p\u003E\n\u003Cp\u003EFor example, \u003Ccode\u003EOnUserLoggedIn\u003C/code\u003E is not the place to decide whether the login should have been permitted.\u003C/p\u003E\n\u003Cp\u003EUse an appropriate authority or policy for security decisions.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022avoid-complex-work-inside-events\u0022\u003EAvoid Complex Work Inside Events\u003C/h3\u003E\n\u003Cp\u003ELong-running or failure-prone external operations should generally be delegated to a reliable application service or message-processing mechanism.\u003C/p\u003E\n\u003Cp\u003EDo not make critical authentication behavior depend on an unreliable external notification system.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-jwt-signing-keys\u0022\u003E16. Custom JWT Signing Keys\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EIJwtSigningKeyProvider\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server registers a development signing key provider as its default implementation.\u003C/p\u003E\n\u003Cp\u003EProduction applications should supply an appropriate signing key strategy.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddSingleton\u0026lt;IJwtSigningKeyProvider, ApplicationJwtSigningKeyProvider\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EApplicationJwtSigningKeyProvider\u003C/code\u003E is an implementation supplied by the application.\u003C/p\u003E\n\u003Cp\u003EA production implementation should use appropriately protected signing keys and support the application\u0027s operational requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022signing-key-responsibilities\u0022\u003ESigning Key Responsibilities\u003C/h3\u003E\n\u003Cp\u003EConsider:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EKey confidentiality.\u003C/li\u003E\n\u003Cli\u003EKey rotation.\u003C/li\u003E\n\u003Cli\u003EKey identification.\u003C/li\u003E\n\u003Cli\u003EConsistent validation across resource servers.\u003C/li\u003E\n\u003Cli\u003ESecure key storage.\u003C/li\u003E\n\u003Cli\u003ERecovery and deployment procedures.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EDo not use development signing keys as a production security strategy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-customization\u0022\u003E17. Endpoint Customization\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth provides an advanced endpoint configuration hook:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.OnConfigureEndpoints\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe hook receives:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EIEndpointRouteBuilder\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.OnConfigureEndpoints = endpoints =\u0026gt;\n {\n // Apply supported application-specific\n // endpoint configuration here.\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe hook is invoked after UltimateAuth registers its default endpoints.\u003C/p\u003E\n\u003Cp\u003EIt can support advanced endpoint integration, but it should not be used to remove, remap, or weaken the security requirements of UltimateAuth endpoints.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022prefer-endpoint-options-first\u0022\u003EPrefer Endpoint Options First\u003C/h3\u003E\n\u003Cp\u003EFor ordinary endpoint configuration, use:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Endpoints\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.Authentication = true;\n options.Endpoints.Credentials = true;\n options.Endpoints.Authorization = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe advanced endpoint hook is intended for cases that cannot be addressed through the supported endpoint options.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-sources-and-precedence\u0022\u003E18. Configuration Sources and Precedence\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth integrates with the standard ASP.NET Core configuration system.\u003C/p\u003E\n\u003Cp\u003EFor the server, the configuration section is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Server\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor the client:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Client\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor Resource APIs:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:ResourceApi\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022registration-order\u0022\u003ERegistration Order\u003C/h3\u003E\n\u003Cp\u003EThe standard server registration applies:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EOption type defaults.\u003C/li\u003E\n\u003Cli\u003EThe \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E configuration delegate.\u003C/li\u003E\n\u003Cli\u003EValues bound from \u003Ccode\u003EUltimateAuth:Server\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EPost-configuration processing.\u003C/li\u003E\n\u003Cli\u003ERegistered options validation.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.MaxFailedAttempts = 5;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWith:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EJSON\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-json\u0022\u003E{\n \u0026quot;UltimateAuth\u0026quot;: {\n \u0026quot;Server\u0026quot;: {\n \u0026quot;Login\u0026quot;: {\n \u0026quot;MaxFailedAttempts\u0026quot;: 3\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe effective configured value is \u003Ccode\u003E3\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe configuration binding occurs after the registration delegate.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022environment-variables\u0022\u003EEnvironment Variables\u003C/h3\u003E\n\u003Cp\u003EASP.NET Core supports hierarchical configuration keys through double underscores.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth__Server__Login__MaxFailedAttempts=3\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis corresponds to:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Server:Login:MaxFailedAttempts\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEnvironment-specific configuration can therefore override values without requiring changes to application code.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022environment-specific-files\u0022\u003EEnvironment-Specific Files\u003C/h3\u003E\n\u003Cp\u003EStandard ASP.NET Core applications commonly use:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003Eappsettings.json\nappsettings.Development.json\nappsettings.Staging.json\nappsettings.Production.json\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe active environment determines which environment-specific file is loaded.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EASPNETCORE_ENVIRONMENT=Production\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe final value depends on the configured ASP.NET Core configuration providers and their precedence.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-binding-does-not-replace-mode-resolution\u0022\u003EConfiguration Binding Does Not Replace Mode Resolution\u003C/h3\u003E\n\u003Cp\u003EA value supplied through \u003Ccode\u003Eappsettings.json\u003C/code\u003E becomes part of the configured options.\u003C/p\u003E\n\u003Cp\u003EIt may still be replaced later when UltimateAuth applies mode defaults.\u003C/p\u003E\n\u003Cp\u003EFor settings explicitly controlled by mode templates, use \u003Ccode\u003EConfigureMode()\u003C/code\u003E when the desired behavior must apply to a specific mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022startup-validation-and-runtime-safety\u0022\u003E19. Startup Validation and Runtime Safety\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth validates server options through registered \u003Ccode\u003EIValidateOptions\u0026lt;UAuthServerOptions\u0026gt;\u003C/code\u003E implementations.\u003C/p\u003E\n\u003Cp\u003EThe server uses:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EValidateOnStart()\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis allows many invalid configurations to fail during application startup.\u003C/p\u003E\n\u003Cp\u003EExamples include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EInvalid endpoint base paths.\u003C/li\u003E\n\u003Cli\u003EInvalid or unsupported allowed modes.\u003C/li\u003E\n\u003Cli\u003EInvalid session lifetimes.\u003C/li\u003E\n\u003Cli\u003EIncompatible token and session lifetime constraints.\u003C/li\u003E\n\u003Cli\u003EInvalid login settings.\u003C/li\u003E\n\u003Cli\u003EInvalid tenant configuration.\u003C/li\u003E\n\u003Cli\u003EInvalid pagination settings.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-has-boundaries\u0022\u003EValidation Has Boundaries\u003C/h3\u003E\n\u003Cp\u003EStartup validation applies to the configured options according to the registered validators.\u003C/p\u003E\n\u003Cp\u003EIt does not automatically prove that every custom dependency injection replacement is safe.\u003C/p\u003E\n\u003Cp\u003EIt also does not guarantee that every mode-specific override has been validated against all possible security invariants.\u003C/p\u003E\n\u003Cp\u003ECustom implementations must preserve the relevant contracts and security requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-validation-strategy\u0022\u003ERecommended Validation Strategy\u003C/h3\u003E\n\u003Cp\u003EFor advanced configurations:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EVerify that the application starts successfully.\u003C/li\u003E\n\u003Cli\u003ETest each enabled authentication mode.\u003C/li\u003E\n\u003Cli\u003ETest login, refresh, validation, and logout.\u003C/li\u003E\n\u003Cli\u003ETest session expiration and revocation.\u003C/li\u003E\n\u003Cli\u003ETest tenant isolation.\u003C/li\u003E\n\u003Cli\u003ETest authorization denial paths.\u003C/li\u003E\n\u003Cli\u003ETest concurrent refresh requests where applicable.\u003C/li\u003E\n\u003Cli\u003EVerify that effective options contain the intended values.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThese checks are especially important when customizing authorities, validators, stores, or authentication mode behavior.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-configuration-mistakes\u0022\u003E20. Common Configuration Mistakes\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuring-core-options-separately-from-server-options\u0022\u003EConfiguring Core Options Separately from Server Options\u003C/h3\u003E\n\u003Cp\u003EWhen using \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E, configure Core-defined behavior through \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EDo not expect a separate \u003Ccode\u003EUAuthOptions\u003C/code\u003E configuration to override the server\u0027s composed options.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-global-values-always-survive-mode-defaults\u0022\u003EAssuming Global Values Always Survive Mode Defaults\u003C/h3\u003E\n\u003Cp\u003EMode templates can overwrite values such as access token lifetime.\u003C/p\u003E\n\u003Cp\u003EUse \u003Ccode\u003EConfigureMode()\u003C/code\u003E for explicit mode-specific customization.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022treating-allowedmodes-as-mode-selection\u0022\u003ETreating AllowedModes as Mode Selection\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E restricts permitted modes.\u003C/p\u003E\n\u003Cp\u003EIt does not replace \u003Ccode\u003EIEffectiveAuthModeResolver\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuring-incompatible-authentication-components\u0022\u003EConfiguring incompatible authentication components\u003C/h3\u003E\n\u003Cp\u003ESupporting all four authentication modes does not mean that every issued credential can be accepted by every Resource API configuration.\u003C/p\u003E\n\u003Cp\u003EEnsure that the issuing server, Resource API, cryptographic settings and credential delivery configuration are compatible.\u003C/p\u003E\n\u003Cp\u003EMode changes should be applied as coordinated configuration changes.\u003C/p\u003E\n\u003Cp\u003EExisting credentials are not automatically converted to the new authentication mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022replacing-security-components-unnecessarily\u0022\u003EReplacing Security Components Unnecessarily\u003C/h3\u003E\n\u003Cp\u003EReplacing a validator or authority can change fundamental authentication behavior.\u003C/p\u003E\n\u003Cp\u003EPrefer options and policies when they satisfy the requirement.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-every-di-service-is-replaceable\u0022\u003EAssuming Every DI Service Is Replaceable\u003C/h3\u003E\n\u003Cp\u003EDifferent services use different registration patterns.\u003C/p\u003E\n\u003Cp\u003EReview the actual registration behavior before replacing a service.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022using-events-for-authorization-decisions\u0022\u003EUsing Events for Authorization Decisions\u003C/h3\u003E\n\u003Cp\u003ELifecycle events are for post-operation reactions.\u003C/p\u003E\n\u003Cp\u003EUse authorities and policies for decisions.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022ignoring-store-concurrency\u0022\u003EIgnoring Store Concurrency\u003C/h3\u003E\n\u003Cp\u003EAuthentication stores must preserve the required consistency and atomicity semantics.\u003C/p\u003E\n\u003Cp\u003EThis is particularly important for refresh token rotation and revocation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-runtime-overrides-receive-full-startup-validation\u0022\u003EAssuming Runtime Overrides Receive Full Startup Validation\u003C/h3\u003E\n\u003Cp\u003EMode-specific overrides are applied during effective-options construction.\u003C/p\u003E\n\u003Cp\u003EValidate their results through tests and appropriate application safeguards.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022advanced-configuration-reference\u0022\u003E21. Advanced Configuration Reference\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EMechanism\u003C/th\u003E\n\u003Cth\u003EAPI / Type\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServer configuration\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EBase server settings\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMode customization\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EConfigureMode()\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EApply mode-specific overrides\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EEffective configuration\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIEffectiveServerOptionsProvider\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve effective server settings\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EEffective result\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EEffectiveUAuthServerOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolved mode and options\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMode selection\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIEffectiveAuthModeResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve mode from application profile\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ELogin decisions\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EILoginAuthority\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEvaluate login decisions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAuthentication authority\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIAuthAuthority\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication security decisions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess authority\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIAccessAuthority\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAccess decisions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ETenant identification\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EITenantIdResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve tenant identifiers\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession validation\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EISessionValidator\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EValidate sessions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession identification\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EISessionIdResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve session identifiers\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDevice identification\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIDeviceResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve device information\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESigning keys\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIJwtSigningKeyProvider\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESupply JWT signing keys\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ELifecycle events\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EObserve completed authentication operations\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EEndpoint customization\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EOnConfigureEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAdvanced endpoint configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession persistence\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EISessionStore\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession storage\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh persistence\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIRefreshTokenStore\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh token storage\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-extension-strategy\u0022\u003E22. Recommended Extension Strategy\u003C/h2\u003E\n\u003Cp\u003EWhen an application requires customization, follow this order:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003E\u003Cstrong\u003EUse existing options.\u003C/strong\u003E Prefer supported configuration properties.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUse mode overrides.\u003C/strong\u003E Apply \u003Ccode\u003EConfigureMode()\u003C/code\u003E when behavior must differ by authentication mode.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUse application policies.\u003C/strong\u003E Extend authorization rules without replacing the authorization pipeline.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUse lifecycle events.\u003C/strong\u003E Implement logging, monitoring, and notifications without changing authentication decisions.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUse focused resolvers or providers.\u003C/strong\u003E Customize tenant identification, signing keys, or other specific infrastructure concerns.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EReplace authorities, validators, or stores only when necessary.\u003C/strong\u003E Preserve all relevant security invariants and verify the implementation through tests.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThe objective is not to replace as much of UltimateAuth as possible.\u003C/p\u003E\n\u003Cp\u003EIt is to customize the smallest component necessary while retaining the guarantees of the surrounding system.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-steps\u0022\u003ENext Steps\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/overview\u0022\u003EConfiguration Overview\u003C/a\u003E \u2014 Understand registration, configuration sources, and architecture.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Configure authentication and server security behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E \u2014 Configure SDK flows and client behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E \u2014 Understand supported authentication modes.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client/authorization\u0022\u003EAuthorization\u003C/a\u003E \u2014 Use the client authorization API.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client/session-management\u0022\u003ESession Management\u003C/a\u003E \u2014 Manage sessions and revocation.\u003C/li\u003E\n\u003C/ul\u003E\n", + "Html": "\n\u003Cp\u003EUltimateAuth supports advanced customization of authentication behavior through effective server options, authentication mode resolution, dependency injection, custom infrastructure, and lifecycle events.\u003C/p\u003E\n\u003Cp\u003EThese mechanisms serve different purposes:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EOptions\u003C/strong\u003E define configurable behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EEffective options\u003C/strong\u003E adapt that behavior to the selected authentication mode.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EResolvers\u003C/strong\u003E determine information required by authentication flows.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EAuthorities and validators\u003C/strong\u003E participate in security decisions.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EStores\u003C/strong\u003E persist authentication and application state.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EEvents\u003C/strong\u003E allow applications to react to completed operations.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EMost applications should begin with the standard Server and Client options. Advanced customization becomes useful when an application needs specialized authentication behavior, custom infrastructure, or integration with existing systems.\u003C/p\u003E\n\u003Cp\u003EThis guide explains the supported extension mechanisms, their execution order, and the security boundaries developers must preserve.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-versus-extensibility\u0022\u003E1. Configuration Versus Extensibility\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth distinguishes between configuring existing behavior and replacing an implementation.\u003C/p\u003E\n\u003Cp\u003EFor example, changing a session lifetime is configuration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EProviding a custom clock is an infrastructure extension:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddSingleton\u0026lt;IClock, ApplicationClock\u0026gt;();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EApplicationClock\u003C/code\u003E is an implementation supplied by your application.\u003C/p\u003E\n\u003Cp\u003EThese approaches are not interchangeable.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ERequirement\u003C/th\u003E\n\u003Cth\u003ERecommended mechanism\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EChange session lifetime\u003C/td\u003E\n\u003Ctd\u003EServer options\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EChange token lifetime for a specific mode\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EConfigureMode()\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESelect authentication mode differently\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIEffectiveAuthModeResolver\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResolve tenants from a custom source\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EITenantIdResolver\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECustomize login decisions\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EILoginAuthority\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESupply signing keys\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIJwtSigningKeyProvider\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPersist sessions in another backend\u003C/td\u003E\n\u003Ctd\u003EStore implementation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EReact to successful login\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthEvents\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAdd application-specific access rules\u003C/td\u003E\n\u003Ctd\u003EPolicies\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EPrefer the most specific supported mechanism rather than replacing an entire authentication component.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022understanding-effective-server-options\u0022\u003E2. Understanding Effective Server Options\u003C/h2\u003E\n\u003Cp\u003EThe server does not necessarily use the original \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E instance unchanged for every authentication flow.\u003C/p\u003E\n\u003Cp\u003EInstead, UltimateAuth can resolve an effective configuration based on the application profile and authentication mode.\u003C/p\u003E\n\u003Cp\u003EThe relevant types are:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EIEffectiveServerOptionsProvider\nEffectiveUAuthServerOptions\nIEffectiveAuthModeResolver\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configured-options\u0022\u003EConfigured Options\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E represents the application\u0027s configured server settings.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n options.Token.Issuer = \u0026quot;MyApplication\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese settings form the base configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022effective-options\u0022\u003EEffective Options\u003C/h3\u003E\n\u003Cp\u003EThe provider produces an \u003Ccode\u003EEffectiveUAuthServerOptions\u003C/code\u003E instance containing:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic sealed class EffectiveUAuthServerOptions\n{\n public UAuthMode Mode { get; init; }\n public UAuthServerOptions Options { get; init; } = default!;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EMode\u003C/code\u003E identifies the resolved authentication mode.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EOptions\u003C/code\u003E contains the effective server configuration for that mode.\u003C/p\u003E\n\u003Cp\u003EThe effective configuration is derived from the original settings rather than replacing the application\u0027s registered options globally.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022effective-configuration-resolution\u0022\u003E3. Effective Configuration Resolution\u003C/h2\u003E\n\u003Cp\u003EThe current \u003Ccode\u003EEffectiveServerOptionsProvider\u003C/code\u003E follows this sequence:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EConfigured UAuthServerOptions\n |\n v\n Resolve mode\n |\n v\n Clone base options\n |\n v\n Apply mode defaults\n |\n v\n Apply ConfigureMode override\n |\n v\n EffectiveUAuthServerOptions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIn simplified form:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar original = baseOptions.Value;\n\nvar mode = modeResolver.Resolve(applicationProfile);\n\nvar options = original.Clone();\n\nConfigureDefaults.ApplyModeDefaults(mode, options);\n\nif (original.ModeConfigurations.TryGetValue(mode, out var configure))\n{\n configure(options);\n}\n\nreturn new EffectiveUAuthServerOptions\n{\n Mode = mode,\n Options = options\n};\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis execution order is important.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EMode defaults are applied after the original configuration is cloned.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EConsequently, certain values configured globally may be replaced by mode-specific defaults.\u003C/p\u003E\n\u003Cp\u003EExplicit mode overrides are applied last.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-changes-between-requests\u0022\u003EWhat Changes Between Requests?\u003C/h3\u003E\n\u003Cp\u003EDifferent application profiles can resolve to different authentication modes.\u003C/p\u003E\n\u003Cp\u003EThe provider therefore can produce different effective configurations for different application profiles.\u003C/p\u003E\n\u003Cp\u003EHowever, this does not mean every setting is independently recalculated from arbitrary request data.\u003C/p\u003E\n\u003Cp\u003EIn the current implementation, mode selection is based on the supplied \u003Ccode\u003EUAuthApplicationProfile\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe provider also accepts tenant context, but the default effective-options construction does not apply an additional tenant-specific configuration override.\u003C/p\u003E\n\u003Cp\u003EApplications should not assume that per-tenant options customization exists automatically.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-authentication-mode-resolution\u0022\u003E4. Default Authentication Mode Resolution\u003C/h2\u003E\n\u003Cp\u003EThe default \u003Ccode\u003EEffectiveAuthModeResolver\u003C/code\u003E maps application profiles to authentication modes.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication Profile\u003C/th\u003E\n\u003Cth\u003EDefault Mode\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EBlazorServer\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EWebServer\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EBlazorWasm\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaui\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthHub\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EApi\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EOther / unknown\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese mappings describe the current default resolver.\u003C/p\u003E\n\u003Cp\u003EThey do not imply that every resolved mode is fully supported in the current release.\u003C/p\u003E\n\u003Cp\u003EApplications should verify that their application profiles resolve to a supported authentication mode before deploying.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022allowedmodes-is-not-a-mode-selector\u0022\u003EAllowedModes Is Not a Mode Selector\u003C/h3\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AllowedModes =\n [\n UAuthMode.PureOpaque,\n UAuthMode.Hybrid\n ];\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis restricts which modes are allowed.\u003C/p\u003E\n\u003Cp\u003EIt does not instruct the resolver to choose \u003Ccode\u003EHybrid\u003C/code\u003E for every client.\u003C/p\u003E\n\u003Cp\u003EMode selection and mode restrictions are separate responsibilities.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-authentication-modes\u0022\u003E5. Configure Authentication Modes\u003C/h2\u003E\n\u003Cp\u003EUse the public \u003Ccode\u003EConfigureMode()\u003C/code\u003E extension to customize settings for a particular authentication mode.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ConfigureMode(UAuthMode.Hybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(5);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configuration changes the effective access token lifetime for \u003Ccode\u003EHybrid\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EIt does not change the effective \u003Ccode\u003EPureOpaque\u003C/code\u003E configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-configuremode-matters\u0022\u003EWhy ConfigureMode Matters\u003C/h3\u003E\n\u003Cp\u003EConsider this configuration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(30);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe current \u003Ccode\u003EHybrid\u003C/code\u003E mode defaults explicitly set:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EToken.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EBecause mode defaults are applied after the base options are cloned, the effective \u003Ccode\u003EHybrid\u003C/code\u003E access token lifetime becomes ten minutes rather than thirty.\u003C/p\u003E\n\u003Cp\u003ETo override that behavior, use:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ConfigureMode(UAuthMode.Hybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(30);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe explicit mode override is applied after the mode defaults.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-multiple-modes\u0022\u003EConfigure Multiple Modes\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ConfigureMode(UAuthMode.Hybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n });\n\n options.ConfigureMode(UAuthMode.PureOpaque, mode =\u0026gt;\n {\n mode.Session.IdleTimeout = TimeSpan.FromDays(3);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach override is associated with its specified mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important-limitations\u0022\u003EImportant Limitations\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EConfigureMode()\u003C/code\u003E configures the effective options for a mode.\u003C/p\u003E\n\u003Cp\u003EIt does not:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EEnable an unsupported authentication mode.\u003C/li\u003E\n\u003Cli\u003EBypass the server\u0027s allowed-mode restrictions.\u003C/li\u003E\n\u003Cli\u003EReplace the authentication mode resolver.\u003C/li\u003E\n\u003Cli\u003EAutomatically create a tenant-specific configuration.\u003C/li\u003E\n\u003Cli\u003EGuarantee that every combination of effective settings is safe.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe current implementation applies mode overrides during effective-options resolution.\u003C/p\u003E\n\u003Cp\u003EDo not assume that every mode-specific combination receives the same startup validation as the original \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E instance.\u003C/p\u003E\n\u003Cp\u003ETest mode overrides carefully, especially when changing token issuance, session lifetimes, or credential delivery.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-defaults\u0022\u003E6. Mode Defaults\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth applies authentication-mode-specific defaults when resolving effective server options.\u003C/p\u003E\n\u003Cp\u003EThese defaults adapt the authentication infrastructure to the selected mode without requiring mode-specific application code.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-defined-surrogate-behavior\u0022\u003EMode-defined surrogate behavior\u003C/h3\u003E\n\u003Cp\u003EThe effective authentication mode determines which surrogate kinds are supported and how they participate in authentication.\u003C/p\u003E\n\u003Cp\u003EJWT and opaque token issuance are not independent mode-selection flags.\u003C/p\u003E\n\u003Cp\u003EApplications select the authentication strategy through \u003Ccode\u003EAuthMode\u003C/code\u003E or \u003Ccode\u003EApplicationProfileModes\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-specific-configuration-behavior\u0022\u003EMode-specific configuration behavior\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EMode\u003C/th\u003E\n\u003Cth\u003ERelevant defaults\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003Ctd\u003ESession-based continuation, longer default idle timeout and touch interval\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003EAuthoritative session validation with separate token lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003EJWT authentication with server-managed session lineage\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ESession-independent JWT authentication without session touch\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EMode defaults also configure applicable surrogate transport and cookie lifetime behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022global-values-and-mode-overrides\u0022\u003EGlobal values and mode overrides\u003C/h3\u003E\n\u003Cp\u003EToken lifetimes can be configured globally.\u003C/p\u003E\n\u003Cp\u003EMode-specific overrides allow applications to customize the effective configuration for particular authentication modes.\u003C/p\u003E\n\u003Cp\u003EThe effective configuration is resolved from the configured values, applicable mode defaults, and explicit mode-specific overrides.\u003C/p\u003E\n\u003Cp\u003EUse \u003Ccode\u003EConfigureMode()\u003C/code\u003E when a configuration value must differ between authentication modes.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E for the available token and session properties.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-requirements-are-independent-of-mode-selection\u0022\u003EValidation requirements are independent of mode selection\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid supports Standard and HubValidated authentication requirements without introducing additional authentication modes.\u003C/p\u003E\n\u003Cp\u003EThe validation requirement determines whether a particular operation needs authoritative session validation.\u003C/p\u003E\n\u003Cp\u003EThis allows applications to tune authentication behavior without introducing mode-specific client integration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022inspect-effective-options\u0022\u003E7. Inspect Effective Options\u003C/h2\u003E\n\u003Cp\u003EAdvanced integrations can use \u003Ccode\u003EIEffectiveServerOptionsProvider\u003C/code\u003E to inspect configured and effective server options.\u003C/p\u003E\n\u003Cp\u003EThe interface exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic interface IEffectiveServerOptionsProvider\n{\n UAuthServerOptions GetOriginal(HttpContext context);\n EffectiveUAuthServerOptions GetEffective(HttpContext context, UAuthApplicationProfile applicationProfile);\n EffectiveUAuthServerOptions GetEffective(TenantKey tenant, UAuthApplicationProfile applicationProfile);\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022inspect-the-original-configuration\u0022\u003EInspect the Original Configuration\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar original = provider.GetOriginal(httpContext);\nvar configuredLifetime = original.Token.AccessTokenLifetime;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022inspect-the-effective-configuration\u0022\u003EInspect the Effective Configuration\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar effective = provider.GetEffective(httpContext, UAuthApplicationProfile.BlazorWasm);\nvar mode = effective.Mode;\nvar lifetime = effective.Options.Token.AccessTokenLifetime;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is useful when diagnosing unexpected differences between configured and runtime behavior.\u003C/p\u003E\n\u003Cp\u003EFor example, a globally configured access token lifetime may differ from the effective value because a mode template overrides it.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022do-not-mutate-the-original-options\u0022\u003EDo Not Mutate the Original Options\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EGetOriginal()\u003C/code\u003E returns the original options instance.\u003C/p\u003E\n\u003Cp\u003ETreat it as read-only application configuration.\u003C/p\u003E\n\u003Cp\u003ERuntime customization should use the supported configuration mechanisms rather than mutating registered options during requests.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-authentication-mode-resolution\u0022\u003E8. Custom Authentication Mode Resolution\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EIEffectiveAuthModeResolver\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe interface contains:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic interface IEffectiveAuthModeResolver\n{\n UAuthMode Resolve(UAuthApplicationProfile applicationProfile);\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe default implementation selects the mode using the application profile.\u003C/p\u003E\n\u003Cp\u003EAn application can provide its own resolver when the default mapping does not meet its requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-resolver-example\u0022\u003ECustom Resolver Example\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic sealed class ApplicationAuthModeResolver : IEffectiveAuthModeResolver\n{\n public UAuthMode Resolve(UAuthApplicationProfile applicationProfile)\n {\n return applicationProfile switch\n {\n UAuthApplicationProfile.BlazorServer =\u0026gt; UAuthMode.PureOpaque,\n UAuthApplicationProfile.BlazorWasm =\u0026gt; UAuthMode.Hybrid,\n UAuthApplicationProfile.Maui =\u0026gt; UAuthMode.Hybrid,\n\n _ =\u0026gt; UAuthMode.Hybrid\n };\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister the implementation:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddSingleton\u0026lt;IEffectiveAuthModeResolver, ApplicationAuthModeResolver\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server registers its default resolver using \u003Ccode\u003ETryAddSingleton\u003C/code\u003E, so an existing registration can take precedence.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-considerations\u0022\u003ESecurity Considerations\u003C/h3\u003E\n\u003Cp\u003EThe custom resolver must return a mode compatible with the server\u0027s supported modes and security requirements.\u003C/p\u003E\n\u003Cp\u003EDo not choose authentication modes based solely on untrusted client-provided values without appropriate validation.\u003C/p\u003E\n\u003Cp\u003EAlso note that the current resolver interface receives an application profile, not an arbitrary HTTP request context.\u003C/p\u003E\n\u003Cp\u003EFor more complex context-dependent selection, additional application integration may be necessary.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022dependency-injection-extension-points\u0022\u003E9. Dependency Injection Extension Points\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth registers many internal services through dependency injection.\u003C/p\u003E\n\u003Cp\u003ESeveral default registrations use \u003Ccode\u003ETryAddScoped\u003C/code\u003E or \u003Ccode\u003ETryAddSingleton\u003C/code\u003E, allowing applications to supply an implementation before the default registration is added.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;ISessionValidator, ApplicationSessionValidator\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe application-defined validator is registered before the UltimateAuth server\u0027s default registration.\u003C/p\u003E\n\u003Cp\u003EBecause the server uses \u003Ccode\u003ETryAddScoped\u003C/code\u003E for this service, it does not add its default implementation when an existing registration is present.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022registration-order-matters\u0022\u003ERegistration Order Matters\u003C/h3\u003E\n\u003Cp\u003EFor services registered using \u003Ccode\u003ETryAdd...\u003C/code\u003E, prefer:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;ISessionValidator, ApplicationSessionValidator\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDo not assume that registering a replacement after the server will always produce the same behavior.\u003C/p\u003E\n\u003Cp\u003EThe result depends on the service\u0027s registration pattern and how it is resolved.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022not-every-service-is-replaceable-in-the-same-way\u0022\u003ENot Every Service Is Replaceable in the Same Way\u003C/h3\u003E\n\u003Cp\u003ESome UltimateAuth services use ordinary \u003Ccode\u003EAddSingleton\u003C/code\u003E or \u003Ccode\u003EAddScoped\u003C/code\u003E registrations.\u003C/p\u003E\n\u003Cp\u003EOthers use \u003Ccode\u003ETryAdd...\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003ESome are registered as collections.\u003C/p\u003E\n\u003Cp\u003EThese patterns have different override semantics.\u003C/p\u003E\n\u003Cp\u003ETherefore, do not assume that every internal service can be replaced safely or that every replacement preserves the intended security behavior.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-login-authority\u0022\u003E10. Custom Login Authority\u003C/h2\u003E\n\u003Cp\u003EThe login authority participates in deciding whether a login attempt is permitted.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EILoginAuthority\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe interface is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic interface ILoginAuthority\n{\n LoginDecision Decide(LoginDecisionContext context);\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAn application can implement its own login decision logic.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic sealed class ApplicationLoginAuthority : ILoginAuthority\n{\n public LoginDecision Decide(LoginDecisionContext context)\n {\n // Evaluate application-specific login rules.\n // Return a valid LoginDecision.\n throw new NotImplementedException();\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe example illustrates the extension contract; it is not a usable implementation.\u003C/p\u003E\n\u003Cp\u003ERegister the implementation:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;ILoginAuthority, ApplicationLoginAuthority\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important-security-boundary\u0022\u003EImportant Security Boundary\u003C/h3\u003E\n\u003Cp\u003EReplacing the login authority changes a security decision component.\u003C/p\u003E\n\u003Cp\u003EThe replacement must preserve required authentication checks and correctly handle all decision outcomes.\u003C/p\u003E\n\u003Cp\u003EDo not replace the authority merely to add logging, notifications, or metrics.\u003C/p\u003E\n\u003Cp\u003EUse lifecycle events for those purposes.\u003C/p\u003E\n\u003Cp\u003EIf the application only needs additional access rules, consider the policy system before replacing a core authority.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorities-policies-and-invariants\u0022\u003E11. Authorities, Policies, and Invariants\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates different responsibilities within its security architecture.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorities\u0022\u003EAuthorities\u003C/h3\u003E\n\u003Cp\u003EAuthorities evaluate security decisions.\u003C/p\u003E\n\u003Cp\u003EExamples include:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EIAuthAuthority\nIAccessAuthority\nILoginAuthority\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022policies\u0022\u003EPolicies\u003C/h3\u003E\n\u003Cp\u003EPolicies define application-specific rules used by the authorization system.\u003C/p\u003E\n\u003Cp\u003EThey should be the preferred extension mechanism when the requirement is to add or refine access rules.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022invariants\u0022\u003EInvariants\u003C/h3\u003E\n\u003Cp\u003EInvariants enforce foundational security requirements.\u003C/p\u003E\n\u003Cp\u003EThe server registers invariants including:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EDeviceRequiredInvariant\nExpiredSessionInvariant\nInvalidOrRevokedSessionInvariant\nTenantResolvedInvariant\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese are registered as a collection of \u003Ccode\u003EIAuthorityInvariant\u003C/code\u003E implementations.\u003C/p\u003E\n\u003Cp\u003EUnlike ordinary application policies, security invariants protect fundamental authentication requirements.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDo not remove or bypass invariants to make a custom authentication flow succeed.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EFor example, an expired or revoked session should not become valid merely because a custom access policy grants permission.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-tenant-resolution\u0022\u003E12. Custom Tenant Resolution\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports route, header, and host-based tenant resolution.\u003C/p\u003E\n\u003Cp\u003EThese mechanisms are controlled through server options.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.MultiTenant.EnableHeader = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor applications with a different tenant identification strategy, UltimateAuth exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EITenantIdResolver\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server\u0027s default registration uses \u003Ccode\u003ETryAddSingleton\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EA custom resolver can therefore be registered before the server:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddSingleton\u0026lt;ITenantIdResolver, ApplicationTenantIdResolver\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EApplicationTenantIdResolver\u003C/code\u003E represents an application-defined implementation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022when-to-use-a-custom-resolver\u0022\u003EWhen to Use a Custom Resolver\u003C/h3\u003E\n\u003Cp\u003EA custom tenant resolver may be appropriate when tenants are identified through:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAn application-specific host naming convention.\u003C/li\u003E\n\u003Cli\u003EA trusted gateway-provided tenant identifier.\u003C/li\u003E\n\u003Cli\u003EA custom routing structure.\u003C/li\u003E\n\u003Cli\u003EAn existing tenant management system.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-considerations-1\u0022\u003ESecurity Considerations\u003C/h3\u003E\n\u003Cp\u003ETenant identification is not the same as tenant authorization.\u003C/p\u003E\n\u003Cp\u003EThe server must still verify that the authenticated user or application is allowed to access the resolved tenant.\u003C/p\u003E\n\u003Cp\u003ENever trust arbitrary tenant identifiers supplied by clients without applying the required validation and isolation rules.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-session-and-device-resolution\u0022\u003E13. Custom Session and Device Resolution\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates session identifier resolution from session validation.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EISessionIdResolver\nISessionValidator\nIDeviceResolver\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese interfaces have different responsibilities.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EComponent\u003C/th\u003E\n\u003Cth\u003EResponsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EISessionIdResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDetermine which session identifier is supplied\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EISessionValidator\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EValidate the session\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIDeviceResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve device information\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EUltimateAuth uses a unified surrogate resolution mechanism.\u003C/p\u003E\n\u003Cp\u003EThe effective authentication mode determines the primary surrogate, while the effective transport configuration determines how it is resolved.\u003C/p\u003E\n\u003Cp\u003EEach surrogate is resolved exclusively from its configured cookie or request header. Alternative sources are not used as fallbacks.\u003C/p\u003E\n\u003Cp\u003ESurrogate resolution extracts authentication data from a request. It does not establish authenticity or validity.\u003C/p\u003E\n\u003Cp\u003EThis separation keeps resolution consistent across authentication handlers, session context resolution, validation endpoints, and refresh flows.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-session-validator\u0022\u003ECustom Session Validator\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;ISessionValidator, ApplicationSessionValidator\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA custom validator must preserve the relevant expiration, revocation, and security-state checks.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-device-resolver\u0022\u003ECustom Device Resolver\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;IDeviceResolver, ApplicationDeviceResolver\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDevice resolution may affect session identification and security decisions.\u003C/p\u003E\n\u003Cp\u003ECustom implementations should produce consistent, trustworthy device information.\u003C/p\u003E\n\u003Cp\u003EAvoid replacing these services unless the application\u0027s requirements cannot be met through standard options.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-stores\u0022\u003E14. Custom Stores\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates domain behavior from persistence through store interfaces.\u003C/p\u003E\n\u003Cp\u003EExamples include:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EISessionStore\nIRefreshTokenStore\nIRoleStore\nIUserRoleStore\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ESome stores are resolved through corresponding factory interfaces.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides persistence implementations in separate packages, including in-memory and Entity Framework Core implementations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-a-store-implementation\u0022\u003EChoosing a Store Implementation\u003C/h3\u003E\n\u003Cp\u003EUse in-memory implementations for suitable development, testing, or demonstration scenarios.\u003C/p\u003E\n\u003Cp\u003EUse durable persistence for production authentication state that must survive process restarts or be shared across application instances.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-store-requirements\u0022\u003ECustom Store Requirements\u003C/h3\u003E\n\u003Cp\u003EA custom store must preserve the semantics expected by the authentication services.\u003C/p\u003E\n\u003Cp\u003EDepending on the store, these may include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECorrect session expiration handling.\u003C/li\u003E\n\u003Cli\u003EReliable revocation state.\u003C/li\u003E\n\u003Cli\u003ERefresh token consumption and replay protection.\u003C/li\u003E\n\u003Cli\u003EConsistent user and tenant scoping.\u003C/li\u003E\n\u003Cli\u003EAppropriate concurrency behavior.\u003C/li\u003E\n\u003Cli\u003EAtomic state transitions where required.\u003C/li\u003E\n\u003Cli\u003ECorrect deletion and lifecycle behavior.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor example, refresh token rotation may depend on preventing two concurrent requests from successfully consuming the same token.\u003C/p\u003E\n\u003Cp\u003EA store implementation that does not enforce the required concurrency semantics can undermine the security of the refresh flow.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022store-registration\u0022\u003EStore Registration\u003C/h3\u003E\n\u003Cp\u003ECustom store registration depends on the specific store interface and its factory.\u003C/p\u003E\n\u003Cp\u003EDo not assume that replacing one store interface is sufficient when the runtime resolves stores through a factory.\u003C/p\u003E\n\u003Cp\u003EUse the relevant domain package\u0027s documented registration pattern.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-lifecycle-events\u0022\u003E15. Authentication Lifecycle Events\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth provides application-wide authentication event hooks through:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EUAuthEvents\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese hooks allow applications to react to authentication lifecycle events without replacing the authentication flow.\u003C/p\u003E\n\u003Cp\u003EThe current event options expose:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EOnAnyEvent\nOnUserLoggedIn\nOnUserLoggedOut\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-event\u0022\u003ELogin Event\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Events.OnUserLoggedIn = context =\u0026gt;\n {\n // Record a successful login.\n return Task.CompletedTask;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-event\u0022\u003ELogout Event\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Events.OnUserLoggedOut = context =\u0026gt;\n {\n // Record a logout event.\n return Task.CompletedTask;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022global-event-hook\u0022\u003EGlobal Event Hook\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Events.OnAnyEvent = context =\u0026gt;\n {\n // Process an authentication event.\n return Task.CompletedTask;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe global hook receives an \u003Ccode\u003EIAuthEventContext\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022appropriate-event-uses\u0022\u003EAppropriate Event Uses\u003C/h3\u003E\n\u003Cp\u003ELifecycle events are suitable for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAudit logging.\u003C/li\u003E\n\u003Cli\u003EApplication metrics.\u003C/li\u003E\n\u003Cli\u003EMonitoring.\u003C/li\u003E\n\u003Cli\u003ENotifications.\u003C/li\u003E\n\u003Cli\u003ELightweight post-operation integration.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThey should not be used to implement critical authentication checks.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022events-are-not-decision-hooks\u0022\u003EEvents Are Not Decision Hooks\u003C/h3\u003E\n\u003Cp\u003EThe documented event delegates run after their corresponding successful operations.\u003C/p\u003E\n\u003Cp\u003EFor example, \u003Ccode\u003EOnUserLoggedIn\u003C/code\u003E is not the place to decide whether the login should have been permitted.\u003C/p\u003E\n\u003Cp\u003EUse an appropriate authority or policy for security decisions.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022avoid-complex-work-inside-events\u0022\u003EAvoid Complex Work Inside Events\u003C/h3\u003E\n\u003Cp\u003ELong-running or failure-prone external operations should generally be delegated to a reliable application service or message-processing mechanism.\u003C/p\u003E\n\u003Cp\u003EDo not make critical authentication behavior depend on an unreliable external notification system.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-jwt-signing-keys\u0022\u003E16. Custom JWT Signing Keys\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EIJwtSigningKeyProvider\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server registers a development signing key provider as its default implementation.\u003C/p\u003E\n\u003Cp\u003EProduction applications should supply an appropriate signing key strategy.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddSingleton\u0026lt;IJwtSigningKeyProvider, ApplicationJwtSigningKeyProvider\u0026gt;();\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EApplicationJwtSigningKeyProvider\u003C/code\u003E is an implementation supplied by the application.\u003C/p\u003E\n\u003Cp\u003EA production implementation should use appropriately protected signing keys and support the application\u0027s operational requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022signing-key-responsibilities\u0022\u003ESigning Key Responsibilities\u003C/h3\u003E\n\u003Cp\u003EConsider:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EKey confidentiality.\u003C/li\u003E\n\u003Cli\u003EKey rotation.\u003C/li\u003E\n\u003Cli\u003EKey identification.\u003C/li\u003E\n\u003Cli\u003EConsistent validation across resource servers.\u003C/li\u003E\n\u003Cli\u003ESecure key storage.\u003C/li\u003E\n\u003Cli\u003ERecovery and deployment procedures.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EDo not use development signing keys as a production security strategy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-customization\u0022\u003E17. Endpoint Customization\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth provides an advanced endpoint configuration hook:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.OnConfigureEndpoints\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe hook receives:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EIEndpointRouteBuilder\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.OnConfigureEndpoints = endpoints =\u0026gt;\n {\n // Apply supported application-specific\n // endpoint configuration here.\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe hook is invoked after UltimateAuth registers its default endpoints.\u003C/p\u003E\n\u003Cp\u003EIt can support advanced endpoint integration, but it should not be used to remove, remap, or weaken the security requirements of UltimateAuth endpoints.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022prefer-endpoint-options-first\u0022\u003EPrefer Endpoint Options First\u003C/h3\u003E\n\u003Cp\u003EFor ordinary endpoint configuration, use:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Endpoints\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.Authentication = true;\n options.Endpoints.Credentials = true;\n options.Endpoints.Authorization = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe advanced endpoint hook is intended for cases that cannot be addressed through the supported endpoint options.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-sources-and-precedence\u0022\u003E18. Configuration Sources and Precedence\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth integrates with the standard ASP.NET Core configuration system.\u003C/p\u003E\n\u003Cp\u003EFor the server, the configuration section is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Server\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor the client:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Client\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor Resource APIs:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:ResourceApi\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022registration-order\u0022\u003ERegistration Order\u003C/h3\u003E\n\u003Cp\u003EThe standard server registration applies:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EOption type defaults.\u003C/li\u003E\n\u003Cli\u003EThe \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E configuration delegate.\u003C/li\u003E\n\u003Cli\u003EValues bound from \u003Ccode\u003EUltimateAuth:Server\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EPost-configuration processing.\u003C/li\u003E\n\u003Cli\u003ERegistered options validation.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.MaxFailedAttempts = 5;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWith:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EJSON\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-json\u0022\u003E{\n \u0026quot;UltimateAuth\u0026quot;: {\n \u0026quot;Server\u0026quot;: {\n \u0026quot;Login\u0026quot;: {\n \u0026quot;MaxFailedAttempts\u0026quot;: 3\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe effective configured value is \u003Ccode\u003E3\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe configuration binding occurs after the registration delegate.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022environment-variables\u0022\u003EEnvironment Variables\u003C/h3\u003E\n\u003Cp\u003EASP.NET Core supports hierarchical configuration keys through double underscores.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth__Server__Login__MaxFailedAttempts=3\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis corresponds to:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Server:Login:MaxFailedAttempts\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEnvironment-specific configuration can therefore override values without requiring changes to application code.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022environment-specific-files\u0022\u003EEnvironment-Specific Files\u003C/h3\u003E\n\u003Cp\u003EStandard ASP.NET Core applications commonly use:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003Eappsettings.json\nappsettings.Development.json\nappsettings.Staging.json\nappsettings.Production.json\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe active environment determines which environment-specific file is loaded.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EASPNETCORE_ENVIRONMENT=Production\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe final value depends on the configured ASP.NET Core configuration providers and their precedence.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-binding-does-not-replace-mode-resolution\u0022\u003EConfiguration Binding Does Not Replace Mode Resolution\u003C/h3\u003E\n\u003Cp\u003EA value supplied through \u003Ccode\u003Eappsettings.json\u003C/code\u003E becomes part of the configured options.\u003C/p\u003E\n\u003Cp\u003EIt may still be replaced later when UltimateAuth applies mode defaults.\u003C/p\u003E\n\u003Cp\u003EFor settings explicitly controlled by mode templates, use \u003Ccode\u003EConfigureMode()\u003C/code\u003E when the desired behavior must apply to a specific mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022startup-validation-and-runtime-safety\u0022\u003E19. Startup Validation and Runtime Safety\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth validates server options through registered \u003Ccode\u003EIValidateOptions\u0026lt;UAuthServerOptions\u0026gt;\u003C/code\u003E implementations.\u003C/p\u003E\n\u003Cp\u003EThe server uses:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EValidateOnStart()\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis allows many invalid configurations to fail during application startup.\u003C/p\u003E\n\u003Cp\u003EExamples include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EInvalid endpoint base paths.\u003C/li\u003E\n\u003Cli\u003EInvalid or unsupported allowed modes.\u003C/li\u003E\n\u003Cli\u003EInvalid session lifetimes.\u003C/li\u003E\n\u003Cli\u003EIncompatible token and session lifetime constraints.\u003C/li\u003E\n\u003Cli\u003EInvalid login settings.\u003C/li\u003E\n\u003Cli\u003EInvalid tenant configuration.\u003C/li\u003E\n\u003Cli\u003EInvalid pagination settings.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-has-boundaries\u0022\u003EValidation Has Boundaries\u003C/h3\u003E\n\u003Cp\u003EStartup validation applies to the configured options according to the registered validators.\u003C/p\u003E\n\u003Cp\u003EIt does not automatically prove that every custom dependency injection replacement is safe.\u003C/p\u003E\n\u003Cp\u003EIt also does not guarantee that every mode-specific override has been validated against all possible security invariants.\u003C/p\u003E\n\u003Cp\u003ECustom implementations must preserve the relevant contracts and security requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-validation-strategy\u0022\u003ERecommended Validation Strategy\u003C/h3\u003E\n\u003Cp\u003EFor advanced configurations:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EVerify that the application starts successfully.\u003C/li\u003E\n\u003Cli\u003ETest each enabled authentication mode.\u003C/li\u003E\n\u003Cli\u003ETest login, refresh, validation, and logout.\u003C/li\u003E\n\u003Cli\u003ETest session expiration and revocation.\u003C/li\u003E\n\u003Cli\u003ETest tenant isolation.\u003C/li\u003E\n\u003Cli\u003ETest authorization denial paths.\u003C/li\u003E\n\u003Cli\u003ETest concurrent refresh requests where applicable.\u003C/li\u003E\n\u003Cli\u003EVerify that effective options contain the intended values.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThese checks are especially important when customizing authorities, validators, stores, or authentication mode behavior.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-configuration-mistakes\u0022\u003E20. Common Configuration Mistakes\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuring-core-options-separately-from-server-options\u0022\u003EConfiguring Core Options Separately from Server Options\u003C/h3\u003E\n\u003Cp\u003EWhen using \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E, configure Core-defined behavior through \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EDo not expect a separate \u003Ccode\u003EUAuthOptions\u003C/code\u003E configuration to override the server\u0027s composed options.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-global-values-always-survive-mode-defaults\u0022\u003EAssuming Global Values Always Survive Mode Defaults\u003C/h3\u003E\n\u003Cp\u003EMode templates can overwrite values such as access token lifetime.\u003C/p\u003E\n\u003Cp\u003EUse \u003Ccode\u003EConfigureMode()\u003C/code\u003E for explicit mode-specific customization.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022treating-allowedmodes-as-mode-selection\u0022\u003ETreating AllowedModes as Mode Selection\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E restricts permitted modes.\u003C/p\u003E\n\u003Cp\u003EIt does not replace \u003Ccode\u003EIEffectiveAuthModeResolver\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuring-incompatible-authentication-components\u0022\u003EConfiguring incompatible authentication components\u003C/h3\u003E\n\u003Cp\u003ESupporting all four authentication modes does not mean that every issued token can be accepted by every Resource API configuration.\u003C/p\u003E\n\u003Cp\u003EEnsure that the issuing server, Resource API, cryptographic settings, and surrogate transport configuration are compatible.\u003C/p\u003E\n\u003Cp\u003EMode changes should be applied as coordinated configuration changes.\u003C/p\u003E\n\u003Cp\u003EExisting tokens are not automatically converted to the new authentication mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022replacing-security-components-unnecessarily\u0022\u003EReplacing Security Components Unnecessarily\u003C/h3\u003E\n\u003Cp\u003EReplacing a validator or authority can change fundamental authentication behavior.\u003C/p\u003E\n\u003Cp\u003EPrefer options and policies when they satisfy the requirement.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-every-di-service-is-replaceable\u0022\u003EAssuming Every DI Service Is Replaceable\u003C/h3\u003E\n\u003Cp\u003EDifferent services use different registration patterns.\u003C/p\u003E\n\u003Cp\u003EReview the actual registration behavior before replacing a service.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022using-events-for-authorization-decisions\u0022\u003EUsing Events for Authorization Decisions\u003C/h3\u003E\n\u003Cp\u003ELifecycle events are for post-operation reactions.\u003C/p\u003E\n\u003Cp\u003EUse authorities and policies for decisions.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022ignoring-store-concurrency\u0022\u003EIgnoring Store Concurrency\u003C/h3\u003E\n\u003Cp\u003EAuthentication stores must preserve the required consistency and atomicity semantics.\u003C/p\u003E\n\u003Cp\u003EThis is particularly important for refresh token rotation and revocation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-runtime-overrides-receive-full-startup-validation\u0022\u003EAssuming Runtime Overrides Receive Full Startup Validation\u003C/h3\u003E\n\u003Cp\u003EMode-specific overrides are applied during effective-options construction.\u003C/p\u003E\n\u003Cp\u003EValidate their results through tests and appropriate application safeguards.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022advanced-configuration-reference\u0022\u003E21. Advanced Configuration Reference\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EMechanism\u003C/th\u003E\n\u003Cth\u003EAPI / Type\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServer configuration\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EBase server settings\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMode customization\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EConfigureMode()\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EApply mode-specific overrides\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EEffective configuration\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIEffectiveServerOptionsProvider\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve effective server settings\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EEffective result\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EEffectiveUAuthServerOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolved mode and options\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMode selection\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIEffectiveAuthModeResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve mode from application profile\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ELogin decisions\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EILoginAuthority\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEvaluate login decisions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAuthentication authority\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIAuthAuthority\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication security decisions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess authority\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIAccessAuthority\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAccess decisions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ETenant identification\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EITenantIdResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve tenant identifiers\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession validation\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EISessionValidator\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EValidate sessions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession identification\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EISessionIdResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve session identifiers\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESurrogate resolution\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EISurrogateResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve incoming authentication surrogates\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDevice identification\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIDeviceResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve device information\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESigning keys\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIJwtSigningKeyProvider\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESupply JWT signing keys\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ELifecycle events\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EObserve completed authentication operations\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EEndpoint customization\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EOnConfigureEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAdvanced endpoint configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession persistence\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EISessionStore\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession storage\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh persistence\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIRefreshTokenStore\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh token storage\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-extension-strategy\u0022\u003E22. Recommended Extension Strategy\u003C/h2\u003E\n\u003Cp\u003EWhen an application requires customization, follow this order:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003E\u003Cstrong\u003EUse existing options.\u003C/strong\u003E Prefer supported configuration properties.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUse mode overrides.\u003C/strong\u003E Apply \u003Ccode\u003EConfigureMode()\u003C/code\u003E when behavior must differ by authentication mode.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUse application policies.\u003C/strong\u003E Extend authorization rules without replacing the authorization pipeline.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUse lifecycle events.\u003C/strong\u003E Implement logging, monitoring, and notifications without changing authentication decisions.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUse focused resolvers or providers.\u003C/strong\u003E Customize tenant identification, signing keys, or other specific infrastructure concerns.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EReplace authorities, validators, or stores only when necessary.\u003C/strong\u003E Preserve all relevant security invariants and verify the implementation through tests.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThe objective is not to replace as much of UltimateAuth as possible.\u003C/p\u003E\n\u003Cp\u003EIt is to customize the smallest component necessary while retaining the guarantees of the surrounding system.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-steps\u0022\u003ENext Steps\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/overview\u0022\u003EConfiguration Overview\u003C/a\u003E \u2014 Understand registration, configuration sources, and architecture.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Configure authentication and server security behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E \u2014 Configure SDK flows and client behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E \u2014 Understand supported authentication modes.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client/authorization\u0022\u003EAuthorization\u003C/a\u003E \u2014 Use the client authorization API.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client/session-management\u0022\u003ESession Management\u003C/a\u003E \u2014 Manage sessions and revocation.\u003C/li\u003E\n\u003C/ul\u003E\n", "Headings": [ { "Id": "configuration-versus-extensibility", @@ -69,8 +69,8 @@ "Level": 0 }, { - "Id": "mode-defined-credential-behavior", - "Text": "Mode-defined credential behavior", + "Id": "mode-defined-surrogate-behavior", + "Text": "Mode-defined surrogate behavior", "Level": 1 }, { @@ -379,6 +379,6 @@ "Level": 0 } ], - "SourceHash": "020D03CDE480446C7230437A5322AA251D412BABE4BBDEE6C6564C6D6CE9FCB5", + "SourceHash": "507AA5821114B4E25A11541CE705EBEB7A807E84B3C692A7C85449DD6F14C777", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/overview.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/overview.json index 59598b0d..ee3aa792 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/overview.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/overview.json @@ -1,7 +1,7 @@ { "Slug": "configuration/overview", "Title": "Configuration Overview", - "Html": "\n\u003Cp\u003EUltimateAuth provides a structured configuration system for controlling authentication behavior, session lifecycles, token policies, client integration, and server security.\u003C/p\u003E\n\u003Cp\u003EConfiguration is organized around the application components that actually consume it.\u003C/p\u003E\n\u003Cp\u003EFor most applications, the two primary configuration types are:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E\u003C/strong\u003E \u2014 Controls authentication and security behavior on the UltimateAuth server.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003E\u003Ccode\u003EUAuthClientOptions\u003C/code\u003E\u003C/strong\u003E \u2014 Controls how an application client communicates with UltimateAuth and executes authentication flows.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EUltimateAuth also defines reusable options in its Core package. These types form the foundation of server configuration, but they do not need to be configured independently when using \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThis guide explains where configuration belongs, how options are registered, how configuration sources interact, and how to customize behavior safely.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-architecture\u0022\u003E1. Configuration Architecture\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates reusable option definitions from the runtime components that consume them.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth\n\u2502\n\u251C\u2500\u2500 Core\n\u2502 \u2514\u2500\u2500 Shared option definitions\n\u2502 \u251C\u2500\u2500 Login\n\u2502 \u251C\u2500\u2500 Session\n\u2502 \u251C\u2500\u2500 Token\n\u2502 \u251C\u2500\u2500 PKCE\n\u2502 \u2514\u2500\u2500 Multi-tenancy\n\u2502\n\u251C\u2500\u2500 Server\n\u2502 \u2514\u2500\u2500 UAuthServerOptions\n\u2502 \u251C\u2500\u2500 Core-defined options\n\u2502 \u251C\u2500\u2500 Authentication mode restrictions\n\u2502 \u251C\u2500\u2500 Grant delivery and credential resolution\n\u2502 \u251C\u2500\u2500 Endpoints\n\u2502 \u251C\u2500\u2500 Hub configuration\n\u2502 \u251C\u2500\u2500 Credential policies\n\u2502 \u2514\u2500\u2500 Server-specific behavior\n\u2502\n\u2514\u2500\u2500 Client\n \u2514\u2500\u2500 UAuthClientOptions\n \u251C\u2500\u2500 Application profile\n \u251C\u2500\u2500 Login and PKCE flows\n \u251C\u2500\u2500 Endpoint configuration\n \u251C\u2500\u2500 Auto-refresh\n \u251C\u2500\u2500 Reauthentication\n \u2514\u2500\u2500 Client state events\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe important distinction is between \u003Cstrong\u003Ewhere an option type is defined\u003C/strong\u003E and \u003Cstrong\u003Ewhere its value is consumed\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EFor example, \u003Ccode\u003EUAuthTokenOptions\u003C/code\u003E is defined in Core, but a normal UltimateAuth Server application configures it through:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server consumes \u003Ccode\u003Eoptions.Token\u003C/code\u003E from \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThere is no need to configure a separate Core options instance for this setting.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-server\u0022\u003E2. Configure the Server\u003C/h2\u003E\n\u003Cp\u003EThe main server registration method is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n // Server configuration.\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis registers the UltimateAuth server infrastructure and its configuration.\u003C/p\u003E\n\u003Cp\u003EThe method accepts an optional configuration delegate:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EAction\u0026lt;UAuthServerOptions\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIt also supports a separate optional delegate for registering access policies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-authentication-and-session-settings\u0022\u003EExample: Authentication and Session Settings\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.MaxFailedAttempts = 5;\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(15);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese settings control different parts of the authentication lifecycle:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOption\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin.MaxFailedAttempts\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMaximum failed login attempts under the configured login policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EToken.SessionIdLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession identifier lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EToken.AccessTokenLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAccess token lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe server applies its validation rules to the resulting configuration.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EConfiguration values should be chosen together.\u003C/strong\u003E For example, token lifetime settings must remain compatible with the configured session lifetime limits.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-ownership\u0022\u003E3. Configuration Ownership\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates configuration according to the component responsible for applying it.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EComponent\u003C/th\u003E\n\u003Cth\u003EConfiguration responsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServer\u003C/td\u003E\n\u003Ctd\u003EAuthentication flows, credential issuance, lifecycle, and security policies\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003Ctd\u003EApplication integration, credential handling, navigation, and automatic refresh\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResource API\u003C/td\u003E\n\u003Ctd\u003EIncoming credential validation and protected resource authentication\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EShared authentication contracts and domain concepts are provided by UltimateAuth Core.\u003C/p\u003E\n\u003Cp\u003EServer-specific configuration belongs to the Server integration.\u003C/p\u003E\n\u003Cp\u003EConfigure server behavior through the primary server registration API:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthMode = UAuthMode.Hybrid;\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n options.Session.SlidingExpiration = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApplications should not independently configure internal option groups when the corresponding component exposes a primary configuration entry point.\u003C/p\u003E\n\u003Cp\u003EThis keeps configuration ownership explicit and allows UltimateAuth to resolve effective options consistently.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-configuration-groups\u0022\u003E4. Server Configuration Groups\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E organizes server behavior into focused option groups.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EResponsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin attempts and authentication behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession lifetime and lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EToken\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EToken issuance, lifetimes, and refresh behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE flow configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant resolution and multi-tenant behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERestricts permitted authentication modes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHubDeploymentMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub deployment arrangement\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHub\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub-specific configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECookie\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication cookie behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EGrantDelivery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication grant delivery and credential transport\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EServer endpoint configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECredentialSessionPolicy\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession handling after credential changes and recovery\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResetCredential\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential reset configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPrimaryCredential\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPrimary credential policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIdentifiers\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifier management behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIdentifierValidation\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifier validation rules\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELoginIdentifiers\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifier types permitted for login\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUserProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EUser profile behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPagination\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPagination limits and defaults\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication response behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENavigation\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENavigation and redirect behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDiagnostics\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDiagnostic configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EServer event configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese groups allow applications to customize specific behavior without replacing the overall authentication architecture.\u003C/p\u003E\n\u003Cp\u003EThe individual option types and their defaults are documented in \u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-client\u0022\u003E5. Configure the Client\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth clients have their own configuration model.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthClient(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = true;\n options.DefaultReturnUrl = \u0026quot;/\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe registration accepts:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EAction\u0026lt;UAuthClientOptions\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client options control how the client behaves, not the server\u0027s security policy.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthClient(options =\u0026gt;\n{\n options.AutoRefresh.Enabled = true;\n options.DefaultReturnUrl = \u0026quot;/dashboard\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEnabling client auto-refresh does not change the server\u0027s refresh token lifetime, session expiration rules, or rotation policy.\u003C/p\u003E\n\u003Cp\u003EThose are server-side responsibilities.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-configuration-groups\u0022\u003EClient Configuration Groups\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EResponsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EExplicit application profile\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoDetectApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAutomatic application profile detection\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDefaultReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDefault post-authentication navigation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EClient login flow behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EClient PKCE flow behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAutomatic refresh behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauth\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReauthentication behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EServer endpoint paths used by the client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EClient tenant propagation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EStateEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EClient state event handling\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E for the full reference.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-and-client-configuration-are-independent\u0022\u003E6. Server and Client Configuration Are Independent\u003C/h2\u003E\n\u003Cp\u003EA project may register both UltimateAuth Server and UltimateAuth Client.\u003C/p\u003E\n\u003Cp\u003EThis is common in applications that host authentication services and also use the client SDK.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n});\n\nbuilder.Services.AddUltimateAuthClient(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = true;\n options.DefaultReturnUrl = \u0026quot;/\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese registrations configure different components.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ESetting\u003C/th\u003E\n\u003Cth\u003EServer\u003C/th\u003E\n\u003Cth\u003EClient\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession lifetime\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EToken lifetime\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECredential reset policy\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAllowed authentication modes\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EApplication profile\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EClient auto-refresh\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EClient navigation\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServer endpoint exposure\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003Ctd\u003EUses configured routes\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe client must be compatible with the server\u0027s configuration, but it cannot override server-side security requirements.\u003C/p\u003E\n\u003Cp\u003EFor example, enabling PKCE in client options does not make a disabled or unsupported PKCE server flow available.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-sources\u0022\u003E7. Configuration Sources\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports configuration through registration delegates and the standard ASP.NET Core configuration system.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022code-based-configuration\u0022\u003ECode-Based Configuration\u003C/h3\u003E\n\u003Cp\u003EUse \u003Ccode\u003EProgram.cs\u003C/code\u003E for explicit configuration.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.MaxFailedAttempts = 5;\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is useful when configuration is closely tied to application behavior or requires strongly typed values.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-based-setup\u0022\u003EConfiguration-Based Setup\u003C/h3\u003E\n\u003Cp\u003EThe server binds settings from:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Server\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example, in \u003Ccode\u003Eappsettings.json\u003C/code\u003E:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EJSON\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-json\u0022\u003E{\n \u0026quot;UltimateAuth\u0026quot;: {\n \u0026quot;Server\u0026quot;: {\n \u0026quot;Login\u0026quot;: {\n \u0026quot;MaxFailedAttempts\u0026quot;: 5\n },\n \u0026quot;Token\u0026quot;: {\n \u0026quot;SessionIdLifetime\u0026quot;: \u0026quot;08:00:00\u0026quot;\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client binds settings from:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Client\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EJSON\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-json\u0022\u003E{\n \u0026quot;UltimateAuth\u0026quot;: {\n \u0026quot;Client\u0026quot;: {\n \u0026quot;AutoDetectApplicationProfile\u0026quot;: true,\n \u0026quot;DefaultReturnUrl\u0026quot;: \u0026quot;/dashboard\u0026quot;,\n \u0026quot;AutoRefresh\u0026quot;: {\n \u0026quot;Enabled\u0026quot;: true\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese sections are independent.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022using-both-sources\u0022\u003EUsing Both Sources\u003C/h3\u003E\n\u003Cp\u003EYou can combine code-based and configuration-based settings:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.MaxFailedAttempts = 5;\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWith:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EJSON\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-json\u0022\u003E{\n \u0026quot;UltimateAuth\u0026quot;: {\n \u0026quot;Server\u0026quot;: {\n \u0026quot;Login\u0026quot;: {\n \u0026quot;MaxFailedAttempts\u0026quot;: 3\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe effective \u003Ccode\u003ELogin.MaxFailedAttempts\u003C/code\u003E is \u003Ccode\u003E3\u003C/code\u003E, because the registration binds the configuration section after applying the configuration delegate.\u003C/p\u003E\n\u003Cp\u003EThe session lifetime remains eight hours because the configuration section does not override it.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-precedence\u0022\u003E8. Configuration Precedence\u003C/h2\u003E\n\u003Cp\u003EThe current registration pipeline applies options in this order:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EOption type defaults.\u003C/li\u003E\n\u003Cli\u003EValues supplied by the registration delegate.\u003C/li\u003E\n\u003Cli\u003EValues bound from the corresponding configuration section.\u003C/li\u003E\n\u003Cli\u003EApplicable post-configuration processing.\u003C/li\u003E\n\u003Cli\u003EOptions validation.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EFor the server:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eservices.AddOptions\u0026lt;UAuthServerOptions\u0026gt;()\n .Configure(options =\u0026gt;\n {\n configure?.Invoke(options);\n })\n .BindConfiguration(\u0026quot;UltimateAuth:Server\u0026quot;)\n .ValidateOnStart();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor the client, the corresponding configuration section is \u003Ccode\u003EUltimateAuth:Client\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important-distinction\u0022\u003EImportant Distinction\u003C/h3\u003E\n\u003Cp\u003EWhen we say configuration values override \u003Ccode\u003EProgram.cs\u003C/code\u003E, we mean that the \u003Cstrong\u003Elater configuration binding takes precedence for the same property\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe exact value also depends on the normal ASP.NET Core configuration provider order.\u003C/p\u003E\n\u003Cp\u003EFor example, environment-specific configuration files and environment variables may override values from the base \u003Ccode\u003Eappsettings.json\u003C/code\u003E file.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022environment-variable-example\u0022\u003EEnvironment Variable Example\u003C/h3\u003E\n\u003Cp\u003EASP.NET Core configuration supports double underscores as section separators.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth__Server__Login__MaxFailedAttempts=3\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis maps to:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Server:Login:MaxFailedAttempts\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor a client setting:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth__Client__DefaultReturnUrl=/dashboard\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis makes it possible to provide environment-specific settings without modifying application code.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-mode-configuration\u0022\u003E9. Authentication Mode Configuration\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports multiple authentication mode concepts.\u003C/p\u003E\n\u003Cp\u003EThe server exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.AllowedModes\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis setting defines which modes the server is permitted to use.\u003C/p\u003E\n\u003Cp\u003EIt is a \u003Cstrong\u003Erestriction\u003C/strong\u003E, not a direct mode selector.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022restrict-allowed-modes\u0022\u003ERestrict Allowed Modes\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AllowedModes =\n [\n UAuthMode.PureOpaque,\n UAuthMode.Hybrid\n ];\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe effective authentication mode is resolved by the server\u0027s authentication mode resolution mechanism.\u003C/p\u003E\n\u003Cp\u003ESetting \u003Ccode\u003EAllowedModes\u003C/code\u003E does not directly choose which mode every client will use.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022supported-authentication-modes\u0022\u003ESupported Authentication Modes\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth supports four authentication modes:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EPureOpaque\u003C/li\u003E\n\u003Cli\u003EHybrid\u003C/li\u003E\n\u003Cli\u003ESemiHybrid\u003C/li\u003E\n\u003Cli\u003EPureJwt\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EAll modes share the same application-level authentication programming model.\u003C/p\u003E\n\u003Cp\u003EThe selected mode determines the underlying credential, validation and lifecycle strategy.\u003C/p\u003E\n\u003Cp\u003EHybrid is the recommended general-purpose starting point when no specialized authentication requirements have been identified.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E for a complete comparison and selection guidance.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-credential-session-policies\u0022\u003E10. Configure Credential Session Policies\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports configurable session invalidation after credential changes.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.CredentialSessionPolicy.OnSelfChange =\n CredentialSessionBehavior.PreserveCurrent;\n\n options.CredentialSessionPolicy.OnAdminChange =\n CredentialSessionBehavior.RevokeAll;\n\n options.CredentialSessionPolicy.OnRecovery =\n CredentialSessionBehavior.RevokeAll;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe available behaviors are:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EBehavior\u003C/th\u003E\n\u003Cth\u003EMeaning\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPreserveAll\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPreserve existing session chains\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPreserveCurrent\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPreserve the current chain and revoke others\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERevokeAll\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERevoke all applicable session chains\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThis is an example of configuration controlling \u003Cstrong\u003Esecurity behavior\u003C/strong\u003E, rather than merely adjusting a numeric value.\u003C/p\u003E\n\u003Cp\u003EThe client does not decide which sessions remain valid after a credential change.\u003C/p\u003E\n\u003Cp\u003EThat decision belongs to the server.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-endpoint-exposure\u0022\u003E11. Configure Endpoint Exposure\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth allows server applications to configure endpoint groups.\u003C/p\u003E\n\u003Cp\u003EThe relevant options are available through:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Endpoints\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;/uauth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client must use compatible endpoint paths.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthClient(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;/uauth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server controls which endpoints are registered and exposed.\u003C/p\u003E\n\u003Cp\u003EThe client controls where it sends requests.\u003C/p\u003E\n\u003Cp\u003EChanging a client endpoint path does not create or enable a server endpoint.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E and \u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022multi-tenant-configuration\u0022\u003E12. Multi-Tenant Configuration\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports tenant-aware authentication and authorization.\u003C/p\u003E\n\u003Cp\u003EThe server\u0027s multi-tenant configuration is available through:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.MultiTenant\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server uses this configuration to determine how tenant information is resolved.\u003C/p\u003E\n\u003Cp\u003ESupported resolution mechanisms include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ERoute-based resolution.\u003C/li\u003E\n\u003Cli\u003EHeader-based resolution.\u003C/li\u003E\n\u003Cli\u003EHost-based resolution.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe corresponding server options include:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.MultiTenant.EnableRoute;\noptions.MultiTenant.EnableHeader;\noptions.MultiTenant.EnableDomain;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.MultiTenant.EnableHeader = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client has its own multi-tenant options for propagating tenant information to the server.\u003C/p\u003E\n\u003Cp\u003EClient-side tenant selection does not authorize cross-tenant access.\u003C/p\u003E\n\u003Cp\u003EThe server remains responsible for tenant resolution, validation, and isolation.\u003C/p\u003E\n\u003Cp\u003EFor more details, see \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-configuration\u0022\u003E13. Resource API Configuration\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth also supports a separate Resource API integration.\u003C/p\u003E\n\u003Cp\u003EResource APIs use their own configuration model:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EUAuthResourceApiOptions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister a Resource API with:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.UAuthHubBaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe configuration section is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:ResourceApi\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EJSON\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-json\u0022\u003E{\n \u0026quot;UltimateAuth\u0026quot;: {\n \u0026quot;ResourceApi\u0026quot;: {\n \u0026quot;UAuthHubBaseUrl\u0026quot;: \u0026quot;https://auth.example.com\u0026quot;\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA Resource API does not become a full UltimateAuth authentication server merely by registering this integration.\u003C/p\u003E\n\u003Cp\u003EIts role is to protect application resources using the configured UltimateAuth authentication infrastructure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-resource-api\u0022\u003EPureJwt Resource API\u003C/h3\u003E\n\u003Cp\u003EA PureJwt Resource API validates access tokens locally and does not require a connection to UAuthHub for each authenticated request.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.Auth.Mode = UAuthMode.PureJwt;\n\n options.Auth.Jwt = new UAuthJwtValidationOptions\n {\n Issuer = \u0026quot;https://auth.example.com\u0026quot;,\n Audience = \u0026quot;products-api\u0026quot;,\n ValidAlgorithms = [SecurityAlgorithms.HmacSha256]\n };\n\n options.Cryptography.JwtVerificationKeys.Add(\n new UAuthJwtVerificationKeyOptions\n {\n KeyId = \u0026quot;uauth-hs256-v1\u0026quot;,\n Key = builder.Configuration[\u0026quot;UltimateAuth:JwtVerificationKey\u0026quot;]!\n });\n\n options.Auth.AccessToken.DeliveryMode = GrantDeliveryMode.Header;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource API must trust the signing key used by UAuthHub and must configure matching issuer, audience, algorithm, and key ID values.\u003C/p\u003E\n\u003Cp\u003EThe example uses a symmetric key. Production deployments must protect shared signing material and distribute it only through trusted configuration or secret-management systems.\u003C/p\u003E\n\u003Cp\u003EFor PureJwt, \u003Ccode\u003EHub.BaseUrl\u003C/code\u003E is optional because access-token validation does not require remote session validation.\u003C/p\u003E\n\u003Cp\u003EFor session-based Resource API validation, \u003Ccode\u003EHub.BaseUrl\u003C/code\u003E is required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important-resource-api-cors-configuration\u0022\u003EImportant: Resource API CORS Configuration\u003C/h3\u003E\n\u003Cp\u003EThe current Resource API registration constructs its CORS policy using the values supplied to the registration delegate.\u003C/p\u003E\n\u003Cp\u003ETherefore, when configuring \u003Ccode\u003EAllowedClientOrigins\u003C/code\u003E, prefer supplying them directly in the registration delegate rather than assuming values bound only from \u003Ccode\u003Eappsettings.json\u003C/code\u003E will automatically populate that CORS policy.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.UAuthHubBaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\n options.AllowedClientOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EKeep CORS configuration explicit and restrict allowed origins to trusted applications.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-and-safe-configuration\u0022\u003E14. Validation and Safe Configuration\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses ASP.NET Core options validation to reject invalid configurations.\u003C/p\u003E\n\u003Cp\u003EThe server registers validators for areas including:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EGeneral server configuration.\u003C/li\u003E\n\u003Cli\u003ELogin settings.\u003C/li\u003E\n\u003Cli\u003ESession settings.\u003C/li\u003E\n\u003Cli\u003EToken settings.\u003C/li\u003E\n\u003Cli\u003EMulti-tenancy.\u003C/li\u003E\n\u003Cli\u003EUser identifiers.\u003C/li\u003E\n\u003Cli\u003EGrant delivery and credential resolution.\u003C/li\u003E\n\u003Cli\u003EPagination.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor example, the server validates that:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe endpoint base path is specified.\u003C/li\u003E\n\u003Cli\u003EThe base path does not contain invalid double slashes.\u003C/li\u003E\n\u003Cli\u003EAllowed authentication modes are valid.\u003C/li\u003E\n\u003Cli\u003EExplicitly unsupported modes are not enabled.\u003C/li\u003E\n\u003Cli\u003ESession lifetimes satisfy applicable constraints.\u003C/li\u003E\n\u003Cli\u003EAccess token lifetime does not exceed the configured session maximum lifetime.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-invalid-session-lifetime\u0022\u003EExample: Invalid Session Lifetime\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.Zero;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configuration is rejected when the applicable session lifetime validation runs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-invalid-endpoint-path\u0022\u003EExample: Invalid Endpoint Path\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;//invalid\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configuration fails server options validation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-timing\u0022\u003EValidation Timing\u003C/h3\u003E\n\u003Cp\u003EServer options use \u003Ccode\u003EValidateOnStart()\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThis allows configuration errors to surface during application startup instead of waiting until the first authentication request.\u003C/p\u003E\n\u003Cp\u003EClient options also have registered validators and post-configuration processing, but their validation timing follows the client options registration and resolution lifecycle.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EValidation is an important safeguard, not a guarantee that every logically undesirable configuration is automatically detected.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EApplications must still choose appropriate production settings and securely implement custom extensions.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022extensibility-through-dependency-injection\u0022\u003E15. Extensibility Through Dependency Injection\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses dependency injection to support customization of selected runtime behaviors.\u003C/p\u003E\n\u003Cp\u003EConfiguration controls the behavior of existing components.\u003C/p\u003E\n\u003Cp\u003EDependency injection allows applications to supply implementations for supported extension points.\u003C/p\u003E\n\u003Cp\u003EExamples include:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EExtension point\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EICredentialResetNotifier\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDeliver credential recovery proofs\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIUserIdentifierVerifier\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EValidate identifier ownership proof\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EITenantIdResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECustomize tenant identification\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIClock\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EProvide a clock implementation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIJwtSigningKeyProvider\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESupply JWT signing keys\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EFor example, a credential reset notifier can be registered as:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;ICredentialResetNotifier, ApplicationCredentialResetNotifier\u0026gt;();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EApplicationCredentialResetNotifier\u003C/code\u003E represents an implementation supplied by your application.\u003C/p\u003E\n\u003Cp\u003EThe server\u0027s supported registration and resolution behavior must be respected when replacing services.\u003C/p\u003E\n\u003Cp\u003ENot every internal service is intended to be replaced, and custom implementations must preserve UltimateAuth\u0027s security invariants.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-versus-extension\u0022\u003EConfiguration Versus Extension\u003C/h3\u003E\n\u003Cp\u003EUse configuration when you want to adjust a supported behavior:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUse an extension point when your application needs to provide its own implementation:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;ICredentialResetNotifier, ApplicationCredentialResetNotifier\u0026gt;();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis separation helps keep ordinary configuration simple while allowing advanced integration where necessary.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-customization\u0022\u003E16. Endpoint Customization\u003C/h2\u003E\n\u003Cp\u003EThe server exposes an advanced endpoint configuration hook:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.OnConfigureEndpoints\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe hook receives an \u003Ccode\u003EIEndpointRouteBuilder\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EIt is intended for advanced endpoint configuration after UltimateAuth registers its default endpoints.\u003C/p\u003E\n\u003Cp\u003EFor example, an application may use the hook to apply additional endpoint metadata or filters where appropriate.\u003C/p\u003E\n\u003Cp\u003EHowever, it must not remove or remap UltimateAuth endpoints in ways that invalidate expected security behavior.\u003C/p\u003E\n\u003Cp\u003EEndpoint customization should be treated as an advanced integration mechanism, not a replacement for the supported endpoint configuration options.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-configuration-strategy\u0022\u003E17. Recommended Configuration Strategy\u003C/h2\u003E\n\u003Cp\u003EFor most applications, use the following approach.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022keep-server-security-settings-on-the-server\u0022\u003EKeep Server Security Settings on the Server\u003C/h3\u003E\n\u003Cp\u003EConfigure authentication modes, token lifetimes, session lifetimes, credential policies, and tenant resolution through \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022keep-client-behavior-in-client-options\u0022\u003EKeep Client Behavior in Client Options\u003C/h3\u003E\n\u003Cp\u003EConfigure application profiles, navigation, auto-refresh, reauthentication, and endpoint usage through \u003Ccode\u003EUAuthClientOptions\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022use-configuration-files-for-environment-differences\u0022\u003EUse Configuration Files for Environment Differences\u003C/h3\u003E\n\u003Cp\u003EUse \u003Ccode\u003Eappsettings.json\u003C/code\u003E, environment-specific configuration, and environment variables for values that differ between development, staging, and production.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022prefer-strongly-typed-configuration\u0022\u003EPrefer Strongly Typed Configuration\u003C/h3\u003E\n\u003Cp\u003EUse the provided option types rather than inventing custom configuration keys for features already supported by UltimateAuth.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022preserve-secure-defaults\u0022\u003EPreserve Secure Defaults\u003C/h3\u003E\n\u003Cp\u003EOnly change security-sensitive defaults when the application\u0027s requirements justify the change.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022avoid-duplicate-core-configuration\u0022\u003EAvoid Duplicate Core Configuration\u003C/h3\u003E\n\u003Cp\u003EWhen using \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E, do not separately configure Core options and expect them to override the server\u0027s composed options.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validate-production-configuration\u0022\u003EValidate Production Configuration\u003C/h3\u003E\n\u003Cp\u003ETest startup validation and authentication flows using the effective configuration that will be deployed.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-reference\u0022\u003E18. Configuration Reference\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication role\u003C/th\u003E\n\u003Cth\u003ERegistration method\u003C/th\u003E\n\u003Cth\u003EOptions type\u003C/th\u003E\n\u003Cth\u003EConfiguration section\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAuthentication server\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUltimateAuth:Server\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUltimateAuth client\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAddUltimateAuthClient()\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUltimateAuth:Client\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResource API\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAddUltimateAuthResourceApi()\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthResourceApiOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUltimateAuth:ResourceApi\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECore-only infrastructure\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAddUltimateAuth()\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUltimateAuth:Core\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EFor normal server applications, \u003Cstrong\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E is the effective configuration entry point for both Core-defined authentication settings and server-specific behavior\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe Core-only registration exists for infrastructure scenarios that explicitly consume \u003Ccode\u003EUAuthOptions\u003C/code\u003E; it should not be treated as an additional server configuration layer.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-steps\u0022\u003ENext Steps\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/configuration-overview\u0022\u003EConfiguration Overview\u003C/a\u003E \u2014 Understand the overall configuration model.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Configure authentication and security behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E \u2014 Configure application profiles, flows, and SDK behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E \u2014 Customize integration, multi-tenancy, and runtime extension points.\u003C/li\u003E\n\u003C/ul\u003E\n", + "Html": "\n\u003Cp\u003EUltimateAuth provides a structured configuration system for controlling authentication behavior, session lifecycles, token policies, client integration, and server security.\u003C/p\u003E\n\u003Cp\u003EConfiguration is organized around the application components that actually consume it.\u003C/p\u003E\n\u003Cp\u003EFor most applications, the two primary configuration types are:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E\u003C/strong\u003E \u2014 Controls authentication and security behavior on the UltimateAuth server.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003E\u003Ccode\u003EUAuthClientOptions\u003C/code\u003E\u003C/strong\u003E \u2014 Controls how an application client communicates with UltimateAuth and executes authentication flows.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EUltimateAuth also defines reusable options in its Core package. These types form the foundation of server configuration, but they do not need to be configured independently when using \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThis guide explains where configuration belongs, how options are registered, how configuration sources interact, and how to customize behavior safely.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-architecture\u0022\u003E1. Configuration Architecture\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates reusable option definitions from the runtime components that consume them.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth\n\u2502\n\u251C\u2500\u2500 Core\n\u2502 \u2514\u2500\u2500 Shared option definitions\n\u2502 \u251C\u2500\u2500 Login\n\u2502 \u251C\u2500\u2500 Session\n\u2502 \u251C\u2500\u2500 Token\n\u2502 \u251C\u2500\u2500 PKCE\n\u2502 \u2514\u2500\u2500 Multi-tenancy\n\u2502\n\u251C\u2500\u2500 Server\n\u2502 \u2514\u2500\u2500 UAuthServerOptions\n\u2502 \u251C\u2500\u2500 Core-defined options\n\u2502 \u251C\u2500\u2500 Authentication mode restrictions\n\u2502 \u251C\u2500\u2500 Surrogate transport and resolution\n\u2502 \u251C\u2500\u2500 Endpoints\n\u2502 \u251C\u2500\u2500 Hub configuration\n\u2502 \u251C\u2500\u2500 Credential policies\n\u2502 \u2514\u2500\u2500 Server-specific behavior\n\u2502\n\u2514\u2500\u2500 Client\n \u2514\u2500\u2500 UAuthClientOptions\n \u251C\u2500\u2500 Application profile\n \u251C\u2500\u2500 Login and PKCE flows\n \u251C\u2500\u2500 Endpoint configuration\n \u251C\u2500\u2500 Auto-refresh\n \u251C\u2500\u2500 Reauthentication\n \u2514\u2500\u2500 Client state events\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe important distinction is between \u003Cstrong\u003Ewhere an option type is defined\u003C/strong\u003E and \u003Cstrong\u003Ewhere its value is consumed\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EFor example, \u003Ccode\u003EUAuthTokenOptions\u003C/code\u003E is defined in Core, but a normal UltimateAuth Server application configures it through:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server consumes \u003Ccode\u003Eoptions.Token\u003C/code\u003E from \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThere is no need to configure a separate Core options instance for this setting.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-server\u0022\u003E2. Configure the Server\u003C/h2\u003E\n\u003Cp\u003EThe main server registration method is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n // Server configuration.\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis registers the UltimateAuth server infrastructure and its configuration.\u003C/p\u003E\n\u003Cp\u003EThe method accepts an optional configuration delegate:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EAction\u0026lt;UAuthServerOptions\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIt also supports a separate optional delegate for registering access policies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-authentication-and-session-settings\u0022\u003EExample: Authentication and Session Settings\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.MaxFailedAttempts = 5;\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(15);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese settings control different parts of the authentication lifecycle:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOption\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin.MaxFailedAttempts\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMaximum failed login attempts under the configured login policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EToken.SessionIdLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession identifier lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EToken.AccessTokenLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAccess token lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe server applies its validation rules to the resulting configuration.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EConfiguration values should be chosen together.\u003C/strong\u003E For example, token lifetime settings must remain compatible with the configured session lifetime limits.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-ownership\u0022\u003E3. Configuration Ownership\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates configuration according to the component responsible for applying it.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EComponent\u003C/th\u003E\n\u003Cth\u003EConfiguration responsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServer\u003C/td\u003E\n\u003Ctd\u003EAuthentication flows, token issuance, lifecycle, and security policies\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003Ctd\u003EApplication integration, surrogate handling, navigation, and automatic refresh\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResource API\u003C/td\u003E\n\u003Ctd\u003EIncoming surrogate validation and protected resource authentication\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EShared authentication contracts and domain concepts are provided by UltimateAuth Core.\u003C/p\u003E\n\u003Cp\u003EServer-specific configuration belongs to the Server integration.\u003C/p\u003E\n\u003Cp\u003EConfigure server behavior through the primary server registration API:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthMode = UAuthMode.Hybrid;\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n options.Session.SlidingExpiration = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApplications should not independently configure internal option groups when the corresponding component exposes a primary configuration entry point.\u003C/p\u003E\n\u003Cp\u003EThis keeps configuration ownership explicit and allows UltimateAuth to resolve effective options consistently.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-configuration-groups\u0022\u003E4. Server Configuration Groups\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E organizes server behavior into focused option groups.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EResponsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin attempts and authentication behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession lifetime and lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EToken\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EToken issuance, lifetimes, and refresh behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE flow configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant resolution and multi-tenant behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERestricts permitted authentication modes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHubDeploymentMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub deployment arrangement\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHub\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub-specific configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECookie\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication cookie behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETransport\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication surrogate transport\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EServer endpoint configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECredentialSessionPolicy\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession handling after credential changes and recovery\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResetCredential\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential reset configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPrimaryCredential\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPrimary credential policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIdentifiers\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifier management behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIdentifierValidation\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifier validation rules\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELoginIdentifiers\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifier types permitted for login\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUserProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EUser profile behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPagination\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPagination limits and defaults\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERedirect\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication-related navigation behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENavigation\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENavigation and redirect behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDiagnostics\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDiagnostic configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EServer event configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese groups allow applications to customize specific behavior without replacing the overall authentication architecture.\u003C/p\u003E\n\u003Cp\u003EThe individual option types and their defaults are documented in \u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-client\u0022\u003E5. Configure the Client\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth clients have their own configuration model.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthClient(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = true;\n options.DefaultReturnUrl = \u0026quot;/\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe registration accepts:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EAction\u0026lt;UAuthClientOptions\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client options control how the client behaves, not the server\u0027s security policy.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthClient(options =\u0026gt;\n{\n options.AutoRefresh.Enabled = true;\n options.DefaultReturnUrl = \u0026quot;/dashboard\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEnabling client auto-refresh does not change the server\u0027s refresh token lifetime, session expiration rules, or rotation policy.\u003C/p\u003E\n\u003Cp\u003EThose are server-side responsibilities.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-configuration-groups\u0022\u003EClient Configuration Groups\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EResponsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EExplicit application profile\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoDetectApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAutomatic application profile detection\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDefaultReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDefault post-authentication navigation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EClient login flow behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EClient PKCE flow behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAutomatic refresh behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauth\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReauthentication behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EServer endpoint paths used by the client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EClient tenant propagation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EStateEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EClient state event handling\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E for the full reference.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-and-client-configuration-are-independent\u0022\u003E6. Server and Client Configuration Are Independent\u003C/h2\u003E\n\u003Cp\u003EA project may register both UltimateAuth Server and UltimateAuth Client.\u003C/p\u003E\n\u003Cp\u003EThis is common in applications that host authentication services and also use the client SDK.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n});\n\nbuilder.Services.AddUltimateAuthClient(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = true;\n options.DefaultReturnUrl = \u0026quot;/\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese registrations configure different components.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ESetting\u003C/th\u003E\n\u003Cth\u003EServer\u003C/th\u003E\n\u003Cth\u003EClient\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession lifetime\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EToken lifetime\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECredential reset policy\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAllowed authentication modes\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EApplication profile\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EClient auto-refresh\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EClient navigation\u003C/td\u003E\n\u003Ctd\u003EDoes not control\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServer endpoint exposure\u003C/td\u003E\n\u003Ctd\u003EControls\u003C/td\u003E\n\u003Ctd\u003EUses configured routes\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe client must be compatible with the server\u0027s configuration, but it cannot override server-side security requirements.\u003C/p\u003E\n\u003Cp\u003EFor example, enabling PKCE in client options does not make a disabled or unsupported PKCE server flow available.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-sources\u0022\u003E7. Configuration Sources\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports configuration through registration delegates and the standard ASP.NET Core configuration system.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022code-based-configuration\u0022\u003ECode-Based Configuration\u003C/h3\u003E\n\u003Cp\u003EUse \u003Ccode\u003EProgram.cs\u003C/code\u003E for explicit configuration.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.MaxFailedAttempts = 5;\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is useful when configuration is closely tied to application behavior or requires strongly typed values.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-based-setup\u0022\u003EConfiguration-Based Setup\u003C/h3\u003E\n\u003Cp\u003EThe server binds settings from:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Server\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example, in \u003Ccode\u003Eappsettings.json\u003C/code\u003E:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EJSON\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-json\u0022\u003E{\n \u0026quot;UltimateAuth\u0026quot;: {\n \u0026quot;Server\u0026quot;: {\n \u0026quot;Login\u0026quot;: {\n \u0026quot;MaxFailedAttempts\u0026quot;: 5\n },\n \u0026quot;Token\u0026quot;: {\n \u0026quot;SessionIdLifetime\u0026quot;: \u0026quot;08:00:00\u0026quot;\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client binds settings from:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Client\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EJSON\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-json\u0022\u003E{\n \u0026quot;UltimateAuth\u0026quot;: {\n \u0026quot;Client\u0026quot;: {\n \u0026quot;AutoDetectApplicationProfile\u0026quot;: true,\n \u0026quot;DefaultReturnUrl\u0026quot;: \u0026quot;/dashboard\u0026quot;,\n \u0026quot;AutoRefresh\u0026quot;: {\n \u0026quot;Enabled\u0026quot;: true\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese sections are independent.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022using-both-sources\u0022\u003EUsing Both Sources\u003C/h3\u003E\n\u003Cp\u003EYou can combine code-based and configuration-based settings:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.MaxFailedAttempts = 5;\n options.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWith:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EJSON\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-json\u0022\u003E{\n \u0026quot;UltimateAuth\u0026quot;: {\n \u0026quot;Server\u0026quot;: {\n \u0026quot;Login\u0026quot;: {\n \u0026quot;MaxFailedAttempts\u0026quot;: 3\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe effective \u003Ccode\u003ELogin.MaxFailedAttempts\u003C/code\u003E is \u003Ccode\u003E3\u003C/code\u003E, because the registration binds the configuration section after applying the configuration delegate.\u003C/p\u003E\n\u003Cp\u003EThe session lifetime remains eight hours because the configuration section does not override it.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-precedence\u0022\u003E8. Configuration Precedence\u003C/h2\u003E\n\u003Cp\u003EThe current registration pipeline applies options in this order:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EOption type defaults.\u003C/li\u003E\n\u003Cli\u003EValues supplied by the registration delegate.\u003C/li\u003E\n\u003Cli\u003EValues bound from the corresponding configuration section.\u003C/li\u003E\n\u003Cli\u003EApplicable post-configuration processing.\u003C/li\u003E\n\u003Cli\u003EOptions validation.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EFor the server:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eservices.AddOptions\u0026lt;UAuthServerOptions\u0026gt;()\n .Configure(options =\u0026gt;\n {\n configure?.Invoke(options);\n })\n .BindConfiguration(\u0026quot;UltimateAuth:Server\u0026quot;)\n .ValidateOnStart();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor the client, the corresponding configuration section is \u003Ccode\u003EUltimateAuth:Client\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important-distinction\u0022\u003EImportant Distinction\u003C/h3\u003E\n\u003Cp\u003EWhen we say configuration values override \u003Ccode\u003EProgram.cs\u003C/code\u003E, we mean that the \u003Cstrong\u003Elater configuration binding takes precedence for the same property\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe exact value also depends on the normal ASP.NET Core configuration provider order.\u003C/p\u003E\n\u003Cp\u003EFor example, environment-specific configuration files and environment variables may override values from the base \u003Ccode\u003Eappsettings.json\u003C/code\u003E file.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022environment-variable-example\u0022\u003EEnvironment Variable Example\u003C/h3\u003E\n\u003Cp\u003EASP.NET Core configuration supports double underscores as section separators.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth__Server__Login__MaxFailedAttempts=3\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis maps to:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Server:Login:MaxFailedAttempts\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor a client setting:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth__Client__DefaultReturnUrl=/dashboard\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis makes it possible to provide environment-specific settings without modifying application code.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-mode-configuration\u0022\u003E9. Authentication Mode Configuration\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports multiple authentication mode concepts.\u003C/p\u003E\n\u003Cp\u003EThe server exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.AllowedModes\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis setting defines which modes the server is permitted to use.\u003C/p\u003E\n\u003Cp\u003EIt is a \u003Cstrong\u003Erestriction\u003C/strong\u003E, not a direct mode selector.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022restrict-allowed-modes\u0022\u003ERestrict Allowed Modes\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AllowedModes =\n [\n UAuthMode.PureOpaque,\n UAuthMode.Hybrid\n ];\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe effective authentication mode is resolved by the server\u0027s authentication mode resolution mechanism.\u003C/p\u003E\n\u003Cp\u003ESetting \u003Ccode\u003EAllowedModes\u003C/code\u003E does not directly choose which mode every client will use.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022supported-authentication-modes\u0022\u003ESupported Authentication Modes\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth supports four authentication modes:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EPureOpaque\u003C/li\u003E\n\u003Cli\u003EHybrid\u003C/li\u003E\n\u003Cli\u003ESemiHybrid\u003C/li\u003E\n\u003Cli\u003EPureJwt\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EAll modes share the same application-level authentication programming model.\u003C/p\u003E\n\u003Cp\u003EThe selected mode determines the underlying surrogate, validation, and lifecycle strategy.\u003C/p\u003E\n\u003Cp\u003EHybrid is the recommended general-purpose starting point when no specialized authentication requirements have been identified.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E for a complete comparison and selection guidance.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-credential-session-policies\u0022\u003E10. Configure Credential Session Policies\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports configurable session invalidation after credential changes.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.CredentialSessionPolicy.OnSelfChange =\n CredentialSessionBehavior.PreserveCurrent;\n\n options.CredentialSessionPolicy.OnAdminChange =\n CredentialSessionBehavior.RevokeAll;\n\n options.CredentialSessionPolicy.OnRecovery =\n CredentialSessionBehavior.RevokeAll;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe available behaviors are:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EBehavior\u003C/th\u003E\n\u003Cth\u003EMeaning\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPreserveAll\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPreserve existing session chains\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPreserveCurrent\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPreserve the current chain and revoke others\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERevokeAll\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERevoke all applicable session chains\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThis is an example of configuration controlling \u003Cstrong\u003Esecurity behavior\u003C/strong\u003E, rather than merely adjusting a numeric value.\u003C/p\u003E\n\u003Cp\u003EThe client does not decide which sessions remain valid after a credential change.\u003C/p\u003E\n\u003Cp\u003EThat decision belongs to the server.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-endpoint-exposure\u0022\u003E11. Configure Endpoint Exposure\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth allows server applications to configure endpoint groups.\u003C/p\u003E\n\u003Cp\u003EThe relevant options are available through:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Endpoints\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;/uauth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client must use compatible endpoint paths.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthClient(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;/uauth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server controls which endpoints are registered and exposed.\u003C/p\u003E\n\u003Cp\u003EThe client controls where it sends requests.\u003C/p\u003E\n\u003Cp\u003EChanging a client endpoint path does not create or enable a server endpoint.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E and \u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022multi-tenant-configuration\u0022\u003E12. Multi-Tenant Configuration\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports tenant-aware authentication and authorization.\u003C/p\u003E\n\u003Cp\u003EThe server\u0027s multi-tenant configuration is available through:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.MultiTenant\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server uses this configuration to determine how tenant information is resolved.\u003C/p\u003E\n\u003Cp\u003ESupported resolution mechanisms include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ERoute-based resolution.\u003C/li\u003E\n\u003Cli\u003EHeader-based resolution.\u003C/li\u003E\n\u003Cli\u003EHost-based resolution.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe corresponding server options include:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.MultiTenant.EnableRoute;\noptions.MultiTenant.EnableHeader;\noptions.MultiTenant.EnableDomain;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.MultiTenant.EnableHeader = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client has its own multi-tenant options for propagating tenant information to the server.\u003C/p\u003E\n\u003Cp\u003EClient-side tenant selection does not authorize cross-tenant access.\u003C/p\u003E\n\u003Cp\u003EThe server remains responsible for tenant resolution, validation, and isolation.\u003C/p\u003E\n\u003Cp\u003EFor more details, see \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-configuration\u0022\u003E13. Resource API Configuration\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth also supports a separate Resource API integration.\u003C/p\u003E\n\u003Cp\u003EResource APIs use their own configuration model:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EUAuthResourceApiOptions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister a Resource API with:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.UAuthHubBaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe configuration section is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:ResourceApi\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EJSON\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-json\u0022\u003E{\n \u0026quot;UltimateAuth\u0026quot;: {\n \u0026quot;ResourceApi\u0026quot;: {\n \u0026quot;UAuthHubBaseUrl\u0026quot;: \u0026quot;https://auth.example.com\u0026quot;\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA Resource API does not become a full UltimateAuth authentication server merely by registering this integration.\u003C/p\u003E\n\u003Cp\u003EIts role is to protect application resources using the configured UltimateAuth authentication infrastructure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-resource-api\u0022\u003EPureJwt Resource API\u003C/h3\u003E\n\u003Cp\u003EA PureJwt Resource API validates access tokens locally and does not require a connection to UAuthHub for each authenticated request.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.Auth.Mode = UAuthMode.PureJwt;\n\n options.Auth.Jwt = new UAuthJwtValidationOptions\n {\n Issuer = \u0026quot;https://auth.example.com\u0026quot;,\n Audience = \u0026quot;products-api\u0026quot;,\n ValidAlgorithms = [SecurityAlgorithms.HmacSha256]\n };\n\n options.Cryptography.JwtVerificationKeys.Add(\n new UAuthJwtVerificationKeyOptions\n {\n KeyId = \u0026quot;uauth-hs256-v1\u0026quot;,\n Key = builder.Configuration[\u0026quot;UltimateAuth:JwtVerificationKey\u0026quot;]!\n });\n\n options.Auth.AccessToken.Mode = SurrogateTransport.Header;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource API must trust the signing key used by UAuthHub and must configure matching issuer, audience, algorithm, and key ID values.\u003C/p\u003E\n\u003Cp\u003EThe example uses a symmetric key. Production deployments must protect shared signing material and distribute it only through trusted configuration or secret-management systems.\u003C/p\u003E\n\u003Cp\u003EFor PureJwt, \u003Ccode\u003EHub.BaseUrl\u003C/code\u003E is optional because access-token validation does not require remote session validation.\u003C/p\u003E\n\u003Cp\u003EFor session-based Resource API validation, \u003Ccode\u003EHub.BaseUrl\u003C/code\u003E is required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important-resource-api-cors-configuration\u0022\u003EImportant: Resource API CORS Configuration\u003C/h3\u003E\n\u003Cp\u003EThe current Resource API registration constructs its CORS policy using the values supplied to the registration delegate.\u003C/p\u003E\n\u003Cp\u003ETherefore, when configuring \u003Ccode\u003EAllowedClientOrigins\u003C/code\u003E, prefer supplying them directly in the registration delegate rather than assuming values bound only from \u003Ccode\u003Eappsettings.json\u003C/code\u003E will automatically populate that CORS policy.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.UAuthHubBaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\n options.AllowedClientOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EKeep CORS configuration explicit and restrict allowed origins to trusted applications.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-and-safe-configuration\u0022\u003E14. Validation and Safe Configuration\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses ASP.NET Core options validation to reject invalid configurations.\u003C/p\u003E\n\u003Cp\u003EThe server registers validators for areas including:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EGeneral server configuration.\u003C/li\u003E\n\u003Cli\u003ELogin settings.\u003C/li\u003E\n\u003Cli\u003ESession settings.\u003C/li\u003E\n\u003Cli\u003EToken settings.\u003C/li\u003E\n\u003Cli\u003EMulti-tenancy.\u003C/li\u003E\n\u003Cli\u003EUser identifiers.\u003C/li\u003E\n\u003Cli\u003ESurrogate transport and resolution.\u003C/li\u003E\n\u003Cli\u003EPagination.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor example, the server validates that:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe endpoint base path is specified.\u003C/li\u003E\n\u003Cli\u003EThe base path does not contain invalid double slashes.\u003C/li\u003E\n\u003Cli\u003EAllowed authentication modes are valid.\u003C/li\u003E\n\u003Cli\u003EExplicitly unsupported modes are not enabled.\u003C/li\u003E\n\u003Cli\u003ESession lifetimes satisfy applicable constraints.\u003C/li\u003E\n\u003Cli\u003EAccess token lifetime does not exceed the configured session maximum lifetime.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-invalid-session-lifetime\u0022\u003EExample: Invalid Session Lifetime\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.Zero;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configuration is rejected when the applicable session lifetime validation runs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-invalid-endpoint-path\u0022\u003EExample: Invalid Endpoint Path\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;//invalid\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configuration fails server options validation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-timing\u0022\u003EValidation Timing\u003C/h3\u003E\n\u003Cp\u003EServer options use \u003Ccode\u003EValidateOnStart()\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThis allows configuration errors to surface during application startup instead of waiting until the first authentication request.\u003C/p\u003E\n\u003Cp\u003EClient options also have registered validators and post-configuration processing, but their validation timing follows the client options registration and resolution lifecycle.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EValidation is an important safeguard, not a guarantee that every logically undesirable configuration is automatically detected.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EApplications must still choose appropriate production settings and securely implement custom extensions.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022extensibility-through-dependency-injection\u0022\u003E15. Extensibility Through Dependency Injection\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses dependency injection to support customization of selected runtime behaviors.\u003C/p\u003E\n\u003Cp\u003EConfiguration controls the behavior of existing components.\u003C/p\u003E\n\u003Cp\u003EDependency injection allows applications to supply implementations for supported extension points.\u003C/p\u003E\n\u003Cp\u003EExamples include:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EExtension point\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EICredentialResetNotifier\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDeliver credential recovery proofs\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIUserIdentifierVerifier\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EValidate identifier ownership proof\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EITenantIdResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECustomize tenant identification\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIClock\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EProvide a clock implementation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIJwtSigningKeyProvider\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESupply JWT signing keys\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EFor example, a credential reset notifier can be registered as:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;ICredentialResetNotifier, ApplicationCredentialResetNotifier\u0026gt;();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EApplicationCredentialResetNotifier\u003C/code\u003E represents an implementation supplied by your application.\u003C/p\u003E\n\u003Cp\u003EThe server\u0027s supported registration and resolution behavior must be respected when replacing services.\u003C/p\u003E\n\u003Cp\u003ENot every internal service is intended to be replaced, and custom implementations must preserve UltimateAuth\u0027s security invariants.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-versus-extension\u0022\u003EConfiguration Versus Extension\u003C/h3\u003E\n\u003Cp\u003EUse configuration when you want to adjust a supported behavior:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Token.SessionIdLifetime = TimeSpan.FromHours(8);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUse an extension point when your application needs to provide its own implementation:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddScoped\u0026lt;ICredentialResetNotifier, ApplicationCredentialResetNotifier\u0026gt;();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis separation helps keep ordinary configuration simple while allowing advanced integration where necessary.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-customization\u0022\u003E16. Endpoint Customization\u003C/h2\u003E\n\u003Cp\u003EThe server exposes an advanced endpoint configuration hook:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.OnConfigureEndpoints\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe hook receives an \u003Ccode\u003EIEndpointRouteBuilder\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EIt is intended for advanced endpoint configuration after UltimateAuth registers its default endpoints.\u003C/p\u003E\n\u003Cp\u003EFor example, an application may use the hook to apply additional endpoint metadata or filters where appropriate.\u003C/p\u003E\n\u003Cp\u003EHowever, it must not remove or remap UltimateAuth endpoints in ways that invalidate expected security behavior.\u003C/p\u003E\n\u003Cp\u003EEndpoint customization should be treated as an advanced integration mechanism, not a replacement for the supported endpoint configuration options.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-configuration-strategy\u0022\u003E17. Recommended Configuration Strategy\u003C/h2\u003E\n\u003Cp\u003EFor most applications, use the following approach.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022keep-server-security-settings-on-the-server\u0022\u003EKeep Server Security Settings on the Server\u003C/h3\u003E\n\u003Cp\u003EConfigure authentication modes, token lifetimes, session lifetimes, credential policies, and tenant resolution through \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022keep-client-behavior-in-client-options\u0022\u003EKeep Client Behavior in Client Options\u003C/h3\u003E\n\u003Cp\u003EConfigure application profiles, navigation, auto-refresh, reauthentication, and endpoint usage through \u003Ccode\u003EUAuthClientOptions\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022use-configuration-files-for-environment-differences\u0022\u003EUse Configuration Files for Environment Differences\u003C/h3\u003E\n\u003Cp\u003EUse \u003Ccode\u003Eappsettings.json\u003C/code\u003E, environment-specific configuration, and environment variables for values that differ between development, staging, and production.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022prefer-strongly-typed-configuration\u0022\u003EPrefer Strongly Typed Configuration\u003C/h3\u003E\n\u003Cp\u003EUse the provided option types rather than inventing custom configuration keys for features already supported by UltimateAuth.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022preserve-secure-defaults\u0022\u003EPreserve Secure Defaults\u003C/h3\u003E\n\u003Cp\u003EOnly change security-sensitive defaults when the application\u0027s requirements justify the change.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022avoid-duplicate-core-configuration\u0022\u003EAvoid Duplicate Core Configuration\u003C/h3\u003E\n\u003Cp\u003EWhen using \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E, do not separately configure Core options and expect them to override the server\u0027s composed options.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validate-production-configuration\u0022\u003EValidate Production Configuration\u003C/h3\u003E\n\u003Cp\u003ETest startup validation and authentication flows using the effective configuration that will be deployed.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-reference\u0022\u003E18. Configuration Reference\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication role\u003C/th\u003E\n\u003Cth\u003ERegistration method\u003C/th\u003E\n\u003Cth\u003EOptions type\u003C/th\u003E\n\u003Cth\u003EConfiguration section\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAuthentication server\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUltimateAuth:Server\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUltimateAuth client\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAddUltimateAuthClient()\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUltimateAuth:Client\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResource API\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAddUltimateAuthResourceApi()\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthResourceApiOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUltimateAuth:ResourceApi\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECore-only infrastructure\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAddUltimateAuth()\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUltimateAuth:Core\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EFor normal server applications, \u003Cstrong\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E is the effective configuration entry point for both Core-defined authentication settings and server-specific behavior\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe Core-only registration exists for infrastructure scenarios that explicitly consume \u003Ccode\u003EUAuthOptions\u003C/code\u003E; it should not be treated as an additional server configuration layer.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-steps\u0022\u003ENext Steps\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/configuration-overview\u0022\u003EConfiguration Overview\u003C/a\u003E \u2014 Understand the overall configuration model.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Configure authentication and security behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E \u2014 Configure application profiles, flows, and SDK behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E \u2014 Customize integration, multi-tenancy, and runtime extension points.\u003C/li\u003E\n\u003C/ul\u003E\n", "Headings": [ { "Id": "configuration-architecture", @@ -209,6 +209,6 @@ "Level": 0 } ], - "SourceHash": "4B811B4B53884F5927AF19271A576844DC4515B1F1A39ABB00BCD180E0DA2EF7", + "SourceHash": "54702788A4CD059052025136B01317D4529C24516C73400E94651398C763BFE1", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/server-options.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/server-options.json index 72ad5cf8..63a04776 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/server-options.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/server-options.json @@ -1,7 +1,7 @@ { "Slug": "configuration/server-options", "Title": "Server Options", - "Html": "\n\u003Cp\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E is the primary configuration surface for UltimateAuth Server.\u003C/p\u003E\n\u003Cp\u003EIt controls authentication behavior, session lifecycles, token issuance, credential security, tenant resolution, endpoint exposure, and integration with UAuthHub.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth composes its Core-defined options directly into \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E. When using UltimateAuth Server, you configure both shared authentication behavior and server-specific features through the same options object.\u003C/p\u003E\n\u003Cp\u003EThis guide covers the available configuration groups, their defaults, practical examples, and the distinction between configured and effective runtime behavior.\u003C/p\u003E\n\u003Cp\u003EBuilt-in HTTP throttling is configured through \u003Ccode\u003Eoptions.RateLimiting\u003C/code\u003E. See \u003Ca href=\u0022/docs/security/rate-limiting\u0022\u003ERate Limiting\u003C/a\u003E for defaults, middleware ownership, proxy configuration and native-policy integration.\u003C/p\u003E\n\u003Cp\u003EExpensive password hashing operations are protected by \u003Ccode\u003Eoptions.ConcurrencyLimiting\u003C/code\u003E, which provides global and workload-specific concurrency budgets. See \u003Ca href=\u0022/docs/security/concurrency-limiting\u0022\u003EConcurrency Limiting\u003C/a\u003E for defaults, queue behavior, timeouts, and configuration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022register-ultimateauth-server\u0022\u003E1. Register UltimateAuth Server\u003C/h2\u003E\n\u003Cp\u003EConfigure the server through \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.MaxFailedAttempts = 5;\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe configuration delegate receives:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EUAuthServerOptions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server registration also supports an optional policy configuration delegate.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(\n configure: options =\u0026gt;\n {\n options.Login.MaxFailedAttempts = 5;\n },\n configurePolicies: policies =\u0026gt;\n {\n // Register application access policies.\n });\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server automatically registers its Core infrastructure. You do not need to call \u003Ccode\u003EAddUltimateAuth()\u003C/code\u003E separately.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-from-appsettings.json\u0022\u003EConfiguration from appsettings.json\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth Server binds the configuration section:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Server\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EJSON\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-json\u0022\u003E{\n \u0026quot;UltimateAuth\u0026quot;: {\n \u0026quot;Server\u0026quot;: {\n \u0026quot;Login\u0026quot;: {\n \u0026quot;MaxFailedAttempts\u0026quot;: 5,\n \u0026quot;LockoutDuration\u0026quot;: \u0026quot;00:15:00\u0026quot;\n },\n \u0026quot;Token\u0026quot;: {\n \u0026quot;SessionIdLifetime\u0026quot;: \u0026quot;7.00:00:00\u0026quot;,\n \u0026quot;AccessTokenLifetime\u0026quot;: \u0026quot;00:10:00\u0026quot;\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EASP.NET Core represents \u003Ccode\u003ETimeSpan\u003C/code\u003E values using strings such as \u003Ccode\u003E00:15:00\u003C/code\u003E for fifteen minutes and \u003Ccode\u003E7.00:00:00\u003C/code\u003E for seven days.\u003C/p\u003E\n\u003Cp\u003EThe configuration section is bound after the registration delegate, so configuration provider values take precedence for matching properties.\u003C/p\u003E\n\u003Cp\u003EFor configuration source ordering and environment-specific overrides, see \u003Ca href=\u0022/docs/configuration/configuration\u0022\u003EConfiguration Overview\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-options-architecture\u0022\u003E2. Server Options Architecture\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E is the primary configuration entry point for UltimateAuth Server.\u003C/p\u003E\n\u003Cp\u003EIt composes authentication configuration into logical groups according to their responsibilities.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConfiguration group\u003C/th\u003E\n\u003Cth\u003EResponsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EExplicit authentication mode selection\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EApplicationProfileModes\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EApplication-profile-specific mode selection\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERestrict permitted authentication modes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession lifecycle and security policies\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EToken\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential lifetimes and token configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EValidation\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication validation requirements\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin and lockout behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE flow configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceLimits\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EActive-device admission limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EGrantDelivery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication credential delivery\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESessionResolution\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIncoming session credential resolution\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECookie\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECookie configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEndpoint exposure and configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant resolution\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication lifecycle callbacks\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EConfigure these groups through the server\u0027s registration API.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth resolves the effective configuration according to the application profile, authentication mode and applicable mode-specific overrides.\u003C/p\u003E\n\u003Cp\u003EServer configuration and client configuration remain separate responsibilities.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E for effective-options resolution.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-options\u0022\u003E3. Login Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Login\u003C/code\u003E controls login attempt limits, lockout behavior, and related security settings.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.MaxFailedAttempts = 5;\n options.Login.LockoutDuration = TimeSpan.FromMinutes(15);\n options.Login.FailureWindow = TimeSpan.FromMinutes(15);\n options.Login.ExtendLockOnFailure = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-properties\u0022\u003EAvailable Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxFailedAttempts\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E10\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EFailed login threshold; \u003Ccode\u003E0\u003C/code\u003E disables lockout\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELockoutDuration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E15 minutes\u003C/td\u003E\n\u003Ctd\u003ELockout duration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EFailureWindow\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E15 minutes\u003C/td\u003E\n\u003Ctd\u003EWindow for counting failed attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EExtendLockOnFailure\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EExtend lockout when another attempt fails during lockout\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIncludeFailureDetails\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EInclude detailed authentication failure information\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETryLoginDuration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E180 seconds\u003C/td\u003E\n\u003Ctd\u003EDuration associated with the try-login flow\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-restrict-login-failure-details\u0022\u003EExample: Restrict Login Failure Details\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.IncludeFailureDetails = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis setting is useful when an application does not want to expose detailed lockout information to callers.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important\u0022\u003EImportant\u003C/h3\u003E\n\u003Cp\u003ELockout configuration is not equivalent to complete network-level rate limiting.\u003C/p\u003E\n\u003Cp\u003EProduction deployments should also consider infrastructure protections against abusive traffic and distributed login attempts.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-options\u0022\u003E4. Session Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Session\u003C/code\u003E controls session expiration, sliding behavior, and session-chain limits.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Session.SlidingExpiration = true;\n options.Session.IdleTimeout = TimeSpan.FromDays(3);\n options.Session.MaxLifetime = TimeSpan.FromDays(30);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-lifetime-properties\u0022\u003ESession Lifetime Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EOptional absolute lifetime limit\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESlidingExpiration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAllow eligible activity or refresh operations to extend expiration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIdleTimeout\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EOptional inactivity timeout\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETouchInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E5 minutes\u003C/td\u003E\n\u003Ctd\u003EMinimum interval between last-seen updates\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese settings have different purposes.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EMaxLifetime\u003C/code\u003E establishes an optional hard boundary that cannot be extended indefinitely.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EIdleTimeout\u003C/code\u003E limits how long a session can remain inactive.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ETouchInterval\u003C/code\u003E reduces unnecessary persistence operations caused by frequent activity updates.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-chain-properties\u0022\u003ESession-Chain Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxSessionsPerChain\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E100\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession-chain rotation limit\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceMismatchBehavior\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EReject\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDevice mismatch behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022enforced-device-limits\u0022\u003EEnforced Device Limits\u003C/h3\u003E\n\u003Cp\u003EActive-device admission limits are configured separately from \u003Ccode\u003Eoptions.Session\u003C/code\u003E:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.DeviceLimits.MaxDevices = 3;\n options.DeviceLimits.TypeLimits[\u0026quot;web\u0026quot;] = 2;\n options.DeviceLimits.Behavior = DeviceLimitBehavior.RejectNewLogin;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceLimits.MaxDevices\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EOptional maximum distinct active device IDs per user and tenant\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceLimits.TypeLimits\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEmpty\u003C/td\u003E\n\u003Ctd\u003EOptional per-type limits (case-insensitive keys)\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceLimits.Behavior\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ERejectNewLogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReject a new device or revoke oldest eligible active device(s)\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe feature is disabled until one or more quotas are configured.\u003C/p\u003E\n\u003Cp\u003EMultiple active chains sharing the same \u003Ccode\u003EDeviceId\u003C/code\u003E count as one device.\u003C/p\u003E\n\u003Cp\u003EBuilt-in browser clients are classified as \u003Ccode\u003Eweb\u003C/code\u003E, regardless of operating system.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EDeviceLimits\u003C/code\u003E is the supported active-device enforcement mechanism. Reserved \u003Ccode\u003ESession.MaxChainsPerUser\u003C/code\u003E, \u003Ccode\u003EMaxChainsPerPlatform\u003C/code\u003E, and category-based chain settings do not enforce these quotas.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/sessions-devices/device-limits\u0022\u003EDevice Limits\u003C/a\u003E for admission, eviction, persistence, and migration behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-specific-session-defaults\u0022\u003EMode-Specific Session Defaults\u003C/h3\u003E\n\u003Cp\u003ESession settings can also be affected by authentication mode defaults.\u003C/p\u003E\n\u003Cp\u003EFor example, \u003Ccode\u003EPureOpaque\u003C/code\u003E supplies a longer idle timeout and touch interval when those values have not been configured.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E for the effective-options resolution order.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-options\u0022\u003E5. Token Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Token\u003C/code\u003E configures authentication credential lifetimes and token-related behavior.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth determines which credential types are issued according to the effective authentication mode.\u003C/p\u003E\n\u003Cp\u003EApplications do not need to enable JWT or opaque credential issuance independently.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n options.Token.RefreshTokenLifetime = TimeSpan.FromDays(7);\n\n options.Token.Issuer = \u0026quot;MyApplication\u0026quot;;\n options.Token.Audience = \u0026quot;MyApplicationApi\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-properties-1\u0022\u003EAvailable Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESessionIdLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E7 days\u003C/td\u003E\n\u003Ctd\u003ELifetime of the session identifier\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAccessTokenLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E10 minutes\u003C/td\u003E\n\u003Ctd\u003EAccess-token lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshTokenLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E7 days\u003C/td\u003E\n\u003Ctd\u003ERefresh-token lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIssueRefreshToken\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnable refresh-token issuance where supported\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOpaqueIdBytes\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E32\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERandom byte length used for opaque identifiers\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshTokenConcurrentRequestWindow\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E2 seconds\u003C/td\u003E\n\u003Ctd\u003EConcurrent duplicate refresh classification window\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIssuer\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuth\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EJWT issuer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAudience\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClient\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EJWT audience\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EKeyId\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EOptional signing key identifier\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-specific-applicability\u0022\u003EMode-specific applicability\u003C/h3\u003E\n\u003Cp\u003ENot every token option applies to every authentication mode.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EPureOpaque uses \u003Ccode\u003ESessionIdLifetime\u003C/code\u003E but does not issue access or refresh tokens.\u003C/li\u003E\n\u003Cli\u003EHybrid maintains authoritative session state together with a separate token lifecycle.\u003C/li\u003E\n\u003Cli\u003ESemiHybrid uses JWT access tokens associated with server-managed session lineage.\u003C/li\u003E\n\u003Cli\u003EPureJwt uses JWT access tokens without authentication sessions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EConfiguring a credential lifetime does not enable a credential type that is unsupported by the effective mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-identifiers-and-credentials\u0022\u003ESession identifiers and credentials\u003C/h3\u003E\n\u003Cp\u003EThe purpose of a session identifier depends on the authentication mode.\u003C/p\u003E\n\u003Cp\u003EIn PureOpaque and Hybrid, the session identifier is an opaque authentication credential.\u003C/p\u003E\n\u003Cp\u003EIn SemiHybrid, the session identifier represents session lineage metadata.\u003C/p\u003E\n\u003Cp\u003EA metadata-only session identifier must never be accepted as an opaque authentication credential.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-token-concurrency-window\u0022\u003ERefresh Token Concurrency Window\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.RefreshTokenConcurrentRequestWindow = TimeSpan.FromSeconds(2);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis option distinguishes likely concurrent refresh requests from later token reuse.\u003C/p\u003E\n\u003Cp\u003EA consumed refresh token cannot be successfully rotated again.\u003C/p\u003E\n\u003Cp\u003EThe concurrency window affects replay classification, not token validity.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/auth-flows/refresh-flow\u0022\u003ERefresh Flow\u003C/a\u003E\nand \u003Ca href=\u0022/docs/security/refresh-rotation\u0022\u003ERefresh Rotation\u003C/a\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-specific-token-configuration\u0022\u003EMode-specific token configuration\u003C/h3\u003E\n\u003Cp\u003EToken lifetimes can be configured globally or overridden for a particular authentication mode.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n\n options.ConfigureMode(UAuthMode.SemiHybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(5);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EMode-specific overrides are useful when a server supports multiple authentication modes.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022pkce-options\u0022\u003E6. PKCE Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Pkce\u003C/code\u003E configures the lifetime of PKCE authorization codes.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Pkce.AuthorizationCodeLifetimeSeconds = 120;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthorizationCodeLifetimeSeconds\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E120\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELifetime of a PKCE authorization code\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EPKCE is particularly important for browser-based clients such as Blazor WebAssembly.\u003C/p\u003E\n\u003Cp\u003EA shorter authorization code lifetime reduces the period during which an intercepted or exposed code could potentially be used.\u003C/p\u003E\n\u003Cp\u003EHowever, the value must remain long enough for legitimate authorization exchanges to complete.\u003C/p\u003E\n\u003Cp\u003EThe server\u0027s PKCE configuration is separate from the client\u0027s PKCE flow settings.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes\u0022\u003E7. Authentication Modes\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports authentication mode resolution based on the application profile.\u003C/p\u003E\n\u003Cp\u003EThe server exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.AllowedModes\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis property restricts the modes the server is permitted to use.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022restrict-allowed-modes\u0022\u003ERestrict Allowed Modes\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AllowedModes =\n [\n UAuthMode.PureOpaque,\n UAuthMode.Hybrid\n ];\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E is a restriction, not a mode selector.\u003C/p\u003E\n\u003Cp\u003EThe effective mode is resolved by \u003Ccode\u003EIEffectiveAuthModeResolver\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-mode-resolution\u0022\u003EDefault Mode Resolution\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth resolves the effective authentication mode using the application profile unless the server explicitly configures \u003Ccode\u003EAuthMode\u003C/code\u003E or \u003Ccode\u003EApplicationProfileModes\u003C/code\u003E.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication Profile\u003C/th\u003E\n\u003Cth\u003EDefault Mode\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazorServer\u003C/td\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EWebServer\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazorWasm\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMaui\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUAuthHub\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EApi\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResourceApi\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe server controls the effective authentication mode. Application profile metadata is not an authorization boundary.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthMode\u003C/code\u003E forces a single mode for the server, while \u003Ccode\u003EApplicationProfileModes\u003C/code\u003E provides explicit profile-specific mappings. These configuration mechanisms cannot be combined.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E restricts permitted modes but does not select a mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-profile-specific-modes\u0022\u003EApplication-profile-specific modes\u003C/h3\u003E\n\u003Cp\u003EAn authentication mode can be selected globally:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthMode = UAuthMode.Hybrid;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAlternatively, authentication modes can be selected for individual application profiles:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ApplicationProfileModes[UAuthApplicationProfile.BlazorServer] = UAuthMode.PureOpaque;\n options.ApplicationProfileModes[UAuthApplicationProfile.BlazorWasm] = UAuthMode.SemiHybrid;\n options.ApplicationProfileModes[UAuthApplicationProfile.Maui] = UAuthMode.Hybrid;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthMode\u003C/code\u003E and \u003Ccode\u003EApplicationProfileModes\u003C/code\u003E are alternative explicit mode-selection mechanisms.\u003C/p\u003E\n\u003Cp\u003EDo not configure both simultaneously.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E restricts which modes are permitted. It does not select the effective authentication mode.\u003C/p\u003E\n\u003Cp\u003EWhen no explicit selection is provided, UltimateAuth uses its application-profile-aware defaults.\u003C/p\u003E\n\u003Cp\u003EHybrid is the general-purpose default for most application profiles, while Blazor Server defaults to PureOpaque.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E for selection guidance and mode transition considerations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022explicit-purejwt-configuration\u0022\u003EExplicit PureJwt Configuration\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthMode = UAuthMode.PureJwt;\n\n options.Token.Issuer = \u0026quot;https://auth.example.com\u0026quot;;\n options.Token.Audience = \u0026quot;products-api\u0026quot;;\n\n options.Cryptography.JwtSigningKey = builder.Configuration[\u0026quot;UltimateAuth:JwtSigningKey\u0026quot;];\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe JWT signing key must be a Base64-encoded cryptographic key containing at least 32 bytes of key material.\u003C/p\u003E\n\u003Cp\u003EUse a cryptographically secure, independently generated key in production. Do not reuse the JWT signing key as the token-hashing key.\u003C/p\u003E\n\u003Cp\u003EPureJwt does not create authentication sessions, but refresh-token persistence is still required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-mode-specific-behavior\u0022\u003EConfigure Mode-Specific Behavior\u003C/h3\u003E\n\u003Cp\u003EUse \u003Ccode\u003EConfigureMode()\u003C/code\u003E for behavior that should differ by mode.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ConfigureMode(UAuthMode.PureOpaque, mode =\u0026gt;\n {\n mode.Session.IdleTimeout = TimeSpan.FromDays(7);\n });\n\n options.ConfigureMode(UAuthMode.Hybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(5);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe mode override runs after the built-in mode defaults.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E for details.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022a.validation-options\u0022\u003E7/A. Validation Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Validation\u003C/code\u003E configures authentication validation requirements for applicable UltimateAuth server operations.\u003C/p\u003E\n\u003Cp\u003EThe available requirements are:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ERequirement\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EStandard\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENormal authentication guarantees of the effective mode\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHubValidated\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthoritative validation of the associated session\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-validation-requirement\u0022\u003EDefault validation requirement\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthMode = UAuthMode.SemiHybrid;\n\n options.Validation.Default = UAuthValidationRequirement.Standard;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EStandard is the default configured requirement.\u003C/p\u003E\n\u003Cp\u003EIndividual UltimateAuth operations may require stronger validation according to their security classification.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-specific-validation\u0022\u003EEndpoint-specific validation\u003C/h3\u003E\n\u003Cp\u003EValidation requirements can be customized for supported UltimateAuth endpoints:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Validation.Endpoints[UAuthEndpoint.GetMyIdentifiers] = UAuthValidationRequirement.HubValidated;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEndpoint-specific configuration cannot weaken mandatory framework security requirements.\u003C/p\u003E\n\u003Cp\u003EThe effective requirement considers the endpoint classification, configured default, explicit requirements, and applicable framework-enforced minimums.\u003C/p\u003E\n\u003Cp\u003EAuthentication flows such as login, refresh and credential recovery retain their own security requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-defined-endpoints\u0022\u003EApplication-defined endpoints\u003C/h3\u003E\n\u003Cp\u003ECustom ASP.NET Core endpoints can explicitly require authoritative validation:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eapp.MapPost(\u0026quot;/api/security/settings\u0026quot;, UpdateSecuritySettings)\n .RequireUAuthHubValidation();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EController actions can use \u003Ccode\u003EUAuthHubValidated\u003C/code\u003E together with the applicable authorization requirement.\u003C/p\u003E\n\u003Cp\u003EServer validation options for built-in UltimateAuth operations should not be interpreted as automatically applying the same requirement to every custom endpoint.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-validation\u0022\u003EResource API validation\u003C/h3\u003E\n\u003Cp\u003EResource APIs configure their own default validation requirement through:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Auth.Validation.Default = UAuthValidationRequirement.HubValidated;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is particularly useful for SemiHybrid Resource APIs that require authoritative session validation by default.\u003C/p\u003E\n\u003Cp\u003EPureJwt cannot satisfy a HubValidated requirement because it has no associated authentication session.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/request-lifecycle\u0022\u003ERequest Lifecycle\u003C/a\u003E for validation behavior.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-options\u0022\u003E8. Endpoint Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Endpoints\u003C/code\u003E controls endpoint paths, feature groups, and individual action restrictions.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022base-path\u0022\u003EBase Path\u003C/h3\u003E\n\u003Cp\u003EThe default server endpoint base path is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003E/auth\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EConfigure it through:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;/auth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EChanging the base path can help avoid route conflicts when integrating UltimateAuth into an existing application.\u003C/p\u003E\n\u003Cp\u003EThe client must use compatible endpoint paths.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-groups\u0022\u003EEndpoint Groups\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthentication\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession management endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUserLifecycle\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EUser lifecycle endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUserProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EUser profile endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUserIdentifier\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifier management endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECredentials\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential management endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthorization\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthorization endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.Authentication = true;\n options.Endpoints.Session = true;\n options.Endpoints.Authorization = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDisabling an endpoint group controls endpoint exposure. It does not automatically remove the underlying domain services or invalidate previously issued credentials.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022disable-individual-actions\u0022\u003EDisable Individual Actions\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EDisabledActions\u003C/code\u003E is a collection of action identifiers:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.DisabledActions.Add(\u0026quot;users.create.anonymous\u0026quot;);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe string must match the action identifier used by the server\u0027s endpoint registration and action policy.\u003C/p\u003E\n\u003Cp\u003EDo not pass a C# constant name as a string unless that exact text is also the registered action value.\u003C/p\u003E\n\u003Cp\u003EFor example, these are not necessarily equivalent:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003E\u0026quot;UAuthActions.Users.Create.Anonymous\u0026quot;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Eand:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003E\u0026quot;users.create.anonymous\u0026quot;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUse the actual action value defined by the corresponding \u003Ccode\u003EUAuthActions\u003C/code\u003E constant.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-hardening\u0022\u003EEndpoint Hardening\u003C/h3\u003E\n\u003Cp\u003EDisable endpoints that are not required by the application.\u003C/p\u003E\n\u003Cp\u003EFor example, an application that delegates user provisioning to administrators may choose to disable anonymous user creation.\u003C/p\u003E\n\u003Cp\u003EEndpoint exposure is a separate concern from authorization: an exposed endpoint must still enforce the applicable security policy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-resolution\u0022\u003E9. Credential Resolution\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth resolves incoming authentication credentials according to the effective authentication mode and grant delivery configuration.\u003C/p\u003E\n\u003Cp\u003EEach authentication grant has a single configured transport. Credential resolution does not use an ordered list of alternative sources.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022primary-authentication-credential\u0022\u003EPrimary Authentication Credential\u003C/h3\u003E\n\u003Cp\u003EThe effective authentication mode determines which credential establishes the authentication identity.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EAuthentication mode\u003C/th\u003E\n\u003Cth\u003EPrimary credential\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003Ctd\u003EOpaque session credential\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003EOpaque session credential\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003EJWT access token\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003EJWT access token\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-transport\u0022\u003ECredential Transport\u003C/h3\u003E\n\u003Cp\u003EIncoming credentials are resolved from the configured cookie or request header.\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECookie delivery reads the configured authentication cookie.\u003C/li\u003E\n\u003Cli\u003EHeader delivery reads the effective request header using the expected header format.\u003C/li\u003E\n\u003Cli\u003EQuery-string credential resolution is not supported.\u003C/li\u003E\n\u003Cli\u003EMissing or invalid credentials do not trigger fallback to another transport.\u003C/li\u003E\n\u003Cli\u003EDuplicate credential values are rejected.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003ERefresh tokens are resolved separately using their own grant delivery configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-request-header-names\u0022\u003EDefault Request Header Names\u003C/h3\u003E\n\u003Cp\u003EWhen header delivery is active, the following request header names are used by default:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EGrant\u003C/th\u003E\n\u003Cth\u003ERequest header\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euas\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess token\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthorization\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh token\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euar\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EAccess tokens are presented using the \u003Ccode\u003EBearer\u003C/code\u003E authorization scheme. Session and refresh token headers follow their configured header formats.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-consistency\u0022\u003EConfiguration Consistency\u003C/h3\u003E\n\u003Cp\u003EActive grants must not share the same cookie name, request header name, or response header name within their respective transport namespaces.\u003C/p\u003E\n\u003Cp\u003EConflicting effective grant configurations are rejected.\u003C/p\u003E\n\u003Cp\u003ESee the Grant Delivery section for configuration examples and delivery defaults.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022cookie-configuration\u0022\u003E10. Cookie Configuration\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Cookie\u003C/code\u003E controls cookies used for authentication credentials.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth defines three cookie groups:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Cookie.Session\noptions.Cookie.AccessToken\noptions.Cookie.RefreshToken\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-cookie-names\u0022\u003EDefault Cookie Names\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ECookie\u003C/th\u003E\n\u003Cth\u003EDefault name\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euas\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess token\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euat\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh token\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euar\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe default cookie options use:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EHttpOnly = true\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ESecurePolicy = CookieSecurePolicy.Always\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EPath = \u0026quot;/\u0026quot;\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EDomain = null\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EMaxAge = null\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003E\u003Ccode\u003ESameSite\u003C/code\u003E is nullable and can be resolved through the applicable cookie and deployment policies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022customize-cookie-names\u0022\u003ECustomize Cookie Names\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cookie.Session.Name = \u0026quot;myapp_session\u0026quot;;\n options.Cookie.RefreshToken.Name = \u0026quot;myapp_refresh\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-cookie-scope\u0022\u003EConfigure Cookie Scope\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cookie.Session.Path = \u0026quot;/\u0026quot;;\n options.Cookie.Session.Domain = null;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA null domain produces a host-only cookie.\u003C/p\u003E\n\u003Cp\u003ESetting a parent domain can broaden cookie availability to subdomains and should be done only when necessary.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cookie-security\u0022\u003ECookie Security\u003C/h3\u003E\n\u003Cp\u003EAvoid disabling \u003Ccode\u003EHttpOnly\u003C/code\u003E or relaxing secure transport requirements for authentication cookies.\u003C/p\u003E\n\u003Cp\u003ECookie settings interact with:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe deployment mode.\u003C/li\u003E\n\u003Cli\u003ECross-site requests.\u003C/li\u003E\n\u003Cli\u003EBrowser cookie policies.\u003C/li\u003E\n\u003Cli\u003ECredential delivery configuration.\u003C/li\u003E\n\u003Cli\u003EHTTPS requirements.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor cross-site deployments, configure cookie behavior together with CORS and the relevant browser security requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022hub-deployment-mode\u0022\u003E11. Hub Deployment Mode\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.HubDeploymentMode\u003C/code\u003E describes how UAuthHub is deployed relative to the application.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.HubDeploymentMode = UAuthHubDeploymentMode.Embedded;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-modes\u0022\u003EAvailable Modes\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EMode\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEmbedded\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub and application share the same origin\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIntegrated\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub is separate but within the same-site boundary\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EExternal\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub is hosted on a different site or domain\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe default is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EUAuthHubDeploymentMode.Integrated\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022embedded\u0022\u003EEmbedded\u003C/h3\u003E\n\u003Cp\u003ESuitable for applications hosting UltimateAuth within the same application and origin.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.HubDeploymentMode = UAuthHubDeploymentMode.Embedded;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022integrated\u0022\u003EIntegrated\u003C/h3\u003E\n\u003Cp\u003ESuitable for deployments such as:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003Eauth.example.com\napp.example.com\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Ewhere the authentication service and application are separate origins within the same site.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022external\u0022\u003EExternal\u003C/h3\u003E\n\u003Cp\u003ESuitable for a separate authentication provider domain.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.HubDeploymentMode = UAuthHubDeploymentMode.External;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EExternal deployment requires careful coordination of cookie policies, redirects, allowed origins, and browser restrictions.\u003C/p\u003E\n\u003Cp\u003EThe deployment mode influences authentication transport behavior; it is not merely descriptive metadata.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022hub-options\u0022\u003E12. Hub Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Hub\u003C/code\u003E configures UAuthHub integration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-properties-2\u0022\u003EAvailable Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EClientBaseAddress\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EOptional client application base address\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAllowedClientOrigins\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEmpty set\u003C/td\u003E\n\u003Ctd\u003EAllowed client origins\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EFlowLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E5 minutes\u003C/td\u003E\n\u003Ctd\u003ELifetime of Hub flow artifacts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELoginPath\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/login\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub login page path\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example\u0022\u003EExample\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Hub.ClientBaseAddress = \u0026quot;https://app.example.com\u0026quot;;\n options.Hub.AllowedClientOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n options.Hub.FlowLifetime = TimeSpan.FromMinutes(5);\n options.Hub.LoginPath = \u0026quot;/login\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Hub flow lifetime is not the same as the authenticated session lifetime.\u003C/p\u003E\n\u003Cp\u003EHub artifacts support authentication orchestration and should generally be short-lived.\u003C/p\u003E\n\u003Cp\u003EOnly trusted origins should be included in \u003Ccode\u003EAllowedClientOrigins\u003C/code\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022primary-credential-selection\u0022\u003E13. Primary Credential Selection\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth determines the primary authentication credential from the effective authentication mode.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EAuthentication mode\u003C/th\u003E\n\u003Cth\u003EPrimary credential\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003Ctd\u003ESession\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003ESession\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003EJWT access token\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003EJWT access token\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EPrimary credential selection is not based on request paths, UI/API classification, or the presence of additional authentication headers.\u003C/p\u003E\n\u003Cp\u003EThe effective grant delivery configuration determines how the selected credential is transported.\u003C/p\u003E\n\u003Cp\u003EFor more information, see \u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-session-policy\u0022\u003E14. Credential Session Policy\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.CredentialSessionPolicy\u003C/code\u003E determines what happens to active session chains after credential changes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-properties-3\u0022\u003EAvailable Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOnSelfChange\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EPreserveCurrent\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EUser changes their own credential\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOnAdminChange\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ERevokeAll\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAdministrator changes a user\u0027s credential\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOnRecovery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ERevokeAll\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential recovery completes\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-1\u0022\u003EExample\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.CredentialSessionPolicy.OnSelfChange = CredentialSessionBehavior.PreserveCurrent;\n options.CredentialSessionPolicy.OnAdminChange = CredentialSessionBehavior.RevokeAll;\n options.CredentialSessionPolicy.OnRecovery = CredentialSessionBehavior.RevokeAll;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-behaviors\u0022\u003EAvailable Behaviors\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EBehavior\u003C/th\u003E\n\u003Cth\u003EEffect\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPreserveAll\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EKeep existing session chains\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPreserveCurrent\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EKeep the current chain and revoke other applicable chains\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERevokeAll\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERevoke all applicable session chains\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EFor recovery flows, \u003Ccode\u003EPreserveCurrent\u003C/code\u003E is not always meaningful because the user may not have an authenticated current session.\u003C/p\u003E\n\u003Cp\u003EThe current implementation treats this situation using the more restrictive \u003Ccode\u003ERevokeAll\u003C/code\u003E behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-recommendation\u0022\u003ESecurity Recommendation\u003C/h3\u003E\n\u003Cp\u003EPreserving the current session after a normal password change can provide a reasonable user experience.\u003C/p\u003E\n\u003Cp\u003ERevoking all sessions after administrative credential changes or account recovery is generally more conservative.\u003C/p\u003E\n\u003Cp\u003EChoose the policy according to the application\u0027s security requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-reset-options\u0022\u003E15. Credential Reset Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.ResetCredential\u003C/code\u003E configures credential recovery proof lifetimes and attempt limits.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022defaults\u0022\u003EDefaults\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETokenValidity\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E30 minutes\u003C/td\u003E\n\u003Ctd\u003EReset token lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECodeValidity\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E10 minutes\u003C/td\u003E\n\u003Ctd\u003ENumeric reset code lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxAttempts\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E3\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMaximum permitted recovery attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECodeLength\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E6\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENumeric reset code length\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-2\u0022\u003EExample\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ResetCredential.TokenValidity = TimeSpan.FromMinutes(20);\n options.ResetCredential.CodeValidity = TimeSpan.FromMinutes(5);\n options.ResetCredential.MaxAttempts = 3;\n options.ResetCredential.CodeLength = 6;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003ECodeLength\u003C/code\u003E applies to numeric reset codes, not token-based recovery proofs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important-security-boundary\u0022\u003EImportant Security Boundary\u003C/h3\u003E\n\u003Cp\u003EReset proofs must be delivered through a trusted server-side mechanism.\u003C/p\u003E\n\u003Cp\u003EDo not return recovery tokens to anonymous callers simply to simplify a client-side reset form.\u003C/p\u003E\n\u003Cp\u003EThe application should provide the appropriate \u003Ccode\u003EICredentialResetNotifier\u003C/code\u003E implementation for supported recovery flows.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-identifier-options\u0022\u003E16. Login Identifier Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.LoginIdentifiers\u003C/code\u003E determines which identifier types can be used for login.\u003C/p\u003E\n\u003Cp\u003EThe default allowed types are:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EUserIdentifierType.Username\nUserIdentifierType.Email\nUserIdentifierType.Phone\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022restrict-login-identifier-types\u0022\u003ERestrict Login Identifier Types\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.LoginIdentifiers.AllowedTypes =\n new HashSet\u0026lt;UserIdentifierType\u0026gt;\n {\n UserIdentifierType.Email\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configures email as the allowed login identifier type.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022require-verification\u0022\u003ERequire Verification\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.LoginIdentifiers.RequireVerificationForEmail = true;\n options.LoginIdentifiers.RequireVerificationForPhone = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese settings control whether the corresponding identifiers must be verified before being accepted for login.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-resolvers\u0022\u003ECustom Resolvers\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnableCustomResolvers\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECustomResolversFirst\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese options control the participation and ordering of custom login identifier resolvers.\u003C/p\u003E\n\u003Cp\u003EAn identifier existing on a user account does not necessarily mean it is permitted for login.\u003C/p\u003E\n\u003Cp\u003EIdentifier management and login eligibility are separate concerns.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022identifier-validation\u0022\u003E17. Identifier Validation\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.IdentifierValidation\u003C/code\u003E provides rules for usernames, email addresses, and phone numbers.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022username-rules\u0022\u003EUsername Rules\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.IdentifierValidation.UserName.Enabled = true;\n options.IdentifierValidation.UserName.MinLength = 3;\n options.IdentifierValidation.UserName.MaxLength = 32;\n options.IdentifierValidation.UserName.AllowedRegex = \u0026quot;^[a-zA-Z0-9._-]\u002B$\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-validation-rules\u0022\u003EDefault Validation Rules\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EIdentifier\u003C/th\u003E\n\u003Cth\u003EEnabled\u003C/th\u003E\n\u003Cth\u003EMinimum length\u003C/th\u003E\n\u003Cth\u003EMaximum length\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUsername\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E3\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E64\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EEmail\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E3\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E256\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPhone\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E3\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E24\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EUsername validation additionally supports \u003Ccode\u003EAllowedRegex\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe default username expression is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EREGEX\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-regex\u0022\u003E^[a-zA-Z0-9._-]\u002B$\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022identifier-behavior\u0022\u003EIdentifier Behavior\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Identifiers\u003C/code\u003E contains additional groups:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Identifiers.Behavior\noptions.Identifiers.Validation\noptions.Identifiers.Normalization\noptions.Identifiers.Uniqueness\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese configure identifier behavior beyond the top-level validation rules.\u003C/p\u003E\n\u003Cp\u003EIdentifier normalization and uniqueness are particularly important because they affect how duplicate identifiers are detected.\u003C/p\u003E\n\u003Cp\u003EUse the provided options rather than implementing inconsistent normalization independently in the client.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022identifier-limits\u0022\u003EIdentifier Limits\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth supports configurable limits on the number of identifiers associated with each user.\u003C/p\u003E\n\u003Cp\u003EBy default, a user can have up to \u003Cstrong\u003E10 active identifiers\u003C/strong\u003E, regardless of their type.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Identifiers.Behavior.MaxIdentifiersPerUser = 10;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is a global per-user limit. It applies to the combined number of usernames, email addresses, phone numbers, and custom identifiers.\u003C/p\u003E\n\u003Ch4 id=\u0022optional-per-type-limits\u0022\u003EOptional Per-Type Limits\u003C/h4\u003E\n\u003Cp\u003EApplications can optionally define limits for individual identifier types:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Identifiers.Behavior.MaxIdentifiersPerUser = 10;\n\noptions.Identifiers.Behavior.MaxIdentifiersPerType = new()\n{\n [UserIdentifierType.Username] = 2,\n [UserIdentifierType.Email] = 5,\n [UserIdentifierType.Phone] = 3\n};\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EPer-type limits are not configured by default.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EWhen no per-type limit is specified, only the global limit applies.\u003C/p\u003E\n\u003Cp\u003EFor example, with the configuration above, a user may have up to five email addresses, but the combined number of all active identifiers cannot exceed ten.\u003C/p\u003E\n\u003Ch4 id=\u0022default-behavior\u0022\u003EDefault Behavior\u003C/h4\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOption\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxIdentifiersPerUser\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E10\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMaximum total active identifiers per user\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxIdentifiersPerType\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEmpty dictionary\u003C/td\u003E\n\u003Ctd\u003EOptional limits for individual identifier types\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe following rules apply:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EPrimary and non-primary identifiers count equally.\u003C/li\u003E\n\u003Cli\u003ESoft-deleted identifiers do not count toward active limits.\u003C/li\u003E\n\u003Cli\u003ESelf-service and administrative operations follow the same limits.\u003C/li\u003E\n\u003Cli\u003EPer-type limits do not override the global limit.\u003C/li\u003E\n\u003Cli\u003EExisting identifier behavior options remain applicable.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor example, \u003Ccode\u003EAllowMultipleUsernames = false\u003C/code\u003E still prevents multiple usernames, even when the configured username limit is greater than one.\u003C/p\u003E\n\u003Ch4 id=\u0022limit-validation\u0022\u003ELimit Validation\u003C/h4\u003E\n\u003Cp\u003EWhen an identifier addition exceeds a configured limit, the operation is rejected with a validation error.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EError Code\u003C/th\u003E\n\u003Cth\u003EMeaning\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003Eidentifier_total_limit_exceeded\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EThe user has reached the global identifier limit\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003Eidentifier_type_limit_exceeded\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EThe user has reached the configured limit for that identifier type\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EApplications should handle these errors and display appropriate feedback.\u003C/p\u003E\n\u003Cp\u003EIdentifier limits are enforced by the Users application layer rather than individual persistence stores.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022user-profile-options\u0022\u003E18. User Profile Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.UserProfile\u003C/code\u003E controls profile-related capabilities.\u003C/p\u003E\n\u003Cp\u003EThe current option is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.UserProfile.EnableMultiProfile\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIts default is \u003Ccode\u003Efalse\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022enable-multiple-profiles\u0022\u003EEnable Multiple Profiles\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.UserProfile.EnableMultiProfile = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis allows applications to use UltimateAuth\u0027s multiple-profile capability where supported by the user domain.\u003C/p\u003E\n\u003Cp\u003EFor example, an application may maintain separate profile contexts for different purposes.\u003C/p\u003E\n\u003Cp\u003EMulti-profile support does not create separate user identities or independent authentication accounts.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022multi-tenant-options\u0022\u003E19. Multi-Tenant Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.MultiTenant\u003C/code\u003E controls whether tenant-aware behavior is enabled and how tenant identifiers are resolved.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-properties-4\u0022\u003EAvailable Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnabled\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnable multi-tenant behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENormalizeToLowercase\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENormalize tenant identifiers\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnableRoute\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve tenants from routes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnableHeader\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve tenants from headers\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnableDomain\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve tenants from hosts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHeaderName\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EX-Tenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant header name\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-header-based-tenant-resolution\u0022\u003EExample: Header-Based Tenant Resolution\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.MultiTenant.Enabled = true;\n options.MultiTenant.EnableHeader = true;\n options.MultiTenant.HeaderName = \u0026quot;X-Tenant\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-domain-based-resolution\u0022\u003EExample: Domain-Based Resolution\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.MultiTenant.Enabled = true;\n options.MultiTenant.EnableDomain = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EMultiple resolution mechanisms can be enabled.\u003C/p\u003E\n\u003Cp\u003EThe server composes the configured tenant resolvers according to its resolution infrastructure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-boundary\u0022\u003ESecurity Boundary\u003C/h3\u003E\n\u003Cp\u003ETenant identification is not tenant authorization.\u003C/p\u003E\n\u003Cp\u003EA request providing another tenant identifier must not gain access to that tenant without appropriate authorization.\u003C/p\u003E\n\u003Cp\u003EThe server remains responsible for tenant isolation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022pagination-options\u0022\u003E20. Pagination Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Pagination\u003C/code\u003E controls pagination defaults and maximum page sizes.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDefaultPageSize\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E250\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxPageSize\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E1000\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-3\u0022\u003EExample\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Pagination.DefaultPageSize = 50;\n options.Pagination.MaxPageSize = 200;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese settings affect paginated queries exposed by UltimateAuth domain services.\u003C/p\u003E\n\u003Cp\u003EFor administrative interfaces, choosing a moderate page size can reduce unnecessary data transfer and processing.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022navigation-options\u0022\u003E21. Navigation Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Navigation\u003C/code\u003E configures automatic authentication navigation behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-properties-5\u0022\u003EAvailable Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnableAutomaticNavigationRedirect\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELoginResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAccessDeniedResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022disable-automatic-redirects\u0022\u003EDisable Automatic Redirects\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Navigation.EnableAutomaticNavigationRedirect = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-login-redirect\u0022\u003ECustom Login Redirect\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Navigation.LoginResolver = context =\u0026gt;\n {\n return \u0026quot;/account/login\u0026quot;;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-access-denied-redirect\u0022\u003ECustom Access Denied Redirect\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Navigation.AccessDeniedResolver = context =\u0026gt;\n {\n return \u0026quot;/account/access-denied\u0026quot;;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese delegates receive the current \u003Ccode\u003EHttpContext\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe application should return valid, trusted navigation destinations.\u003C/p\u003E\n\u003Cp\u003EAvoid constructing redirects from unvalidated user-controlled URLs.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-delivery-and-authentication-responses\u0022\u003E22. Credential Delivery and Authentication Responses\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates credential delivery from navigation behavior.\u003C/p\u003E\n\u003Cp\u003EAuthentication grant delivery and incoming credential transport are configured through \u003Ccode\u003Eoptions.GrantDelivery\u003C/code\u003E:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.GrantDelivery.Default\noptions.GrantDelivery.Session\noptions.GrantDelivery.AccessToken\noptions.GrantDelivery.RefreshToken\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach grant can have its own delivery configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-specific-delivery-defaults\u0022\u003EMode-Specific Delivery Defaults\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EAuthentication Mode\u003C/th\u003E\n\u003Cth\u003ESession\u003C/th\u003E\n\u003Cth\u003EAccess Token\u003C/th\u003E\n\u003Cth\u003ERefresh Token\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003Ctd\u003ECookie\u003C/td\u003E\n\u003Ctd\u003ENot issued\u003C/td\u003E\n\u003Ctd\u003ENot issued\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003ECookie\u003C/td\u003E\n\u003Ctd\u003EHeader\u003C/td\u003E\n\u003Ctd\u003ECookie\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ENot issued\u003C/td\u003E\n\u003Ctd\u003EHeader\u003C/td\u003E\n\u003Ctd\u003ECookie\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese are the built-in defaults before application-profile adaptation and explicit configuration.\u003C/p\u003E\n\u003Cp\u003EFor MAUI, grants that would otherwise use cookie delivery default to header delivery.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-grant-delivery\u0022\u003EConfigure Grant Delivery\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthMode = UAuthMode.PureJwt;\n\n options.GrantDelivery.AccessToken.Mode = GrantDeliveryMode.Header;\n options.GrantDelivery.RefreshToken.Mode = GrantDeliveryMode.Cookie;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAn explicit per-grant delivery mode takes precedence over the global delivery default and the built-in mode-specific default.\u003C/p\u003E\n\u003Cp\u003EOnly credentials available in the selected authentication mode can be configured for delivery.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022request-and-response-headers\u0022\u003ERequest and Response Headers\u003C/h3\u003E\n\u003Cp\u003ERequest and response headers serve different purposes.\u003C/p\u003E\n\u003Cp\u003EResponse headers deliver newly issued credentials to the client. Request headers present credentials for authentication or refresh.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EGrant\u003C/th\u003E\n\u003Cth\u003EDefault response header\u003C/th\u003E\n\u003Cth\u003EDefault request header\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euas\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euas\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess token\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euat\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthorization\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh token\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euar\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euar\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe access token response header can be customized independently of the incoming \u003Ccode\u003EAuthorization: Bearer\u003C/code\u003E convention.\u003C/p\u003E\n\u003Cp\u003ESession and refresh token headers use their configured header names and formats in both directions.\u003C/p\u003E\n\u003Cp\u003EHeader names are case-insensitive. Active grants must use distinct header names within each direction.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022redirect-configuration\u0022\u003ERedirect Configuration\u003C/h3\u003E\n\u003Cp\u003ELogin and logout redirect behavior is configured separately:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Redirect.Login\noptions.Redirect.Logout\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA redirect is a navigation concern, not an authentication credential.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-transport-discovery\u0022\u003ELogin Transport Discovery\u003C/h3\u003E\n\u003Cp\u003EThe client discovers whether the effective server configuration supports navigation-based login or requires fetch-based submission.\u003C/p\u003E\n\u003Cp\u003EHeader-delivered access tokens require a transport that allows the client to observe and process the authentication response.\u003C/p\u003E\n\u003Cp\u003EApplications should normally allow the client to select the appropriate login transport automatically.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-considerations\u0022\u003ESecurity Considerations\u003C/h3\u003E\n\u003Cp\u003ECredential delivery must be compatible with the selected authentication mode, application profile, and deployment topology.\u003C/p\u003E\n\u003Cp\u003EBrowser cookie restrictions, CORS policies, trusted origins, and token storage behavior remain relevant regardless of the selected transport.\u003C/p\u003E\n\u003Cp\u003EFor additional client-side behavior, see \u003Ca href=\u0022/docs/client-sdk/authentication\u0022\u003EAuthentication\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022diagnostics-options\u0022\u003E23. Diagnostics Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Diagnostics\u003C/code\u003E provides optional diagnostic behavior.\u003C/p\u003E\n\u003Cp\u003EThe current property is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Diagnostics.EnableRefreshDetails\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIts default is \u003Ccode\u003Efalse\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-4\u0022\u003EExample\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Diagnostics.EnableRefreshDetails = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen enabled, the option allows additional refresh-related diagnostic response information, such as the \u003Ccode\u003EX-UAuth-Refresh\u003C/code\u003E header.\u003C/p\u003E\n\u003Cp\u003EThis is primarily useful during development and debugging.\u003C/p\u003E\n\u003Cp\u003EAvoid enabling detailed authentication diagnostics in production unless the exposure is understood and justified.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-lifecycle-events\u0022\u003E24. Authentication Lifecycle Events\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Events\u003C/code\u003E exposes server-side authentication lifecycle callbacks.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-events\u0022\u003EAvailable Events\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Events.OnAnyEvent\noptions.Events.OnUserLoggedIn\noptions.Events.OnUserLoggedOut\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-login-logging\u0022\u003EExample: Login Logging\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Events.OnUserLoggedIn = context =\u0026gt;\n {\n // Record the successful login.\n return Task.CompletedTask;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-global-event-handler\u0022\u003EExample: Global Event Handler\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Events.OnAnyEvent = context =\u0026gt;\n {\n // Process an authentication lifecycle event.\n return Task.CompletedTask;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ELifecycle events are intended for lightweight reactions such as logging, metrics, and notifications.\u003C/p\u003E\n\u003Cp\u003EThey should not replace security decisions, authentication validation, or application policies.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E for event and extension guidance.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022in-memory-auth-artifact-store\u0022\u003E25. In-Memory Auth Artifact Store\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses a bounded in-memory store by default for temporary authentication artifacts, including PKCE authorization codes and login preview receipts.\u003C/p\u003E\n\u003Cp\u003EExpired artifacts are rejected on access and periodically removed in the background, even when they are never accessed again. The store also enforces a maximum number of entries to prevent unbounded accumulation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDefault configuration\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOption\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthArtifacts.MaxEntries\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E50,000\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMaximum retained artifacts per application instance\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthArtifacts.CleanupInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E1 minute\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EInterval between expiration cleanup passes\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese defaults require no additional configuration.\u003C/p\u003E\n\u003Cp\u003ETo customize them:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthArtifacts.MaxEntries = 200_000;\n options.AuthArtifacts.CleanupInterval = TimeSpan.FromMinutes(5);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen capacity is reached, the store attempts to reclaim expired entries. If it remains full, new artifacts are rejected without evicting valid authentication proofs.\u003C/p\u003E\n\u003Cp\u003EExpiration is always enforced when an artifact is accessed or consumed, independently of the cleanup interval. Atomic consume-once semantics are preserved.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDeployment notes:\u003C/strong\u003E Capacity limits are process-local, not shared across application instances. Custom \u003Ccode\u003EIAuthStore\u003C/code\u003E implementations are responsible for their own expiration and capacity management. Choose limits according to expected authentication traffic and available memory.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022effective-server-options\u0022\u003E26. Effective Server Options\u003C/h2\u003E\n\u003Cp\u003EThe configured \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E instance is the base configuration.\u003C/p\u003E\n\u003Cp\u003EAt runtime, UltimateAuth can resolve:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EEffectiveUAuthServerOptions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe current resolution process is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EConfigured UAuthServerOptions\n |\n v\n Resolve auth mode\n |\n v\n Clone base options\n |\n v\n Apply mode defaults\n |\n v\n Apply ConfigureMode overrides\n |\n v\n EffectiveUAuthServerOptions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis means that the effective settings used for a \u003Ccode\u003EHybrid\u003C/code\u003E client can differ from those used for a \u003Ccode\u003EPureOpaque\u003C/code\u003E client.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-5\u0022\u003EExample\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n\n options.ConfigureMode(UAuthMode.Hybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(5);\n });\n\n options.ConfigureMode(UAuthMode.PureOpaque, mode =\u0026gt;\n {\n mode.Session.IdleTimeout = TimeSpan.FromDays(3);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe original options remain the common starting point.\u003C/p\u003E\n\u003Cp\u003EMode defaults and overrides determine the effective values for the resolved mode.\u003C/p\u003E\n\u003Cp\u003EFor implementation details and inspection of effective options, see \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-and-configuration-safety\u0022\u003E27. Validation and Configuration Safety\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth Server registers multiple options validators and enables startup validation.\u003C/p\u003E\n\u003Cp\u003EThese validators cover areas including:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ELogin settings.\u003C/li\u003E\n\u003Cli\u003ESession settings.\u003C/li\u003E\n\u003Cli\u003EToken settings.\u003C/li\u003E\n\u003Cli\u003EPKCE.\u003C/li\u003E\n\u003Cli\u003EMulti-tenancy.\u003C/li\u003E\n\u003Cli\u003EIdentifier configuration.\u003C/li\u003E\n\u003Cli\u003EPagination.\u003C/li\u003E\n\u003Cli\u003EGeneral server configuration.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-invalid-session-lifetime\u0022\u003EExample: Invalid Session Lifetime\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.Zero;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server rejects an invalid session lifetime under the applicable validation rules.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-invalid-base-path\u0022\u003EExample: Invalid Base Path\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;//auth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe general server validator rejects paths containing \u003Ccode\u003E//\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-limitations\u0022\u003EValidation Limitations\u003C/h3\u003E\n\u003Cp\u003EStartup validation protects the configured options according to the registered validators.\u003C/p\u003E\n\u003Cp\u003EIt does not guarantee that every custom service implementation or mode-specific override is secure.\u003C/p\u003E\n\u003Cp\u003EWhen using advanced customization, test the resulting effective configuration and authentication flows.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022complete-configuration-example\u0022\u003E28. Complete Configuration Example\u003C/h2\u003E\n\u003Cp\u003EThe following example combines several commonly used server settings.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n // Authentication modes\n options.AllowedModes =\n [\n UAuthMode.PureOpaque,\n UAuthMode.Hybrid\n ];\n\n // Login security\n options.Login.MaxFailedAttempts = 5;\n options.Login.LockoutDuration = TimeSpan.FromMinutes(15);\n options.Login.IncludeFailureDetails = false;\n\n // Sessions\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n options.Session.MaxLifetime = TimeSpan.FromDays(30);\n\n // Token identity\n options.Token.Issuer = \u0026quot;MyApplication\u0026quot;;\n options.Token.Audience = \u0026quot;MyApplicationApi\u0026quot;;\n\n // Hybrid-specific token lifetime\n options.ConfigureMode(UAuthMode.Hybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n });\n\n // PKCE\n options.Pkce.AuthorizationCodeLifetimeSeconds = 120;\n\n // Hub deployment\n options.HubDeploymentMode = UAuthHubDeploymentMode.Integrated;\n options.Hub.ClientBaseAddress = \u0026quot;https://app.example.com\u0026quot;;\n options.Hub.AllowedClientOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n\n // Credential security\n options.CredentialSessionPolicy.OnSelfChange = CredentialSessionBehavior.PreserveCurrent;\n options.CredentialSessionPolicy.OnAdminChange = CredentialSessionBehavior.RevokeAll;\n options.CredentialSessionPolicy.OnRecovery = CredentialSessionBehavior.RevokeAll;\n\n // Credential recovery\n options.ResetCredential.TokenValidity = TimeSpan.FromMinutes(30);\n options.ResetCredential.MaxAttempts = 3;\n\n // Identifier login rules\n options.LoginIdentifiers.RequireVerificationForEmail = true;\n\n // Endpoint exposure\n options.Endpoints.Authentication = true;\n options.Endpoints.Session = true;\n options.Endpoints.Credentials = true;\n options.Endpoints.Authorization = true;\n\n // Pagination\n options.Pagination.DefaultPageSize = 50;\n options.Pagination.MaxPageSize = 200;\n\n // Diagnostics\n options.Diagnostics.EnableRefreshDetails = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is an illustrative configuration, not a universal production preset.\u003C/p\u003E\n\u003Cp\u003EApplications should choose session lifetimes, authentication modes, credential transport, tenant behavior, and endpoint exposure according to their own deployment and security requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-configuration-mistakes\u0022\u003E29. Common Configuration Mistakes\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuring-core-options-separately\u0022\u003EConfiguring Core Options Separately\u003C/h3\u003E\n\u003Cp\u003EWhen using \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E, configure Core-defined options through \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EA separate \u003Ccode\u003EUAuthOptions\u003C/code\u003E configuration does not automatically override the server\u0027s composed options.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-allowedmodes-selects-the-mode\u0022\u003EAssuming AllowedModes Selects the Mode\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E is a restriction.\u003C/p\u003E\n\u003Cp\u003EMode selection is performed by the authentication mode resolver.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022ignoring-mode-defaults\u0022\u003EIgnoring Mode Defaults\u003C/h3\u003E\n\u003Cp\u003EMode-specific defaults can replace globally configured values.\u003C/p\u003E\n\u003Cp\u003EUse \u003Ccode\u003EConfigureMode()\u003C/code\u003E for explicit mode-specific behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022treating-reserved-session-options-as-enforced-security-features\u0022\u003ETreating Reserved Session Options as Enforced Security Features\u003C/h3\u003E\n\u003Cp\u003ESome device and session-chain options are reserved for future enforcement.\u003C/p\u003E\n\u003Cp\u003EVerify actual runtime support before relying on them.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022exposing-unnecessary-endpoints\u0022\u003EExposing Unnecessary Endpoints\u003C/h3\u003E\n\u003Cp\u003EDisable endpoint groups or actions that the application does not require.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022allowing-query-string-credentials-without-a-specific-need\u0022\u003EAllowing Query-String Credentials Without a Specific Need\u003C/h3\u003E\n\u003Cp\u003EQuery-string credentials can leak through URLs and infrastructure logs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022weakening-cookie-security\u0022\u003EWeakening Cookie Security\u003C/h3\u003E\n\u003Cp\u003EDo not relax secure transport or cookie protections without understanding the consequences.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-configuration-validation-covers-everything\u0022\u003EAssuming Configuration Validation Covers Everything\u003C/h3\u003E\n\u003Cp\u003EStartup validation does not replace testing, infrastructure security, or validation of custom extension implementations.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-options-quick-reference\u0022\u003E30. Server Options Quick Reference\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConfiguration group\u003C/th\u003E\n\u003Cth\u003ETypical use\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPermitted authentication modes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthArtifacts\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIn-memory authentication artifact capacity and expiration cleanup\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential delivery\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EConfigureMode()\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMode-specific option overrides\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECookie\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECookie security and scope\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECredentialSessionPolicy\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession invalidation after credential changes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceLimits\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnforced global and per-type active-device admission limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDiagnostics\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh diagnostics\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEndpoint exposure\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication lifecycle callbacks\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EGrantDelivery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EGrant transport and credential resolution\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHub\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub integration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHubDeploymentMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub deployment topology\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIdentifiers\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifier behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIdentifierValidation\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifier validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin attempts and lockout\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELoginIdentifiers\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin identifier eligibility\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant resolution\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENavigation\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication redirects\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOnConfigureEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAdvanced endpoint customization\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPagination\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EQuery page limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE code lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResetCredential\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential recovery rules\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession expiration and lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EToken\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EToken issuance and lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUserProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMulti-profile capability\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-steps\u0022\u003ENext Steps\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/configuration\u0022\u003EConfiguration Overview\u003C/a\u003E \u2014 Understand the configuration architecture and precedence.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E \u2014 Configure client SDK behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E \u2014 Explore effective options, mode resolution, and extension points.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client/session-management\u0022\u003ESession Management\u003C/a\u003E \u2014 Manage sessions through the client.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client/authentication\u0022\u003EAuthentication\u003C/a\u003E \u2014 Use the client authentication flows.\u003C/li\u003E\n\u003C/ul\u003E\n", + "Html": "\n\u003Cp\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E is the primary configuration surface for UltimateAuth Server.\u003C/p\u003E\n\u003Cp\u003EIt controls authentication behavior, session lifecycles, token issuance, credential security, tenant resolution, endpoint exposure, and integration with UAuthHub.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth composes its Core-defined options directly into \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E. When using UltimateAuth Server, you configure both shared authentication behavior and server-specific features through the same options object.\u003C/p\u003E\n\u003Cp\u003EThis guide covers the available configuration groups, their defaults, practical examples, and the distinction between configured and effective runtime behavior.\u003C/p\u003E\n\u003Cp\u003EBuilt-in HTTP throttling is configured through \u003Ccode\u003Eoptions.RateLimiting\u003C/code\u003E. See \u003Ca href=\u0022/docs/security/rate-limiting\u0022\u003ERate Limiting\u003C/a\u003E for defaults, middleware ownership, proxy configuration and native-policy integration.\u003C/p\u003E\n\u003Cp\u003EExpensive password hashing operations are protected by \u003Ccode\u003Eoptions.ConcurrencyLimiting\u003C/code\u003E, which provides global and workload-specific concurrency budgets. See \u003Ca href=\u0022/docs/security/concurrency-limiting\u0022\u003EConcurrency Limiting\u003C/a\u003E for defaults, queue behavior, timeouts, and configuration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022register-ultimateauth-server\u0022\u003E1. Register UltimateAuth Server\u003C/h2\u003E\n\u003Cp\u003EConfigure the server through \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.MaxFailedAttempts = 5;\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe configuration delegate receives:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EUAuthServerOptions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server registration also supports an optional policy configuration delegate.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(\n configure: options =\u0026gt;\n {\n options.Login.MaxFailedAttempts = 5;\n },\n configurePolicies: policies =\u0026gt;\n {\n // Register application access policies.\n });\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server automatically registers its Core infrastructure. You do not need to call \u003Ccode\u003EAddUltimateAuth()\u003C/code\u003E separately.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-from-appsettings.json\u0022\u003EConfiguration from appsettings.json\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth Server binds the configuration section:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth:Server\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EJSON\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-json\u0022\u003E{\n \u0026quot;UltimateAuth\u0026quot;: {\n \u0026quot;Server\u0026quot;: {\n \u0026quot;Login\u0026quot;: {\n \u0026quot;MaxFailedAttempts\u0026quot;: 5,\n \u0026quot;LockoutDuration\u0026quot;: \u0026quot;00:15:00\u0026quot;\n },\n \u0026quot;Token\u0026quot;: {\n \u0026quot;SessionIdLifetime\u0026quot;: \u0026quot;7.00:00:00\u0026quot;,\n \u0026quot;AccessTokenLifetime\u0026quot;: \u0026quot;00:10:00\u0026quot;\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EASP.NET Core represents \u003Ccode\u003ETimeSpan\u003C/code\u003E values using strings such as \u003Ccode\u003E00:15:00\u003C/code\u003E for fifteen minutes and \u003Ccode\u003E7.00:00:00\u003C/code\u003E for seven days.\u003C/p\u003E\n\u003Cp\u003EThe configuration section is bound after the registration delegate, so configuration provider values take precedence for matching properties.\u003C/p\u003E\n\u003Cp\u003EFor configuration source ordering and environment-specific overrides, see \u003Ca href=\u0022/docs/configuration/configuration\u0022\u003EConfiguration Overview\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-options-architecture\u0022\u003E2. Server Options Architecture\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E is the primary configuration entry point for UltimateAuth Server.\u003C/p\u003E\n\u003Cp\u003EIt composes authentication configuration into logical groups according to their responsibilities.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConfiguration group\u003C/th\u003E\n\u003Cth\u003EResponsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EExplicit authentication mode selection\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EApplicationProfileModes\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EApplication-profile-specific mode selection\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERestrict permitted authentication modes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession lifecycle and security policies\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EToken\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EToken lifetimes and renewal behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETransport\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication surrogate transport\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EValidation\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication validation requirements\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin and lockout behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE flow configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceLimits\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EActive-device admission limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECookie\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECookie configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEndpoint exposure and configuration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant resolution\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication lifecycle callbacks\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EConfigure these groups through the server\u0027s registration API.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth resolves the effective configuration according to the application profile, authentication mode and applicable mode-specific overrides.\u003C/p\u003E\n\u003Cp\u003EServer configuration and client configuration remain separate responsibilities.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E for effective-options resolution.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-options\u0022\u003E3. Login Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Login\u003C/code\u003E controls login attempt limits, lockout behavior, and related security settings.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.MaxFailedAttempts = 5;\n options.Login.LockoutDuration = TimeSpan.FromMinutes(15);\n options.Login.FailureWindow = TimeSpan.FromMinutes(15);\n options.Login.ExtendLockOnFailure = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-properties\u0022\u003EAvailable Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxFailedAttempts\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E10\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EFailed login threshold; \u003Ccode\u003E0\u003C/code\u003E disables lockout\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELockoutDuration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E15 minutes\u003C/td\u003E\n\u003Ctd\u003ELockout duration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EFailureWindow\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E15 minutes\u003C/td\u003E\n\u003Ctd\u003EWindow for counting failed attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EExtendLockOnFailure\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EExtend lockout when another attempt fails during lockout\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIncludeFailureDetails\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EInclude detailed authentication failure information\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETryLoginDuration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E180 seconds\u003C/td\u003E\n\u003Ctd\u003EDuration associated with the try-login flow\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-restrict-login-failure-details\u0022\u003EExample: Restrict Login Failure Details\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.IncludeFailureDetails = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis setting is useful when an application does not want to expose detailed lockout information to callers.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important\u0022\u003EImportant\u003C/h3\u003E\n\u003Cp\u003ELockout configuration is not equivalent to complete network-level rate limiting.\u003C/p\u003E\n\u003Cp\u003EProduction deployments should also consider infrastructure protections against abusive traffic and distributed login attempts.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-options\u0022\u003E4. Session Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Session\u003C/code\u003E controls session expiration, sliding behavior, and session-chain limits.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Session.SlidingExpiration = true;\n options.Session.IdleTimeout = TimeSpan.FromDays(3);\n options.Session.MaxLifetime = TimeSpan.FromDays(30);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-lifetime-properties\u0022\u003ESession Lifetime Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EOptional absolute lifetime limit\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESlidingExpiration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAllow eligible activity or refresh operations to extend expiration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIdleTimeout\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EOptional inactivity timeout\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETouchInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E5 minutes\u003C/td\u003E\n\u003Ctd\u003EMinimum interval between last-seen updates\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese settings have different purposes.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EMaxLifetime\u003C/code\u003E establishes an optional hard boundary that cannot be extended indefinitely.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EIdleTimeout\u003C/code\u003E limits how long a session can remain inactive.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ETouchInterval\u003C/code\u003E reduces unnecessary persistence operations caused by frequent activity updates.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-chain-properties\u0022\u003ESession-Chain Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxSessionsPerChain\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E100\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession-chain rotation limit\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceMismatchBehavior\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EReject\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDevice mismatch behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022enforced-device-limits\u0022\u003EEnforced Device Limits\u003C/h3\u003E\n\u003Cp\u003EActive-device admission limits are configured separately from \u003Ccode\u003Eoptions.Session\u003C/code\u003E:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.DeviceLimits.MaxDevices = 3;\n options.DeviceLimits.TypeLimits[\u0026quot;web\u0026quot;] = 2;\n options.DeviceLimits.Behavior = DeviceLimitBehavior.RejectNewLogin;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceLimits.MaxDevices\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EOptional maximum distinct active device IDs per user and tenant\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceLimits.TypeLimits\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEmpty\u003C/td\u003E\n\u003Ctd\u003EOptional per-type limits (case-insensitive keys)\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceLimits.Behavior\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ERejectNewLogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReject a new device or revoke oldest eligible active device(s)\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe feature is disabled until one or more quotas are configured.\u003C/p\u003E\n\u003Cp\u003EMultiple active chains sharing the same \u003Ccode\u003EDeviceId\u003C/code\u003E count as one device.\u003C/p\u003E\n\u003Cp\u003EBuilt-in browser clients are classified as \u003Ccode\u003Eweb\u003C/code\u003E, regardless of operating system.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EDeviceLimits\u003C/code\u003E is the supported active-device enforcement mechanism. Reserved \u003Ccode\u003ESession.MaxChainsPerUser\u003C/code\u003E, \u003Ccode\u003EMaxChainsPerPlatform\u003C/code\u003E, and category-based chain settings do not enforce these quotas.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/sessions-devices/device-limits\u0022\u003EDevice Limits\u003C/a\u003E for admission, eviction, persistence, and migration behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-specific-session-defaults\u0022\u003EMode-Specific Session Defaults\u003C/h3\u003E\n\u003Cp\u003ESession settings can also be affected by authentication mode defaults.\u003C/p\u003E\n\u003Cp\u003EFor example, \u003Ccode\u003EPureOpaque\u003C/code\u003E supplies a longer idle timeout and touch interval when those values have not been configured.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E for the effective-options resolution order.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-options\u0022\u003E5. Token Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Token\u003C/code\u003E configures token lifetimes and renewal behavior.\u003C/p\u003E\n\u003Cp\u003EThe effective authentication mode determines which surrogate kinds are supported and which token formats are used.\u003C/p\u003E\n\u003Cp\u003EApplications do not need to enable JWT or opaque token issuance independently.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n options.Token.RefreshTokenLifetime = TimeSpan.FromDays(7);\n\n options.Token.Issuer = \u0026quot;MyApplication\u0026quot;;\n options.Token.Audience = \u0026quot;MyApplicationApi\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-properties-1\u0022\u003EAvailable Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESessionIdLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E7 days\u003C/td\u003E\n\u003Ctd\u003ELifetime of the session identifier\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAccessTokenLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E10 minutes\u003C/td\u003E\n\u003Ctd\u003EAccess-token lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshTokenLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E7 days\u003C/td\u003E\n\u003Ctd\u003ERefresh-token lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIssueRefreshToken\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnable refresh-token issuance where supported\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOpaqueIdBytes\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E32\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERandom byte length used for opaque identifiers\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshTokenConcurrentRequestWindow\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E2 seconds\u003C/td\u003E\n\u003Ctd\u003EConcurrent duplicate refresh classification window\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIssuer\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuth\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EJWT issuer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAudience\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClient\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EJWT audience\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EKeyId\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EOptional signing key identifier\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-specific-applicability\u0022\u003EMode-specific applicability\u003C/h3\u003E\n\u003Cp\u003ENot every token option applies to every authentication mode.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EPureOpaque uses \u003Ccode\u003ESessionIdLifetime\u003C/code\u003E but does not issue access or refresh tokens.\u003C/li\u003E\n\u003Cli\u003EHybrid maintains authoritative session state together with a separate token lifecycle.\u003C/li\u003E\n\u003Cli\u003ESemiHybrid uses JWT access tokens associated with server-managed session lineage.\u003C/li\u003E\n\u003Cli\u003EPureJwt uses JWT access tokens without authentication sessions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EConfiguring a credential lifetime does not enable a credential type that is unsupported by the effective mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-identifiers-and-surrogates\u0022\u003ESession identifiers and surrogates\u003C/h3\u003E\n\u003Cp\u003EIn PureOpaque and Hybrid, the session identifier acts as an opaque authentication surrogate.\u003C/p\u003E\n\u003Cp\u003EIn SemiHybrid, the session identifier is carried as metadata within the JWT and identifies the associated session lineage.\u003C/p\u003E\n\u003Cp\u003EA metadata-only session identifier must never be accepted as an independent authentication surrogate.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-token-concurrency-window\u0022\u003ERefresh Token Concurrency Window\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.RefreshTokenConcurrentRequestWindow = TimeSpan.FromSeconds(2);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis option distinguishes likely concurrent refresh requests from later token reuse.\u003C/p\u003E\n\u003Cp\u003EA consumed refresh token cannot be successfully rotated again.\u003C/p\u003E\n\u003Cp\u003EThe concurrency window affects replay classification, not token validity.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/auth-flows/refresh-flow\u0022\u003ERefresh Flow\u003C/a\u003E\nand \u003Ca href=\u0022/docs/security/refresh-rotation\u0022\u003ERefresh Rotation\u003C/a\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-specific-token-configuration\u0022\u003EMode-specific token configuration\u003C/h3\u003E\n\u003Cp\u003EToken lifetimes can be configured globally or overridden for a particular authentication mode.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n\n options.ConfigureMode(UAuthMode.SemiHybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(5);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EMode-specific overrides are useful when a server supports multiple authentication modes.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022pkce-options\u0022\u003E6. PKCE Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Pkce\u003C/code\u003E configures the lifetime of PKCE authorization codes.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Pkce.AuthorizationCodeLifetimeSeconds = 120;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthorizationCodeLifetimeSeconds\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E120\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELifetime of a PKCE authorization code\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EPKCE is particularly important for browser-based clients such as Blazor WebAssembly.\u003C/p\u003E\n\u003Cp\u003EA shorter authorization code lifetime reduces the period during which an intercepted or exposed code could potentially be used.\u003C/p\u003E\n\u003Cp\u003EHowever, the value must remain long enough for legitimate authorization exchanges to complete.\u003C/p\u003E\n\u003Cp\u003EThe server\u0027s PKCE configuration is separate from the client\u0027s PKCE flow settings.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes\u0022\u003E7. Authentication Modes\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports authentication mode resolution based on the application profile.\u003C/p\u003E\n\u003Cp\u003EThe server exposes:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.AllowedModes\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis property restricts the modes the server is permitted to use.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022restrict-allowed-modes\u0022\u003ERestrict Allowed Modes\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AllowedModes =\n [\n UAuthMode.PureOpaque,\n UAuthMode.Hybrid\n ];\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E is a restriction, not a mode selector.\u003C/p\u003E\n\u003Cp\u003EThe effective mode is resolved by \u003Ccode\u003EIEffectiveAuthModeResolver\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-mode-resolution\u0022\u003EDefault Mode Resolution\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth resolves the effective authentication mode using the application profile unless the server explicitly configures \u003Ccode\u003EAuthMode\u003C/code\u003E or \u003Ccode\u003EApplicationProfileModes\u003C/code\u003E.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication Profile\u003C/th\u003E\n\u003Cth\u003EDefault Mode\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazorServer\u003C/td\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EWebServer\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazorWasm\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMaui\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUAuthHub\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EApi\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResourceApi\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe server controls the effective authentication mode. Application profile metadata is not an authorization boundary.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthMode\u003C/code\u003E forces a single mode for the server, while \u003Ccode\u003EApplicationProfileModes\u003C/code\u003E provides explicit profile-specific mappings. These configuration mechanisms cannot be combined.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E restricts permitted modes but does not select a mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-profile-specific-modes\u0022\u003EApplication-profile-specific modes\u003C/h3\u003E\n\u003Cp\u003EAn authentication mode can be selected globally:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthMode = UAuthMode.Hybrid;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAlternatively, authentication modes can be selected for individual application profiles:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ApplicationProfileModes[UAuthApplicationProfile.BlazorServer] = UAuthMode.PureOpaque;\n options.ApplicationProfileModes[UAuthApplicationProfile.BlazorWasm] = UAuthMode.SemiHybrid;\n options.ApplicationProfileModes[UAuthApplicationProfile.Maui] = UAuthMode.Hybrid;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthMode\u003C/code\u003E and \u003Ccode\u003EApplicationProfileModes\u003C/code\u003E are alternative explicit mode-selection mechanisms.\u003C/p\u003E\n\u003Cp\u003EDo not configure both simultaneously.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E restricts which modes are permitted. It does not select the effective authentication mode.\u003C/p\u003E\n\u003Cp\u003EWhen no explicit selection is provided, UltimateAuth uses its application-profile-aware defaults.\u003C/p\u003E\n\u003Cp\u003EHybrid is the general-purpose default for most application profiles, while Blazor Server defaults to PureOpaque.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E for selection guidance and mode transition considerations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022explicit-purejwt-configuration\u0022\u003EExplicit PureJwt Configuration\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthMode = UAuthMode.PureJwt;\n\n options.Token.Issuer = \u0026quot;https://auth.example.com\u0026quot;;\n options.Token.Audience = \u0026quot;products-api\u0026quot;;\n\n options.Cryptography.JwtSigningKey = builder.Configuration[\u0026quot;UltimateAuth:JwtSigningKey\u0026quot;];\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe JWT signing key must be a Base64-encoded cryptographic key containing at least 32 bytes of key material.\u003C/p\u003E\n\u003Cp\u003EUse a cryptographically secure, independently generated key in production. Do not reuse the JWT signing key as the token-hashing key.\u003C/p\u003E\n\u003Cp\u003EPureJwt does not create authentication sessions, but refresh-token persistence is still required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-mode-specific-behavior\u0022\u003EConfigure Mode-Specific Behavior\u003C/h3\u003E\n\u003Cp\u003EUse \u003Ccode\u003EConfigureMode()\u003C/code\u003E for behavior that should differ by mode.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ConfigureMode(UAuthMode.PureOpaque, mode =\u0026gt;\n {\n mode.Session.IdleTimeout = TimeSpan.FromDays(7);\n });\n\n options.ConfigureMode(UAuthMode.Hybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(5);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe mode override runs after the built-in mode defaults.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E for details.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-options\u0022\u003E8. Validation Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Validation\u003C/code\u003E configures authentication validation requirements for applicable UltimateAuth server operations.\u003C/p\u003E\n\u003Cp\u003EThe available requirements are:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ERequirement\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EStandard\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENormal authentication guarantees of the effective mode\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHubValidated\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthoritative validation of the associated session\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-validation-requirement\u0022\u003EDefault validation requirement\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthMode = UAuthMode.SemiHybrid;\n\n options.Validation.Default = UAuthValidationRequirement.Standard;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EStandard is the default configured requirement.\u003C/p\u003E\n\u003Cp\u003EIndividual UltimateAuth operations may require stronger validation according to their security classification.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-specific-validation\u0022\u003EEndpoint-specific validation\u003C/h3\u003E\n\u003Cp\u003EValidation requirements can be customized for supported UltimateAuth endpoints:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Validation.Endpoints[UAuthEndpoint.GetMyIdentifiers] = UAuthValidationRequirement.HubValidated;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEndpoint-specific configuration cannot weaken mandatory framework security requirements.\u003C/p\u003E\n\u003Cp\u003EThe effective requirement considers the endpoint classification, configured default, explicit requirements, and applicable framework-enforced minimums.\u003C/p\u003E\n\u003Cp\u003EAuthentication flows such as login, refresh and credential recovery retain their own security requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-defined-endpoints\u0022\u003EApplication-defined endpoints\u003C/h3\u003E\n\u003Cp\u003ECustom ASP.NET Core endpoints can explicitly require authoritative validation:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eapp.MapPost(\u0026quot;/api/security/settings\u0026quot;, UpdateSecuritySettings)\n .RequireUAuthHubValidation();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EController actions can use \u003Ccode\u003EUAuthHubValidated\u003C/code\u003E together with the applicable authorization requirement.\u003C/p\u003E\n\u003Cp\u003EServer validation options for built-in UltimateAuth operations should not be interpreted as automatically applying the same requirement to every custom endpoint.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-validation\u0022\u003EResource API validation\u003C/h3\u003E\n\u003Cp\u003EResource APIs configure their own default validation requirement through:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Auth.Validation.Default = UAuthValidationRequirement.HubValidated;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is particularly useful for SemiHybrid Resource APIs that require authoritative session validation by default.\u003C/p\u003E\n\u003Cp\u003EPureJwt cannot satisfy a HubValidated requirement because it has no associated authentication session.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/request-lifecycle\u0022\u003ERequest Lifecycle\u003C/a\u003E for validation behavior.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-options\u0022\u003E9. Endpoint Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Endpoints\u003C/code\u003E controls endpoint paths, feature groups, and individual action restrictions.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022base-path\u0022\u003EBase Path\u003C/h3\u003E\n\u003Cp\u003EThe default server endpoint base path is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003E/auth\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EConfigure it through:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;/auth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EChanging the base path can help avoid route conflicts when integrating UltimateAuth into an existing application.\u003C/p\u003E\n\u003Cp\u003EThe client must use compatible endpoint paths.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-groups\u0022\u003EEndpoint Groups\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthentication\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession management endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUserLifecycle\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EUser lifecycle endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUserProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EUser profile endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUserIdentifier\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifier management endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECredentials\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential management endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthorization\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthorization endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.Authentication = true;\n options.Endpoints.Session = true;\n options.Endpoints.Authorization = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDisabling an endpoint group controls endpoint exposure. It does not automatically remove the underlying domain services or invalidate previously issued credentials.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022disable-individual-actions\u0022\u003EDisable Individual Actions\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EDisabledActions\u003C/code\u003E is a collection of action identifiers:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.DisabledActions.Add(\u0026quot;users.create.anonymous\u0026quot;);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe string must match the action identifier used by the server\u0027s endpoint registration and action policy.\u003C/p\u003E\n\u003Cp\u003EDo not pass a C# constant name as a string unless that exact text is also the registered action value.\u003C/p\u003E\n\u003Cp\u003EFor example, these are not necessarily equivalent:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003E\u0026quot;UAuthActions.Users.Create.Anonymous\u0026quot;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Eand:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003E\u0026quot;users.create.anonymous\u0026quot;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUse the actual action value defined by the corresponding \u003Ccode\u003EUAuthActions\u003C/code\u003E constant.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-hardening\u0022\u003EEndpoint Hardening\u003C/h3\u003E\n\u003Cp\u003EDisable endpoints that are not required by the application.\u003C/p\u003E\n\u003Cp\u003EFor example, an application that delegates user provisioning to administrators may choose to disable anonymous user creation.\u003C/p\u003E\n\u003Cp\u003EEndpoint exposure is a separate concern from authorization: an exposed endpoint must still enforce the applicable security policy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022surrogate-resolution\u0022\u003E10. Surrogate Resolution\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth resolves incoming authentication surrogates according to the effective authentication mode and transport configuration.\u003C/p\u003E\n\u003Cp\u003EEach surrogate has a single configured transport. Alternative sources are not used as fallbacks.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022primary-surrogate\u0022\u003EPrimary Surrogate\u003C/h3\u003E\n\u003Cp\u003EThe effective authentication mode determines which surrogate is used to establish the authentication identity.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EAuthentication mode\u003C/th\u003E\n\u003Cth\u003EPrimary surrogate\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003Ctd\u003EOpaque session ID\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003EOpaque session ID\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003EJWT access token\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003EJWT access token\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022incoming-transport\u0022\u003EIncoming Transport\u003C/h3\u003E\n\u003Cp\u003ESurrogates are resolved exclusively from the configured cookie or request header.\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECookie transport reads the configured authentication cookie.\u003C/li\u003E\n\u003Cli\u003EHeader transport reads the effective request header using the expected header format.\u003C/li\u003E\n\u003Cli\u003EQuery-string transport is not supported.\u003C/li\u003E\n\u003Cli\u003EMissing or invalid values do not trigger fallback to another transport.\u003C/li\u003E\n\u003Cli\u003EDuplicate surrogate values are rejected.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003ERefresh tokens are resolved separately using their own transport configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-request-headers\u0022\u003EDefault Request Headers\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ESurrogate\u003C/th\u003E\n\u003Cth\u003ERequest header\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession ID\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euas\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess Token\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthorization\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh Token\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euar\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EAccess tokens use the Bearer format in the default authorization header.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022transport-collisions\u0022\u003ETransport Collisions\u003C/h3\u003E\n\u003Cp\u003EActive surrogates must not share the same cookie name, request header name, or response header name within their respective transport namespaces.\u003C/p\u003E\n\u003Cp\u003EConflicting effective transport configurations are rejected.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022#22-surrogate-transport-and-authentication-responses\u0022\u003ESurrogate Transport and Authentication Responses\u003C/a\u003E for configuration examples.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022cookie-configuration\u0022\u003E11. Cookie Configuration\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Cookie\u003C/code\u003E controls cookies used for authentication credentials.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth defines three cookie groups:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Cookie.Session\noptions.Cookie.AccessToken\noptions.Cookie.RefreshToken\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-cookie-names\u0022\u003EDefault Cookie Names\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ECookie\u003C/th\u003E\n\u003Cth\u003EDefault name\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euas\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess token\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euat\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh token\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euar\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe default cookie options use:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EHttpOnly = true\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ESecurePolicy = CookieSecurePolicy.Always\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EPath = \u0026quot;/\u0026quot;\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EDomain = null\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EMaxAge = null\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003E\u003Ccode\u003ESameSite\u003C/code\u003E is nullable and can be resolved through the applicable cookie and deployment policies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022customize-cookie-names\u0022\u003ECustomize Cookie Names\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cookie.Session.Name = \u0026quot;myapp_session\u0026quot;;\n options.Cookie.RefreshToken.Name = \u0026quot;myapp_refresh\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-cookie-scope\u0022\u003EConfigure Cookie Scope\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cookie.Session.Path = \u0026quot;/\u0026quot;;\n options.Cookie.Session.Domain = null;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA null domain produces a host-only cookie.\u003C/p\u003E\n\u003Cp\u003ESetting a parent domain can broaden cookie availability to subdomains and should be done only when necessary.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cookie-security\u0022\u003ECookie Security\u003C/h3\u003E\n\u003Cp\u003EAvoid disabling \u003Ccode\u003EHttpOnly\u003C/code\u003E or relaxing secure transport requirements for authentication cookies.\u003C/p\u003E\n\u003Cp\u003ECookie settings interact with:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe deployment mode.\u003C/li\u003E\n\u003Cli\u003ECross-site requests.\u003C/li\u003E\n\u003Cli\u003EBrowser cookie policies.\u003C/li\u003E\n\u003Cli\u003ECredential delivery configuration.\u003C/li\u003E\n\u003Cli\u003EHTTPS requirements.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor cross-site deployments, configure cookie behavior together with CORS and the relevant browser security requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022hub-deployment-mode\u0022\u003E12. Hub Deployment Mode\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.HubDeploymentMode\u003C/code\u003E describes how UAuthHub is deployed relative to the application.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.HubDeploymentMode = UAuthHubDeploymentMode.Embedded;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-modes\u0022\u003EAvailable Modes\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EMode\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEmbedded\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub and application share the same origin\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIntegrated\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub is separate but within the same-site boundary\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EExternal\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub is hosted on a different site or domain\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe default is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EUAuthHubDeploymentMode.Integrated\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022embedded\u0022\u003EEmbedded\u003C/h3\u003E\n\u003Cp\u003ESuitable for applications hosting UltimateAuth within the same application and origin.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.HubDeploymentMode = UAuthHubDeploymentMode.Embedded;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022integrated\u0022\u003EIntegrated\u003C/h3\u003E\n\u003Cp\u003ESuitable for deployments such as:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003Eauth.example.com\napp.example.com\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Ewhere the authentication service and application are separate origins within the same site.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022external\u0022\u003EExternal\u003C/h3\u003E\n\u003Cp\u003ESuitable for a separate authentication provider domain.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.HubDeploymentMode = UAuthHubDeploymentMode.External;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EExternal deployment requires careful coordination of cookie policies, redirects, allowed origins, and browser restrictions.\u003C/p\u003E\n\u003Cp\u003EThe deployment mode influences authentication transport behavior; it is not merely descriptive metadata.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022hub-options\u0022\u003E13. Hub Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Hub\u003C/code\u003E configures UAuthHub integration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-properties-2\u0022\u003EAvailable Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EClientBaseAddress\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EOptional client application base address\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAllowedClientOrigins\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEmpty set\u003C/td\u003E\n\u003Ctd\u003EAllowed client origins\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EFlowLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E5 minutes\u003C/td\u003E\n\u003Ctd\u003ELifetime of Hub flow artifacts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELoginPath\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/login\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub login page path\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example\u0022\u003EExample\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Hub.ClientBaseAddress = \u0026quot;https://app.example.com\u0026quot;;\n options.Hub.AllowedClientOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n options.Hub.FlowLifetime = TimeSpan.FromMinutes(5);\n options.Hub.LoginPath = \u0026quot;/login\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Hub flow lifetime is not the same as the authenticated session lifetime.\u003C/p\u003E\n\u003Cp\u003EHub artifacts support authentication orchestration and should generally be short-lived.\u003C/p\u003E\n\u003Cp\u003EOnly trusted origins should be included in \u003Ccode\u003EAllowedClientOrigins\u003C/code\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-session-policy\u0022\u003E14. Credential Session Policy\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.CredentialSessionPolicy\u003C/code\u003E determines what happens to active session chains after credential changes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-properties-3\u0022\u003EAvailable Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOnSelfChange\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EPreserveCurrent\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EUser changes their own credential\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOnAdminChange\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ERevokeAll\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAdministrator changes a user\u0027s credential\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOnRecovery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ERevokeAll\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential recovery completes\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-1\u0022\u003EExample\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.CredentialSessionPolicy.OnSelfChange = CredentialSessionBehavior.PreserveCurrent;\n options.CredentialSessionPolicy.OnAdminChange = CredentialSessionBehavior.RevokeAll;\n options.CredentialSessionPolicy.OnRecovery = CredentialSessionBehavior.RevokeAll;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-behaviors\u0022\u003EAvailable Behaviors\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EBehavior\u003C/th\u003E\n\u003Cth\u003EEffect\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPreserveAll\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EKeep existing session chains\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPreserveCurrent\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EKeep the current chain and revoke other applicable chains\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERevokeAll\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERevoke all applicable session chains\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EFor recovery flows, \u003Ccode\u003EPreserveCurrent\u003C/code\u003E is not always meaningful because the user may not have an authenticated current session.\u003C/p\u003E\n\u003Cp\u003EThe current implementation treats this situation using the more restrictive \u003Ccode\u003ERevokeAll\u003C/code\u003E behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-recommendation\u0022\u003ESecurity Recommendation\u003C/h3\u003E\n\u003Cp\u003EPreserving the current session after a normal password change can provide a reasonable user experience.\u003C/p\u003E\n\u003Cp\u003ERevoking all sessions after administrative credential changes or account recovery is generally more conservative.\u003C/p\u003E\n\u003Cp\u003EChoose the policy according to the application\u0027s security requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-reset-options\u0022\u003E15. Credential Reset Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.ResetCredential\u003C/code\u003E configures credential recovery proof lifetimes and attempt limits.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022defaults\u0022\u003EDefaults\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETokenValidity\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E30 minutes\u003C/td\u003E\n\u003Ctd\u003EReset token lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECodeValidity\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E10 minutes\u003C/td\u003E\n\u003Ctd\u003ENumeric reset code lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxAttempts\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E3\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMaximum permitted recovery attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECodeLength\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E6\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENumeric reset code length\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-2\u0022\u003EExample\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ResetCredential.TokenValidity = TimeSpan.FromMinutes(20);\n options.ResetCredential.CodeValidity = TimeSpan.FromMinutes(5);\n options.ResetCredential.MaxAttempts = 3;\n options.ResetCredential.CodeLength = 6;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003ECodeLength\u003C/code\u003E applies to numeric reset codes, not token-based recovery proofs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important-security-boundary\u0022\u003EImportant Security Boundary\u003C/h3\u003E\n\u003Cp\u003EReset proofs must be delivered through a trusted server-side mechanism.\u003C/p\u003E\n\u003Cp\u003EDo not return recovery tokens to anonymous callers simply to simplify a client-side reset form.\u003C/p\u003E\n\u003Cp\u003EThe application should provide the appropriate \u003Ccode\u003EICredentialResetNotifier\u003C/code\u003E implementation for supported recovery flows.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-identifier-options\u0022\u003E16. Login Identifier Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.LoginIdentifiers\u003C/code\u003E determines which identifier types can be used for login.\u003C/p\u003E\n\u003Cp\u003EThe default allowed types are:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EUserIdentifierType.Username\nUserIdentifierType.Email\nUserIdentifierType.Phone\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022restrict-login-identifier-types\u0022\u003ERestrict Login Identifier Types\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.LoginIdentifiers.AllowedTypes =\n new HashSet\u0026lt;UserIdentifierType\u0026gt;\n {\n UserIdentifierType.Email\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configures email as the allowed login identifier type.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022require-verification\u0022\u003ERequire Verification\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.LoginIdentifiers.RequireVerificationForEmail = true;\n options.LoginIdentifiers.RequireVerificationForPhone = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese settings control whether the corresponding identifiers must be verified before being accepted for login.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-resolvers\u0022\u003ECustom Resolvers\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnableCustomResolvers\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECustomResolversFirst\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese options control the participation and ordering of custom login identifier resolvers.\u003C/p\u003E\n\u003Cp\u003EAn identifier existing on a user account does not necessarily mean it is permitted for login.\u003C/p\u003E\n\u003Cp\u003EIdentifier management and login eligibility are separate concerns.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022identifier-validation\u0022\u003E17. Identifier Validation\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.IdentifierValidation\u003C/code\u003E provides rules for usernames, email addresses, and phone numbers.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022username-rules\u0022\u003EUsername Rules\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.IdentifierValidation.UserName.Enabled = true;\n options.IdentifierValidation.UserName.MinLength = 3;\n options.IdentifierValidation.UserName.MaxLength = 32;\n options.IdentifierValidation.UserName.AllowedRegex = \u0026quot;^[a-zA-Z0-9._-]\u002B$\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-validation-rules\u0022\u003EDefault Validation Rules\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EIdentifier\u003C/th\u003E\n\u003Cth\u003EEnabled\u003C/th\u003E\n\u003Cth\u003EMinimum length\u003C/th\u003E\n\u003Cth\u003EMaximum length\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUsername\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E3\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E64\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EEmail\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E3\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E256\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPhone\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E3\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E24\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EUsername validation additionally supports \u003Ccode\u003EAllowedRegex\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe default username expression is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EREGEX\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-regex\u0022\u003E^[a-zA-Z0-9._-]\u002B$\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022identifier-behavior\u0022\u003EIdentifier Behavior\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Identifiers\u003C/code\u003E contains additional groups:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Identifiers.Behavior\noptions.Identifiers.Validation\noptions.Identifiers.Normalization\noptions.Identifiers.Uniqueness\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese configure identifier behavior beyond the top-level validation rules.\u003C/p\u003E\n\u003Cp\u003EIdentifier normalization and uniqueness are particularly important because they affect how duplicate identifiers are detected.\u003C/p\u003E\n\u003Cp\u003EUse the provided options rather than implementing inconsistent normalization independently in the client.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022identifier-limits\u0022\u003EIdentifier Limits\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth supports configurable limits on the number of identifiers associated with each user.\u003C/p\u003E\n\u003Cp\u003EBy default, a user can have up to \u003Cstrong\u003E10 active identifiers\u003C/strong\u003E, regardless of their type.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Identifiers.Behavior.MaxIdentifiersPerUser = 10;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is a global per-user limit. It applies to the combined number of usernames, email addresses, phone numbers, and custom identifiers.\u003C/p\u003E\n\u003Ch4 id=\u0022optional-per-type-limits\u0022\u003EOptional Per-Type Limits\u003C/h4\u003E\n\u003Cp\u003EApplications can optionally define limits for individual identifier types:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Identifiers.Behavior.MaxIdentifiersPerUser = 10;\n\noptions.Identifiers.Behavior.MaxIdentifiersPerType = new()\n{\n [UserIdentifierType.Username] = 2,\n [UserIdentifierType.Email] = 5,\n [UserIdentifierType.Phone] = 3\n};\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EPer-type limits are not configured by default.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EWhen no per-type limit is specified, only the global limit applies.\u003C/p\u003E\n\u003Cp\u003EFor example, with the configuration above, a user may have up to five email addresses, but the combined number of all active identifiers cannot exceed ten.\u003C/p\u003E\n\u003Ch4 id=\u0022default-behavior\u0022\u003EDefault Behavior\u003C/h4\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOption\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxIdentifiersPerUser\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E10\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMaximum total active identifiers per user\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxIdentifiersPerType\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEmpty dictionary\u003C/td\u003E\n\u003Ctd\u003EOptional limits for individual identifier types\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe following rules apply:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EPrimary and non-primary identifiers count equally.\u003C/li\u003E\n\u003Cli\u003ESoft-deleted identifiers do not count toward active limits.\u003C/li\u003E\n\u003Cli\u003ESelf-service and administrative operations follow the same limits.\u003C/li\u003E\n\u003Cli\u003EPer-type limits do not override the global limit.\u003C/li\u003E\n\u003Cli\u003EExisting identifier behavior options remain applicable.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor example, \u003Ccode\u003EAllowMultipleUsernames = false\u003C/code\u003E still prevents multiple usernames, even when the configured username limit is greater than one.\u003C/p\u003E\n\u003Ch4 id=\u0022limit-validation\u0022\u003ELimit Validation\u003C/h4\u003E\n\u003Cp\u003EWhen an identifier addition exceeds a configured limit, the operation is rejected with a validation error.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EError Code\u003C/th\u003E\n\u003Cth\u003EMeaning\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003Eidentifier_total_limit_exceeded\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EThe user has reached the global identifier limit\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003Eidentifier_type_limit_exceeded\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EThe user has reached the configured limit for that identifier type\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EApplications should handle these errors and display appropriate feedback.\u003C/p\u003E\n\u003Cp\u003EIdentifier limits are enforced by the Users application layer rather than individual persistence stores.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022user-profile-options\u0022\u003E18. User Profile Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.UserProfile\u003C/code\u003E controls profile-related capabilities.\u003C/p\u003E\n\u003Cp\u003EThe current option is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.UserProfile.EnableMultiProfile\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIts default is \u003Ccode\u003Efalse\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022enable-multiple-profiles\u0022\u003EEnable Multiple Profiles\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.UserProfile.EnableMultiProfile = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis allows applications to use UltimateAuth\u0027s multiple-profile capability where supported by the user domain.\u003C/p\u003E\n\u003Cp\u003EFor example, an application may maintain separate profile contexts for different purposes.\u003C/p\u003E\n\u003Cp\u003EMulti-profile support does not create separate user identities or independent authentication accounts.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022multi-tenant-options\u0022\u003E19. Multi-Tenant Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.MultiTenant\u003C/code\u003E controls whether tenant-aware behavior is enabled and how tenant identifiers are resolved.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-properties-4\u0022\u003EAvailable Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnabled\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnable multi-tenant behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENormalizeToLowercase\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENormalize tenant identifiers\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnableRoute\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve tenants from routes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnableHeader\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve tenants from headers\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnableDomain\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResolve tenants from hosts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHeaderName\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EX-Tenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant header name\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-header-based-tenant-resolution\u0022\u003EExample: Header-Based Tenant Resolution\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.MultiTenant.Enabled = true;\n options.MultiTenant.EnableHeader = true;\n options.MultiTenant.HeaderName = \u0026quot;X-Tenant\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-domain-based-resolution\u0022\u003EExample: Domain-Based Resolution\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.MultiTenant.Enabled = true;\n options.MultiTenant.EnableDomain = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EMultiple resolution mechanisms can be enabled.\u003C/p\u003E\n\u003Cp\u003EThe server composes the configured tenant resolvers according to its resolution infrastructure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-boundary\u0022\u003ESecurity Boundary\u003C/h3\u003E\n\u003Cp\u003ETenant identification is not tenant authorization.\u003C/p\u003E\n\u003Cp\u003EA request providing another tenant identifier must not gain access to that tenant without appropriate authorization.\u003C/p\u003E\n\u003Cp\u003EThe server remains responsible for tenant isolation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022pagination-options\u0022\u003E20. Pagination Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Pagination\u003C/code\u003E controls pagination defaults and maximum page sizes.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDefaultPageSize\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E250\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxPageSize\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E1000\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-3\u0022\u003EExample\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Pagination.DefaultPageSize = 50;\n options.Pagination.MaxPageSize = 200;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese settings affect paginated queries exposed by UltimateAuth domain services.\u003C/p\u003E\n\u003Cp\u003EFor administrative interfaces, choosing a moderate page size can reduce unnecessary data transfer and processing.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022navigation-options\u0022\u003E21. Navigation Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Navigation\u003C/code\u003E configures automatic authentication navigation behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-properties-5\u0022\u003EAvailable Properties\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProperty\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnableAutomaticNavigationRedirect\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELoginResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAccessDeniedResolver\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022disable-automatic-redirects\u0022\u003EDisable Automatic Redirects\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Navigation.EnableAutomaticNavigationRedirect = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-login-redirect\u0022\u003ECustom Login Redirect\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Navigation.LoginResolver = context =\u0026gt;\n {\n return \u0026quot;/account/login\u0026quot;;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-access-denied-redirect\u0022\u003ECustom Access Denied Redirect\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Navigation.AccessDeniedResolver = context =\u0026gt;\n {\n return \u0026quot;/account/access-denied\u0026quot;;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese delegates receive the current \u003Ccode\u003EHttpContext\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe application should return valid, trusted navigation destinations.\u003C/p\u003E\n\u003Cp\u003EAvoid constructing redirects from unvalidated user-controlled URLs.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022surrogate-transport-and-authentication-responses\u0022\u003E22. Surrogate Transport and Authentication Responses\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates surrogate transport from navigation behavior.\u003C/p\u003E\n\u003Cp\u003EThe effective authentication mode determines which surrogates are supported. Transport configuration determines how those surrogates are carried between applications.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022transport-configuration\u0022\u003ETransport Configuration\u003C/h3\u003E\n\u003Cp\u003ESurrogate transport is configured through \u003Ccode\u003Eoptions.Transport\u003C/code\u003E:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Transport.Default\noptions.Transport.SessionId\noptions.Transport.AccessToken\noptions.Transport.RefreshToken\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach surrogate can have its own transport configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-transports\u0022\u003EDefault Transports\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EAuthentication mode\u003C/th\u003E\n\u003Cth\u003ESession ID\u003C/th\u003E\n\u003Cth\u003EAccess Token\u003C/th\u003E\n\u003Cth\u003ERefresh Token\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003Ctd\u003ECookie\u003C/td\u003E\n\u003Ctd\u003E\u2014\u003C/td\u003E\n\u003Ctd\u003E\u2014\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003ECookie\u003C/td\u003E\n\u003Ctd\u003EHeader\u003C/td\u003E\n\u003Ctd\u003ECookie\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003E\u2014\u003C/td\u003E\n\u003Ctd\u003EHeader\u003C/td\u003E\n\u003Ctd\u003ECookie\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003E\u2014\u003C/td\u003E\n\u003Ctd\u003EHeader\u003C/td\u003E\n\u003Ctd\u003ECookie\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese defaults apply to supported surrogates. Actual token issuance remains subject to the effective authentication configuration.\u003C/p\u003E\n\u003Cp\u003EFor .NET MAUI, supported surrogates default to header transport.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-surrogate-transport\u0022\u003EConfigure Surrogate Transport\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Transport.AccessToken.Mode = SurrogateTransport.Header;\n options.Transport.RefreshToken.Mode = SurrogateTransport.Cookie;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAn explicit per-surrogate transport setting takes precedence over the global transport preference and built-in defaults.\u003C/p\u003E\n\u003Cp\u003ETransport configuration does not enable surrogate kinds that are unsupported by the effective authentication mode.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ESurrogateTransport.Body\u003C/code\u003E is reserved and is not currently supported.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022request-and-response-headers\u0022\u003ERequest and Response Headers\u003C/h3\u003E\n\u003Cp\u003ERequest and response header names do not necessarily match.\u003C/p\u003E\n\u003Cp\u003EResponse headers deliver newly issued tokens to the client. Request headers present those tokens for authentication or renewal.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ESurrogate\u003C/th\u003E\n\u003Cth\u003EDefault response header\u003C/th\u003E\n\u003Cth\u003EDefault request header\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession ID\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euas\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euas\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess Token\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euat\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthorization\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh Token\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euar\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Euar\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EHeader names are case-insensitive. Active surrogates must use distinct header names within each direction.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022redirect-behavior\u0022\u003ERedirect Behavior\u003C/h3\u003E\n\u003Cp\u003ERedirect configuration is independent of surrogate transport.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Redirect.Login.SuccessRedirect = \u0026quot;/dashboard\u0026quot;;\noptions.Redirect.Logout.SuccessRedirect = \u0026quot;/\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA redirect is a navigation decision, not an authentication or revocation mechanism.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022compatibility\u0022\u003ECompatibility\u003C/h3\u003E\n\u003Cp\u003ESurrogate transport must be compatible with the selected authentication mode, application profile, and deployment topology.\u003C/p\u003E\n\u003Cp\u003EApplications using custom cookie or header handling should ensure that their request-side behavior matches the effective transport configuration.\u003C/p\u003E\n\u003Cp\u003EFor the distinction between surrogates, tokens, and transport, see \u003Ca href=\u0022/docs/fundamentals/core-concepts\u0022\u003ECore Concepts\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022diagnostics-options\u0022\u003E23. Diagnostics Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Diagnostics\u003C/code\u003E provides optional diagnostic behavior.\u003C/p\u003E\n\u003Cp\u003EThe current property is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Diagnostics.EnableRefreshDetails\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIts default is \u003Ccode\u003Efalse\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-4\u0022\u003EExample\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Diagnostics.EnableRefreshDetails = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen enabled, the option allows additional refresh-related diagnostic response information, such as the \u003Ccode\u003EX-UAuth-Refresh\u003C/code\u003E header.\u003C/p\u003E\n\u003Cp\u003EThis is primarily useful during development and debugging.\u003C/p\u003E\n\u003Cp\u003EAvoid enabling detailed authentication diagnostics in production unless the exposure is understood and justified.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-lifecycle-events\u0022\u003E24. Authentication Lifecycle Events\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Events\u003C/code\u003E exposes server-side authentication lifecycle callbacks.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022available-events\u0022\u003EAvailable Events\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Events.OnAnyEvent\noptions.Events.OnUserLoggedIn\noptions.Events.OnUserLoggedOut\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-login-logging\u0022\u003EExample: Login Logging\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Events.OnUserLoggedIn = context =\u0026gt;\n {\n // Record the successful login.\n return Task.CompletedTask;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-global-event-handler\u0022\u003EExample: Global Event Handler\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Events.OnAnyEvent = context =\u0026gt;\n {\n // Process an authentication lifecycle event.\n return Task.CompletedTask;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ELifecycle events are intended for lightweight reactions such as logging, metrics, and notifications.\u003C/p\u003E\n\u003Cp\u003EThey should not replace security decisions, authentication validation, or application policies.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E for event and extension guidance.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022in-memory-auth-artifact-store\u0022\u003E25. In-Memory Auth Artifact Store\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses a bounded in-memory store by default for temporary authentication artifacts, including PKCE authorization codes and login preview receipts.\u003C/p\u003E\n\u003Cp\u003EExpired artifacts are rejected on access and periodically removed in the background, even when they are never accessed again. The store also enforces a maximum number of entries to prevent unbounded accumulation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDefault configuration\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOption\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthArtifacts.MaxEntries\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E50,000\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMaximum retained artifacts per application instance\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthArtifacts.CleanupInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E1 minute\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EInterval between expiration cleanup passes\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese defaults require no additional configuration.\u003C/p\u003E\n\u003Cp\u003ETo customize them:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthArtifacts.MaxEntries = 200_000;\n options.AuthArtifacts.CleanupInterval = TimeSpan.FromMinutes(5);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen capacity is reached, the store attempts to reclaim expired entries. If it remains full, new artifacts are rejected without evicting valid authentication proofs.\u003C/p\u003E\n\u003Cp\u003EExpiration is always enforced when an artifact is accessed or consumed, independently of the cleanup interval. Atomic consume-once semantics are preserved.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDeployment notes:\u003C/strong\u003E Capacity limits are process-local, not shared across application instances. Custom \u003Ccode\u003EIAuthStore\u003C/code\u003E implementations are responsible for their own expiration and capacity management. Choose limits according to expected authentication traffic and available memory.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022effective-server-options\u0022\u003E26. Effective Server Options\u003C/h2\u003E\n\u003Cp\u003EThe configured \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E instance is the base configuration.\u003C/p\u003E\n\u003Cp\u003EAt runtime, UltimateAuth can resolve:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EEffectiveUAuthServerOptions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe current resolution process is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EConfigured UAuthServerOptions\n |\n v\n Resolve auth mode\n |\n v\n Clone base options\n |\n v\n Apply mode defaults\n |\n v\n Apply ConfigureMode overrides\n |\n v\n EffectiveUAuthServerOptions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis means that the effective settings used for a \u003Ccode\u003EHybrid\u003C/code\u003E client can differ from those used for a \u003Ccode\u003EPureOpaque\u003C/code\u003E client.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-5\u0022\u003EExample\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n\n options.ConfigureMode(UAuthMode.Hybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(5);\n });\n\n options.ConfigureMode(UAuthMode.PureOpaque, mode =\u0026gt;\n {\n mode.Session.IdleTimeout = TimeSpan.FromDays(3);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe original options remain the common starting point.\u003C/p\u003E\n\u003Cp\u003EMode defaults and overrides determine the effective values for the resolved mode.\u003C/p\u003E\n\u003Cp\u003EFor implementation details and inspection of effective options, see \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-and-configuration-safety\u0022\u003E27. Validation and Configuration Safety\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth Server registers multiple options validators and enables startup validation.\u003C/p\u003E\n\u003Cp\u003EThese validators cover areas including:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ELogin settings.\u003C/li\u003E\n\u003Cli\u003ESession settings.\u003C/li\u003E\n\u003Cli\u003EToken settings.\u003C/li\u003E\n\u003Cli\u003EPKCE.\u003C/li\u003E\n\u003Cli\u003EMulti-tenancy.\u003C/li\u003E\n\u003Cli\u003EIdentifier configuration.\u003C/li\u003E\n\u003Cli\u003EPagination.\u003C/li\u003E\n\u003Cli\u003EGeneral server configuration.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-invalid-session-lifetime\u0022\u003EExample: Invalid Session Lifetime\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.SessionIdLifetime = TimeSpan.Zero;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server rejects an invalid session lifetime under the applicable validation rules.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-invalid-base-path\u0022\u003EExample: Invalid Base Path\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;//auth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe general server validator rejects paths containing \u003Ccode\u003E//\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-limitations\u0022\u003EValidation Limitations\u003C/h3\u003E\n\u003Cp\u003EStartup validation protects the configured options according to the registered validators.\u003C/p\u003E\n\u003Cp\u003EIt does not guarantee that every custom service implementation or mode-specific override is secure.\u003C/p\u003E\n\u003Cp\u003EWhen using advanced customization, test the resulting effective configuration and authentication flows.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022complete-configuration-example\u0022\u003E28. Complete Configuration Example\u003C/h2\u003E\n\u003Cp\u003EThe following example combines several commonly used server settings.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n // Authentication modes\n options.AllowedModes =\n [\n UAuthMode.PureOpaque,\n UAuthMode.Hybrid\n ];\n\n // Login security\n options.Login.MaxFailedAttempts = 5;\n options.Login.LockoutDuration = TimeSpan.FromMinutes(15);\n options.Login.IncludeFailureDetails = false;\n\n // Sessions\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n options.Session.MaxLifetime = TimeSpan.FromDays(30);\n\n // Token identity\n options.Token.Issuer = \u0026quot;MyApplication\u0026quot;;\n options.Token.Audience = \u0026quot;MyApplicationApi\u0026quot;;\n\n // Hybrid-specific token lifetime\n options.ConfigureMode(UAuthMode.Hybrid, mode =\u0026gt;\n {\n mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n });\n\n // PKCE\n options.Pkce.AuthorizationCodeLifetimeSeconds = 120;\n\n // Hub deployment\n options.HubDeploymentMode = UAuthHubDeploymentMode.Integrated;\n options.Hub.ClientBaseAddress = \u0026quot;https://app.example.com\u0026quot;;\n options.Hub.AllowedClientOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n\n // Credential security\n options.CredentialSessionPolicy.OnSelfChange = CredentialSessionBehavior.PreserveCurrent;\n options.CredentialSessionPolicy.OnAdminChange = CredentialSessionBehavior.RevokeAll;\n options.CredentialSessionPolicy.OnRecovery = CredentialSessionBehavior.RevokeAll;\n\n // Credential recovery\n options.ResetCredential.TokenValidity = TimeSpan.FromMinutes(30);\n options.ResetCredential.MaxAttempts = 3;\n\n // Identifier login rules\n options.LoginIdentifiers.RequireVerificationForEmail = true;\n\n // Endpoint exposure\n options.Endpoints.Authentication = true;\n options.Endpoints.Session = true;\n options.Endpoints.Credentials = true;\n options.Endpoints.Authorization = true;\n\n // Pagination\n options.Pagination.DefaultPageSize = 50;\n options.Pagination.MaxPageSize = 200;\n\n // Diagnostics\n options.Diagnostics.EnableRefreshDetails = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is an illustrative configuration, not a universal production preset.\u003C/p\u003E\n\u003Cp\u003EApplications should choose session lifetimes, authentication modes, credential transport, tenant behavior, and endpoint exposure according to their own deployment and security requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-configuration-mistakes\u0022\u003E29. Common Configuration Mistakes\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuring-core-options-separately\u0022\u003EConfiguring Core Options Separately\u003C/h3\u003E\n\u003Cp\u003EWhen using \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E, configure Core-defined options through \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EA separate \u003Ccode\u003EUAuthOptions\u003C/code\u003E configuration does not automatically override the server\u0027s composed options.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-allowedmodes-selects-the-mode\u0022\u003EAssuming AllowedModes Selects the Mode\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E is a restriction.\u003C/p\u003E\n\u003Cp\u003EMode selection is performed by the authentication mode resolver.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022ignoring-mode-defaults\u0022\u003EIgnoring Mode Defaults\u003C/h3\u003E\n\u003Cp\u003EMode-specific defaults can replace globally configured values.\u003C/p\u003E\n\u003Cp\u003EUse \u003Ccode\u003EConfigureMode()\u003C/code\u003E for explicit mode-specific behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022treating-reserved-session-options-as-enforced-security-features\u0022\u003ETreating Reserved Session Options as Enforced Security Features\u003C/h3\u003E\n\u003Cp\u003ESome device and session-chain options are reserved for future enforcement.\u003C/p\u003E\n\u003Cp\u003EVerify actual runtime support before relying on them.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022exposing-unnecessary-endpoints\u0022\u003EExposing Unnecessary Endpoints\u003C/h3\u003E\n\u003Cp\u003EDisable endpoint groups or actions that the application does not require.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022allowing-query-string-credentials-without-a-specific-need\u0022\u003EAllowing Query-String Credentials Without a Specific Need\u003C/h3\u003E\n\u003Cp\u003EQuery-string credentials can leak through URLs and infrastructure logs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022weakening-cookie-security\u0022\u003EWeakening Cookie Security\u003C/h3\u003E\n\u003Cp\u003EDo not relax secure transport or cookie protections without understanding the consequences.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-configuration-validation-covers-everything\u0022\u003EAssuming Configuration Validation Covers Everything\u003C/h3\u003E\n\u003Cp\u003EStartup validation does not replace testing, infrastructure security, or validation of custom extension implementations.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-options-quick-reference\u0022\u003E30. Server Options Quick Reference\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConfiguration group\u003C/th\u003E\n\u003Cth\u003ETypical use\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPermitted authentication modes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthArtifacts\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIn-memory authentication artifact capacity and expiration cleanup\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential delivery\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EConfigureMode()\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMode-specific option overrides\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECookie\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECookie security and scope\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECredentialSessionPolicy\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession invalidation after credential changes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceLimits\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnforced global and per-type active-device admission limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDiagnostics\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh diagnostics\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEndpoint exposure\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication lifecycle callbacks\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EGrantDelivery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EGrant transport and credential resolution\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHub\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub integration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHubDeploymentMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHub deployment topology\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIdentifiers\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifier behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIdentifierValidation\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifier validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin attempts and lockout\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELoginIdentifiers\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin identifier eligibility\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant resolution\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENavigation\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication redirects\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOnConfigureEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAdvanced endpoint customization\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPagination\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EQuery page limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE code lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResetCredential\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential recovery rules\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession expiration and lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EToken\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EToken issuance and lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUserProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMulti-profile capability\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-steps\u0022\u003ENext Steps\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/configuration\u0022\u003EConfiguration Overview\u003C/a\u003E \u2014 Understand the configuration architecture and precedence.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E \u2014 Configure client SDK behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E \u2014 Explore effective options, mode resolution, and extension points.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client/session-management\u0022\u003ESession Management\u003C/a\u003E \u2014 Manage sessions through the client.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client/authentication\u0022\u003EAuthentication\u003C/a\u003E \u2014 Use the client authentication flows.\u003C/li\u003E\n\u003C/ul\u003E\n", "Headings": [ { "Id": "register-ultimateauth-server", @@ -79,8 +79,8 @@ "Level": 1 }, { - "Id": "session-identifiers-and-credentials", - "Text": "Session identifiers and credentials", + "Id": "session-identifiers-and-surrogates", + "Text": "Session identifiers and surrogates", "Level": 1 }, { @@ -129,8 +129,8 @@ "Level": 1 }, { - "Id": "a.validation-options", - "Text": "7/A. Validation Options", + "Id": "validation-options", + "Text": "8. Validation Options", "Level": 0 }, { @@ -155,7 +155,7 @@ }, { "Id": "endpoint-options", - "Text": "8. Endpoint Options", + "Text": "9. Endpoint Options", "Level": 0 }, { @@ -179,33 +179,33 @@ "Level": 1 }, { - "Id": "credential-resolution", - "Text": "9. Credential Resolution", + "Id": "surrogate-resolution", + "Text": "10. Surrogate Resolution", "Level": 0 }, { - "Id": "primary-authentication-credential", - "Text": "Primary Authentication Credential", + "Id": "primary-surrogate", + "Text": "Primary Surrogate", "Level": 1 }, { - "Id": "credential-transport", - "Text": "Credential Transport", + "Id": "incoming-transport", + "Text": "Incoming Transport", "Level": 1 }, { - "Id": "default-request-header-names", - "Text": "Default Request Header Names", + "Id": "default-request-headers", + "Text": "Default Request Headers", "Level": 1 }, { - "Id": "configuration-consistency", - "Text": "Configuration Consistency", + "Id": "transport-collisions", + "Text": "Transport Collisions", "Level": 1 }, { "Id": "cookie-configuration", - "Text": "10. Cookie Configuration", + "Text": "11. Cookie Configuration", "Level": 0 }, { @@ -230,7 +230,7 @@ }, { "Id": "hub-deployment-mode", - "Text": "11. Hub Deployment Mode", + "Text": "12. Hub Deployment Mode", "Level": 0 }, { @@ -255,7 +255,7 @@ }, { "Id": "hub-options", - "Text": "12. Hub Options", + "Text": "13. Hub Options", "Level": 0 }, { @@ -268,11 +268,6 @@ "Text": "Example", "Level": 1 }, - { - "Id": "primary-credential-selection", - "Text": "13. Primary Credential Selection", - "Level": 0 - }, { "Id": "credential-session-policy", "Text": "14. Credential Session Policy", @@ -434,38 +429,38 @@ "Level": 1 }, { - "Id": "credential-delivery-and-authentication-responses", - "Text": "22. Credential Delivery and Authentication Responses", + "Id": "surrogate-transport-and-authentication-responses", + "Text": "22. Surrogate Transport and Authentication Responses", "Level": 0 }, { - "Id": "mode-specific-delivery-defaults", - "Text": "Mode-Specific Delivery Defaults", + "Id": "transport-configuration", + "Text": "Transport Configuration", "Level": 1 }, { - "Id": "configure-grant-delivery", - "Text": "Configure Grant Delivery", + "Id": "default-transports", + "Text": "Default Transports", "Level": 1 }, { - "Id": "request-and-response-headers", - "Text": "Request and Response Headers", + "Id": "configure-surrogate-transport", + "Text": "Configure Surrogate Transport", "Level": 1 }, { - "Id": "redirect-configuration", - "Text": "Redirect Configuration", + "Id": "request-and-response-headers", + "Text": "Request and Response Headers", "Level": 1 }, { - "Id": "login-transport-discovery", - "Text": "Login Transport Discovery", + "Id": "redirect-behavior", + "Text": "Redirect Behavior", "Level": 1 }, { - "Id": "security-considerations", - "Text": "Security Considerations", + "Id": "compatibility", + "Text": "Compatibility", "Level": 1 }, { @@ -594,6 +589,6 @@ "Level": 0 } ], - "SourceHash": "30BE9A5D40E59047F46A420220E092442A015B259D3F5119EF4A1265A746D174", + "SourceHash": "9538BF92AC95AB52A37CD75F0E1D12F0AAC3DB3860C607280BC3C53B69602BE1", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/docs-index.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/docs-index.json index a825eb99..9932d22a 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/docs-index.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/docs-index.json @@ -34,45 +34,52 @@ "Group": "fundamentals", "GroupOrder": 2 }, + { + "Title": "Core Concepts", + "Slug": "fundamentals/core-concepts", + "Order": 2, + "Group": "fundamentals", + "GroupOrder": 2 + }, { "Title": "Authentication Model", "Slug": "fundamentals/auth-model", - "Order": 2, + "Order": 3, "Group": "fundamentals", "GroupOrder": 2 }, { "Title": "Flow-Based Authentication", "Slug": "fundamentals/flow-based-auth", - "Order": 3, + "Order": 4, "Group": "fundamentals", "GroupOrder": 2 }, { "Title": "Authentication Modes", "Slug": "fundamentals/auth-modes", - "Order": 4, + "Order": 5, "Group": "fundamentals", "GroupOrder": 2 }, { "Title": "Application Profiles", "Slug": "fundamentals/application-profiles", - "Order": 5, + "Order": 6, "Group": "fundamentals", "GroupOrder": 2 }, { "Title": "Runtime Architecture", "Slug": "fundamentals/runtime-architecture", - "Order": 6, + "Order": 7, "Group": "fundamentals", "GroupOrder": 2 }, { "Title": "Request Lifecycle", "Slug": "fundamentals/request-lifecycle", - "Order": 7, + "Order": 8, "Group": "fundamentals", "GroupOrder": 2 }, diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/application-profiles.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/application-profiles.json index a3f2ad00..19e8aa94 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/application-profiles.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/application-profiles.json @@ -149,6 +149,6 @@ "Level": 0 } ], - "SourceHash": "2325A6990BD64EC79999F4942D5AD8EF329DCA2FCA03352EAFB7D49407AA3394", + "SourceHash": "3DB7A8B3B15CE9F428ED44B3C4772B5A0E46A48185DC83CC1F15AEA3EEFB3B7D", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/auth-model.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/auth-model.json index f26ccf91..db823a71 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/auth-model.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/auth-model.json @@ -159,6 +159,6 @@ "Level": 0 } ], - "SourceHash": "1B21BD5DC9880EB6EB96786B7CEF98F384BFE49AD8F09D3311A896F93796DDB4", + "SourceHash": "71BBCE72A593CB812BF2CF874F79C7D14CC938563002FA4137CE853C394B11C0", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/auth-modes.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/auth-modes.json index 634d5734..d74c7452 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/auth-modes.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/auth-modes.json @@ -124,6 +124,6 @@ "Level": 0 } ], - "SourceHash": "21F585C4326CCE9EEE80AC39DBE4D657C9B196419228134893C75789A2B43541", + "SourceHash": "EBF619437BC9229B19C7B22F7DD37EEDB616E7A1B4BD31317D45DF1DF87B13EE", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/core-concepts.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/core-concepts.json new file mode 100644 index 00000000..6fd70e25 --- /dev/null +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/core-concepts.json @@ -0,0 +1,64 @@ +{ + "Slug": "fundamentals/core-concepts", + "Title": "Core Concepts", + "Html": "\n\u003Cp\u003EAuthentication is more than signing in, issuing a token, or checking whether a request is authorized. It is an ongoing relationship between an identity, an application, and the authority responsible for establishing trust.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth builds this relationship around a small set of well-defined concepts. These concepts remain consistent across different applications, authentication modes, and deployment architectures.\u003C/p\u003E\n\u003Cp\u003EUnderstanding them makes it easier to reason about authentication without getting lost in its implementation details.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022identity-identifier-and-credential\u0022\u003EIdentity, Identifier, and Credential\u003C/h2\u003E\n\u003Cp\u003EAuthentication begins with three closely related but distinct concepts.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConcept\u003C/th\u003E\n\u003Cth\u003EMeaning\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EIdentity\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EWho the user is within the system.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EIdentifier\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EHow the user is recognized, such as a username or email address.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ECredential\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EWhat the user presents to establish proof of their identity.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EAn identifier helps the system find an identity. A credential helps establish trust in that identity.\u003C/p\u003E\n\u003Cp\u003EKeeping these concepts separate allows an identity to evolve independently of the identifiers and credentials associated with it.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022surrogate-continuing-authentication\u0022\u003ESurrogate \u2014 Continuing Authentication\u003C/h2\u003E\n\u003Cp\u003EOnce an identity has been authenticated, repeatedly presenting the original credential would be unnecessary and would increase its exposure.\u003C/p\u003E\n\u003Cp\u003EThe concept of a \u003Cstrong\u003Esurrogate\u003C/strong\u003E aims to address this.\u003C/p\u003E\n\u003Cp\u003EA surrogate is system-issued secondary authentication data that substitutes for the original credential during subsequent authenticated interactions.\u003C/p\u003E\n\u003Cp\u003EThink of a surrogate as a stunt double. Instead of exposing the original actor to every risky scene, a substitute takes their place. Similarly, a surrogate allows authentication to continue without repeatedly exposing the original credential.\u003C/p\u003E\n\u003Cp\u003EUnlike the original credential, a surrogate can have its own lifetime, restrictions, and renewal rules. Depending on the authentication mode, it may also be independently invalidated.\u003C/p\u003E\n\u003Cp\u003EUsers do not need to know, understand, or remember their surrogates. UltimateAuth and the participating applications manage them on the user\u0027s behalf.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022surrogates-and-tokens\u0022\u003ESurrogates and Tokens\u003C/h3\u003E\n\u003Cp\u003EA \u003Cstrong\u003Esurrogate\u003C/strong\u003E describes the role of authentication data. A \u003Cstrong\u003Etoken\u003C/strong\u003E is its concrete representation.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth recognizes three kinds of authentication surrogates:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ESurrogate\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESession ID\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EReferences a server-managed authenticated session.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EAccess Token\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EProvides authentication for subsequent requests.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERefresh Token\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ERenews authentication without presenting the original credential again.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003ENot every authentication mode uses all three kinds.\u003C/p\u003E\n\u003Cp\u003EA token may be opaque or self-contained, such as a JWT. Its format does not define its purpose.\u003C/p\u003E\n\u003Cp\u003ESimilarly, a session identifier carried only as metadata is not a surrogate unless it can itself be used for authentication.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authority-and-lineage\u0022\u003EAuthority and Lineage\u003C/h2\u003E\n\u003Cp\u003EAuthentication requires an \u003Cstrong\u003Eauthority\u003C/strong\u003E responsible for establishing trust and defining the rules under which that trust continues.\u003C/p\u003E\n\u003Cp\u003EIn UltimateAuth, the authentication authority governs authentication, token issuance, and the applicable lifecycle policies.\u003C/p\u003E\n\u003Cp\u003EAuthority does not necessarily require a server-side lookup for every request. Different authentication modes allow trust to be evaluated in different ways.\u003C/p\u003E\n\u003Cp\u003EWhen server-managed authentication continuity is required, UltimateAuth organizes it through a structure called \u003Cstrong\u003Elineage\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003ELineage consists of three levels:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ERoot\u003C/strong\u003E \u2014 The user-level authentication authority.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EChain\u003C/strong\u003E \u2014 A continuous authentication lifecycle, typically associated with a device context.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESession\u003C/strong\u003E \u2014 An individual authenticated instance within a chain.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThis structure allows UltimateAuth to distinguish between renewing a session, ending a particular authentication lifecycle, and managing authentication at the user level.\u003C/p\u003E\n\u003Cp\u003ENot every authentication mode requires lineage.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022flow-mode-and-application-profile\u0022\u003EFlow, Mode, and Application Profile\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates three dimensions of authentication that are often tightly coupled in traditional implementations.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConcept\u003C/th\u003E\n\u003Cth\u003EQuestion it answers\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EFlow\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EWhat authentication operation is taking place?\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EMode\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EHow is authentication established and maintained?\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EApplication Profile\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EWhat kind of application is participating?\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EA login, refresh, or logout is a \u003Cstrong\u003Eflow\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EPureOpaque, Hybrid, SemiHybrid, and PureJwt are authentication \u003Cstrong\u003Emodes\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EBlazor, .NET MAUI, web servers, and Resource APIs represent different \u003Cstrong\u003Eapplication profiles\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThese dimensions work together without being treated as the same concern. A login remains a login regardless of the selected authentication mode or the application initiating it.\u003C/p\u003E\n\u003Cp\u003EThis separation is what allows UltimateAuth to provide a unified authentication experience across different environments.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022transport\u0022\u003ETransport\u003C/h2\u003E\n\u003Cp\u003EAuthentication data needs a way to travel between participating applications.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ETransport\u003C/strong\u003E defines how a surrogate is carried, such as through an HTTP cookie or header.\u003C/p\u003E\n\u003Cp\u003ETransport is independent of the surrogate\u0027s purpose and token format. An access token does not become a different kind of surrogate simply because it is transported through a cookie instead of a header.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth uses application-aware defaults to reduce configuration complexity while allowing developers to customize transport when their architecture requires it.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-authorization-and-policy\u0022\u003EValidation, Authorization, and Policy\u003C/h2\u003E\n\u003Cp\u003EReceiving authentication data does not automatically establish trust.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth distinguishes between three responsibilities:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EValidation\u003C/strong\u003E determines whether authentication evidence can be trusted.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EAuthorization\u003C/strong\u003E determines whether an authenticated identity is permitted to perform an operation.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EPolicy\u003C/strong\u003E defines the rules and conditions under which these decisions are made.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThis distinction allows authentication to remain consistent while applications define their own security requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022tenant-and-device\u0022\u003ETenant and Device\u003C/h2\u003E\n\u003Cp\u003EAuthentication also takes place within a context.\u003C/p\u003E\n\u003Cp\u003EA \u003Cstrong\u003Etenant\u003C/strong\u003E represents an isolation boundary within an application or system.\u003C/p\u003E\n\u003Cp\u003EA \u003Cstrong\u003Edevice\u003C/strong\u003E represents the client context associated with an authenticated interaction. It is not necessarily a physical device; it may represent a browser, an application installation, or another client environment.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth treats tenant and device context as first-class architectural concerns rather than features that must be added around authentication afterward.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022bringing-it-all-together\u0022\u003EBringing It All Together\u003C/h2\u003E\n\u003Cp\u003EConsider a user signing in to an application.\u003C/p\u003E\n\u003Cp\u003EThe user provides an identifier and a credential. The authentication authority establishes trust in the identity and issues the appropriate surrogates. Those surrogates are transported according to the application\u0027s configuration and validated during subsequent interactions.\u003C/p\u003E\n\u003Cp\u003EDepending on the authentication mode, UltimateAuth may also maintain a server-managed lineage to govern authentication continuity.\u003C/p\u003E\n\u003Cp\u003EThe application can then make authorization decisions without requiring the user to repeatedly prove their identity.\u003C/p\u003E\n\u003Cp\u003EThe underlying mechanisms may differ, but the conceptual model remains the same.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022one-model-different-applications\u0022\u003EOne Model, Different Applications\u003C/h2\u003E\n\u003Cp\u003EThe purpose of these concepts is not to introduce more terminology for developers to memorize.\u003C/p\u003E\n\u003Cp\u003EIt is to make authentication easier to understand, configure, and reason about.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth aims to keep the developer experience simple without making the underlying security architecture simplistic. By separating concerns that have different responsibilities, it allows applications to evolve without requiring authentication to be redesigned each time.\u003C/p\u003E\n\u003Cp\u003EYou do not need to understand every internal mechanism to start using UltimateAuth. These concepts provide a foundation that becomes increasingly useful as your application grows.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022whats-next\u0022\u003EWhat\u0027s Next?\u003C/h2\u003E\n\u003Cp\u003EExplore how these concepts work together in the \u003Ca href=\u0022/docs/fundamentals/auth-model\u0022\u003EAuthentication Model\u003C/a\u003E.\u003C/p\u003E\n", + "Headings": [ + { + "Id": "identity-identifier-and-credential", + "Text": "Identity, Identifier, and Credential", + "Level": 0 + }, + { + "Id": "surrogate-continuing-authentication", + "Text": "Surrogate \u2014 Continuing Authentication", + "Level": 0 + }, + { + "Id": "surrogates-and-tokens", + "Text": "Surrogates and Tokens", + "Level": 1 + }, + { + "Id": "authority-and-lineage", + "Text": "Authority and Lineage", + "Level": 0 + }, + { + "Id": "flow-mode-and-application-profile", + "Text": "Flow, Mode, and Application Profile", + "Level": 0 + }, + { + "Id": "transport", + "Text": "Transport", + "Level": 0 + }, + { + "Id": "validation-authorization-and-policy", + "Text": "Validation, Authorization, and Policy", + "Level": 0 + }, + { + "Id": "tenant-and-device", + "Text": "Tenant and Device", + "Level": 0 + }, + { + "Id": "bringing-it-all-together", + "Text": "Bringing It All Together", + "Level": 0 + }, + { + "Id": "one-model-different-applications", + "Text": "One Model, Different Applications", + "Level": 0 + }, + { + "Id": "whats-next", + "Text": "What\u0027s Next?", + "Level": 0 + } + ], + "SourceHash": "A2E28159C405869011D3CF0FF2A9DE84F32D437146A30393D18E5B3BE9254DE6", + "BuilderVersion": "1" +} \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/flow-based-auth.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/flow-based-auth.json index cc66f642..a920d505 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/flow-based-auth.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/flow-based-auth.json @@ -89,6 +89,6 @@ "Level": 0 } ], - "SourceHash": "1AB5ADCC5EF8D2C84A67D6D9AF69B2C347E7CBDF2FC76A8AF6CC8A4BB7F261C7", + "SourceHash": "E0C743870B9E858E6AF7168CF47F167A3FA8E0AB558607AE376EDF3BD40A0D9E", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/request-lifecycle.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/request-lifecycle.json index 828e8d96..85a0514f 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/request-lifecycle.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/request-lifecycle.json @@ -119,6 +119,6 @@ "Level": 0 } ], - "SourceHash": "1EE5BF2FBB50B9DB67310AE106084A2AF88AFC8038318BBAE8CCDC5A1EEA7B7A", + "SourceHash": "BBECE8B55ACE7D6CDF05612E79194727F28AE4E6F9C91E655EEDE648304D767B", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/runtime-architecture.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/runtime-architecture.json index 8cb01b7b..727be7f4 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/runtime-architecture.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/runtime-architecture.json @@ -1,7 +1,7 @@ { "Slug": "fundamentals/runtime-architecture", "Title": "Runtime Architecture", - "Html": "\n\u003Cp\u003EUltimateAuth is designed to provide a unified authentication architecture across different .NET application environments.\u003C/p\u003E\n\u003Cp\u003EA Blazor Server application, a standalone Blazor WebAssembly application, a native MAUI application, and a resource API may have different execution models, but they should not require entirely separate authentication systems.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth addresses this through a separation between \u003Cstrong\u003Eauthentication infrastructure, client integration, hosting, and protected resources\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThis separation allows authentication behavior to remain consistent while adapting to the capabilities and responsibilities of each runtime.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022architectural-overview\u0022\u003EArchitectural overview\u003C/h2\u003E\n\u003Cp\u003EAt a high level, UltimateAuth consists of several cooperating layers:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ECore:\u003C/strong\u003E Shared authentication contracts, models, and foundational abstractions.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EServer:\u003C/strong\u003E Authentication operations, security decisions, credential management, and persistence coordination.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EClient:\u003C/strong\u003E Client-side integration, authentication requests, and credential lifecycle handling.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUAuthHub:\u003C/strong\u003E The application hosting UltimateAuth\u0027s authentication endpoints and services.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EResource applications:\u003C/strong\u003E Applications and APIs that consume authenticated identity and enforce authorization.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese are architectural responsibilities, not necessarily separate processes or deployments.\u003C/p\u003E\n\u003Cp\u003EA single application may host multiple responsibilities. Alternatively, they can be distributed across independently deployed services.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003E Application Clients\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 \u2502 \u2502\n Blazor WASM MAUI Other Clients\n \u2502 \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u2502 HTTP\n \u25BC\n UAuthHub\n \u2502\n UltimateAuth Server\n \u2502\n Authentication Services\n \u2502\n Stores / Providers\n \u2502\n \u25BC\n Persistent State\n\n\n Protected Resources\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 \u2502 \u2502\n Resource API Web App Other Services\n \u2502 \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n Authentication Validation\n \u2502\n Authorization\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis diagram illustrates the separation of responsibilities.\u003C/p\u003E\n\u003Cp\u003EIt does not imply that every authenticated resource request must pass through UAuthHub.\u003C/p\u003E\n\u003Cp\u003EWhether a protected resource needs to consult server-side authentication infrastructure depends on the effective authentication mode and its validation requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022core-shared-authentication-foundations\u0022\u003ECore: shared authentication foundations\u003C/h2\u003E\n\u003Cp\u003EThe Core layer defines the common concepts used throughout UltimateAuth.\u003C/p\u003E\n\u003Cp\u003EIts responsibility is to provide stable contracts and abstractions without depending on a particular client runtime or application host.\u003C/p\u003E\n\u003Cp\u003EThese foundations include concepts such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication modes.\u003C/li\u003E\n\u003Cli\u003EAuthentication and security contexts.\u003C/li\u003E\n\u003Cli\u003EAuthentication results and contracts.\u003C/li\u003E\n\u003Cli\u003EDomain models and shared abstractions.\u003C/li\u003E\n\u003Cli\u003ESecurity-related options and definitions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe Core layer provides the common vocabulary used by client integrations, server services, and other framework components.\u003C/p\u003E\n\u003Cp\u003EIt should not contain assumptions that authentication always occurs through an HTTP endpoint, a browser cookie, or a particular hosting model.\u003C/p\u003E\n\u003Cp\u003EThis separation is important because UltimateAuth supports both stateful and stateless authentication strategies.\u003C/p\u003E\n\u003Cp\u003EA shared authentication contract must not implicitly require session persistence when the selected mode does not use sessions.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-authentication-execution-and-lifecycle\u0022\u003EServer: authentication execution and lifecycle\u003C/h2\u003E\n\u003Cp\u003EThe Server layer implements the server-side authentication capabilities.\u003C/p\u003E\n\u003Cp\u003EIt coordinates the operations required to establish, continue, validate, and terminate authentication according to the effective mode and security policies.\u003C/p\u003E\n\u003Cp\u003EIts responsibilities include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication flow execution.\u003C/li\u003E\n\u003Cli\u003ECredential validation and management.\u003C/li\u003E\n\u003Cli\u003ESession and token lifecycle operations.\u003C/li\u003E\n\u003Cli\u003EAuthentication security decisions.\u003C/li\u003E\n\u003Cli\u003ECoordination with persistence providers.\u003C/li\u003E\n\u003Cli\u003ECredential issuance and validation.\u003C/li\u003E\n\u003Cli\u003EIntegration with server-side authorization infrastructure.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe Server layer contains multiple cooperating services rather than one universal authentication engine responsible for every decision.\u003C/p\u003E\n\u003Cp\u003EFor example, session lifecycle operations, credential verification, and authorization may follow different execution paths while sharing common security contracts.\u003C/p\u003E\n\u003Cp\u003EThe architecture separates orchestration from the underlying services that perform domain-specific work.\u003C/p\u003E\n\u003Cp\u003EFor the detailed execution pipeline, see \u003Ca href=\u0022/docs/auth-flows/overview\u0022\u003EAuth Flows\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-runtime-integration\u0022\u003EClient: runtime integration\u003C/h2\u003E\n\u003Cp\u003EThe Client layer provides the integration between an application and UltimateAuth\u0027s authentication services.\u003C/p\u003E\n\u003Cp\u003EIts purpose is to reduce the amount of authentication infrastructure that application developers need to implement themselves.\u003C/p\u003E\n\u003Cp\u003EDepending on the supported runtime and configuration, client integration may handle:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EInitiating authentication flows.\u003C/li\u003E\n\u003Cli\u003ECommunicating with UAuthHub.\u003C/li\u003E\n\u003Cli\u003EProcessing authentication outcomes.\u003C/li\u003E\n\u003Cli\u003EManaging supported credential delivery mechanisms.\u003C/li\u003E\n\u003Cli\u003ECoordinating authentication state with the application.\u003C/li\u003E\n\u003Cli\u003EIntegrating authenticated requests with protected resources.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe client SDK does not replace server-side authentication validation.\u003C/p\u003E\n\u003Cp\u003EIt provides an application-facing interface to the authentication infrastructure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-integration-is-runtime-aware\u0022\u003EClient integration is runtime-aware\u003C/h3\u003E\n\u003Cp\u003EDifferent client runtimes have different capabilities.\u003C/p\u003E\n\u003Cp\u003EA browser-based WebAssembly application executes within browser security restrictions.\u003C/p\u003E\n\u003Cp\u003EA native MAUI application has access to platform-specific capabilities.\u003C/p\u003E\n\u003Cp\u003EA Blazor Server application executes application logic on the server while maintaining an interactive connection with the browser.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth accounts for these differences through runtime-specific integrations and Application Profiles.\u003C/p\u003E\n\u003Cp\u003EThe authentication model remains shared even when the implementation of credential transport or application state differs.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/application-profiles\u0022\u003EApplication Profiles\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022uauthhub-the-authentication-host\u0022\u003EUAuthHub: the authentication host\u003C/h2\u003E\n\u003Cp\u003EUAuthHub is the application hosting UltimateAuth\u0027s server-side authentication infrastructure.\u003C/p\u003E\n\u003Cp\u003EIt provides the environment in which authentication endpoints and the required server services are available.\u003C/p\u003E\n\u003Cp\u003EDepending on the deployment, UAuthHub can be responsible for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAccepting authentication requests.\u003C/li\u003E\n\u003Cli\u003EResolving the applicable tenant and authentication context.\u003C/li\u003E\n\u003Cli\u003EExecuting authentication flows.\u003C/li\u003E\n\u003Cli\u003EManaging credentials and sessions.\u003C/li\u003E\n\u003Cli\u003EIssuing authentication credentials.\u003C/li\u003E\n\u003Cli\u003EApplying configured authentication policies.\u003C/li\u003E\n\u003Cli\u003EExposing the supported authentication endpoints.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EUAuthHub is a hosting role, not an authentication mode.\u003C/p\u003E\n\u003Cp\u003EA single UAuthHub can support multiple client environments and authentication strategies, subject to its configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022centralized-hosting\u0022\u003ECentralized hosting\u003C/h3\u003E\n\u003Cp\u003EIn a centralized deployment, several applications can use the same UAuthHub.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EBlazor WASM Application \u2500\u2500\u2510\n \u2502\nMAUI Application \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u25BA UAuthHub\n \u2502 \u2502\nWeb Application \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n \u25BC\n Authentication Services\n \u2502\n \u25BC\n Authentication Storage\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis allows applications to share authentication infrastructure without requiring each application to implement its own credential management and authentication lifecycle.\u003C/p\u003E\n\u003Cp\u003EHowever, centralized authentication hosting does not mean that all protected resource requests must be routed through UAuthHub.\u003C/p\u003E\n\u003Cp\u003EThe resource authentication strategy remains mode-dependent.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-applications-and-apis\u0022\u003EResource applications and APIs\u003C/h2\u003E\n\u003Cp\u003EA resource application is an application or service that exposes functionality requiring authentication and authorization.\u003C/p\u003E\n\u003Cp\u003EExamples include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EA protected Web API.\u003C/li\u003E\n\u003Cli\u003EAn administrative web application.\u003C/li\u003E\n\u003Cli\u003EA business application backend.\u003C/li\u003E\n\u003Cli\u003EAn independently deployed service.\u003C/li\u003E\n\u003Cli\u003EA server-rendered application with protected operations.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA resource application must establish the caller\u0027s authenticated identity before allowing access to protected functionality.\u003C/p\u003E\n\u003Cp\u003EIt must then enforce the relevant authorization policies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-validation-depends-on-the-mode\u0022\u003EAuthentication validation depends on the mode\u003C/h3\u003E\n\u003Cp\u003EResource applications use the authentication strategy selected for their deployment.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth supports three validation paths across its four authentication modes.\u003C/p\u003E\n\u003Ch4 id=\u0022server-authoritative-validation\u0022\u003EServer-authoritative validation\u003C/h4\u003E\n\u003Cp\u003EPureOpaque and Hybrid require authoritative validation of the presented opaque session credential.\u003C/p\u003E\n\u003Cp\u003EIn a distributed deployment, a Resource API delegates session validation to UAuthHub.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EClient\n |\n | Opaque session credential\n v\nResource API\n |\n | Authoritative validation\n v\nUAuthHub\n |\n v\nSession infrastructure\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch4 id=\u0022local-jwt-validation\u0022\u003ELocal JWT validation\u003C/h4\u003E\n\u003Cp\u003ESemiHybrid and PureJwt support local JWT validation using trusted verification keys and explicit token-validation configuration.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EClient\n |\n | JWT access token\n v\nResource API\n |\n v\nLocal JWT validation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA Resource API does not need to contact UAuthHub for ordinary local JWT validation.\u003C/p\u003E\n\u003Ch4 id=\u0022selective-authoritative-validation\u0022\u003ESelective authoritative validation\u003C/h4\u003E\n\u003Cp\u003ESemiHybrid combines local JWT validation with authoritative session validation when required by the protected operation.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EClient\n |\n | JWT access token\n v\nResource API\n |\n v\nLocal JWT validation\n |\n \u002B-- Standard\n | |\n | v\n | Continue access checks\n |\n \u002B-- HubValidated\n |\n v\n UAuthHub\n |\n v\n Session infrastructure\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIn an integrated deployment, authoritative validation can execute directly against the local session infrastructure without a remote HTTP call.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022uauthhub-is-a-logical-authentication-authority\u0022\u003EUAuthHub is a logical authentication authority\u003C/h3\u003E\n\u003Cp\u003EAuthoritative validation does not imply that every application must deploy a separate authentication server.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth can execute authentication and lifecycle operations within the application itself or delegate them to a separately hosted UAuthHub.\u003C/p\u003E\n\u003Cp\u003EThe deployment topology determines where authoritative operations execute.\u003C/p\u003E\n\u003Cp\u003EThe authentication mode determines when those operations are required.\u003C/p\u003E\n\u003Cp\u003EThese are independent architectural decisions.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-architecture-can-evolve\u0022\u003EAuthentication architecture can evolve\u003C/h3\u003E\n\u003Cp\u003EApplications can start with integrated authentication and later introduce a dedicated UAuthHub, separate Resource APIs, or local JWT validation.\u003C/p\u003E\n\u003Cp\u003EThe shared UltimateAuth APIs remain consistent across these architectural choices.\u003C/p\u003E\n\u003Cp\u003EChanging the deployment topology may require infrastructure and configuration changes, but does not inherently require a different application-level authentication programming model.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E\nand \u003Ca href=\u0022/docs/fundamentals/request-lifecycle\u0022\u003ERequest Lifecycle\u003C/a\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-remains-local-to-the-protected-operation\u0022\u003EAuthorization remains local to the protected operation\u003C/h3\u003E\n\u003Cp\u003EAuthentication establishes who the caller is.\u003C/p\u003E\n\u003Cp\u003EAuthorization determines whether that caller may perform the requested operation.\u003C/p\u003E\n\u003Cp\u003EA valid authentication credential does not automatically grant permission to every resource.\u003C/p\u003E\n\u003Cp\u003EResource applications must continue to enforce their authorization requirements through the applicable framework and application policies.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth\u0027s authentication integration should preserve these boundaries rather than replacing resource authorization with client-side assumptions.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022deployment-topology\u0022\u003EDeployment topology\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates architectural responsibilities from physical deployment boundaries.\u003C/p\u003E\n\u003Cp\u003EThis means the same authentication architecture can support different deployment topologies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022integrated-deployment\u0022\u003EIntegrated deployment\u003C/h3\u003E\n\u003Cp\u003EAn integrated deployment hosts authentication infrastructure and application functionality within the same server application.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EASP.NET Core Application\n \u2502\n \u251C\u2500\u2500 UltimateAuth Server\n \u2502\n \u251C\u2500\u2500 Authentication Services\n \u2502\n \u251C\u2500\u2500 Application Services\n \u2502\n \u2514\u2500\u2500 Protected Endpoints\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIn this model, authentication services and protected application functionality may share the same dependency injection container and process.\u003C/p\u003E\n\u003Cp\u003EWhere supported, internal operations can interact with server-side services directly without requiring an HTTP call to the same application.\u003C/p\u003E\n\u003Cp\u003EThis can simplify deployment and avoid unnecessary network communication.\u003C/p\u003E\n\u003Cp\u003EHowever, direct service access must still respect the required authentication and authorization boundaries.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022distributed-deployment\u0022\u003EDistributed deployment\u003C/h3\u003E\n\u003Cp\u003EA distributed deployment separates the authentication host from one or more resource applications.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003E UAuthHub\n \u2502\n \u2502 Authentication\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 \u2502\n Web Application Mobile Client\n \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u25BC\n Resource API\n \u2502\n \u25BC\n Application Services\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIn this model, clients communicate with UAuthHub for the applicable authentication operations and access resource APIs using the supported credentials.\u003C/p\u003E\n\u003Cp\u003EResource APIs validate those credentials according to the configured authentication mode.\u003C/p\u003E\n\u003Cp\u003EThis architecture supports independently deployed applications while maintaining shared authentication policies and identity infrastructure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-a-topology\u0022\u003EChoosing a topology\u003C/h3\u003E\n\u003Cp\u003EIntegrated and distributed deployments are not different authentication modes.\u003C/p\u003E\n\u003Cp\u003EThey describe where application components execute and how they communicate.\u003C/p\u003E\n\u003Cp\u003EThe appropriate topology depends on:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EApplication boundaries.\u003C/li\u003E\n\u003Cli\u003EDeployment and operational requirements.\u003C/li\u003E\n\u003Cli\u003ENetwork and infrastructure constraints.\u003C/li\u003E\n\u003Cli\u003EAuthentication mode dependencies.\u003C/li\u003E\n\u003Cli\u003EService ownership and scaling requirements.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA distributed deployment is not inherently more secure or more scalable than an integrated deployment.\u003C/p\u003E\n\u003Cp\u003EBoth require correct authentication validation, authorization enforcement, and infrastructure configuration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server-architecture\u0022\u003EBlazor Server architecture\u003C/h2\u003E\n\u003Cp\u003EBlazor Server has a distinct execution model.\u003C/p\u003E\n\u003Cp\u003EThe browser maintains an interactive connection to an application whose component logic executes on the server.\u003C/p\u003E\n\u003Cp\u003EThis makes it possible to keep many application operations and authentication-related services within the server environment.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EBrowser\n \u2502\n \u2502 Interactive Connection\n \u25BC\nBlazor Server Application\n \u2502\n \u251C\u2500\u2500 UI Components\n \u2502\n \u251C\u2500\u2500 Application Services\n \u2502\n \u251C\u2500\u2500 UltimateAuth Integration\n \u2502\n \u2514\u2500\u2500 Protected Operations\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EPureOpaque is a natural default for this environment because it provides server-controlled authentication without requiring a separate access/refresh token lifecycle.\u003C/p\u003E\n\u003Cp\u003EHowever, the hosting model does not require PureOpaque exclusively.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022direct-service-access\u0022\u003EDirect service access\u003C/h3\u003E\n\u003Cp\u003EWhen authentication infrastructure and application services are hosted in the same process, server-side code may be able to use registered services directly.\u003C/p\u003E\n\u003Cp\u003EThis can avoid unnecessary HTTP requests between components of the same application.\u003C/p\u003E\n\u003Cp\u003EThe distinction is between an application service call and a remote API request.\u003C/p\u003E\n\u003Cp\u003EA direct service call must not bypass security checks merely because it avoids HTTP.\u003C/p\u003E\n\u003Cp\u003EAuthorization requirements must still be enforced at the appropriate trusted boundary.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022long-lived-interactive-connections\u0022\u003ELong-lived interactive connections\u003C/h3\u003E\n\u003Cp\u003EBlazor Server introduces an additional consideration: authentication state may change while an interactive circuit remains active.\u003C/p\u003E\n\u003Cp\u003EA session can expire or be revoked after the circuit was established.\u003C/p\u003E\n\u003Cp\u003EApplications must therefore account for authentication-state revalidation and authorization of sensitive operations.\u003C/p\u003E\n\u003Cp\u003EAn authenticated circuit must not be treated as permanently authorized solely because its initial connection succeeded.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-webassembly-architecture\u0022\u003EBlazor WebAssembly architecture\u003C/h2\u003E\n\u003Cp\u003EBlazor WebAssembly executes application code in the browser.\u003C/p\u003E\n\u003Cp\u003EUnlike Blazor Server, it cannot directly access private server-side authentication services.\u003C/p\u003E\n\u003Cp\u003EAuthentication and protected application operations therefore cross an HTTP boundary.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EBrowser\n \u2502\n \u2514\u2500\u2500 Blazor WebAssembly\n \u2502\n \u251C\u2500\u2500 UltimateAuth Client\n \u2502 \u2502\n \u2502 \u25BC\n \u2502 UAuthHub\n \u2502\n \u2514\u2500\u2500 Application API Client\n \u2502\n \u25BC\n Resource API\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EHybrid is a suitable authentication strategy for applications that need separate access and refresh tokens while retaining server-authoritative session validation.\u003C/p\u003E\n\u003Cp\u003EHowever, a browser application can also use other modes when the corresponding transport and security architecture supports them.\u003C/p\u003E\n\u003Cp\u003EFor example, a backend-for-frontend architecture may use secure session cookies rather than exposing bearer tokens to browser application code.\u003C/p\u003E\n\u003Cp\u003EThe runtime determines which integration techniques are available; the authentication mode determines the security and lifecycle model.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022native-application-architecture\u0022\u003ENative application architecture\u003C/h2\u003E\n\u003Cp\u003ENative applications, including .NET MAUI applications, execute outside the browser environment.\u003C/p\u003E\n\u003Cp\u003EThey generally communicate with authentication hosts and resource APIs through HTTP.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EMAUI Application\n \u2502\n \u251C\u2500\u2500 UltimateAuth Client\n \u2502 \u2502\n \u2502 \u25BC\n \u2502 UAuthHub\n \u2502\n \u251C\u2500\u2500 Secure Credential Storage\n \u2502\n \u2514\u2500\u2500 Resource API Client\n \u2502\n \u25BC\n Resource API\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ENative applications can use platform-specific secure storage for sensitive credentials.\u003C/p\u003E\n\u003Cp\u003ETheir credential delivery and persistence requirements differ from browser applications.\u003C/p\u003E\n\u003Cp\u003EHybrid can provide a suitable model for applications requiring refresh-token continuity and centralized session control.\u003C/p\u003E\n\u003Cp\u003EThe choice remains configurable according to the supported authentication modes and application requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022shared-components-across-runtimes\u0022\u003EShared components across runtimes\u003C/h2\u003E\n\u003Cp\u003EA unified authentication architecture should minimize unnecessary duplication between client environments.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth separates shared authentication behavior from runtime-specific integration.\u003C/p\u003E\n\u003Cp\u003EFor example, Blazor Server and Blazor WebAssembly applications may share:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication-related UI components.\u003C/li\u003E\n\u003Cli\u003ELogin and logout interaction patterns.\u003C/li\u003E\n\u003Cli\u003ERequest and response contracts.\u003C/li\u003E\n\u003Cli\u003EApplication-facing client abstractions.\u003C/li\u003E\n\u003Cli\u003EAuthentication-state presentation logic.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EAt the same time, they may require different implementations for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECredential storage.\u003C/li\u003E\n\u003Cli\u003EHTTP communication.\u003C/li\u003E\n\u003Cli\u003EBrowser interaction.\u003C/li\u003E\n\u003Cli\u003EServer-side service access.\u003C/li\u003E\n\u003Cli\u003EAuthentication-state synchronization.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe goal is not to force every runtime to execute identical code.\u003C/p\u003E\n\u003Cp\u003EThe goal is to share behavior and contracts where appropriate while preserving each runtime\u0027s security and execution requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022http-boundaries-and-direct-execution\u0022\u003EHTTP boundaries and direct execution\u003C/h2\u003E\n\u003Cp\u003EAn important architectural distinction is whether an operation crosses an HTTP boundary.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022remote-execution\u0022\u003ERemote execution\u003C/h3\u003E\n\u003Cp\u003EA remote client communicates with an authentication host or resource API through HTTP.\u003C/p\u003E\n\u003Cp\u003EThe server must independently validate the request, credentials, and authorization requirements.\u003C/p\u003E\n\u003Cp\u003EClient-side checks are not sufficient.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022in-process-execution\u0022\u003EIn-process execution\u003C/h3\u003E\n\u003Cp\u003EAn application may host UltimateAuth services and protected application services within the same process.\u003C/p\u003E\n\u003Cp\u003EIn that case, some operations may use direct service calls instead of HTTP.\u003C/p\u003E\n\u003Cp\u003EThis can reduce serialization and network overhead.\u003C/p\u003E\n\u003Cp\u003EHowever, HTTP middleware and endpoint authorization attributes do not automatically execute during arbitrary direct service calls.\u003C/p\u003E\n\u003Cp\u003EThe application must ensure that equivalent security requirements are enforced through the appropriate service or authorization boundary.\u003C/p\u003E\n\u003Cp\u003EDirect execution is an optimization and integration choice, not permission to bypass authentication or authorization.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022infrastructure-and-persistence\u0022\u003EInfrastructure and persistence\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses abstractions to separate authentication behavior from infrastructure implementations.\u003C/p\u003E\n\u003Cp\u003EDepending on the configured mode and services, the system may require storage for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EUser and credential information.\u003C/li\u003E\n\u003Cli\u003EAuthentication security state.\u003C/li\u003E\n\u003Cli\u003ESession lineage.\u003C/li\u003E\n\u003Cli\u003ERefresh-token lifecycle.\u003C/li\u003E\n\u003Cli\u003EDevice-associated authentication state.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese dependencies vary by authentication mode.\u003C/p\u003E\n\u003Cp\u003EFor example, PureOpaque and Hybrid require session infrastructure for authentication.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid requires session infrastructure for authoritative validation and lifecycle management, but Standard JWT validation in a Resource API does not require access to that infrastructure.\u003C/p\u003E\n\u003Cp\u003EPureJwt does not require session lineage infrastructure. When refresh tokens are enabled, it still requires refresh-token persistence for secure credential renewal and revocation.\u003C/p\u003E\n\u003Cp\u003EThe architecture must preserve these distinctions.\u003C/p\u003E\n\u003Cp\u003EInfrastructure abstractions allow the authentication services to remain independent of a particular persistence implementation, while the selected mode determines which capabilities are required.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022architectural-boundaries\u0022\u003EArchitectural boundaries\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth\u0027s runtime architecture depends on several boundaries remaining explicit.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-and-server\u0022\u003EClient and server\u003C/h3\u003E\n\u003Cp\u003EClients initiate operations and present credentials.\u003C/p\u003E\n\u003Cp\u003EServers establish trusted authentication state and enforce security requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-and-authorization\u0022\u003EAuthentication and authorization\u003C/h3\u003E\n\u003Cp\u003EAuthentication determines identity.\u003C/p\u003E\n\u003Cp\u003EAuthorization determines whether an operation is permitted.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022hosting-and-authentication-mode\u0022\u003EHosting and authentication mode\u003C/h3\u003E\n\u003Cp\u003EUAuthHub and resource applications describe hosting responsibilities.\u003C/p\u003E\n\u003Cp\u003EPureOpaque, Hybrid, SemiHybrid, and PureJwt describe authentication strategies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022shared-contracts-and-runtime-integration\u0022\u003EShared contracts and runtime integration\u003C/h3\u003E\n\u003Cp\u003EShared contracts define consistent behavior.\u003C/p\u003E\n\u003Cp\u003ERuntime integrations adapt that behavior to browser, native, and server-side environments.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022orchestration-and-infrastructure\u0022\u003EOrchestration and infrastructure\u003C/h3\u003E\n\u003Cp\u003EOrchestration coordinates authentication operations.\u003C/p\u003E\n\u003Cp\u003EInfrastructure services provide persistence, token operations, and other required capabilities.\u003C/p\u003E\n\u003Cp\u003EThese boundaries allow UltimateAuth to evolve without requiring every client integration or authentication mode to duplicate the complete authentication implementation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022summary\u0022\u003ESummary\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth\u0027s runtime architecture separates authentication responsibilities from application hosting and client execution environments.\u003C/p\u003E\n\u003Cp\u003EIts main architectural components are:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ECore\u003C/strong\u003E, which defines shared contracts and authentication foundations.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EServer\u003C/strong\u003E, which implements authentication operations and lifecycle management.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EClient\u003C/strong\u003E, which provides application-facing authentication integration.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUAuthHub\u003C/strong\u003E, which hosts the authentication infrastructure.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EResource applications\u003C/strong\u003E, which authenticate callers and enforce authorization.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese components can operate within an integrated application or across distributed services.\u003C/p\u003E\n\u003Cp\u003EDifferent client runtimes can share authentication contracts and behavior while using integration mechanisms appropriate to their environments.\u003C/p\u003E\n\u003Cp\u003EAuthentication modes determine the required validation and state dependencies.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EThe architecture is unified because its security contracts and responsibilities remain consistent\u2014not because every runtime, mode, or deployment follows an identical execution path.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003ENext step\u003C/h2\u003E\n\u003Cp\u003EContinue to \u003Ca href=\u0022/docs/fundamentals/request-lifecycle\u0022\u003ERequest Lifecycle\u003C/a\u003E to understand how an incoming request moves through authentication validation, identity establishment, and authorization before reaching a protected operation.\u003C/p\u003E\n", + "Html": "\n\u003Cp\u003EUltimateAuth is designed to provide a unified authentication architecture across different .NET application environments.\u003C/p\u003E\n\u003Cp\u003EA Blazor Server application, a standalone Blazor WebAssembly application, a native MAUI application, and a resource API may have different execution models, but they should not require entirely separate authentication systems.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth addresses this through a separation between \u003Cstrong\u003Eauthentication infrastructure, client integration, hosting, and protected resources\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThis separation allows authentication behavior to remain consistent while adapting to the capabilities and responsibilities of each runtime.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022architectural-overview\u0022\u003EArchitectural overview\u003C/h2\u003E\n\u003Cp\u003EAt a high level, UltimateAuth consists of several cooperating layers:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ECore:\u003C/strong\u003E Shared authentication contracts, models, and foundational abstractions.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EServer:\u003C/strong\u003E Authentication operations, security decisions, credential management, and persistence coordination.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EClient:\u003C/strong\u003E Client-side integration, authentication requests, and surrogate lifecycle handling.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUAuthHub:\u003C/strong\u003E The application hosting UltimateAuth\u0027s authentication endpoints and services.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EResource applications:\u003C/strong\u003E Applications and APIs that consume authenticated identity and enforce authorization.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese are architectural responsibilities, not necessarily separate processes or deployments.\u003C/p\u003E\n\u003Cp\u003EA single application may host multiple responsibilities. Alternatively, they can be distributed across independently deployed services.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003E Application Clients\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 \u2502 \u2502\n Blazor WASM MAUI Other Clients\n \u2502 \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u2502 HTTP\n \u25BC\n UAuthHub\n \u2502\n UltimateAuth Server\n \u2502\n Authentication Services\n \u2502\n Stores / Providers\n \u2502\n \u25BC\n Persistent State\n\n\n Protected Resources\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 \u2502 \u2502\n Resource API Web App Other Services\n \u2502 \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n Authentication Validation\n \u2502\n Authorization\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis diagram illustrates the separation of responsibilities.\u003C/p\u003E\n\u003Cp\u003EIt does not imply that every authenticated resource request must pass through UAuthHub.\u003C/p\u003E\n\u003Cp\u003EWhether a protected resource needs to consult server-side authentication infrastructure depends on the effective authentication mode and its validation requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022core-shared-authentication-foundations\u0022\u003ECore: shared authentication foundations\u003C/h2\u003E\n\u003Cp\u003EThe Core layer defines the common concepts used throughout UltimateAuth.\u003C/p\u003E\n\u003Cp\u003EIts responsibility is to provide stable contracts and abstractions without depending on a particular client runtime or application host.\u003C/p\u003E\n\u003Cp\u003EThese foundations include concepts such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication modes.\u003C/li\u003E\n\u003Cli\u003EAuthentication and security contexts.\u003C/li\u003E\n\u003Cli\u003EAuthentication results and contracts.\u003C/li\u003E\n\u003Cli\u003EDomain models and shared abstractions.\u003C/li\u003E\n\u003Cli\u003ESecurity-related options and definitions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe Core layer provides the common vocabulary used by client integrations, server services, and other framework components.\u003C/p\u003E\n\u003Cp\u003EIt should not contain assumptions that authentication always occurs through an HTTP endpoint, a browser cookie, or a particular hosting model.\u003C/p\u003E\n\u003Cp\u003EThis separation is important because UltimateAuth supports both stateful and stateless authentication strategies.\u003C/p\u003E\n\u003Cp\u003EA shared authentication contract must not implicitly require session persistence when the selected mode does not use sessions.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-authentication-execution-and-lifecycle\u0022\u003EServer: authentication execution and lifecycle\u003C/h2\u003E\n\u003Cp\u003EThe Server layer implements the server-side authentication capabilities.\u003C/p\u003E\n\u003Cp\u003EIt coordinates the operations required to establish, continue, validate, and terminate authentication according to the effective mode and security policies.\u003C/p\u003E\n\u003Cp\u003EIts responsibilities include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication flow execution.\u003C/li\u003E\n\u003Cli\u003ECredential validation and management.\u003C/li\u003E\n\u003Cli\u003ESession and token lifecycle operations.\u003C/li\u003E\n\u003Cli\u003EAuthentication security decisions.\u003C/li\u003E\n\u003Cli\u003ECoordination with persistence providers.\u003C/li\u003E\n\u003Cli\u003ESurrogate issuance and validation.\u003C/li\u003E\n\u003Cli\u003EIntegration with server-side authorization infrastructure.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe Server layer contains multiple cooperating services rather than one universal authentication engine responsible for every decision.\u003C/p\u003E\n\u003Cp\u003EFor example, session lifecycle operations, credential verification, and authorization may follow different execution paths while sharing common security contracts.\u003C/p\u003E\n\u003Cp\u003EThe architecture separates orchestration from the underlying services that perform domain-specific work.\u003C/p\u003E\n\u003Cp\u003EFor the detailed execution pipeline, see \u003Ca href=\u0022/docs/auth-flows/overview\u0022\u003EAuth Flows\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-runtime-integration\u0022\u003EClient: runtime integration\u003C/h2\u003E\n\u003Cp\u003EThe Client layer provides the integration between an application and UltimateAuth\u0027s authentication services.\u003C/p\u003E\n\u003Cp\u003EIts purpose is to reduce the amount of authentication infrastructure that application developers need to implement themselves.\u003C/p\u003E\n\u003Cp\u003EDepending on the supported runtime and configuration, client integration may handle:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EInitiating authentication flows.\u003C/li\u003E\n\u003Cli\u003ECommunicating with UAuthHub.\u003C/li\u003E\n\u003Cli\u003EProcessing authentication outcomes.\u003C/li\u003E\n\u003Cli\u003EManaging supported surrogate delivery mechanisms.\u003C/li\u003E\n\u003Cli\u003ECoordinating authentication state with the application.\u003C/li\u003E\n\u003Cli\u003EIntegrating authenticated requests with protected resources.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe client SDK does not replace server-side authentication validation.\u003C/p\u003E\n\u003Cp\u003EIt provides an application-facing interface to the authentication infrastructure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-integration-is-runtime-aware\u0022\u003EClient integration is runtime-aware\u003C/h3\u003E\n\u003Cp\u003EDifferent client runtimes have different capabilities.\u003C/p\u003E\n\u003Cp\u003EA browser-based WebAssembly application executes within browser security restrictions.\u003C/p\u003E\n\u003Cp\u003EA native MAUI application has access to platform-specific capabilities.\u003C/p\u003E\n\u003Cp\u003EA Blazor Server application executes application logic on the server while maintaining an interactive connection with the browser.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth accounts for these differences through runtime-specific integrations and Application Profiles.\u003C/p\u003E\n\u003Cp\u003EThe authentication model remains shared even when the implementation of surrogate transport or application state differs.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/application-profiles\u0022\u003EApplication Profiles\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022uauthhub-the-authentication-host\u0022\u003EUAuthHub: the authentication host\u003C/h2\u003E\n\u003Cp\u003EUAuthHub is the application hosting UltimateAuth\u0027s server-side authentication infrastructure.\u003C/p\u003E\n\u003Cp\u003EIt provides the environment in which authentication endpoints and the required server services are available.\u003C/p\u003E\n\u003Cp\u003EDepending on the deployment, UAuthHub can be responsible for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAccepting authentication requests.\u003C/li\u003E\n\u003Cli\u003EResolving the applicable tenant and authentication context.\u003C/li\u003E\n\u003Cli\u003EExecuting authentication flows.\u003C/li\u003E\n\u003Cli\u003EManaging credentials and sessions.\u003C/li\u003E\n\u003Cli\u003EIssuing authentication surrogates.\u003C/li\u003E\n\u003Cli\u003EApplying configured authentication policies.\u003C/li\u003E\n\u003Cli\u003EExposing the supported authentication endpoints.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EUAuthHub is a hosting role, not an authentication mode.\u003C/p\u003E\n\u003Cp\u003EA single UAuthHub can support multiple client environments and authentication strategies, subject to its configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022centralized-hosting\u0022\u003ECentralized hosting\u003C/h3\u003E\n\u003Cp\u003EIn a centralized deployment, several applications can use the same UAuthHub.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EBlazor WASM Application \u2500\u2500\u2510\n \u2502\nMAUI Application \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u25BA UAuthHub\n \u2502 \u2502\nWeb Application \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n \u25BC\n Authentication Services\n \u2502\n \u25BC\n Authentication Storage\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis allows applications to share authentication infrastructure without requiring each application to implement its own credential management and authentication lifecycle.\u003C/p\u003E\n\u003Cp\u003EHowever, centralized authentication hosting does not mean that all protected resource requests must be routed through UAuthHub.\u003C/p\u003E\n\u003Cp\u003EThe resource authentication strategy remains mode-dependent.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-applications-and-apis\u0022\u003EResource applications and APIs\u003C/h2\u003E\n\u003Cp\u003EA resource application is an application or service that exposes functionality requiring authentication and authorization.\u003C/p\u003E\n\u003Cp\u003EExamples include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EA protected Web API.\u003C/li\u003E\n\u003Cli\u003EAn administrative web application.\u003C/li\u003E\n\u003Cli\u003EA business application backend.\u003C/li\u003E\n\u003Cli\u003EAn independently deployed service.\u003C/li\u003E\n\u003Cli\u003EA server-rendered application with protected operations.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA resource application must establish the caller\u0027s authenticated identity before allowing access to protected functionality.\u003C/p\u003E\n\u003Cp\u003EIt must then enforce the relevant authorization policies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-validation-depends-on-the-mode\u0022\u003EAuthentication validation depends on the mode\u003C/h3\u003E\n\u003Cp\u003EResource applications use the authentication strategy selected for their deployment.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth supports three validation paths across its four authentication modes.\u003C/p\u003E\n\u003Ch4 id=\u0022server-authoritative-validation\u0022\u003EServer-authoritative validation\u003C/h4\u003E\n\u003Cp\u003EPureOpaque and Hybrid require authoritative validation of the presented opaque session ID.\u003C/p\u003E\n\u003Cp\u003EIn a distributed deployment, a Resource API delegates session validation to UAuthHub.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EClient\n |\n | Opaque session ID\n v\nResource API\n |\n | Authoritative validation\n v\nUAuthHub\n |\n v\nSession infrastructure\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch4 id=\u0022local-jwt-validation\u0022\u003ELocal JWT validation\u003C/h4\u003E\n\u003Cp\u003ESemiHybrid and PureJwt support local JWT validation using trusted verification keys and explicit token-validation configuration.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EClient\n |\n | JWT access token\n v\nResource API\n |\n v\nLocal JWT validation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA Resource API does not need to contact UAuthHub for ordinary local JWT validation.\u003C/p\u003E\n\u003Ch4 id=\u0022selective-authoritative-validation\u0022\u003ESelective authoritative validation\u003C/h4\u003E\n\u003Cp\u003ESemiHybrid combines local JWT validation with authoritative session validation when required by the protected operation.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EClient\n |\n | JWT access token\n v\nResource API\n |\n v\nLocal JWT validation\n |\n \u002B-- Standard\n | |\n | v\n | Continue access checks\n |\n \u002B-- HubValidated\n |\n v\n UAuthHub\n |\n v\n Session infrastructure\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIn an integrated deployment, authoritative validation can execute directly against the local session infrastructure without a remote HTTP call.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022uauthhub-is-a-logical-authentication-authority\u0022\u003EUAuthHub is a logical authentication authority\u003C/h3\u003E\n\u003Cp\u003EAuthoritative validation does not imply that every application must deploy a separate authentication server.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth can execute authentication and lifecycle operations within the application itself or delegate them to a separately hosted UAuthHub.\u003C/p\u003E\n\u003Cp\u003EThe deployment topology determines where authoritative operations execute.\u003C/p\u003E\n\u003Cp\u003EThe authentication mode determines when those operations are required.\u003C/p\u003E\n\u003Cp\u003EThese are independent architectural decisions.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-architecture-can-evolve\u0022\u003EAuthentication architecture can evolve\u003C/h3\u003E\n\u003Cp\u003EApplications can start with integrated authentication and later introduce a dedicated UAuthHub, separate Resource APIs, or local JWT validation.\u003C/p\u003E\n\u003Cp\u003EThe shared UltimateAuth APIs remain consistent across these architectural choices.\u003C/p\u003E\n\u003Cp\u003EChanging the deployment topology may require infrastructure and configuration changes, but does not inherently require a different application-level authentication programming model.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E\nand \u003Ca href=\u0022/docs/fundamentals/request-lifecycle\u0022\u003ERequest Lifecycle\u003C/a\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-remains-local-to-the-protected-operation\u0022\u003EAuthorization remains local to the protected operation\u003C/h3\u003E\n\u003Cp\u003EAuthentication establishes who the caller is.\u003C/p\u003E\n\u003Cp\u003EAuthorization determines whether that caller may perform the requested operation.\u003C/p\u003E\n\u003Cp\u003EA valid authentication evidence does not automatically grant permission to every resource.\u003C/p\u003E\n\u003Cp\u003EResource applications must continue to enforce their authorization requirements through the applicable framework and application policies.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth\u0027s authentication integration should preserve these boundaries rather than replacing resource authorization with client-side assumptions.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022deployment-topology\u0022\u003EDeployment topology\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates architectural responsibilities from physical deployment boundaries.\u003C/p\u003E\n\u003Cp\u003EThis means the same authentication architecture can support different deployment topologies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022integrated-deployment\u0022\u003EIntegrated deployment\u003C/h3\u003E\n\u003Cp\u003EAn integrated deployment hosts authentication infrastructure and application functionality within the same server application.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EASP.NET Core Application\n \u2502\n \u251C\u2500\u2500 UltimateAuth Server\n \u2502\n \u251C\u2500\u2500 Authentication Services\n \u2502\n \u251C\u2500\u2500 Application Services\n \u2502\n \u2514\u2500\u2500 Protected Endpoints\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIn this model, authentication services and protected application functionality may share the same dependency injection container and process.\u003C/p\u003E\n\u003Cp\u003EWhere supported, internal operations can interact with server-side services directly without requiring an HTTP call to the same application.\u003C/p\u003E\n\u003Cp\u003EThis can simplify deployment and avoid unnecessary network communication.\u003C/p\u003E\n\u003Cp\u003EHowever, direct service access must still respect the required authentication and authorization boundaries.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022distributed-deployment\u0022\u003EDistributed deployment\u003C/h3\u003E\n\u003Cp\u003EA distributed deployment separates the authentication host from one or more resource applications.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003E UAuthHub\n \u2502\n \u2502 Authentication\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 \u2502\n Web Application Mobile Client\n \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u25BC\n Resource API\n \u2502\n \u25BC\n Application Services\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIn this model, clients communicate with UAuthHub for the applicable authentication operations and access resource APIs using the supported surrogates.\u003C/p\u003E\n\u003Cp\u003EResource APIs validate those surrogates according to the configured authentication mode.\u003C/p\u003E\n\u003Cp\u003EThis architecture supports independently deployed applications while maintaining shared authentication policies and identity infrastructure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-a-topology\u0022\u003EChoosing a topology\u003C/h3\u003E\n\u003Cp\u003EIntegrated and distributed deployments are not different authentication modes.\u003C/p\u003E\n\u003Cp\u003EThey describe where application components execute and how they communicate.\u003C/p\u003E\n\u003Cp\u003EThe appropriate topology depends on:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EApplication boundaries.\u003C/li\u003E\n\u003Cli\u003EDeployment and operational requirements.\u003C/li\u003E\n\u003Cli\u003ENetwork and infrastructure constraints.\u003C/li\u003E\n\u003Cli\u003EAuthentication mode dependencies.\u003C/li\u003E\n\u003Cli\u003EService ownership and scaling requirements.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA distributed deployment is not inherently more secure or more scalable than an integrated deployment.\u003C/p\u003E\n\u003Cp\u003EBoth require correct authentication validation, authorization enforcement, and infrastructure configuration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server-architecture\u0022\u003EBlazor Server architecture\u003C/h2\u003E\n\u003Cp\u003EBlazor Server has a distinct execution model.\u003C/p\u003E\n\u003Cp\u003EThe browser maintains an interactive connection to an application whose component logic executes on the server.\u003C/p\u003E\n\u003Cp\u003EThis makes it possible to keep many application operations and authentication-related services within the server environment.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EBrowser\n \u2502\n \u2502 Interactive Connection\n \u25BC\nBlazor Server Application\n \u2502\n \u251C\u2500\u2500 UI Components\n \u2502\n \u251C\u2500\u2500 Application Services\n \u2502\n \u251C\u2500\u2500 UltimateAuth Integration\n \u2502\n \u2514\u2500\u2500 Protected Operations\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EPureOpaque is a natural default for this environment because it provides server-controlled authentication without requiring a separate access/refresh token lifecycle.\u003C/p\u003E\n\u003Cp\u003EHowever, the hosting model does not require PureOpaque exclusively.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022direct-service-access\u0022\u003EDirect service access\u003C/h3\u003E\n\u003Cp\u003EWhen authentication infrastructure and application services are hosted in the same process, server-side code may be able to use registered services directly.\u003C/p\u003E\n\u003Cp\u003EThis can avoid unnecessary HTTP requests between components of the same application.\u003C/p\u003E\n\u003Cp\u003EThe distinction is between an application service call and a remote API request.\u003C/p\u003E\n\u003Cp\u003EA direct service call must not bypass security checks merely because it avoids HTTP.\u003C/p\u003E\n\u003Cp\u003EAuthorization requirements must still be enforced at the appropriate trusted boundary.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022long-lived-interactive-connections\u0022\u003ELong-lived interactive connections\u003C/h3\u003E\n\u003Cp\u003EBlazor Server introduces an additional consideration: authentication state may change while an interactive circuit remains active.\u003C/p\u003E\n\u003Cp\u003EA session can expire or be revoked after the circuit was established.\u003C/p\u003E\n\u003Cp\u003EApplications must therefore account for authentication-state revalidation and authorization of sensitive operations.\u003C/p\u003E\n\u003Cp\u003EAn authenticated circuit must not be treated as permanently authorized solely because its initial connection succeeded.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-webassembly-architecture\u0022\u003EBlazor WebAssembly architecture\u003C/h2\u003E\n\u003Cp\u003EBlazor WebAssembly executes application code in the browser.\u003C/p\u003E\n\u003Cp\u003EUnlike Blazor Server, it cannot directly access private server-side authentication services.\u003C/p\u003E\n\u003Cp\u003EAuthentication and protected application operations therefore cross an HTTP boundary.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EBrowser\n \u2502\n \u2514\u2500\u2500 Blazor WebAssembly\n \u2502\n \u251C\u2500\u2500 UltimateAuth Client\n \u2502 \u2502\n \u2502 \u25BC\n \u2502 UAuthHub\n \u2502\n \u2514\u2500\u2500 Application API Client\n \u2502\n \u25BC\n Resource API\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EHybrid is a suitable authentication strategy for applications that need separate access and refresh tokens while retaining server-authoritative session validation.\u003C/p\u003E\n\u003Cp\u003EHowever, a browser application can also use other modes when the corresponding transport and security architecture supports them.\u003C/p\u003E\n\u003Cp\u003EFor example, a backend-for-frontend architecture may use secure session cookies rather than exposing bearer tokens to browser application code.\u003C/p\u003E\n\u003Cp\u003EThe runtime determines which integration techniques are available; the authentication mode determines the security and lifecycle model.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022native-application-architecture\u0022\u003ENative application architecture\u003C/h2\u003E\n\u003Cp\u003ENative applications, including .NET MAUI applications, execute outside the browser environment.\u003C/p\u003E\n\u003Cp\u003EThey generally communicate with authentication hosts and resource APIs through HTTP.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EMAUI Application\n \u2502\n \u251C\u2500\u2500 UltimateAuth Client\n \u2502 \u2502\n \u2502 \u25BC\n \u2502 UAuthHub\n \u2502\n \u251C\u2500\u2500 Secure Token Storage\n \u2502\n \u2514\u2500\u2500 Resource API Client\n \u2502\n \u25BC\n Resource API\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ENative applications can use platform-specific secure storage for sensitive tokens.\u003C/p\u003E\n\u003Cp\u003ETheir surrogate transport and persistence requirements differ from browser applications.\u003C/p\u003E\n\u003Cp\u003EHybrid can provide a suitable model for applications requiring refresh-token continuity and centralized session control.\u003C/p\u003E\n\u003Cp\u003EThe choice remains configurable according to the supported authentication modes and application requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022shared-components-across-runtimes\u0022\u003EShared components across runtimes\u003C/h2\u003E\n\u003Cp\u003EA unified authentication architecture should minimize unnecessary duplication between client environments.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth separates shared authentication behavior from runtime-specific integration.\u003C/p\u003E\n\u003Cp\u003EFor example, Blazor Server and Blazor WebAssembly applications may share:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication-related UI components.\u003C/li\u003E\n\u003Cli\u003ELogin and logout interaction patterns.\u003C/li\u003E\n\u003Cli\u003ERequest and response contracts.\u003C/li\u003E\n\u003Cli\u003EApplication-facing client abstractions.\u003C/li\u003E\n\u003Cli\u003EAuthentication-state presentation logic.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EAt the same time, they may require different implementations for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EToken storage.\u003C/li\u003E\n\u003Cli\u003EHTTP communication.\u003C/li\u003E\n\u003Cli\u003EBrowser interaction.\u003C/li\u003E\n\u003Cli\u003EServer-side service access.\u003C/li\u003E\n\u003Cli\u003EAuthentication-state synchronization.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe goal is not to force every runtime to execute identical code.\u003C/p\u003E\n\u003Cp\u003EThe goal is to share behavior and contracts where appropriate while preserving each runtime\u0027s security and execution requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022http-boundaries-and-direct-execution\u0022\u003EHTTP boundaries and direct execution\u003C/h2\u003E\n\u003Cp\u003EAn important architectural distinction is whether an operation crosses an HTTP boundary.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022remote-execution\u0022\u003ERemote execution\u003C/h3\u003E\n\u003Cp\u003EA remote client communicates with an authentication host or resource API through HTTP.\u003C/p\u003E\n\u003Cp\u003EThe server must independently validate the request, credentials, and authorization requirements.\u003C/p\u003E\n\u003Cp\u003EClient-side checks are not sufficient.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022in-process-execution\u0022\u003EIn-process execution\u003C/h3\u003E\n\u003Cp\u003EAn application may host UltimateAuth services and protected application services within the same process.\u003C/p\u003E\n\u003Cp\u003EIn that case, some operations may use direct service calls instead of HTTP.\u003C/p\u003E\n\u003Cp\u003EThis can reduce serialization and network overhead.\u003C/p\u003E\n\u003Cp\u003EHowever, HTTP middleware and endpoint authorization attributes do not automatically execute during arbitrary direct service calls.\u003C/p\u003E\n\u003Cp\u003EThe application must ensure that equivalent security requirements are enforced through the appropriate service or authorization boundary.\u003C/p\u003E\n\u003Cp\u003EDirect execution is an optimization and integration choice, not permission to bypass authentication or authorization.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022infrastructure-and-persistence\u0022\u003EInfrastructure and persistence\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses abstractions to separate authentication behavior from infrastructure implementations.\u003C/p\u003E\n\u003Cp\u003EDepending on the configured mode and services, the system may require storage for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EUser and credential information.\u003C/li\u003E\n\u003Cli\u003EAuthentication security state.\u003C/li\u003E\n\u003Cli\u003ESession lineage.\u003C/li\u003E\n\u003Cli\u003ERefresh-token lifecycle.\u003C/li\u003E\n\u003Cli\u003EDevice-associated authentication state.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese dependencies vary by authentication mode.\u003C/p\u003E\n\u003Cp\u003EFor example, PureOpaque and Hybrid require session infrastructure for authentication.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid requires session infrastructure for authoritative validation and lifecycle management, but Standard JWT validation in a Resource API does not require access to that infrastructure.\u003C/p\u003E\n\u003Cp\u003EPureJwt does not require session lineage infrastructure. When refresh tokens are enabled, it still requires refresh-token persistence for secure token renewal and revocation.\u003C/p\u003E\n\u003Cp\u003EThe architecture must preserve these distinctions.\u003C/p\u003E\n\u003Cp\u003EInfrastructure abstractions allow the authentication services to remain independent of a particular persistence implementation, while the selected mode determines which capabilities are required.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022architectural-boundaries\u0022\u003EArchitectural boundaries\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth\u0027s runtime architecture depends on several boundaries remaining explicit.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-and-server\u0022\u003EClient and server\u003C/h3\u003E\n\u003Cp\u003EClients initiate operations and present credentials.\u003C/p\u003E\n\u003Cp\u003EServers establish trusted authentication state and enforce security requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-and-authorization\u0022\u003EAuthentication and authorization\u003C/h3\u003E\n\u003Cp\u003EAuthentication determines identity.\u003C/p\u003E\n\u003Cp\u003EAuthorization determines whether an operation is permitted.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022hosting-and-authentication-mode\u0022\u003EHosting and authentication mode\u003C/h3\u003E\n\u003Cp\u003EUAuthHub and resource applications describe hosting responsibilities.\u003C/p\u003E\n\u003Cp\u003EPureOpaque, Hybrid, SemiHybrid, and PureJwt describe authentication strategies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022shared-contracts-and-runtime-integration\u0022\u003EShared contracts and runtime integration\u003C/h3\u003E\n\u003Cp\u003EShared contracts define consistent behavior.\u003C/p\u003E\n\u003Cp\u003ERuntime integrations adapt that behavior to browser, native, and server-side environments.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022orchestration-and-infrastructure\u0022\u003EOrchestration and infrastructure\u003C/h3\u003E\n\u003Cp\u003EOrchestration coordinates authentication operations.\u003C/p\u003E\n\u003Cp\u003EInfrastructure services provide persistence, token operations, and other required capabilities.\u003C/p\u003E\n\u003Cp\u003EThese boundaries allow UltimateAuth to evolve without requiring every client integration or authentication mode to duplicate the complete authentication implementation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022summary\u0022\u003ESummary\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth\u0027s runtime architecture separates authentication responsibilities from application hosting and client execution environments.\u003C/p\u003E\n\u003Cp\u003EIts main architectural components are:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ECore\u003C/strong\u003E, which defines shared contracts and authentication foundations.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EServer\u003C/strong\u003E, which implements authentication operations and lifecycle management.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EClient\u003C/strong\u003E, which provides application-facing authentication integration.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUAuthHub\u003C/strong\u003E, which hosts the authentication infrastructure.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EResource applications\u003C/strong\u003E, which authenticate callers and enforce authorization.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese components can operate within an integrated application or across distributed services.\u003C/p\u003E\n\u003Cp\u003EDifferent client runtimes can share authentication contracts and behavior while using integration mechanisms appropriate to their environments.\u003C/p\u003E\n\u003Cp\u003EAuthentication modes determine the required validation and state dependencies.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EThe architecture is unified because its security contracts and responsibilities remain consistent\u2014not because every runtime, mode, or deployment follows an identical execution path.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003ENext step\u003C/h2\u003E\n\u003Cp\u003EContinue to \u003Ca href=\u0022/docs/fundamentals/request-lifecycle\u0022\u003ERequest Lifecycle\u003C/a\u003E to understand how an incoming request moves through authentication validation, identity establishment, and authorization before reaching a protected operation.\u003C/p\u003E\n", "Headings": [ { "Id": "architectural-overview", @@ -174,6 +174,6 @@ "Level": 0 } ], - "SourceHash": "5432ED76D9CADC49324BE3809E2D79157C027C68E9AB7BD385B3AD7CA394FB73", + "SourceHash": "1CBD2FD8B8FB3D6D746CCE5785D9905CEF738337E576BA2E7378BEB522ED3748", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/migration/v0.2.0.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/migration/v0.2.0.json index a67340ca..a25d67b4 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/migration/v0.2.0.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/migration/v0.2.0.json @@ -1,7 +1,7 @@ { "Slug": "migration/v0.2.0", "Title": "Migrating to v0.2.0", - "Html": "\n\u003Cp\u003E\u003Cstrong\u003EMigration Impact: High \u2014 In Progress\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ELatest published prerelease reviewed: v0.2.0-preview.4\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThis guide covers migration requirements for the upcoming UltimateAuth v0.2.0 release.\u003C/p\u003E\n\u003Cp\u003EThe guide is provisional and will be updated as new preview and release candidate versions become available. The final migration requirements may change before the stable v0.2.0 release.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022migration-overview\u0022\u003EMigration Overview\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth v0.2.0 introduces new authentication capabilities, strengthens security defaults, and reorganizes several public configuration APIs.\u003C/p\u003E\n\u003Cp\u003EFor applications using the built-in integrations and default authentication behavior, migration primarily involves reviewing configuration changes, providing production cryptographic keys, and applying any required database migrations.\u003C/p\u003E\n\u003Cp\u003EApplications with custom authentication policies, persistence stores, credential delivery settings, or Resource API configurations should also review the detailed sections below.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ERecommended upgrade sequence:\u003C/strong\u003E\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EUpdate renamed public APIs and configuration properties.\u003C/li\u003E\n\u003Cli\u003EConfigure and validate cryptographic keys before production deployment.\u003C/li\u003E\n\u003Cli\u003EReview authentication mode and credential delivery behavior.\u003C/li\u003E\n\u003Cli\u003EApply required persistence migrations.\u003C/li\u003E\n\u003Cli\u003EVerify login, refresh, logout, authorization, and Resource API integration.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-public-api-changes\u0022\u003ECommon Public API Changes\u003C/h3\u003E\n\u003Cp\u003EThe following table focuses on commonly accessed public APIs and configuration properties. Internal implementation types and advanced extension-point changes are covered in the detailed migration sections.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EBefore (v0.1.x)\u003C/th\u003E\n\u003Cth\u003EAfter (v0.2.0)\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoDetectClientProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoDetectApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EClientProfileModes\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EApplicationProfileModes\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIClientProfileDetector\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIApplicationProfileDetector\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIFlowClient.LoginAsync(...)\u003C/code\u003E returning \u003Ccode\u003ETask\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIFlowClient.LoginAsync(...)\u003C/code\u003E returning \u003Ccode\u003ETask\u0026lt;UAuthResult\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETokenResponseMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EGrantDeliveryMode\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse.SessionIdDelivery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EGrantDelivery.Session\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse.AccessTokenDelivery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EGrantDelivery.AccessToken\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse.RefreshTokenDelivery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EGrantDelivery.RefreshToken\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse.Login\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ERedirect.Login\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse.Logout\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ERedirect.Logout\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi.UAuthHubBaseUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi.Hub.BaseUrl\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi.AllowedClientOrigins\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi.Cors.AllowedOrigins\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi.CorsPolicyName\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi.Cors.PolicyName\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-behavioral-changes\u0022\u003ECommon Behavioral Changes\u003C/h3\u003E\n\u003Cp\u003EThe following changes may affect existing applications even when no compilation errors occur.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EArea\u003C/th\u003E\n\u003Cth\u003EPrevious Behavior\u003C/th\u003E\n\u003Cth\u003Ev0.2.0 Behavior\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ELogin submission\u003C/td\u003E\n\u003Ctd\u003ENavigation-based\u003C/td\u003E\n\u003Ctd\u003EAutomatic navigation or fetch selection\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid access token\u003C/td\u003E\n\u003Ctd\u003EOpaque\u003C/td\u003E\n\u003Ctd\u003EJWT\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAPI authentication mode\u003C/td\u003E\n\u003Ctd\u003EPureJwt under the previous v0.2.0 resolver\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResource API authentication\u003C/td\u003E\n\u003Ctd\u003ERemote session validation\u003C/td\u003E\n\u003Ctd\u003EHybrid remote session validation by default\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess-token handling\u003C/td\u003E\n\u003Ctd\u003EApplication-managed when required\u003C/td\u003E\n\u003Ctd\u003EBuilt-in in-memory token store\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ELogout completion\u003C/td\u003E\n\u003Ctd\u003ENavigation-oriented submission\u003C/td\u003E\n\u003Ctd\u003EResponse-aware completion and local credential cleanup\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EApplications using the standard UltimateAuth integrations generally do not need to rewrite their login or logout implementations.\u003C/p\u003E\n\u003Cp\u003EHowever, applications relying on specific navigation behavior, custom credential handling, or explicit authentication mode assumptions should review the corresponding migration sections.\u003C/p\u003E\n\u003Cp\u003EThese are API and configuration-path replacements, not guarantees of identical behavior.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E \u003Ccode\u003EAuthResponse\u003C/code\u003E is obsolete and no longer functional. Accessing it throws \u003Ccode\u003ENotSupportedException\u003C/code\u003E. Applications must migrate to \u003Ccode\u003EGrantDelivery\u003C/code\u003E and \u003Ccode\u003ERedirect\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EAuthentication modes and credential delivery now have separate responsibilities. The effective authentication mode determines which grants exist; delivery settings determine how those grants are transported.\u003C/p\u003E\n\u003Cp\u003EThe public \u003Ccode\u003EIUAuthClient\u003C/code\u003E entry point and standard UltimateAuth registration methods remain available. Applications relying on built-in defaults generally do not need to replace their authentication integration.\u003C/p\u003E\n\u003Cp\u003EThe following sections explain the behavioral changes, security implications, and additional migration requirements in detail.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022asynchronous-authorization-policies\u0022\u003E1. Asynchronous Authorization Policies\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.1\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003ECustom implementations of \u003Ccode\u003EIAccessPolicy\u003C/code\u003E, \u003Ccode\u003EIAccessInvariant\u003C/code\u003E, and \u003Ccode\u003EIAccessAuthority\u003C/code\u003E should migrate to \u003Ccode\u003EDecideAsync\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic AccessDecision Decide(AccessContext context)\n{\n return AccessDecision.Allow();\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic ValueTask\u0026lt;AccessDecision\u0026gt; DecideAsync(AccessContext context, CancellationToken ct = default)\n{\n return ValueTask.FromResult(AccessDecision.Allow());\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor \u003Ccode\u003EIAccessAuthority\u003C/code\u003E, preserve the existing \u003Ccode\u003EruntimePolicies\u003C/code\u003E parameter and add the cancellation token.\u003C/p\u003E\n\u003Cp\u003ESynchronous \u003Ccode\u003EDecide\u003C/code\u003E methods are obsolete. Existing synchronous implementations retain compatibility through the interface defaults, but new implementations should use \u003Ccode\u003EDecideAsync\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EIf your application invokes an authority directly, switch to \u003Ccode\u003EDecideAsync\u003C/code\u003E and await the result.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-check-results\u0022\u003E2. Authorization Check Results\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.1\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ECheckAsync\u003C/code\u003E now returns an explicit authorization decision in the response body.\u003C/p\u003E\n\u003Cp\u003EIf your application previously interpreted HTTP \u003Ccode\u003E403\u003C/code\u003E as the result of a successful authorization evaluation that denied access, update that handling.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar result = await UAuthClient.Authorization.CheckAsync(request);\n\nif (result.IsSuccess \u0026amp;\u0026amp; result.Value is { IsAllowed: true })\n{\n // Authorized\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAn HTTP-successful authorization check does not necessarily mean that access was granted.\u003C/p\u003E\n\u003Cp\u003EInspect the returned authorization decision rather than relying solely on the HTTP status.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-user-lifecycle-integrations\u0022\u003E3. Custom User Lifecycle Integrations\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.2\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe \u003Ccode\u003EIUserLifecycleIntegration.OnUserCreatedAsync\u003C/code\u003E signature now includes \u003Ccode\u003EUAuthApplicationProfile\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask OnUserCreatedAsync(\n TenantKey tenant,\n UserKey userKey,\n object request,\n CancellationToken ct = default);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask OnUserCreatedAsync(\n TenantKey tenant,\n UserKey userKey,\n object request,\n UAuthApplicationProfile applicationProfile,\n CancellationToken ct = default);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUpdate custom implementations to accept the additional client profile parameter.\u003C/p\u003E\n\u003Cp\u003EApplications using built-in lifecycle integrations do not need to make this change.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022identifier-and-profile-limits\u0022\u003E4. Identifier and Profile Limits\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.2\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe reference Users domain now enforces additional identifier and profile safety limits.\u003C/p\u003E\n\u003Cp\u003EThe default maximum is 10 active identifiers per user. Applications requiring a different capacity should configure \u003Ccode\u003EIdentifiers.Behavior.MaxIdentifiersPerUser\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EExisting profile creation and update operations must also respect the new field-length and metadata limits.\u003C/p\u003E\n\u003Cp\u003EIf you use EF Core persistence:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EReview existing profile data for values exceeding the new limits.\u003C/li\u003E\n\u003Cli\u003EAdd or apply the appropriate EF Core database migration for your application\u0027s DbContext.\u003C/li\u003E\n\u003Cli\u003EVerify that applications handling profile validation errors use the returned error codes.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/plugin-domains/profile-validation-limits\u0022\u003EProfile Validation \u0026amp; Limits\u003C/a\u003E for the supported limits.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022password-policies-and-history\u0022\u003E5. Password Policies and History\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.2\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe reference password credential implementation now applies configurable password policies, with Standard as the default level.\u003C/p\u003E\n\u003Cp\u003EReview custom registration, password-change, and password-reset flows to ensure that they handle server-side password validation errors.\u003C/p\u003E\n\u003Cp\u003EApplications using persistent password-history storage must apply the required database migration before enabling password history.\u003C/p\u003E\n\u003Cp\u003EPassword history is disabled by default (\u003Ccode\u003ERememberLast = 0\u003C/code\u003E).\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/password-policy\u0022\u003EPassword Policy \u0026amp; History\u003C/a\u003E for configuration and persistence requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022rate-limiting\u0022\u003E6. Rate Limiting\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.2\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EBuilt-in endpoint rate limiting is enabled by default when using:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eapp.UseUltimateAuthWithAspNetCore();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIf your application already registers its own rate limiting middleware, avoid installing a duplicate limiter.\u003C/p\u003E\n\u003Cp\u003ETo retain application-owned rate limiting:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eapp.UseUltimateAuthWithAspNetCore(useRateLimiting: false);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThen configure your existing \u003Ccode\u003EUseRateLimiter()\u003C/code\u003E middleware in the appropriate pipeline position.\u003C/p\u003E\n\u003Cp\u003EApplications using \u003Ccode\u003EUseUltimateAuth()\u003C/code\u003E without the integrated ASP.NET Core helper do not enable UltimateAuth rate limiting by default.\u003C/p\u003E\n\u003Cp\u003EReview custom HTTP clients and authentication flows for HTTP \u003Ccode\u003E429 Too Many Requests\u003C/code\u003E handling.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/rate-limiting\u0022\u003ERate Limiting\u003C/a\u003E for middleware integration and defaults.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022native-login-form-and-credential-submission\u0022\u003E7. Native Login Form and Credential Submission\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthLoginForm\u003C/code\u003E no longer accepts \u003Ccode\u003EIdentifier\u003C/code\u003E and \u003Ccode\u003ESecret\u003C/code\u003E component parameters.\u003C/p\u003E\n\u003Cp\u003ECredentials are now read directly from native browser form inputs. This reduces unnecessary exposure of passwords through Blazor component state and Blazor Server\u0027s interactive communication.\u003C/p\u003E\n\u003Cp\u003EApplications using the removed component parameters must update their login forms.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003ERazor\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-razor\u0022\u003E\u0026lt;UAuthLoginForm Identifier=\u0026quot;@identifier\u0026quot; Secret=\u0026quot;@password\u0026quot; /\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter \u2014 built-in form:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003ERazor\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-razor\u0022\u003E\u0026lt;UAuthLoginForm /\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen no child content is provided, UltimateAuth renders the identifier field, password field, and submit button automatically.\u003C/p\u003E\n\u003Cp\u003EFor custom layouts, provide native-compatible credential inputs:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003ERazor\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-razor\u0022\u003E\u0026lt;UAuthLoginForm\u0026gt;\n \u0026lt;input name=\u0026quot;Identifier\u0026quot; autocomplete=\u0026quot;username\u0026quot; required /\u0026gt;\n \u0026lt;input name=\u0026quot;Secret\u0026quot; type=\u0026quot;password\u0026quot;\n autocomplete=\u0026quot;current-password\u0026quot; required /\u0026gt;\n \u0026lt;button type=\u0026quot;submit\u0026quot;\u0026gt;Sign in\u0026lt;/button\u0026gt;\n\u0026lt;/UAuthLoginForm\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ECustom inputs must use the exact HTML \u003Ccode\u003Ename\u003C/code\u003E - \u003Ccode\u003EIdentifier\u003C/code\u003E and \u003Ccode\u003ESecret\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EKeep credential inputs enabled during submission. Disabled inputs are excluded from native form submissions; disable the submit button instead.\u003C/p\u003E\n\u003Cp\u003EThe existing \u003Ccode\u003ETryOnly\u003C/code\u003E, \u003Ccode\u003ETryAndCommit\u003C/code\u003E, and \u003Ccode\u003EDirectCommit\u003C/code\u003E submission modes remain available.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/client-sdk/authentication\u0022\u003EAuthentication Client SDK\u003C/a\u003E for current login integration guidance.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-failure-details\u0022\u003E8. Authentication Failure Details\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EDefault changed in preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthLoginOptions.IncludeFailureDetails\u003C/code\u003E now defaults to \u003Ccode\u003Efalse\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EPreviously, failed authentication responses could expose lockout reasons, remaining attempts, or lockout expiration details by default.\u003C/p\u003E\n\u003Cp\u003EWith the new default, public authentication failures return generic \u003Ccode\u003EInvalidCredentials\u003C/code\u003E information without exposing account-specific lockout state.\u003C/p\u003E\n\u003Cp\u003EThis applies to ordinary login, login previews, PKCE previews, and login failure redirects.\u003C/p\u003E\n\u003Cp\u003EApplications relying on detailed failure feedback should update their user interfaces to handle generic authentication failures.\u003C/p\u003E\n\u003Cp\u003EDetailed feedback remains available through explicit configuration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.IncludeFailureDetails = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003ESecurity consideration:\u003C/strong\u003E Enabling this option may reveal account existence or lockout state to unauthenticated clients. Keep it disabled unless detailed disclosure is an intentional application requirement.\u003C/p\u003E\n\u003Cp\u003EFor authorized administrative inspection, use the authentication lockout management APIs instead.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022asp.net-core-authorization-and-user-status\u0022\u003E9. ASP.NET Core Authorization and User Status\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBehavior changed in preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth now checks account status when authorizing protected ASP.NET Core HTTP endpoints.\u003C/p\u003E\n\u003Cp\u003EA valid session or matching role no longer automatically grants access when the associated user is inactive.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EUser status\u003C/th\u003E\n\u003Cth\u003EOrdinary protected HTTP endpoint\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EActive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAllowed when other requirements pass\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESuspended\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDenied\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESelfSuspended\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDenied\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDisabled\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDenied\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMissing or invalid status\u003C/td\u003E\n\u003Ctd\u003EDenied\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EExisting applications that intentionally allow suspended users to access selected protected HTTP endpoints should use:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003E[Authorize]\n[UAuthAllowInactive]\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis exception preserves the endpoint\u0027s existing authentication and authorization requirements. It does not grant access to disabled or otherwise ineligible accounts.\u003C/p\u003E\n\u003Cp\u003EFor independently hosted Resource APIs, the validated Hub response must contain a valid \u003Ccode\u003Esnapshot.identity.userStatus\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EOlder custom Hub validation responses that omit this information are no longer sufficient for successful protected HTTP authorization.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAuthorization policy precedence:\u003C/strong\u003E Explicitly registered ASP.NET Core named policies are now resolved before UltimateAuth action-policy fallback. Review applications that use the same policy name in both systems.\u003C/p\u003E\n\u003Cp\u003EThese changes apply to ASP.NET Core HTTP authorization middleware. They do not automatically replace authorization checks in Blazor component rendering, direct service calls, or direct \u003Ccode\u003EIAuthorizationService.AuthorizeAsync\u003C/code\u003E usage.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022password-verification-and-concurrency-limiting\u0022\u003E10. Password Verification and Concurrency Limiting\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth introduces dummy password verification to reduce observable timing differences between authentication paths.\u003C/p\u003E\n\u003Cp\u003EPassword verification now also uses built-in concurrency limiting to protect CPU and memory resources.\u003C/p\u003E\n\u003Cp\u003EConcurrency limiting is \u003Cstrong\u003Eenabled by default\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe default configuration uses three coordinated policies:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EPolicy\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPasswordHashing\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EShared global hashing capacity\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReal and dummy login verification\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECredentialManagement\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPassword creation, changes, resets, and history checks\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EDefault capacity is derived from \u003Ccode\u003EMath.Max(2, Environment.ProcessorCount)\u003C/code\u003E. Initial queue capacity is five times the permit limit, and the queue timeout is three seconds.\u003C/p\u003E\n\u003Cp\u003EWhen capacity is exhausted, the server may return HTTP \u003Ccode\u003E429 Too Many Requests\u003C/code\u003E with the error code \u003Ccode\u003Epassword_verification_busy\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EApplications should treat this as a temporary server-capacity condition, not invalid credentials or an expired session.\u003C/p\u003E\n\u003Cp\u003EConfigure capacity based on deployment resources:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ConcurrencyLimiting.PasswordHashing.PermitLimit = 8;\n options.ConcurrencyLimiting.PasswordHashing.QueueLimit = 40;\n options.ConcurrencyLimiting.PasswordHashing.QueueTimeout = TimeSpan.FromSeconds(3);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe default Argon2 parallelism for newly generated hashes is now \u003Ccode\u003E1\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EExisting hashes remain verifiable using their stored parameters. Password resets or hash migrations are not required solely because of this default change.\u003C/p\u003E\n\u003Cp\u003EConcurrency limiting is independent of HTTP endpoint rate limiting and operates per application process.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/concurrency-limiting\u0022\u003EConcurrency Limiting\u003C/a\u003E for configuration and deployment considerations.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-artifact-store-capacity\u0022\u003E11. Authentication Artifact Store Capacity\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe built-in in-memory authentication artifact store now performs periodic expiration cleanup and enforces a configurable capacity limit.\u003C/p\u003E\n\u003Cp\u003EThis affects temporary authentication artifacts such as PKCE authorization codes and login preview receipts.\u003C/p\u003E\n\u003Cp\u003ENew defaults:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ESetting\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthArtifacts.MaxEntries\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E50,000\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthArtifacts.CleanupInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E1 minute\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe configured capacity is per application process.\u003C/p\u003E\n\u003Cp\u003EWhen all available entries are occupied by valid artifacts, new artifact creation can fail with HTTP \u003Ccode\u003E503 Service Unavailable\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EApplications with high authentication traffic should monitor artifact capacity and adjust the limits as necessary.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthArtifacts.MaxEntries = 100_000;\n options.AuthArtifacts.CleanupInterval = TimeSpan.FromMinutes(1);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe \u003Ccode\u003EIAuthStore\u003C/code\u003E interface remains unchanged.\u003C/p\u003E\n\u003Cp\u003ECustom artifact-store implementations retain responsibility for their own expiration cleanup and capacity management.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-security-state-persistence\u0022\u003E12. Authentication Security State Persistence\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EPersistence change in preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe EF Core authentication security state implementation introduces stronger uniqueness and concurrency enforcement.\u003C/p\u003E\n\u003Cp\u003EFor PostgreSQL, account-level authentication security state records now use uniqueness semantics that treat null credential-type values as non-distinct.\u003C/p\u003E\n\u003Cp\u003EApplications using PostgreSQL persistence must review their authentication security state data and apply the appropriate EF Core migration.\u003C/p\u003E\n\u003Cp\u003EBefore migration:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EBack up the database.\u003C/li\u003E\n\u003Cli\u003ECheck for duplicate authentication security state records, particularly account-level records with a null credential type.\u003C/li\u003E\n\u003Cli\u003EResolve duplicates before introducing the new unique constraint.\u003C/li\u003E\n\u003Cli\u003EApply the migration through the application\u0027s normal EF Core deployment process.\u003C/li\u003E\n\u003Cli\u003EVerify authentication, lockout, and password recovery operations.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThe reference samples and Identity Lab include corresponding migration changes.\u003C/p\u003E\n\u003Cp\u003EApplications managing their own \u003Ccode\u003EDbContext\u003C/code\u003E must ensure that the updated model and database schema are synchronized.\u003C/p\u003E\n\u003Cp\u003EExisting login and session DTO contracts remain unchanged.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-lockout-and-recovery\u0022\u003E13. Authentication Lockout and Recovery\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth introduces administrative APIs for inspecting and clearing account-level and factor-level authentication lockouts.\u003C/p\u003E\n\u003Cp\u003EThrough \u003Ccode\u003EIUAuthClient.Users\u003C/code\u003E, applications can now use:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar state = await UAuthClient.Users.GetAuthenticationLockoutAsync(userKey,\n new LockoutQueryRequest(AuthenticationSecurityScope.Factor, CredentialType.Password));\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAnd:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar result = await UAuthClient.Users.UnlockAuthenticationAsync(userKey,\n new UnlockAuthenticationRequest(AuthenticationSecurityScope.Factor, CredentialType.Password));\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese operations are authorization-protected and do not require existing applications to change their login integrations.\u003C/p\u003E\n\u003Cp\u003EA successful verified password reset now clears the related password-factor lockout as part of credential recovery.\u003C/p\u003E\n\u003Cp\u003EAccount-level lockouts, unrelated security states, user lifecycle status, and existing session policies remain separate.\u003C/p\u003E\n\u003Cp\u003EThis is an additional recovery capability rather than a breaking API change.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/authentication-lockout\u0022\u003EAuthentication Lockout \u0026amp; Recovery\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022additional-authentication-security-hardening\u0022\u003E14. Additional Authentication Security Hardening\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003ESeveral authentication checks have been strengthened:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ERelative return URLs remain supported, while absolute return URLs require an explicitly allowed origin.\u003C/li\u003E\n\u003Cli\u003EAmbiguous or unsafe return URL paths are rejected.\u003C/li\u003E\n\u003Cli\u003ELogin preview receipts are bound to the original authentication context.\u003C/li\u003E\n\u003Cli\u003EPreview receipts must be consumed successfully and atomically before they can suppress duplicate failed-attempt accounting.\u003C/li\u003E\n\u003Cli\u003EPreviously consumed, mismatched, or stale preview receipts cannot bypass failure accounting.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EApplications using standard UltimateAuth login components should not need additional code changes.\u003C/p\u003E\n\u003Cp\u003ECustom login clients should avoid reusing preview receipts or modifying the authentication context between preview and commit.\u003C/p\u003E\n\u003Cp\u003EApplications relying on arbitrary external redirect targets must explicitly configure the corresponding allowed origins.\u003C/p\u003E\n\u003Cp\u003EThese changes intentionally strengthen validation and may reject requests that were previously accepted.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-limits-and-browser-device-type-classification\u0022\u003E15. Device Limits and Browser Device Type Classification\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since rc.1\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth introduces configurable active-device limits through \u003Ccode\u003EUAuthServerOptions.DeviceLimits\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EApplications can restrict the number of distinct active devices per user and tenant, either globally or by device type.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.DeviceLimits.MaxDevices = 3;\n options.DeviceLimits.TypeLimits[\u0026quot;web\u0026quot;] = 2;\n options.DeviceLimits.Behavior = DeviceLimitBehavior.RejectNewLogin;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDevice limits are \u003Cstrong\u003Edisabled by default\u003C/strong\u003E:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EMaxDevices = null\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ETypeLimits\u003C/code\u003E is empty.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EBehavior = RejectNewLogin\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EExisting applications do not acquire device quotas merely by upgrading.\u003C/p\u003E\n\u003Cp\u003EWhen enabled, \u003Ccode\u003ERejectNewLogin\u003C/code\u003E refuses additional device admission without revoking existing devices.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ERevokeOldest\u003C/code\u003E instead revokes eligible older active device chains when capacity must be freed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022breaking-change-browser-device-type-is-now-web\u0022\u003EBreaking Change: Browser Device Type Is Now \u003Ccode\u003Eweb\u003C/code\u003E\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003EBrowser-based clients previously could be classified as \u003Ccode\u003Edesktop\u003C/code\u003E. The built-in Blazor web device provider now reports \u003Ccode\u003EDeviceType = \u0026quot;web\u0026quot;\u003C/code\u003E.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EServer device-type resolution also defaults to \u003Ccode\u003Eweb\u003C/code\u003E when no explicit type is supplied.\u003C/p\u003E\n\u003Cp\u003EThis applies to both desktop and mobile browsers.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EClient Environment\u003C/th\u003E\n\u003Cth\u003EDeviceType\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDesktop browser\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Eweb\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMobile browser\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Eweb\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ENative desktop application\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Edesktop\u003C/code\u003E when explicitly provided\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ENative mobile application\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Emobile\u003C/code\u003E when explicitly provided\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe change distinguishes browser-based client environments from native application platforms.\u003C/p\u003E\n\u003Cp\u003EIt does not remove the \u003Ccode\u003Edesktop\u003C/code\u003E or \u003Ccode\u003Emobile\u003C/code\u003E classifications.\u003C/p\u003E\n\u003Cp\u003EApplications can continue using these values for appropriate native clients.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022migration-impact\u0022\u003EMigration Impact\u003C/h3\u003E\n\u003Cp\u003EThis is a \u003Cstrong\u003Ebehavioral breaking change\u003C/strong\u003E for applications that rely on device-type classification.\u003C/p\u003E\n\u003Cp\u003EReview implementations that:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EFilter sessions by \u003Ccode\u003EDeviceType\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EDisplay device types in user interfaces.\u003C/li\u003E\n\u003Cli\u003EApply custom device-type policies.\u003C/li\u003E\n\u003Cli\u003EUse device classifications in analytics or diagnostics.\u003C/li\u003E\n\u003Cli\u003EAssume that \u003Ccode\u003Edesktop\u003C/code\u003E represents all desktop-browser sessions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar browserType = \u0026quot;desktop\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar browserType = \u0026quot;web\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDo not infer the operating system from \u003Ccode\u003EDeviceType\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EUse the separate \u003Ccode\u003EPlatform\u003C/code\u003E, \u003Ccode\u003EOperatingSystem\u003C/code\u003E, and \u003Ccode\u003EBrowser\u003C/code\u003E metadata where appropriate.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ENote:\u003C/strong\u003E Device Limits is a new feature introduced in v0.2.0. The example above illustrates migration of existing device-type assumptions, not an earlier \u003Ccode\u003EDeviceLimits.TypeLimits\u003C/code\u003E API.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022existing-persisted-device-records\u0022\u003EExisting Persisted Device Records\u003C/h3\u003E\n\u003Cp\u003EUpdating UltimateAuth does not automatically rewrite device-type values in persisted session chains.\u003C/p\u003E\n\u003Cp\u003EAn existing browser device may still be recorded as:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EDeviceType: desktop\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen an incoming \u003Ccode\u003EDeviceId\u003C/code\u003E matches an already active device chain, UltimateAuth preserves that device\u0027s existing type classification.\u003C/p\u003E\n\u003Cp\u003ETherefore, a previously admitted browser device classified as \u003Ccode\u003Edesktop\u003C/code\u003E can retain that classification during subsequent authentication.\u003C/p\u003E\n\u003Cp\u003ENew browser device IDs are classified as \u003Ccode\u003Eweb\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EDuring the transition, both classifications may coexist:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EExisting active browser:\n DeviceType = desktop\n\nNew browser:\n DeviceType = web\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis distinction matters when per-type limits are enabled.\u003C/p\u003E\n\u003Cp\u003ELegacy \u003Ccode\u003Edesktop\u003C/code\u003E records and new \u003Ccode\u003Eweb\u003C/code\u003E records may be counted in different type categories until the existing active device state ends.\u003C/p\u003E\n\u003Cp\u003EApplications should review existing session data and plan an appropriate transition.\u003C/p\u003E\n\u003Cp\u003EIf immediate classification consistency is required, consider controlled reauthentication or device-session revocation.\u003C/p\u003E\n\u003Cp\u003EDo not assume that a database schema migration automatically changes stored device classifications.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022breaking-change-custom-session-stores\u0022\u003EBreaking Change: Custom Session Stores\u003C/h3\u003E\n\u003Cp\u003EThe \u003Ccode\u003EISessionStore\u003C/code\u003E interface introduces a new operation:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask\u0026lt;TResult\u0026gt; ExecuteAdmissionAsync\u0026lt;TResult\u0026gt;(\n Func\u0026lt;CancellationToken, Task\u0026lt;TResult\u0026gt;\u0026gt; action,\n CancellationToken ct = default);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is an \u003Cstrong\u003Einterface-level breaking change\u003C/strong\u003E for custom session-store implementations.\u003C/p\u003E\n\u003Cp\u003EImplementations must add support for the new method even when device limits are disabled.\u003C/p\u003E\n\u003Cp\u003EWhen limits are enabled, device admission must be atomic and concurrency-safe.\u003C/p\u003E\n\u003Cp\u003ECustom stores must ensure:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAdmission changes are committed atomically.\u003C/li\u003E\n\u003Cli\u003EFailed admissions are rolled back.\u003C/li\u003E\n\u003Cli\u003ESimultaneous login requests cannot exceed configured limits.\u003C/li\u003E\n\u003Cli\u003EConcurrency protection applies across application instances sharing the same persistence infrastructure.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe built-in in-memory and EF Core stores implement the new contract.\u003C/p\u003E\n\u003Cp\u003EThe EF Core implementation uses a serializable transaction for device admission.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022database-migration-requirements\u0022\u003EDatabase Migration Requirements\u003C/h3\u003E\n\u003Cp\u003EDevice Limits does not introduce a new database table or require a schema migration by itself.\u003C/p\u003E\n\u003Cp\u003EThe feature uses existing session root, chain, and session persistence.\u003C/p\u003E\n\u003Cp\u003EHowever, other v0.2.0 persistence changes may still require application database migrations.\u003C/p\u003E\n\u003Cp\u003ECustom \u003Ccode\u003EDbContext\u003C/code\u003E implementations should continue following the database migration requirements documented in the preceding sections.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022upgrade-checklist\u0022\u003EUpgrade Checklist\u003C/h3\u003E\n\u003Col\u003E\n\u003Cli\u003EReview custom device-type consumers and replace browser-specific \u003Ccode\u003Edesktop\u003C/code\u003E assumptions with \u003Ccode\u003Eweb\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EReview active persisted device chains for legacy \u003Ccode\u003Edesktop\u003C/code\u003E classifications.\u003C/li\u003E\n\u003Cli\u003EPlan session turnover or controlled revocation if immediate classification consistency is required.\u003C/li\u003E\n\u003Cli\u003EUpdate custom \u003Ccode\u003EISessionStore\u003C/code\u003E implementations to support \u003Ccode\u003EExecuteAdmissionAsync\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EVerify atomic admission and concurrent login handling before enabling device quotas.\u003C/li\u003E\n\u003Cli\u003EConfigure \u003Ccode\u003EDeviceLimits\u003C/code\u003E explicitly only when the application requires device restrictions.\u003C/li\u003E\n\u003Cli\u003ETest login failure handling and device management behavior with the selected \u003Ccode\u003ERejectNewLogin\u003C/code\u003E or \u003Ccode\u003ERevokeOldest\u003C/code\u003E policy.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/sessions-devices/device-limits\u0022\u003EDevice Limits\u003C/a\u003E for the complete configuration and enforcement reference.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-profile-api-redesign\u0022\u003E16. Application Profile API Redesign\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EIntroduced in the PureJwt implementation for v0.2.0\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthClientProfile\u003C/code\u003E has been replaced by \u003Ccode\u003EUAuthApplicationProfile\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe new name distinguishes the application environment from the authentication mode selected by the server.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.ClientProfile = UAuthClientProfile.BlazorServer;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.ApplicationProfile = UAuthApplicationProfile.BlazorServer;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApplications using automatic profile detection normally do not need to configure this property.\u003C/p\u003E\n\u003Cp\u003ECustom implementations of \u003Ccode\u003EIClientProfileDetector\u003C/code\u003E must migrate to \u003Ccode\u003EIApplicationProfileDetector\u003C/code\u003E. Methods and contracts that previously accepted \u003Ccode\u003EUAuthClientProfile\u003C/code\u003E now use the replacement enum.\u003C/p\u003E\n\u003Cp\u003EThe new enum also distinguishes a Resource API from an ordinary API consumer through \u003Ccode\u003EUAuthApplicationProfile.ResourceApi\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-mode-selection\u0022\u003EAuthentication mode selection\u003C/h3\u003E\n\u003Cp\u003EThe server now supports explicit mode selection:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthMode = UAuthMode.PureOpaque;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor profile-specific customization:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ApplicationProfileModes[UAuthApplicationProfile.BlazorServer] = UAuthMode.PureOpaque;\n\n options.ApplicationProfileModes[UAuthApplicationProfile.BlazorWasm] = UAuthMode.PureJwt;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthMode\u003C/code\u003E and \u003Ccode\u003EApplicationProfileModes\u003C/code\u003E cannot be configured together.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E remains an allowlist, \u003Cstrong\u003Enot\u003C/strong\u003E an authentication mode selector.\u003C/p\u003E\n\u003Cp\u003EApplications relying on automatic resolution can keep their existing approach, but should verify the effective mode for each supported application profile.\u003C/p\u003E\n\u003Cp\u003EClient-supplied profile information must not be treated as proof of application identity or trust.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-response-and-grant-delivery-redesign\u0022\u003E17. Authentication Response and Grant Delivery Redesign\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBreaking configuration change in the PureJwt implementation\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe former \u003Ccode\u003EAuthResponse\u003C/code\u003E configuration has been replaced by two independent groups:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EGrantDelivery\u003C/code\u003E configures how authentication credentials are returned.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERedirect\u003C/code\u003E configures navigation after login and logout.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe legacy \u003Ccode\u003EUAuthServerOptions.AuthResponse\u003C/code\u003E property is obsolete and throws \u003Ccode\u003ENotSupportedException\u003C/code\u003E when accessed.\u003C/p\u003E\n\u003Cp\u003EApplications that explicitly configured authentication responses must update those settings.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-delivery\u0022\u003ECredential delivery\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.AuthResponse.AccessTokenDelivery.Mode = TokenResponseMode.Header;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.GrantDelivery.AccessToken.Mode = GrantDeliveryMode.Header;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA global preference is also available:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.GrantDelivery.Default = GrantDeliveryMode.Cookie;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIndividual grant settings take precedence over the global preference.\u003C/p\u003E\n\u003Cp\u003EWhen no explicit delivery preference is configured, UltimateAuth uses the effective authentication mode and application profile to select its defaults.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EGrantDeliveryMode\u003C/code\u003E replaces \u003Ccode\u003ETokenResponseMode\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe configuration is intentionally more restrictive:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EDelivery settings do not create credentials that are unavailable in the selected authentication mode.\u003C/li\u003E\n\u003Cli\u003EA required grant cannot be disabled using \u003Ccode\u003EGrantDeliveryMode.None\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EGrantDeliveryMode.Body\u003C/code\u003E is not supported by the current grant delivery resolver.\u003C/li\u003E\n\u003Cli\u003EHeader names and formats can be customized through the corresponding grant options.\u003C/li\u003E\n\u003Cli\u003ECookie attributes remain configurable through \u003Ccode\u003Eoptions.Cookie\u003C/code\u003E.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EApplications using built-in response defaults generally do not need to configure grant delivery explicitly.\u003C/p\u003E\n\u003Cp\u003EApplications using custom cookie or header handling should verify that their request-side credential resolution matches the configured response delivery.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-and-logout-redirects\u0022\u003ELogin and logout redirects\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.AuthResponse.Login.SuccessRedirect = \u0026quot;/dashboard\u0026quot;;\noptions.AuthResponse.Logout.SuccessRedirect = \u0026quot;/\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Redirect.Login.SuccessRedirect = \u0026quot;/dashboard\u0026quot;;\noptions.Redirect.Logout.SuccessRedirect = \u0026quot;/\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERedirect configuration no longer controls credential delivery.\u003C/p\u003E\n\u003Cp\u003EThe legacy \u003Ccode\u003ELoginRedirectOptions\u003C/code\u003E properties \u003Ccode\u003EFailureQueryKey\u003C/code\u003E, \u003Ccode\u003ECodeQueryKey\u003C/code\u003E, \u003Ccode\u003EFailureCodes\u003C/code\u003E, \u003Ccode\u003EIncludeLockoutTiming\u003C/code\u003E, and \u003Ccode\u003EIncludeRemainingAttempts\u003C/code\u003E have been removed.\u003C/p\u003E\n\u003Cp\u003EApplications that used these options must remove the corresponding configuration and adapt to the supported redirect behavior.\u003C/p\u003E\n\u003Cp\u003EFor authentication failure disclosure, review the \u003Ccode\u003ELogin.IncludeFailureDetails\u003C/code\u003E setting and the security considerations described in Section 8.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022automatic-mode-resolution\u0022\u003EAutomatic mode resolution\u003C/h3\u003E\n\u003Cp\u003EThe selected authentication mode now determines which grants are available before delivery configuration is applied.\u003C/p\u003E\n\u003Cp\u003EDo not assume that selecting cookie or header delivery changes the authentication mode or the issued token format.\u003C/p\u003E\n\u003Cp\u003EReview applications that previously depended on response configuration to override mode-specific credential behavior.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022production-cryptographic-key-configuration\u0022\u003E18. Production Cryptographic Key Configuration\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003ESecurity-sensitive deployment change in the PureJwt implementation\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth now separates JWT signing from server-managed token hashing.\u003C/p\u003E\n\u003Cp\u003EThe built-in cryptography configuration provides two independent keys:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOption\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECryptography.TokenHashingKey\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHMAC-SHA256 hashing of server-managed token material\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECryptography.JwtSigningKey\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHS256 JWT access-token signing\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe built-in implementations require valid Base64-encoded key material containing at least 32 bytes per key.\u003C/p\u003E\n\u003Cp\u003EThe keys must be different.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022production-startup-validation\u0022\u003EProduction startup validation\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth includes deterministic cryptographic defaults for local development.\u003C/p\u003E\n\u003Cp\u003EThese defaults are accepted in the \u003Ccode\u003EDevelopment\u003C/code\u003E environment but are rejected outside Development when the corresponding built-in provider is used.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EApplications that previously started without explicit production cryptographic configuration must now provide securely generated keys.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey = builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;Token hashing key is missing.\u0026quot;);\n\n options.Cryptography.JwtSigningKey = builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;JWT signing key is missing.\u0026quot;);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ESupply the values through a secret manager or environment variables:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth__Cryptography__TokenHashingKey\nUltimateAuth__Cryptography__JwtSigningKey\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EGenerate independent random values using a cryptographically secure random-number generator.\u003C/p\u003E\n\u003Cp\u003EDo not commit production keys to source control or generate new keys on every application startup.\u003C/p\u003E\n\u003Cp\u003EApplications using custom registered signing or hashing providers should review the corresponding provider registrations and validation requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022existing-token-compatibility\u0022\u003EExisting token compatibility\u003C/h3\u003E\n\u003Cp\u003EEarlier built-in token hashing depended on the JWT signing key provider.\u003C/p\u003E\n\u003Cp\u003EThe new implementation uses a separate \u003Ccode\u003ETokenHashingKey\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EChanging the effective token-hashing key can invalidate existing server-managed token credentials whose stored hashes were produced using the previous key.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThis can affect existing sessions or refresh credentials, depending on the application\u0027s active authentication mode and persistence configuration.\u003C/p\u003E\n\u003Cp\u003EPlan an appropriate reauthentication strategy before deploying the new key configuration.\u003C/p\u003E\n\u003Cp\u003EKeep key material consistent across application instances that share authentication state.\u003C/p\u003E\n\u003Cp\u003EJWT signing-key changes can also invalidate previously issued JWTs unless the corresponding verification keys remain available through an explicitly configured validation strategy.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/token-security\u0022\u003EToken Security\u003C/a\u003E and \u003Ca href=\u0022/docs/getting-started/real-world-setup\u0022\u003EReal-World Setup\u003C/a\u003E for current cryptographic configuration guidance.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-authentication-and-resource-api-migration\u0022\u003E19. PureJwt Authentication and Resource API Migration\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003ENew authentication mode implementation in v0.2.0\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EPureJwt\u003C/code\u003E now supports authentication without creating server-side sessions.\u003C/p\u003E\n\u003Cp\u003EIt issues JWT access tokens and uses persisted, device-associated refresh-token chains for renewal.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E and the existing session-backed authentication paths remain available.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ESemiHybrid\u003C/code\u003E is not yet supported by the current implementation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-authentication-behavior\u0022\u003EPureJwt authentication behavior\u003C/h3\u003E\n\u003Cp\u003EUnlike session-backed modes, PureJwt does not require a \u003Ccode\u003ESessionId\u003C/code\u003E or \u003Ccode\u003ESessionChainId\u003C/code\u003E to issue or refresh credentials.\u003C/p\u003E\n\u003Cp\u003EThe JWT access token represents the authenticated identity and can be validated using trusted verification keys.\u003C/p\u003E\n\u003Cp\u003EThe refresh credential remains stateful.\u003C/p\u003E\n\u003Cp\u003EPureJwt refresh:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EValidates the refresh token, tenant, and device association.\u003C/li\u003E\n\u003Cli\u003EConfirms that the refresh credential is not session-bound.\u003C/li\u003E\n\u003Cli\u003ERotates the refresh token and persists its replacement.\u003C/li\u003E\n\u003Cli\u003EIssues a new JWT access token.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EAn invalid, expired, revoked, or incorrectly bound refresh credential cannot continue the authentication flow.\u003C/p\u003E\n\u003Cp\u003ERefresh-token replay detection can revoke the associated refresh chain.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-logout\u0022\u003EPureJwt logout\u003C/h3\u003E\n\u003Cp\u003EPureJwt logout differs from session-based logout.\u003C/p\u003E\n\u003Cp\u003EWhen the authenticated request supplies a refresh token, UltimateAuth validates its ownership and revokes the associated refresh chain.\u003C/p\u003E\n\u003Cp\u003EClients must ensure that the applicable refresh credential is supplied when they expect logout to terminate server-managed refresh capability.\u003C/p\u003E\n\u003Cp\u003EClearing a cookie or deleting a locally stored token is not equivalent to revoking refresh-token state.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EPreviously issued JWT access tokens remain independently valid until expiration\u003C/strong\u003E, unless an additional validation or revocation mechanism prevents their acceptance.\u003C/p\u003E\n\u003Cp\u003EConsequently, PureJwt logout must not be treated as immediate revocation of every already-issued access token.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-configuration\u0022\u003EResource API configuration\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthResourceApiOptions\u003C/code\u003E has been reorganized.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.UAuthHubBaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\noptions.AllowedClientOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\noptions.CorsPolicyName = \u0026quot;UAuthResource\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Hub.BaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\noptions.Cors.AllowedOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\noptions.Cors.PolicyName = \u0026quot;UAuthResource\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EResource API authentication settings are now grouped under \u003Ccode\u003Eoptions.Auth\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor a PureJwt Resource API, configure the JWT validation parameters and trusted verification keys:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.Auth.Mode = UAuthMode.PureJwt;\n\n options.Auth.Jwt = new UAuthJwtValidationOptions\n {\n Issuer = \u0026quot;UAuth\u0026quot;,\n Audience = \u0026quot;UAuthClient\u0026quot;,\n ValidAlgorithms = [SecurityAlgorithms.HmacSha256]\n };\n\n options.Cryptography.JwtVerificationKeys.Add(\n new UAuthJwtVerificationKeyOptions\n {\n KeyId = \u0026quot;uauth-hs256-v1\u0026quot;,\n Key = builder.Configuration[\u0026quot;UltimateAuth:JwtVerificationKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;JWT verification key is missing.\u0026quot;)\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe issuer, audience, algorithm, key ID, and key material must match the issuing authority\u0027s configuration.\u003C/p\u003E\n\u003Cp\u003EWhen using the built-in symmetric signing implementation, the trusted Resource API verification key contains the same cryptographic key material as the authority\u0027s JWT signing key.\u003C/p\u003E\n\u003Cp\u003EDo not configure the server\u0027s token-hashing key as a Resource API verification key.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022remote-versus-local-authentication\u0022\u003ERemote versus local authentication\u003C/h3\u003E\n\u003Cp\u003EThe built-in authentication mode resolver now selects PureOpaque for BlazorServer and Hybrid for all other application profiles.\u003C/p\u003E\n\u003Cp\u003EResource APIs default to Hybrid.\u003C/p\u003E\n\u003Cp\u003EExisting applications using remote session validation can continue using session-backed authentication by configuring the Hub address.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.Hub.BaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe default incoming session credential transport is cookie-based.\u003C/p\u003E\n\u003Cp\u003EPureJwt must be explicitly selected when independent JWT validation is required:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Auth.Mode = UAuthMode.PureJwt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe issuing authentication server must also be configured to issue compatible PureJwt credentials.\u003C/p\u003E\n\u003Cp\u003EAlthough Hybrid now issues JWT access tokens, the current Hybrid Resource API implementation continues to use remote session validation.\u003C/p\u003E\n\u003Cp\u003EHybrid-aware JWT validation in separate Resource APIs is not yet supported.\u003C/p\u003E\n\u003Cp\u003EUAuthHub and Resource APIs resolve their authentication modes independently. Automatic authentication configuration discovery and mode negotiation are not currently supported.\u003C/p\u003E\n\u003Cp\u003EApplications should verify authentication mode compatibility, cookie scope, credential transport, and CORS configuration before deployment.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-token-persistence-and-database-migration\u0022\u003E20. Refresh Token Persistence and Database Migration\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EPersistence and custom-store breaking change in the PureJwt implementation\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003ERefresh-token persistence now supports both session-backed credentials and session-independent PureJwt refresh chains.\u003C/p\u003E\n\u003Cp\u003EThe refresh-token model introduces \u003Ccode\u003ERefreshChainId\u003C/code\u003E and additional device and authentication metadata.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ESessionId\u003C/code\u003E is now nullable, and the previous \u003Ccode\u003EChainId\u003C/code\u003E association is explicitly named \u003Ccode\u003ESessionChainId\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022ef-core-schema-changes\u0022\u003EEF Core schema changes\u003C/h3\u003E\n\u003Cp\u003EApplications using UltimateAuth\u0027s EF Core token persistence must update their database schema before deploying the new runtime.\u003C/p\u003E\n\u003Cp\u003EThe reference migrations introduce:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EChange\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EChainId\u003C/code\u003E \u2192 \u003Ccode\u003ESessionChainId\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERenamed session-chain association\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESessionId\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENullable to support PureJwt\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshChainId\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENew required refresh-chain identifier\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceId\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENew nullable device association\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthenticatedAt\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENew nullable authentication timestamp\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EIndexes\u003C/td\u003E\n\u003Ctd\u003EAdditional refresh-chain and device lookup indexes\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe reference migrations are provided for the sample applications and Identity Lab.\u003C/p\u003E\n\u003Cp\u003EApplications using their own \u003Ccode\u003EDbContext\u003C/code\u003E must generate and review the corresponding EF Core migration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022existing-refresh-token-records\u0022\u003EExisting refresh-token records\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E The generated reference migrations introduce \u003Ccode\u003ERefreshChainId\u003C/code\u003E as a required column with \u003Ccode\u003EGuid.Empty\u003C/code\u003E as the default for pre-existing rows.\u003C/p\u003E\n\u003Cp\u003EThis default supports schema migration but does not establish valid, distinct refresh-chain identities for existing tokens.\u003C/p\u003E\n\u003Cp\u003EDo not assume previously persisted refresh credentials remain compatible with the new token model.\u003C/p\u003E\n\u003Cp\u003EBefore production migration:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EBack up the authentication database.\u003C/li\u003E\n\u003Cli\u003EReview existing refresh-token rows and their session or chain associations.\u003C/li\u003E\n\u003Cli\u003EDecide whether existing refresh credentials should be invalidated or migrated using a reviewed, data-preserving procedure.\u003C/li\u003E\n\u003Cli\u003EAvoid treating \u003Ccode\u003EGuid.Empty\u003C/code\u003E as a valid refresh-chain identifier.\u003C/li\u003E\n\u003Cli\u003EApply the schema migration before deploying the runtime that expects the new model.\u003C/li\u003E\n\u003Cli\u003EVerify login, refresh, logout, and replay handling after deployment.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EIf existing refresh credentials are intentionally invalidated, applications must allow affected users to authenticate again.\u003C/p\u003E\n\u003Cp\u003EDo not use the example migrations as proof that all existing refresh-token records have been semantically migrated.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-refresh-token-stores\u0022\u003ECustom refresh-token stores\u003C/h3\u003E\n\u003Cp\u003EThe \u003Ccode\u003EIRefreshTokenStore\u003C/code\u003E contract now distinguishes session-chain and refresh-chain revocation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ERevokeByChainAsync(...)\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ERevokeBySessionChainAsync(...)\nRevokeByRefreshChainAsync(...)\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ECustom implementations must support the revised contract.\u003C/p\u003E\n\u003Cp\u003EThe refresh-chain operation must revoke only the intended refresh-token lineage within the applicable tenant.\u003C/p\u003E\n\u003Cp\u003EApplications with custom token projections, mappers, validators, or issuance services must also account for the new nullable session association and refresh-chain identity.\u003C/p\u003E\n\u003Cp\u003EThe built-in EF Core and in-memory token stores implement the updated contracts.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-integrations-and-compatibility-review\u0022\u003E21. Custom Integrations and Compatibility Review\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAdditional API and contract changes in the PureJwt implementation\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe changes in this section primarily affect applications replacing or extending UltimateAuth\u0027s built-in implementations.\u003C/p\u003E\n\u003Cp\u003EApplications using the standard client and server registration methods generally do not need to implement these interfaces.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-context-and-refresh-results\u0022\u003EToken context and refresh results\u003C/h3\u003E\n\u003Cp\u003ESeveral public token-related contracts now distinguish session chains from refresh chains.\u003C/p\u003E\n\u003Cp\u003EFor custom integrations, review:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003ETokenIssuanceContext.ChainId\u003C/code\u003E \u2192 \u003Ccode\u003ETokenIssuanceContext.SessionChainId\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshTokenRotationExecution.ChainId\u003C/code\u003E \u2192 \u003Ccode\u003ERefreshTokenRotationExecution.SessionChainId\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshTokenValidationResult.ChainId\u003C/code\u003E \u2192 \u003Ccode\u003ERefreshTokenValidationResult.SessionChainId\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshToken.ChainId\u003C/code\u003E \u2192 \u003Ccode\u003ERefreshToken.SessionChainId\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe new \u003Ccode\u003ERefreshChainId\u003C/code\u003E is a separate identity. It must not be treated as an interchangeable replacement for \u003Ccode\u003ESessionChainId\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EPureJwt token issuance and validation can operate without a server-side session, whereas session-backed modes preserve their session associations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-authentication-and-response-components\u0022\u003ECustom authentication and response components\u003C/h3\u003E\n\u003Cp\u003ECustom implementations using the previous application profile, authentication mode resolver, credential resolver, or response-delivery contracts must be reviewed for signature and behavior changes.\u003C/p\u003E\n\u003Cp\u003EIn particular:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication mode resolution now uses an explicit \u003Ccode\u003EAuthModeResolutionContext\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EEffective grant delivery uses \u003Ccode\u003EEffectiveGrantDelivery\u003C/code\u003E rather than the legacy credential-response options.\u003C/li\u003E\n\u003Cli\u003EJWT-based authentication requires verification of trusted claims and device binding.\u003C/li\u003E\n\u003Cli\u003EPureJwt authorization must not assume that a session ID exists.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EApplications with direct dependencies on these extension points should compile and run their integration tests against v0.2.0 before deployment.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022compatibility-testing\u0022\u003ECompatibility testing\u003C/h3\u003E\n\u003Cp\u003EFor customized deployments, verify the following scenarios against the selected authentication mode:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EInitial login and credential issuance.\u003C/li\u003E\n\u003Cli\u003EAuthenticated request validation.\u003C/li\u003E\n\u003Cli\u003ERefresh and token rotation.\u003C/li\u003E\n\u003Cli\u003ELogout and refresh-chain termination.\u003C/li\u003E\n\u003Cli\u003EAuthorization for protected HTTP endpoints.\u003C/li\u003E\n\u003Cli\u003EDevice mismatch handling.\u003C/li\u003E\n\u003Cli\u003ERestart and multi-instance persistence behavior.\u003C/li\u003E\n\u003Cli\u003EResource API authentication and CORS configuration.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThese checks are especially important when upgrading implementations that previously assumed all authentication contexts were backed by server-side sessions.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-transport-and-client-api-changes\u0022\u003E22. Login Transport and Client API Changes\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAuthentication client changes in v0.2.0\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth now supports both navigation-based and fetch-based login submission.\u003C/p\u003E\n\u003Cp\u003EThe client discovers the effective server capabilities and selects a compatible login transport automatically.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022loginasync-return-type\u0022\u003ELoginAsync return type\u003C/h3\u003E\n\u003Cp\u003EThe return type of \u003Ccode\u003EIFlowClient.LoginAsync\u003C/code\u003E has changed.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask LoginAsync(LoginRequest request, string? returnUrl = null);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask\u0026lt;UAuthResult\u0026gt; LoginAsync(\n LoginRequest request,\n string? returnUrl = null,\n UAuthLoginTransport transport = UAuthLoginTransport.Auto);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EExisting awaited calls remain source-compatible:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eawait UAuthClient.Flows.LoginAsync(request);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApplications can now inspect the returned result:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar result = await UAuthClient.Flows.LoginAsync(request);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor navigation-based submissions, successful submission does not itself confirm that the server has accepted the authentication credentials.\u003C/p\u003E\n\u003Cp\u003EFetch-based submissions allow the client to observe the authentication response and process the delivered credentials.\u003C/p\u003E\n\u003Cp\u003ECustom \u003Ccode\u003EIFlowClient\u003C/code\u003E implementations, test doubles, and mocks must be updated to match the new method signature.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022tryloginasync-signature\u0022\u003ETryLoginAsync signature\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003ETryLoginAsync\u003C/code\u003E now accepts an optional login transport parameter:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask\u0026lt;TryLoginResult\u0026gt; TryLoginAsync(\n LoginRequest request,\n UAuthSubmitMode mode,\n string? returnUrl = null,\n UAuthLoginTransport transport = UAuthLoginTransport.Auto);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe existing \u003Ccode\u003ETryOnly\u003C/code\u003E, \u003Ccode\u003ETryAndCommit\u003C/code\u003E, and \u003Ccode\u003EDirectCommit\u003C/code\u003E submission modes remain available.\u003C/p\u003E\n\u003Cp\u003EExisting application calls do not need to specify the new parameter.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022explicit-login-transport\u0022\u003EExplicit login transport\u003C/h3\u003E\n\u003Cp\u003EApplications can explicitly select a transport when necessary:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eawait UAuthClient.Flows.LoginAsync(\n request,\n transport: UAuthLoginTransport.Fetch);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe available transport strategies are:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EAuto\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EFetch\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ENavigation\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003E\u003Ccode\u003EAuto\u003C/code\u003E is the default and recommended strategy.\u003C/p\u003E\n\u003Cp\u003EApplications must not assume that every login operation performs a full browser navigation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-transport-discovery-endpoint\u0022\u003ELogin transport discovery endpoint\u003C/h3\u003E\n\u003Cp\u003EA new endpoint exposes the effective login transport capabilities:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003E/auth/login/transport\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApplications using custom endpoint paths can configure:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Endpoints.LoginTransport = \u0026quot;/login/transport\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EReview reverse proxies, endpoint allowlists, and custom authentication endpoint configurations to ensure that this endpoint is accessible to the client.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-client-implementations\u0022\u003ECustom client implementations\u003C/h3\u003E\n\u003Cp\u003EThe \u003Ccode\u003EIFlowClient\u003C/code\u003E contract also introduces:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask\u0026lt;RefreshResult\u0026gt; RecoverAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis operation supports authentication recovery when a usable access token is unavailable but a compatible refresh credential remains available.\u003C/p\u003E\n\u003Cp\u003ECustom client implementations must implement the updated contract.\u003C/p\u003E\n\u003Cp\u003EApplications using the built-in UltimateAuth client do not need to implement recovery manually.\u003C/p\u003E\n\u003Chr\u003E\n\u003Cp\u003EThis page will continue to evolve through the v0.2.0 preview and RC series and will become the stable migration guide when v0.2.0 is released.\u003C/p\u003E\n", + "Html": "\n\u003Cp\u003E\u003Cstrong\u003EMigration Impact: High \u2014 In Progress\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ELatest published prerelease reviewed: v0.2.0-preview.4\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThis guide covers migration requirements for the upcoming UltimateAuth v0.2.0 release.\u003C/p\u003E\n\u003Cp\u003EThe guide is provisional and will be updated as new preview and release candidate versions become available. The final migration requirements may change before the stable v0.2.0 release.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022migration-overview\u0022\u003EMigration Overview\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth v0.2.0 introduces new authentication capabilities, strengthens security defaults, and reorganizes several public configuration APIs.\u003C/p\u003E\n\u003Cp\u003EFor applications using the built-in integrations and default authentication behavior, migration primarily involves reviewing configuration changes, providing production cryptographic keys, and applying any required database migrations.\u003C/p\u003E\n\u003Cp\u003EApplications with custom authentication policies, persistence stores, credential delivery settings, or Resource API configurations should also review the detailed sections below.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ERecommended upgrade sequence:\u003C/strong\u003E\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EUpdate renamed public APIs and configuration properties.\u003C/li\u003E\n\u003Cli\u003EConfigure and validate cryptographic keys before production deployment.\u003C/li\u003E\n\u003Cli\u003EReview authentication mode and credential delivery behavior.\u003C/li\u003E\n\u003Cli\u003EApply required persistence migrations.\u003C/li\u003E\n\u003Cli\u003EVerify login, refresh, logout, authorization, and Resource API integration.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-public-api-changes\u0022\u003ECommon Public API Changes\u003C/h3\u003E\n\u003Cp\u003EThe following table focuses on commonly accessed public APIs and configuration properties. Internal implementation types and advanced extension-point changes are covered in the detailed migration sections.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EBefore (v0.1.x)\u003C/th\u003E\n\u003Cth\u003EAfter (v0.2.0)\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoDetectClientProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoDetectApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EClientProfileModes\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EApplicationProfileModes\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIClientProfileDetector\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIApplicationProfileDetector\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIFlowClient.LoginAsync(...)\u003C/code\u003E returning \u003Ccode\u003ETask\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EIFlowClient.LoginAsync(...)\u003C/code\u003E returning \u003Ccode\u003ETask\u0026lt;UAuthResult\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETokenResponseMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ESurrogateTransport\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse.SessionIdDelivery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ETransport.SessionId\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse.AccessTokenDelivery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ETransport.AccessToken\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse.RefreshTokenDelivery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ETransport.RefreshToken\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse.Login\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ERedirect.Login\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthResponse.Logout\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ERedirect.Logout\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi.UAuthHubBaseUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi.Hub.BaseUrl\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi.AllowedClientOrigins\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi.Cors.AllowedOrigins\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi.CorsPolicyName\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EResourceApi.Cors.PolicyName\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-behavioral-changes\u0022\u003ECommon Behavioral Changes\u003C/h3\u003E\n\u003Cp\u003EThe following changes may affect existing applications even when no compilation errors occur.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EArea\u003C/th\u003E\n\u003Cth\u003EPrevious Behavior\u003C/th\u003E\n\u003Cth\u003Ev0.2.0 Behavior\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ELogin submission\u003C/td\u003E\n\u003Ctd\u003ENavigation-based\u003C/td\u003E\n\u003Ctd\u003EAutomatic navigation or fetch selection\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid access token\u003C/td\u003E\n\u003Ctd\u003EOpaque\u003C/td\u003E\n\u003Ctd\u003EJWT\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAPI authentication mode\u003C/td\u003E\n\u003Ctd\u003EPureJwt under the previous v0.2.0 resolver\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResource API authentication\u003C/td\u003E\n\u003Ctd\u003ERemote session validation\u003C/td\u003E\n\u003Ctd\u003EHybrid remote session validation by default\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess-token handling\u003C/td\u003E\n\u003Ctd\u003EApplication-managed when required\u003C/td\u003E\n\u003Ctd\u003EBuilt-in in-memory token store\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ELogout completion\u003C/td\u003E\n\u003Ctd\u003ENavigation-oriented submission\u003C/td\u003E\n\u003Ctd\u003EResponse-aware completion and local credential cleanup\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EApplications using the standard UltimateAuth integrations generally do not need to rewrite their login or logout implementations.\u003C/p\u003E\n\u003Cp\u003EHowever, applications relying on specific navigation behavior, custom credential handling, or explicit authentication mode assumptions should review the corresponding migration sections.\u003C/p\u003E\n\u003Cp\u003EThese are API and configuration-path replacements, not guarantees of identical behavior.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E \u003Ccode\u003EAuthResponse\u003C/code\u003E is obsolete and no longer functional. Accessing it throws \u003Ccode\u003ENotSupportedException\u003C/code\u003E. Applications must migrate to \u003Ccode\u003EGrantDelivery\u003C/code\u003E and \u003Ccode\u003ERedirect\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EAuthentication modes and credential delivery now have separate responsibilities. The effective authentication mode determines which grants exist; delivery settings determine how those grants are transported.\u003C/p\u003E\n\u003Cp\u003EThe public \u003Ccode\u003EIUAuthClient\u003C/code\u003E entry point and standard UltimateAuth registration methods remain available. Applications relying on built-in defaults generally do not need to replace their authentication integration.\u003C/p\u003E\n\u003Cp\u003EThe following sections explain the behavioral changes, security implications, and additional migration requirements in detail.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022asynchronous-authorization-policies\u0022\u003E1. Asynchronous Authorization Policies\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.1\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003ECustom implementations of \u003Ccode\u003EIAccessPolicy\u003C/code\u003E, \u003Ccode\u003EIAccessInvariant\u003C/code\u003E, and \u003Ccode\u003EIAccessAuthority\u003C/code\u003E should migrate to \u003Ccode\u003EDecideAsync\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic AccessDecision Decide(AccessContext context)\n{\n return AccessDecision.Allow();\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Epublic ValueTask\u0026lt;AccessDecision\u0026gt; DecideAsync(AccessContext context, CancellationToken ct = default)\n{\n return ValueTask.FromResult(AccessDecision.Allow());\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor \u003Ccode\u003EIAccessAuthority\u003C/code\u003E, preserve the existing \u003Ccode\u003EruntimePolicies\u003C/code\u003E parameter and add the cancellation token.\u003C/p\u003E\n\u003Cp\u003ESynchronous \u003Ccode\u003EDecide\u003C/code\u003E methods are obsolete. Existing synchronous implementations retain compatibility through the interface defaults, but new implementations should use \u003Ccode\u003EDecideAsync\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EIf your application invokes an authority directly, switch to \u003Ccode\u003EDecideAsync\u003C/code\u003E and await the result.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-check-results\u0022\u003E2. Authorization Check Results\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.1\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ECheckAsync\u003C/code\u003E now returns an explicit authorization decision in the response body.\u003C/p\u003E\n\u003Cp\u003EIf your application previously interpreted HTTP \u003Ccode\u003E403\u003C/code\u003E as the result of a successful authorization evaluation that denied access, update that handling.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar result = await UAuthClient.Authorization.CheckAsync(request);\n\nif (result.IsSuccess \u0026amp;\u0026amp; result.Value is { IsAllowed: true })\n{\n // Authorized\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAn HTTP-successful authorization check does not necessarily mean that access was granted.\u003C/p\u003E\n\u003Cp\u003EInspect the returned authorization decision rather than relying solely on the HTTP status.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-user-lifecycle-integrations\u0022\u003E3. Custom User Lifecycle Integrations\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.2\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe \u003Ccode\u003EIUserLifecycleIntegration.OnUserCreatedAsync\u003C/code\u003E signature now includes \u003Ccode\u003EUAuthApplicationProfile\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask OnUserCreatedAsync(\n TenantKey tenant,\n UserKey userKey,\n object request,\n CancellationToken ct = default);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask OnUserCreatedAsync(\n TenantKey tenant,\n UserKey userKey,\n object request,\n UAuthApplicationProfile applicationProfile,\n CancellationToken ct = default);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUpdate custom implementations to accept the additional client profile parameter.\u003C/p\u003E\n\u003Cp\u003EApplications using built-in lifecycle integrations do not need to make this change.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022identifier-and-profile-limits\u0022\u003E4. Identifier and Profile Limits\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.2\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe reference Users domain now enforces additional identifier and profile safety limits.\u003C/p\u003E\n\u003Cp\u003EThe default maximum is 10 active identifiers per user. Applications requiring a different capacity should configure \u003Ccode\u003EIdentifiers.Behavior.MaxIdentifiersPerUser\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EExisting profile creation and update operations must also respect the new field-length and metadata limits.\u003C/p\u003E\n\u003Cp\u003EIf you use EF Core persistence:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EReview existing profile data for values exceeding the new limits.\u003C/li\u003E\n\u003Cli\u003EAdd or apply the appropriate EF Core database migration for your application\u0027s DbContext.\u003C/li\u003E\n\u003Cli\u003EVerify that applications handling profile validation errors use the returned error codes.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/plugin-domains/profile-validation-limits\u0022\u003EProfile Validation \u0026amp; Limits\u003C/a\u003E for the supported limits.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022password-policies-and-history\u0022\u003E5. Password Policies and History\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.2\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe reference password credential implementation now applies configurable password policies, with Standard as the default level.\u003C/p\u003E\n\u003Cp\u003EReview custom registration, password-change, and password-reset flows to ensure that they handle server-side password validation errors.\u003C/p\u003E\n\u003Cp\u003EApplications using persistent password-history storage must apply the required database migration before enabling password history.\u003C/p\u003E\n\u003Cp\u003EPassword history is disabled by default (\u003Ccode\u003ERememberLast = 0\u003C/code\u003E).\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/password-policy\u0022\u003EPassword Policy \u0026amp; History\u003C/a\u003E for configuration and persistence requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022rate-limiting\u0022\u003E6. Rate Limiting\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.2\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EBuilt-in endpoint rate limiting is enabled by default when using:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eapp.UseUltimateAuthWithAspNetCore();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIf your application already registers its own rate limiting middleware, avoid installing a duplicate limiter.\u003C/p\u003E\n\u003Cp\u003ETo retain application-owned rate limiting:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eapp.UseUltimateAuthWithAspNetCore(useRateLimiting: false);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThen configure your existing \u003Ccode\u003EUseRateLimiter()\u003C/code\u003E middleware in the appropriate pipeline position.\u003C/p\u003E\n\u003Cp\u003EApplications using \u003Ccode\u003EUseUltimateAuth()\u003C/code\u003E without the integrated ASP.NET Core helper do not enable UltimateAuth rate limiting by default.\u003C/p\u003E\n\u003Cp\u003EReview custom HTTP clients and authentication flows for HTTP \u003Ccode\u003E429 Too Many Requests\u003C/code\u003E handling.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/rate-limiting\u0022\u003ERate Limiting\u003C/a\u003E for middleware integration and defaults.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022native-login-form-and-credential-submission\u0022\u003E7. Native Login Form and Credential Submission\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthLoginForm\u003C/code\u003E no longer accepts \u003Ccode\u003EIdentifier\u003C/code\u003E and \u003Ccode\u003ESecret\u003C/code\u003E component parameters.\u003C/p\u003E\n\u003Cp\u003ECredentials are now read directly from native browser form inputs. This reduces unnecessary exposure of passwords through Blazor component state and Blazor Server\u0027s interactive communication.\u003C/p\u003E\n\u003Cp\u003EApplications using the removed component parameters must update their login forms.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003ERazor\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-razor\u0022\u003E\u0026lt;UAuthLoginForm Identifier=\u0026quot;@identifier\u0026quot; Secret=\u0026quot;@password\u0026quot; /\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter \u2014 built-in form:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003ERazor\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-razor\u0022\u003E\u0026lt;UAuthLoginForm /\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen no child content is provided, UltimateAuth renders the identifier field, password field, and submit button automatically.\u003C/p\u003E\n\u003Cp\u003EFor custom layouts, provide native-compatible credential inputs:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003ERazor\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-razor\u0022\u003E\u0026lt;UAuthLoginForm\u0026gt;\n \u0026lt;input name=\u0026quot;Identifier\u0026quot; autocomplete=\u0026quot;username\u0026quot; required /\u0026gt;\n \u0026lt;input name=\u0026quot;Secret\u0026quot; type=\u0026quot;password\u0026quot;\n autocomplete=\u0026quot;current-password\u0026quot; required /\u0026gt;\n \u0026lt;button type=\u0026quot;submit\u0026quot;\u0026gt;Sign in\u0026lt;/button\u0026gt;\n\u0026lt;/UAuthLoginForm\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ECustom inputs must use the exact HTML \u003Ccode\u003Ename\u003C/code\u003E - \u003Ccode\u003EIdentifier\u003C/code\u003E and \u003Ccode\u003ESecret\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EKeep credential inputs enabled during submission. Disabled inputs are excluded from native form submissions; disable the submit button instead.\u003C/p\u003E\n\u003Cp\u003EThe existing \u003Ccode\u003ETryOnly\u003C/code\u003E, \u003Ccode\u003ETryAndCommit\u003C/code\u003E, and \u003Ccode\u003EDirectCommit\u003C/code\u003E submission modes remain available.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/client-sdk/authentication\u0022\u003EAuthentication Client SDK\u003C/a\u003E for current login integration guidance.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-failure-details\u0022\u003E8. Authentication Failure Details\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EDefault changed in preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthLoginOptions.IncludeFailureDetails\u003C/code\u003E now defaults to \u003Ccode\u003Efalse\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EPreviously, failed authentication responses could expose lockout reasons, remaining attempts, or lockout expiration details by default.\u003C/p\u003E\n\u003Cp\u003EWith the new default, public authentication failures return generic \u003Ccode\u003EInvalidCredentials\u003C/code\u003E information without exposing account-specific lockout state.\u003C/p\u003E\n\u003Cp\u003EThis applies to ordinary login, login previews, PKCE previews, and login failure redirects.\u003C/p\u003E\n\u003Cp\u003EApplications relying on detailed failure feedback should update their user interfaces to handle generic authentication failures.\u003C/p\u003E\n\u003Cp\u003EDetailed feedback remains available through explicit configuration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Login.IncludeFailureDetails = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003ESecurity consideration:\u003C/strong\u003E Enabling this option may reveal account existence or lockout state to unauthenticated clients. Keep it disabled unless detailed disclosure is an intentional application requirement.\u003C/p\u003E\n\u003Cp\u003EFor authorized administrative inspection, use the authentication lockout management APIs instead.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022asp.net-core-authorization-and-user-status\u0022\u003E9. ASP.NET Core Authorization and User Status\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBehavior changed in preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth now checks account status when authorizing protected ASP.NET Core HTTP endpoints.\u003C/p\u003E\n\u003Cp\u003EA valid session or matching role no longer automatically grants access when the associated user is inactive.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EUser status\u003C/th\u003E\n\u003Cth\u003EOrdinary protected HTTP endpoint\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EActive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAllowed when other requirements pass\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESuspended\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDenied\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESelfSuspended\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDenied\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDisabled\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDenied\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMissing or invalid status\u003C/td\u003E\n\u003Ctd\u003EDenied\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EExisting applications that intentionally allow suspended users to access selected protected HTTP endpoints should use:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003E[Authorize]\n[UAuthAllowInactive]\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis exception preserves the endpoint\u0027s existing authentication and authorization requirements. It does not grant access to disabled or otherwise ineligible accounts.\u003C/p\u003E\n\u003Cp\u003EFor independently hosted Resource APIs, the validated Hub response must contain a valid \u003Ccode\u003Esnapshot.identity.userStatus\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EOlder custom Hub validation responses that omit this information are no longer sufficient for successful protected HTTP authorization.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAuthorization policy precedence:\u003C/strong\u003E Explicitly registered ASP.NET Core named policies are now resolved before UltimateAuth action-policy fallback. Review applications that use the same policy name in both systems.\u003C/p\u003E\n\u003Cp\u003EThese changes apply to ASP.NET Core HTTP authorization middleware. They do not automatically replace authorization checks in Blazor component rendering, direct service calls, or direct \u003Ccode\u003EIAuthorizationService.AuthorizeAsync\u003C/code\u003E usage.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022password-verification-and-concurrency-limiting\u0022\u003E10. Password Verification and Concurrency Limiting\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth introduces dummy password verification to reduce observable timing differences between authentication paths.\u003C/p\u003E\n\u003Cp\u003EPassword verification now also uses built-in concurrency limiting to protect CPU and memory resources.\u003C/p\u003E\n\u003Cp\u003EConcurrency limiting is \u003Cstrong\u003Eenabled by default\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe default configuration uses three coordinated policies:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EPolicy\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPasswordHashing\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EShared global hashing capacity\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReal and dummy login verification\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECredentialManagement\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPassword creation, changes, resets, and history checks\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EDefault capacity is derived from \u003Ccode\u003EMath.Max(2, Environment.ProcessorCount)\u003C/code\u003E. Initial queue capacity is five times the permit limit, and the queue timeout is three seconds.\u003C/p\u003E\n\u003Cp\u003EWhen capacity is exhausted, the server may return HTTP \u003Ccode\u003E429 Too Many Requests\u003C/code\u003E with the error code \u003Ccode\u003Epassword_verification_busy\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EApplications should treat this as a temporary server-capacity condition, not invalid credentials or an expired session.\u003C/p\u003E\n\u003Cp\u003EConfigure capacity based on deployment resources:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ConcurrencyLimiting.PasswordHashing.PermitLimit = 8;\n options.ConcurrencyLimiting.PasswordHashing.QueueLimit = 40;\n options.ConcurrencyLimiting.PasswordHashing.QueueTimeout = TimeSpan.FromSeconds(3);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe default Argon2 parallelism for newly generated hashes is now \u003Ccode\u003E1\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EExisting hashes remain verifiable using their stored parameters. Password resets or hash migrations are not required solely because of this default change.\u003C/p\u003E\n\u003Cp\u003EConcurrency limiting is independent of HTTP endpoint rate limiting and operates per application process.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/concurrency-limiting\u0022\u003EConcurrency Limiting\u003C/a\u003E for configuration and deployment considerations.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-artifact-store-capacity\u0022\u003E11. Authentication Artifact Store Capacity\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe built-in in-memory authentication artifact store now performs periodic expiration cleanup and enforces a configurable capacity limit.\u003C/p\u003E\n\u003Cp\u003EThis affects temporary authentication artifacts such as PKCE authorization codes and login preview receipts.\u003C/p\u003E\n\u003Cp\u003ENew defaults:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ESetting\u003C/th\u003E\n\u003Cth\u003EDefault\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthArtifacts.MaxEntries\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E50,000\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthArtifacts.CleanupInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E1 minute\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe configured capacity is per application process.\u003C/p\u003E\n\u003Cp\u003EWhen all available entries are occupied by valid artifacts, new artifact creation can fail with HTTP \u003Ccode\u003E503 Service Unavailable\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EApplications with high authentication traffic should monitor artifact capacity and adjust the limits as necessary.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthArtifacts.MaxEntries = 100_000;\n options.AuthArtifacts.CleanupInterval = TimeSpan.FromMinutes(1);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe \u003Ccode\u003EIAuthStore\u003C/code\u003E interface remains unchanged.\u003C/p\u003E\n\u003Cp\u003ECustom artifact-store implementations retain responsibility for their own expiration cleanup and capacity management.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-security-state-persistence\u0022\u003E12. Authentication Security State Persistence\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EPersistence change in preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe EF Core authentication security state implementation introduces stronger uniqueness and concurrency enforcement.\u003C/p\u003E\n\u003Cp\u003EFor PostgreSQL, account-level authentication security state records now use uniqueness semantics that treat null credential-type values as non-distinct.\u003C/p\u003E\n\u003Cp\u003EApplications using PostgreSQL persistence must review their authentication security state data and apply the appropriate EF Core migration.\u003C/p\u003E\n\u003Cp\u003EBefore migration:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EBack up the database.\u003C/li\u003E\n\u003Cli\u003ECheck for duplicate authentication security state records, particularly account-level records with a null credential type.\u003C/li\u003E\n\u003Cli\u003EResolve duplicates before introducing the new unique constraint.\u003C/li\u003E\n\u003Cli\u003EApply the migration through the application\u0027s normal EF Core deployment process.\u003C/li\u003E\n\u003Cli\u003EVerify authentication, lockout, and password recovery operations.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThe reference samples and Identity Lab include corresponding migration changes.\u003C/p\u003E\n\u003Cp\u003EApplications managing their own \u003Ccode\u003EDbContext\u003C/code\u003E must ensure that the updated model and database schema are synchronized.\u003C/p\u003E\n\u003Cp\u003EExisting login and session DTO contracts remain unchanged.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-lockout-and-recovery\u0022\u003E13. Authentication Lockout and Recovery\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth introduces administrative APIs for inspecting and clearing account-level and factor-level authentication lockouts.\u003C/p\u003E\n\u003Cp\u003EThrough \u003Ccode\u003EIUAuthClient.Users\u003C/code\u003E, applications can now use:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar state = await UAuthClient.Users.GetAuthenticationLockoutAsync(userKey,\n new LockoutQueryRequest(AuthenticationSecurityScope.Factor, CredentialType.Password));\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAnd:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar result = await UAuthClient.Users.UnlockAuthenticationAsync(userKey,\n new UnlockAuthenticationRequest(AuthenticationSecurityScope.Factor, CredentialType.Password));\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese operations are authorization-protected and do not require existing applications to change their login integrations.\u003C/p\u003E\n\u003Cp\u003EA successful verified password reset now clears the related password-factor lockout as part of credential recovery.\u003C/p\u003E\n\u003Cp\u003EAccount-level lockouts, unrelated security states, user lifecycle status, and existing session policies remain separate.\u003C/p\u003E\n\u003Cp\u003EThis is an additional recovery capability rather than a breaking API change.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/authentication-lockout\u0022\u003EAuthentication Lockout \u0026amp; Recovery\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022additional-authentication-security-hardening\u0022\u003E14. Additional Authentication Security Hardening\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since preview.3\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003ESeveral authentication checks have been strengthened:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ERelative return URLs remain supported, while absolute return URLs require an explicitly allowed origin.\u003C/li\u003E\n\u003Cli\u003EAmbiguous or unsafe return URL paths are rejected.\u003C/li\u003E\n\u003Cli\u003ELogin preview receipts are bound to the original authentication context.\u003C/li\u003E\n\u003Cli\u003EPreview receipts must be consumed successfully and atomically before they can suppress duplicate failed-attempt accounting.\u003C/li\u003E\n\u003Cli\u003EPreviously consumed, mismatched, or stale preview receipts cannot bypass failure accounting.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EApplications using standard UltimateAuth login components should not need additional code changes.\u003C/p\u003E\n\u003Cp\u003ECustom login clients should avoid reusing preview receipts or modifying the authentication context between preview and commit.\u003C/p\u003E\n\u003Cp\u003EApplications relying on arbitrary external redirect targets must explicitly configure the corresponding allowed origins.\u003C/p\u003E\n\u003Cp\u003EThese changes intentionally strengthen validation and may reject requests that were previously accepted.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-limits-and-browser-device-type-classification\u0022\u003E15. Device Limits and Browser Device Type Classification\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailable since rc.1\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth introduces configurable active-device limits through \u003Ccode\u003EUAuthServerOptions.DeviceLimits\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EApplications can restrict the number of distinct active devices per user and tenant, either globally or by device type.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.DeviceLimits.MaxDevices = 3;\n options.DeviceLimits.TypeLimits[\u0026quot;web\u0026quot;] = 2;\n options.DeviceLimits.Behavior = DeviceLimitBehavior.RejectNewLogin;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDevice limits are \u003Cstrong\u003Edisabled by default\u003C/strong\u003E:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EMaxDevices = null\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ETypeLimits\u003C/code\u003E is empty.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EBehavior = RejectNewLogin\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EExisting applications do not acquire device quotas merely by upgrading.\u003C/p\u003E\n\u003Cp\u003EWhen enabled, \u003Ccode\u003ERejectNewLogin\u003C/code\u003E refuses additional device admission without revoking existing devices.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ERevokeOldest\u003C/code\u003E instead revokes eligible older active device chains when capacity must be freed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022breaking-change-browser-device-type-is-now-web\u0022\u003EBreaking Change: Browser Device Type Is Now \u003Ccode\u003Eweb\u003C/code\u003E\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003EBrowser-based clients previously could be classified as \u003Ccode\u003Edesktop\u003C/code\u003E. The built-in Blazor web device provider now reports \u003Ccode\u003EDeviceType = \u0026quot;web\u0026quot;\u003C/code\u003E.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EServer device-type resolution also defaults to \u003Ccode\u003Eweb\u003C/code\u003E when no explicit type is supplied.\u003C/p\u003E\n\u003Cp\u003EThis applies to both desktop and mobile browsers.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EClient Environment\u003C/th\u003E\n\u003Cth\u003EDeviceType\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDesktop browser\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Eweb\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMobile browser\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Eweb\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ENative desktop application\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Edesktop\u003C/code\u003E when explicitly provided\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ENative mobile application\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Emobile\u003C/code\u003E when explicitly provided\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe change distinguishes browser-based client environments from native application platforms.\u003C/p\u003E\n\u003Cp\u003EIt does not remove the \u003Ccode\u003Edesktop\u003C/code\u003E or \u003Ccode\u003Emobile\u003C/code\u003E classifications.\u003C/p\u003E\n\u003Cp\u003EApplications can continue using these values for appropriate native clients.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022migration-impact\u0022\u003EMigration Impact\u003C/h3\u003E\n\u003Cp\u003EThis is a \u003Cstrong\u003Ebehavioral breaking change\u003C/strong\u003E for applications that rely on device-type classification.\u003C/p\u003E\n\u003Cp\u003EReview implementations that:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EFilter sessions by \u003Ccode\u003EDeviceType\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EDisplay device types in user interfaces.\u003C/li\u003E\n\u003Cli\u003EApply custom device-type policies.\u003C/li\u003E\n\u003Cli\u003EUse device classifications in analytics or diagnostics.\u003C/li\u003E\n\u003Cli\u003EAssume that \u003Ccode\u003Edesktop\u003C/code\u003E represents all desktop-browser sessions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar browserType = \u0026quot;desktop\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar browserType = \u0026quot;web\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDo not infer the operating system from \u003Ccode\u003EDeviceType\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EUse the separate \u003Ccode\u003EPlatform\u003C/code\u003E, \u003Ccode\u003EOperatingSystem\u003C/code\u003E, and \u003Ccode\u003EBrowser\u003C/code\u003E metadata where appropriate.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ENote:\u003C/strong\u003E Device Limits is a new feature introduced in v0.2.0. The example above illustrates migration of existing device-type assumptions, not an earlier \u003Ccode\u003EDeviceLimits.TypeLimits\u003C/code\u003E API.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022existing-persisted-device-records\u0022\u003EExisting Persisted Device Records\u003C/h3\u003E\n\u003Cp\u003EUpdating UltimateAuth does not automatically rewrite device-type values in persisted session chains.\u003C/p\u003E\n\u003Cp\u003EAn existing browser device may still be recorded as:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EDeviceType: desktop\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen an incoming \u003Ccode\u003EDeviceId\u003C/code\u003E matches an already active device chain, UltimateAuth preserves that device\u0027s existing type classification.\u003C/p\u003E\n\u003Cp\u003ETherefore, a previously admitted browser device classified as \u003Ccode\u003Edesktop\u003C/code\u003E can retain that classification during subsequent authentication.\u003C/p\u003E\n\u003Cp\u003ENew browser device IDs are classified as \u003Ccode\u003Eweb\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EDuring the transition, both classifications may coexist:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EExisting active browser:\n DeviceType = desktop\n\nNew browser:\n DeviceType = web\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis distinction matters when per-type limits are enabled.\u003C/p\u003E\n\u003Cp\u003ELegacy \u003Ccode\u003Edesktop\u003C/code\u003E records and new \u003Ccode\u003Eweb\u003C/code\u003E records may be counted in different type categories until the existing active device state ends.\u003C/p\u003E\n\u003Cp\u003EApplications should review existing session data and plan an appropriate transition.\u003C/p\u003E\n\u003Cp\u003EIf immediate classification consistency is required, consider controlled reauthentication or device-session revocation.\u003C/p\u003E\n\u003Cp\u003EDo not assume that a database schema migration automatically changes stored device classifications.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022breaking-change-custom-session-stores\u0022\u003EBreaking Change: Custom Session Stores\u003C/h3\u003E\n\u003Cp\u003EThe \u003Ccode\u003EISessionStore\u003C/code\u003E interface introduces a new operation:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask\u0026lt;TResult\u0026gt; ExecuteAdmissionAsync\u0026lt;TResult\u0026gt;(\n Func\u0026lt;CancellationToken, Task\u0026lt;TResult\u0026gt;\u0026gt; action,\n CancellationToken ct = default);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is an \u003Cstrong\u003Einterface-level breaking change\u003C/strong\u003E for custom session-store implementations.\u003C/p\u003E\n\u003Cp\u003EImplementations must add support for the new method even when device limits are disabled.\u003C/p\u003E\n\u003Cp\u003EWhen limits are enabled, device admission must be atomic and concurrency-safe.\u003C/p\u003E\n\u003Cp\u003ECustom stores must ensure:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAdmission changes are committed atomically.\u003C/li\u003E\n\u003Cli\u003EFailed admissions are rolled back.\u003C/li\u003E\n\u003Cli\u003ESimultaneous login requests cannot exceed configured limits.\u003C/li\u003E\n\u003Cli\u003EConcurrency protection applies across application instances sharing the same persistence infrastructure.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe built-in in-memory and EF Core stores implement the new contract.\u003C/p\u003E\n\u003Cp\u003EThe EF Core implementation uses a serializable transaction for device admission.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022database-migration-requirements\u0022\u003EDatabase Migration Requirements\u003C/h3\u003E\n\u003Cp\u003EDevice Limits does not introduce a new database table or require a schema migration by itself.\u003C/p\u003E\n\u003Cp\u003EThe feature uses existing session root, chain, and session persistence.\u003C/p\u003E\n\u003Cp\u003EHowever, other v0.2.0 persistence changes may still require application database migrations.\u003C/p\u003E\n\u003Cp\u003ECustom \u003Ccode\u003EDbContext\u003C/code\u003E implementations should continue following the database migration requirements documented in the preceding sections.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022upgrade-checklist\u0022\u003EUpgrade Checklist\u003C/h3\u003E\n\u003Col\u003E\n\u003Cli\u003EReview custom device-type consumers and replace browser-specific \u003Ccode\u003Edesktop\u003C/code\u003E assumptions with \u003Ccode\u003Eweb\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EReview active persisted device chains for legacy \u003Ccode\u003Edesktop\u003C/code\u003E classifications.\u003C/li\u003E\n\u003Cli\u003EPlan session turnover or controlled revocation if immediate classification consistency is required.\u003C/li\u003E\n\u003Cli\u003EUpdate custom \u003Ccode\u003EISessionStore\u003C/code\u003E implementations to support \u003Ccode\u003EExecuteAdmissionAsync\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EVerify atomic admission and concurrent login handling before enabling device quotas.\u003C/li\u003E\n\u003Cli\u003EConfigure \u003Ccode\u003EDeviceLimits\u003C/code\u003E explicitly only when the application requires device restrictions.\u003C/li\u003E\n\u003Cli\u003ETest login failure handling and device management behavior with the selected \u003Ccode\u003ERejectNewLogin\u003C/code\u003E or \u003Ccode\u003ERevokeOldest\u003C/code\u003E policy.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/sessions-devices/device-limits\u0022\u003EDevice Limits\u003C/a\u003E for the complete configuration and enforcement reference.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-profile-api-redesign\u0022\u003E16. Application Profile API Redesign\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EIntroduced in the PureJwt implementation for v0.2.0\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthClientProfile\u003C/code\u003E has been replaced by \u003Ccode\u003EUAuthApplicationProfile\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe new name distinguishes the application environment from the authentication mode selected by the server.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.ClientProfile = UAuthClientProfile.BlazorServer;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.ApplicationProfile = UAuthApplicationProfile.BlazorServer;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApplications using automatic profile detection normally do not need to configure this property.\u003C/p\u003E\n\u003Cp\u003ECustom implementations of \u003Ccode\u003EIClientProfileDetector\u003C/code\u003E must migrate to \u003Ccode\u003EIApplicationProfileDetector\u003C/code\u003E. Methods and contracts that previously accepted \u003Ccode\u003EUAuthClientProfile\u003C/code\u003E now use the replacement enum.\u003C/p\u003E\n\u003Cp\u003EThe new enum also distinguishes a Resource API from an ordinary API consumer through \u003Ccode\u003EUAuthApplicationProfile.ResourceApi\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-mode-selection\u0022\u003EAuthentication mode selection\u003C/h3\u003E\n\u003Cp\u003EThe server now supports explicit mode selection:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthMode = UAuthMode.PureOpaque;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor profile-specific customization:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.ApplicationProfileModes[UAuthApplicationProfile.BlazorServer] = UAuthMode.PureOpaque;\n\n options.ApplicationProfileModes[UAuthApplicationProfile.BlazorWasm] = UAuthMode.PureJwt;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthMode\u003C/code\u003E and \u003Ccode\u003EApplicationProfileModes\u003C/code\u003E cannot be configured together.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E remains an allowlist, \u003Cstrong\u003Enot\u003C/strong\u003E an authentication mode selector.\u003C/p\u003E\n\u003Cp\u003EApplications relying on automatic resolution can keep their existing approach, but should verify the effective mode for each supported application profile.\u003C/p\u003E\n\u003Cp\u003EClient-supplied profile information must not be treated as proof of application identity or trust.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022surrogate-model-and-transport-configuration\u0022\u003E17. Surrogate Model and Transport Configuration\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth 0.2.0 introduces a unified surrogate model.\u003C/p\u003E\n\u003Cp\u003EA surrogate represents system-issued secondary authentication data used to continue authentication without repeatedly presenting the original credential.\u003C/p\u003E\n\u003Cp\u003ESession IDs used for authentication, access tokens, and refresh tokens are represented by this model.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/core-concepts\u0022\u003ECore Concepts\u003C/a\u003E for an introduction to the terminology.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-response-configuration\u0022\u003EAuthentication Response Configuration\u003C/h3\u003E\n\u003Cp\u003EThe former \u003Ccode\u003EAuthResponse\u003C/code\u003E configuration has been replaced by two independent configuration groups:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003ETransport\u003C/code\u003E configures how authentication surrogates are carried.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERedirect\u003C/code\u003E configures authentication-related navigation.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe legacy \u003Ccode\u003EUAuthServerOptions.AuthResponse\u003C/code\u003E property has been removed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-surrogate-transport\u0022\u003EConfigure Surrogate Transport\u003C/h3\u003E\n\u003Cp\u003EBefore:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.AuthResponse.AccessTokenDelivery.Mode = TokenResponseMode.Header;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAfter:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Transport.AccessToken.Mode = SurrogateTransport.Header;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA global transport preference can also be configured:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Transport.Default = SurrogateTransport.Cookie;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIndividual surrogate settings take precedence over the global preference.\u003C/p\u003E\n\u003Cp\u003EWhen no explicit preference is configured, UltimateAuth uses the effective authentication mode and application profile to determine the applicable defaults.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022transport-restrictions\u0022\u003ETransport Restrictions\u003C/h3\u003E\n\u003Cul\u003E\n\u003Cli\u003ETransport settings do not enable unsupported surrogate kinds.\u003C/li\u003E\n\u003Cli\u003ERequired surrogate transports cannot be disabled using \u003Ccode\u003ESurrogateTransport.None\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ESurrogateTransport.Body\u003C/code\u003E is not currently supported.\u003C/li\u003E\n\u003Cli\u003EHeader names and formats can be customized through the corresponding transport options.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EApplications using built-in defaults generally do not need to configure surrogate transport explicitly.\u003C/p\u003E\n\u003Cp\u003EApplications using custom cookie or header handling should verify compatibility between the issuing server and receiving applications.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022redirect-configuration\u0022\u003ERedirect Configuration\u003C/h3\u003E\n\u003Cp\u003EBefore:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.AuthResponse.Login.SuccessRedirect = \u0026quot;/dashboard\u0026quot;;\noptions.AuthResponse.Logout.SuccessRedirect = \u0026quot;/\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAfter:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Redirect.Login.SuccessRedirect = \u0026quot;/dashboard\u0026quot;;\noptions.Redirect.Logout.SuccessRedirect = \u0026quot;/\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERedirect configuration is independent of surrogate transport.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-configuration\u0022\u003EResource API Configuration\u003C/h3\u003E\n\u003Cp\u003EResource API transport settings now use a shared configuration type.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Auth.SessionId.Mode = SurrogateTransport.Cookie;\noptions.Auth.AccessToken.Mode = SurrogateTransport.Header;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ESession ID and access token transport settings are represented by \u003Ccode\u003EUAuthResourceSurrogateTransportOptions\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EOnly the settings relevant to the selected transport are required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022preview-api-changes\u0022\u003EPreview API Changes\u003C/h3\u003E\n\u003Cp\u003EApplications migrating from earlier 0.2.0 preview versions should also update the following API references:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EPrevious preview API\u003C/th\u003E\n\u003Cth\u003ENew API\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EGrantKind\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ESurrogateKind\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EGrantDeliveryMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ESurrogateTransport\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EGrantDeliveryOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ESurrogateTransportOptions\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthGrantDeliveryOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthSurrogateTransportOptions\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEffectiveGrantDelivery\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EEffectiveSurrogateTransport\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHeaderTokenFormat\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHeaderValueFormat\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003Eoptions.GrantDelivery.Session\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Eoptions.Transport.SessionId\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003Eoptions.GrantDelivery.AccessToken\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Eoptions.Transport.AccessToken\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003Eoptions.GrantDelivery.RefreshToken\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Eoptions.Transport.RefreshToken\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe authentication mode determines surrogate availability and token format. Transport configuration does not change the authentication mode.\u003C/p\u003E\n\u003Cp\u003ECustom authentication integrations should review their surrogate resolution, response writing, and effective transport contracts.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022production-cryptographic-key-configuration\u0022\u003E18. Production Cryptographic Key Configuration\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003ESecurity-sensitive deployment change in the PureJwt implementation\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth now separates JWT signing from server-managed token hashing.\u003C/p\u003E\n\u003Cp\u003EThe built-in cryptography configuration provides two independent keys:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOption\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECryptography.TokenHashingKey\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHMAC-SHA256 hashing of server-managed token material\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECryptography.JwtSigningKey\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHS256 JWT access-token signing\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe built-in implementations require valid Base64-encoded key material containing at least 32 bytes per key.\u003C/p\u003E\n\u003Cp\u003EThe keys must be different.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022production-startup-validation\u0022\u003EProduction startup validation\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth includes deterministic cryptographic defaults for local development.\u003C/p\u003E\n\u003Cp\u003EThese defaults are accepted in the \u003Ccode\u003EDevelopment\u003C/code\u003E environment but are rejected outside Development when the corresponding built-in provider is used.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EApplications that previously started without explicit production cryptographic configuration must now provide securely generated keys.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey = builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;Token hashing key is missing.\u0026quot;);\n\n options.Cryptography.JwtSigningKey = builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;JWT signing key is missing.\u0026quot;);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ESupply the values through a secret manager or environment variables:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003EUltimateAuth__Cryptography__TokenHashingKey\nUltimateAuth__Cryptography__JwtSigningKey\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EGenerate independent random values using a cryptographically secure random-number generator.\u003C/p\u003E\n\u003Cp\u003EDo not commit production keys to source control or generate new keys on every application startup.\u003C/p\u003E\n\u003Cp\u003EApplications using custom registered signing or hashing providers should review the corresponding provider registrations and validation requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022existing-token-compatibility\u0022\u003EExisting token compatibility\u003C/h3\u003E\n\u003Cp\u003EEarlier built-in token hashing depended on the JWT signing key provider.\u003C/p\u003E\n\u003Cp\u003EThe new implementation uses a separate \u003Ccode\u003ETokenHashingKey\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EChanging the effective token-hashing key can invalidate existing server-managed token credentials whose stored hashes were produced using the previous key.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThis can affect existing sessions or refresh credentials, depending on the application\u0027s active authentication mode and persistence configuration.\u003C/p\u003E\n\u003Cp\u003EPlan an appropriate reauthentication strategy before deploying the new key configuration.\u003C/p\u003E\n\u003Cp\u003EKeep key material consistent across application instances that share authentication state.\u003C/p\u003E\n\u003Cp\u003EJWT signing-key changes can also invalidate previously issued JWTs unless the corresponding verification keys remain available through an explicitly configured validation strategy.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/token-security\u0022\u003EToken Security\u003C/a\u003E and \u003Ca href=\u0022/docs/getting-started/real-world-setup\u0022\u003EReal-World Setup\u003C/a\u003E for current cryptographic configuration guidance.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-authentication-and-resource-api-migration\u0022\u003E19. PureJwt Authentication and Resource API Migration\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003ENew authentication mode implementation in v0.2.0\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EPureJwt\u003C/code\u003E now supports authentication without creating server-side sessions.\u003C/p\u003E\n\u003Cp\u003EIt issues JWT access tokens and uses persisted, device-associated refresh-token chains for renewal.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E and the existing session-backed authentication paths remain available.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ESemiHybrid\u003C/code\u003E is not yet supported by the current implementation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-authentication-behavior\u0022\u003EPureJwt authentication behavior\u003C/h3\u003E\n\u003Cp\u003EUnlike session-backed modes, PureJwt does not require a \u003Ccode\u003ESessionId\u003C/code\u003E or \u003Ccode\u003ESessionChainId\u003C/code\u003E to issue or refresh credentials.\u003C/p\u003E\n\u003Cp\u003EThe JWT access token represents the authenticated identity and can be validated using trusted verification keys.\u003C/p\u003E\n\u003Cp\u003EThe refresh credential remains stateful.\u003C/p\u003E\n\u003Cp\u003EPureJwt refresh:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EValidates the refresh token, tenant, and device association.\u003C/li\u003E\n\u003Cli\u003EConfirms that the refresh credential is not session-bound.\u003C/li\u003E\n\u003Cli\u003ERotates the refresh token and persists its replacement.\u003C/li\u003E\n\u003Cli\u003EIssues a new JWT access token.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EAn invalid, expired, revoked, or incorrectly bound refresh credential cannot continue the authentication flow.\u003C/p\u003E\n\u003Cp\u003ERefresh-token replay detection can revoke the associated refresh chain.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-logout\u0022\u003EPureJwt logout\u003C/h3\u003E\n\u003Cp\u003EPureJwt logout differs from session-based logout.\u003C/p\u003E\n\u003Cp\u003EWhen the authenticated request supplies a refresh token, UltimateAuth validates its ownership and revokes the associated refresh chain.\u003C/p\u003E\n\u003Cp\u003EClients must ensure that the applicable refresh credential is supplied when they expect logout to terminate server-managed refresh capability.\u003C/p\u003E\n\u003Cp\u003EClearing a cookie or deleting a locally stored token is not equivalent to revoking refresh-token state.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EPreviously issued JWT access tokens remain independently valid until expiration\u003C/strong\u003E, unless an additional validation or revocation mechanism prevents their acceptance.\u003C/p\u003E\n\u003Cp\u003EConsequently, PureJwt logout must not be treated as immediate revocation of every already-issued access token.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-configuration-1\u0022\u003EResource API configuration\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthResourceApiOptions\u003C/code\u003E has been reorganized.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.UAuthHubBaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\noptions.AllowedClientOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\noptions.CorsPolicyName = \u0026quot;UAuthResource\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Hub.BaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\noptions.Cors.AllowedOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\noptions.Cors.PolicyName = \u0026quot;UAuthResource\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EResource API authentication settings are now grouped under \u003Ccode\u003Eoptions.Auth\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor a PureJwt Resource API, configure the JWT validation parameters and trusted verification keys:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.Auth.Mode = UAuthMode.PureJwt;\n\n options.Auth.Jwt = new UAuthJwtValidationOptions\n {\n Issuer = \u0026quot;UAuth\u0026quot;,\n Audience = \u0026quot;UAuthClient\u0026quot;,\n ValidAlgorithms = [SecurityAlgorithms.HmacSha256]\n };\n\n options.Cryptography.JwtVerificationKeys.Add(\n new UAuthJwtVerificationKeyOptions\n {\n KeyId = \u0026quot;uauth-hs256-v1\u0026quot;,\n Key = builder.Configuration[\u0026quot;UltimateAuth:JwtVerificationKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;JWT verification key is missing.\u0026quot;)\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe issuer, audience, algorithm, key ID, and key material must match the issuing authority\u0027s configuration.\u003C/p\u003E\n\u003Cp\u003EWhen using the built-in symmetric signing implementation, the trusted Resource API verification key contains the same cryptographic key material as the authority\u0027s JWT signing key.\u003C/p\u003E\n\u003Cp\u003EDo not configure the server\u0027s token-hashing key as a Resource API verification key.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022remote-versus-local-authentication\u0022\u003ERemote versus local authentication\u003C/h3\u003E\n\u003Cp\u003EThe built-in authentication mode resolver now selects PureOpaque for BlazorServer and Hybrid for all other application profiles.\u003C/p\u003E\n\u003Cp\u003EResource APIs default to Hybrid.\u003C/p\u003E\n\u003Cp\u003EExisting applications using remote session validation can continue using session-backed authentication by configuring the Hub address.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Ebuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.Hub.BaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe default incoming session credential transport is cookie-based.\u003C/p\u003E\n\u003Cp\u003EPureJwt must be explicitly selected when independent JWT validation is required:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Auth.Mode = UAuthMode.PureJwt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe issuing authentication server must also be configured to issue compatible PureJwt credentials.\u003C/p\u003E\n\u003Cp\u003EAlthough Hybrid now issues JWT access tokens, the current Hybrid Resource API implementation continues to use remote session validation.\u003C/p\u003E\n\u003Cp\u003EHybrid-aware JWT validation in separate Resource APIs is not yet supported.\u003C/p\u003E\n\u003Cp\u003EUAuthHub and Resource APIs resolve their authentication modes independently. Automatic authentication configuration discovery and mode negotiation are not currently supported.\u003C/p\u003E\n\u003Cp\u003EApplications should verify authentication mode compatibility, cookie scope, credential transport, and CORS configuration before deployment.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-token-persistence-and-database-migration\u0022\u003E20. Refresh Token Persistence and Database Migration\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EPersistence and custom-store breaking change in the PureJwt implementation\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003ERefresh-token persistence now supports both session-backed credentials and session-independent PureJwt refresh chains.\u003C/p\u003E\n\u003Cp\u003EThe refresh-token model introduces \u003Ccode\u003ERefreshChainId\u003C/code\u003E and additional device and authentication metadata.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ESessionId\u003C/code\u003E is now nullable, and the previous \u003Ccode\u003EChainId\u003C/code\u003E association is explicitly named \u003Ccode\u003ESessionChainId\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022ef-core-schema-changes\u0022\u003EEF Core schema changes\u003C/h3\u003E\n\u003Cp\u003EApplications using UltimateAuth\u0027s EF Core token persistence must update their database schema before deploying the new runtime.\u003C/p\u003E\n\u003Cp\u003EThe reference migrations introduce:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EChange\u003C/th\u003E\n\u003Cth\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EChainId\u003C/code\u003E \u2192 \u003Ccode\u003ESessionChainId\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERenamed session-chain association\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESessionId\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENullable to support PureJwt\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshChainId\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENew required refresh-chain identifier\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeviceId\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENew nullable device association\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuthenticatedAt\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ENew nullable authentication timestamp\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EIndexes\u003C/td\u003E\n\u003Ctd\u003EAdditional refresh-chain and device lookup indexes\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe reference migrations are provided for the sample applications and Identity Lab.\u003C/p\u003E\n\u003Cp\u003EApplications using their own \u003Ccode\u003EDbContext\u003C/code\u003E must generate and review the corresponding EF Core migration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022existing-refresh-token-records\u0022\u003EExisting refresh-token records\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E The generated reference migrations introduce \u003Ccode\u003ERefreshChainId\u003C/code\u003E as a required column with \u003Ccode\u003EGuid.Empty\u003C/code\u003E as the default for pre-existing rows.\u003C/p\u003E\n\u003Cp\u003EThis default supports schema migration but does not establish valid, distinct refresh-chain identities for existing tokens.\u003C/p\u003E\n\u003Cp\u003EDo not assume previously persisted refresh credentials remain compatible with the new token model.\u003C/p\u003E\n\u003Cp\u003EBefore production migration:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EBack up the authentication database.\u003C/li\u003E\n\u003Cli\u003EReview existing refresh-token rows and their session or chain associations.\u003C/li\u003E\n\u003Cli\u003EDecide whether existing refresh credentials should be invalidated or migrated using a reviewed, data-preserving procedure.\u003C/li\u003E\n\u003Cli\u003EAvoid treating \u003Ccode\u003EGuid.Empty\u003C/code\u003E as a valid refresh-chain identifier.\u003C/li\u003E\n\u003Cli\u003EApply the schema migration before deploying the runtime that expects the new model.\u003C/li\u003E\n\u003Cli\u003EVerify login, refresh, logout, and replay handling after deployment.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EIf existing refresh credentials are intentionally invalidated, applications must allow affected users to authenticate again.\u003C/p\u003E\n\u003Cp\u003EDo not use the example migrations as proof that all existing refresh-token records have been semantically migrated.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-refresh-token-stores\u0022\u003ECustom refresh-token stores\u003C/h3\u003E\n\u003Cp\u003EThe \u003Ccode\u003EIRefreshTokenStore\u003C/code\u003E contract now distinguishes session-chain and refresh-chain revocation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ERevokeByChainAsync(...)\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ERevokeBySessionChainAsync(...)\nRevokeByRefreshChainAsync(...)\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ECustom implementations must support the revised contract.\u003C/p\u003E\n\u003Cp\u003EThe refresh-chain operation must revoke only the intended refresh-token lineage within the applicable tenant.\u003C/p\u003E\n\u003Cp\u003EApplications with custom token projections, mappers, validators, or issuance services must also account for the new nullable session association and refresh-chain identity.\u003C/p\u003E\n\u003Cp\u003EThe built-in EF Core and in-memory token stores implement the updated contracts.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-integrations-and-compatibility-review\u0022\u003E21. Custom Integrations and Compatibility Review\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAdditional API and contract changes in the PureJwt implementation\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe changes in this section primarily affect applications replacing or extending UltimateAuth\u0027s built-in implementations.\u003C/p\u003E\n\u003Cp\u003EApplications using the standard client and server registration methods generally do not need to implement these interfaces.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-context-and-refresh-results\u0022\u003EToken context and refresh results\u003C/h3\u003E\n\u003Cp\u003ESeveral public token-related contracts now distinguish session chains from refresh chains.\u003C/p\u003E\n\u003Cp\u003EFor custom integrations, review:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003ETokenIssuanceContext.ChainId\u003C/code\u003E \u2192 \u003Ccode\u003ETokenIssuanceContext.SessionChainId\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshTokenRotationExecution.ChainId\u003C/code\u003E \u2192 \u003Ccode\u003ERefreshTokenRotationExecution.SessionChainId\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshTokenValidationResult.ChainId\u003C/code\u003E \u2192 \u003Ccode\u003ERefreshTokenValidationResult.SessionChainId\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshToken.ChainId\u003C/code\u003E \u2192 \u003Ccode\u003ERefreshToken.SessionChainId\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe new \u003Ccode\u003ERefreshChainId\u003C/code\u003E is a separate identity. It must not be treated as an interchangeable replacement for \u003Ccode\u003ESessionChainId\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EPureJwt token issuance and validation can operate without a server-side session, whereas session-backed modes preserve their session associations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-authentication-and-response-components\u0022\u003ECustom authentication and response components\u003C/h3\u003E\n\u003Cp\u003ECustom implementations using the previous application profile, authentication mode resolver, credential resolver, or response-delivery contracts must be reviewed for signature and behavior changes.\u003C/p\u003E\n\u003Cp\u003EIn particular:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication mode resolution now uses an explicit \u003Ccode\u003EAuthModeResolutionContext\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EEffective grant delivery uses \u003Ccode\u003EEffectiveGrantDelivery\u003C/code\u003E rather than the legacy credential-response options.\u003C/li\u003E\n\u003Cli\u003EJWT-based authentication requires verification of trusted claims and device binding.\u003C/li\u003E\n\u003Cli\u003EPureJwt authorization must not assume that a session ID exists.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EApplications with direct dependencies on these extension points should compile and run their integration tests against v0.2.0 before deployment.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022compatibility-testing\u0022\u003ECompatibility testing\u003C/h3\u003E\n\u003Cp\u003EFor customized deployments, verify the following scenarios against the selected authentication mode:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EInitial login and credential issuance.\u003C/li\u003E\n\u003Cli\u003EAuthenticated request validation.\u003C/li\u003E\n\u003Cli\u003ERefresh and token rotation.\u003C/li\u003E\n\u003Cli\u003ELogout and refresh-chain termination.\u003C/li\u003E\n\u003Cli\u003EAuthorization for protected HTTP endpoints.\u003C/li\u003E\n\u003Cli\u003EDevice mismatch handling.\u003C/li\u003E\n\u003Cli\u003ERestart and multi-instance persistence behavior.\u003C/li\u003E\n\u003Cli\u003EResource API authentication and CORS configuration.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThese checks are especially important when upgrading implementations that previously assumed all authentication contexts were backed by server-side sessions.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-transport-and-client-api-changes\u0022\u003E22. Login Transport and Client API Changes\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EAuthentication client changes in v0.2.0\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth now supports both navigation-based and fetch-based login submission.\u003C/p\u003E\n\u003Cp\u003EThe client discovers the effective server capabilities and selects a compatible login transport automatically.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022loginasync-return-type\u0022\u003ELoginAsync return type\u003C/h3\u003E\n\u003Cp\u003EThe return type of \u003Ccode\u003EIFlowClient.LoginAsync\u003C/code\u003E has changed.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EBefore:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask LoginAsync(LoginRequest request, string? returnUrl = null);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EAfter:\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask\u0026lt;UAuthResult\u0026gt; LoginAsync(\n LoginRequest request,\n string? returnUrl = null,\n UAuthLoginTransport transport = UAuthLoginTransport.Auto);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EExisting awaited calls remain source-compatible:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eawait UAuthClient.Flows.LoginAsync(request);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApplications can now inspect the returned result:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Evar result = await UAuthClient.Flows.LoginAsync(request);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor navigation-based submissions, successful submission does not itself confirm that the server has accepted the authentication credentials.\u003C/p\u003E\n\u003Cp\u003EFetch-based submissions allow the client to observe the authentication response and process the delivered credentials.\u003C/p\u003E\n\u003Cp\u003ECustom \u003Ccode\u003EIFlowClient\u003C/code\u003E implementations, test doubles, and mocks must be updated to match the new method signature.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022tryloginasync-signature\u0022\u003ETryLoginAsync signature\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003ETryLoginAsync\u003C/code\u003E now accepts an optional login transport parameter:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask\u0026lt;TryLoginResult\u0026gt; TryLoginAsync(\n LoginRequest request,\n UAuthSubmitMode mode,\n string? returnUrl = null,\n UAuthLoginTransport transport = UAuthLoginTransport.Auto);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe existing \u003Ccode\u003ETryOnly\u003C/code\u003E, \u003Ccode\u003ETryAndCommit\u003C/code\u003E, and \u003Ccode\u003EDirectCommit\u003C/code\u003E submission modes remain available.\u003C/p\u003E\n\u003Cp\u003EExisting application calls do not need to specify the new parameter.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022explicit-login-transport\u0022\u003EExplicit login transport\u003C/h3\u003E\n\u003Cp\u003EApplications can explicitly select a transport when necessary:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eawait UAuthClient.Flows.LoginAsync(\n request,\n transport: UAuthLoginTransport.Fetch);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe available transport strategies are:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EAuto\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EFetch\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ENavigation\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003E\u003Ccode\u003EAuto\u003C/code\u003E is the default and recommended strategy.\u003C/p\u003E\n\u003Cp\u003EApplications must not assume that every login operation performs a full browser navigation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-transport-discovery-endpoint\u0022\u003ELogin transport discovery endpoint\u003C/h3\u003E\n\u003Cp\u003EA new endpoint exposes the effective login transport capabilities:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EText\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-text\u0022\u003E/auth/login/transport\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApplications using custom endpoint paths can configure:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eoptions.Endpoints.LoginTransport = \u0026quot;/login/transport\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EReview reverse proxies, endpoint allowlists, and custom authentication endpoint configurations to ensure that this endpoint is accessible to the client.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022custom-client-implementations\u0022\u003ECustom client implementations\u003C/h3\u003E\n\u003Cp\u003EThe \u003Ccode\u003EIFlowClient\u003C/code\u003E contract also introduces:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003ETask\u0026lt;RefreshResult\u0026gt; RecoverAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis operation supports authentication recovery when a usable access token is unavailable but a compatible refresh credential remains available.\u003C/p\u003E\n\u003Cp\u003ECustom client implementations must implement the updated contract.\u003C/p\u003E\n\u003Cp\u003EApplications using the built-in UltimateAuth client do not need to implement recovery manually.\u003C/p\u003E\n\u003Chr\u003E\n\u003Cp\u003EThis page will continue to evolve through the v0.2.0 preview and RC series and will become the stable migration guide when v0.2.0 is released.\u003C/p\u003E\n", "Headings": [ { "Id": "migration-overview", @@ -134,23 +134,38 @@ "Level": 1 }, { - "Id": "authentication-response-and-grant-delivery-redesign", - "Text": "17. Authentication Response and Grant Delivery Redesign", + "Id": "surrogate-model-and-transport-configuration", + "Text": "17. Surrogate Model and Transport Configuration", "Level": 0 }, { - "Id": "credential-delivery", - "Text": "Credential delivery", + "Id": "authentication-response-configuration", + "Text": "Authentication Response Configuration", "Level": 1 }, { - "Id": "login-and-logout-redirects", - "Text": "Login and logout redirects", + "Id": "configure-surrogate-transport", + "Text": "Configure Surrogate Transport", "Level": 1 }, { - "Id": "automatic-mode-resolution", - "Text": "Automatic mode resolution", + "Id": "transport-restrictions", + "Text": "Transport Restrictions", + "Level": 1 + }, + { + "Id": "redirect-configuration", + "Text": "Redirect Configuration", + "Level": 1 + }, + { + "Id": "resource-api-configuration", + "Text": "Resource API Configuration", + "Level": 1 + }, + { + "Id": "preview-api-changes", + "Text": "Preview API Changes", "Level": 1 }, { @@ -184,7 +199,7 @@ "Level": 1 }, { - "Id": "resource-api-configuration", + "Id": "resource-api-configuration-1", "Text": "Resource API configuration", "Level": 1 }, @@ -264,6 +279,6 @@ "Level": 1 } ], - "SourceHash": "4C6603C0E7EAB0BC2D7843841820053C760DE0AF0D27AC620C7382AF762E8038", + "SourceHash": "E9DBB4DCC226F458201907742268EBF293E422E0C9A60F9A3C695C6C54E63F91", "BuilderVersion": "1" } \ No newline at end of file diff --git a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Program.cs b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Program.cs index ab929b0f..052a0132 100644 --- a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Program.cs +++ b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Program.cs @@ -33,7 +33,7 @@ builder.Services.AddUltimateAuthServer(o => { //o.AuthMode = UAuthMode.PureJwt; - //o.GrantDelivery.Default = GrantDeliveryMode.Cookie; + //o.GrantDelivery.Default = SurrogateTransport.Cookie; o.Cryptography.JwtSigningKey = UAuthCryptographyConstants.DevelopmentJwtSigningKey; o.Diagnostics.EnableRefreshDetails = true; diff --git a/src/CodeBeam.UltimateAuth.Core/Domain/Surrogates/SurrogateKind.cs b/src/CodeBeam.UltimateAuth.Core/Domain/Surrogates/SurrogateKind.cs index 59416dfc..ba300f5b 100644 --- a/src/CodeBeam.UltimateAuth.Core/Domain/Surrogates/SurrogateKind.cs +++ b/src/CodeBeam.UltimateAuth.Core/Domain/Surrogates/SurrogateKind.cs @@ -1,8 +1,14 @@ namespace CodeBeam.UltimateAuth.Core.Domain; /// -/// Identifies the kind of secondary authentication data used to maintain authentication continuity. +/// Identifies the kind of authentication surrogate. /// +/// +/// A surrogate is system-issued secondary authentication data that substitutes for the original credential during subsequent +/// authenticated interactions. +///

+/// Surrogates are represented by tokens and allow authentication to continue while minimizing exposure of the original credential. +///
public enum SurrogateKind { /// diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/SurrogateTransportCollisionValidator.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/SurrogateTransportCollisionValidator.cs index dc087f5a..e71833e0 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/SurrogateTransportCollisionValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/SurrogateTransportCollisionValidator.cs @@ -2,53 +2,49 @@ namespace CodeBeam.UltimateAuth.Server.Auth; -// TODO: Support collision detection with externally configured authentication schemes and reserved credential transport names. +// TODO: Support collision detection with externally configured authentication schemes and reserved transport names. internal static class SurrogateTransportCollisionValidator { public static void Validate(EffectiveAuthResponse response) { - var grants = new[] + var transports = new[] { response.SessionIdTransport, response.AccessTokenTransport, response.RefreshTokenTransport }; - ValidateNames(grants, SurrogateTransport.Cookie, grant => grant.Cookie?.Name, "cookie"); - - ValidateNames(grants, SurrogateTransport.Header, grant => grant.Name, "response header"); - - ValidateNames(grants, SurrogateTransport.Header, grant => grant.RequestHeaderName, "request header"); + ValidateNames(transports, SurrogateTransport.Cookie, transport => transport.Cookie?.Name, "cookie"); + ValidateNames(transports, SurrogateTransport.Header, transport => transport.Name, "response header"); + ValidateNames(transports, SurrogateTransport.Header, transport => transport.RequestHeaderName, "request header"); } private static void ValidateNames( - IEnumerable grants, + IEnumerable transports, SurrogateTransport mode, Func nameSelector, string source) { var names = new Dictionary(StringComparer.OrdinalIgnoreCase); - foreach (var grant in grants) + foreach (var transport in transports) { - if (grant.Mode != mode) + if (transport.Mode != mode) continue; - var name = nameSelector(grant); + var name = nameSelector(transport); if (string.IsNullOrWhiteSpace(name)) { - throw new InvalidOperationException($"Grant '{grant.Kind}' requires a valid {source} name."); + throw new InvalidOperationException($"Surrogate '{transport.Kind}' requires a valid {source} name."); } if (names.TryGetValue(name, out var existing)) { - throw new InvalidOperationException( - $"Grants '{existing.Kind}' and '{grant.Kind}' " + - $"cannot use the same {source} '{name}'."); + throw new InvalidOperationException($"Surrogates '{existing.Kind}' and '{transport.Kind}' cannot use the same {source} '{name}'."); } - names.Add(name, grant); + names.Add(name, transport); } } } diff --git a/src/CodeBeam.UltimateAuth.Server/Domain/SurrogateTransport.cs b/src/CodeBeam.UltimateAuth.Server/Domain/SurrogateTransport.cs index d043328d..67d37039 100644 --- a/src/CodeBeam.UltimateAuth.Server/Domain/SurrogateTransport.cs +++ b/src/CodeBeam.UltimateAuth.Server/Domain/SurrogateTransport.cs @@ -1,27 +1,27 @@ namespace CodeBeam.UltimateAuth.Server.Domain; /// -/// Defines how an issued authentication grant is delivered to the client in an HTTP response. +/// Defines how an authentication surrogate is transported between applications over HTTP. /// public enum SurrogateTransport { /// - /// The grant is not delivered. + /// The surrogate is not delivered. /// None = 0, /// - /// The grant is delivered through an HTTP cookie. + /// The surrogate is delivered through an HTTP cookie. /// Cookie = 10, /// - /// The grant is delivered through an HTTP response header. + /// The surrogate is delivered through an HTTP response header. /// Header = 20, /// - /// The grant is delivered in the HTTP response body. + /// The surrogate is delivered in the HTTP response body. /// Body = 30 } diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/SurrogateResponseWriter.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/SurrogateResponseWriter.cs index 7763d4fa..f8b8f362 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/SurrogateResponseWriter.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/SurrogateResponseWriter.cs @@ -65,74 +65,55 @@ public void Write(HttpContext context, SurrogateKind kind, RefreshTokenInfo toke public void WriteInternal(HttpContext context, SurrogateKind kind, string value) { var auth = _authContext.Current; - var delivery = ResolveDelivery(auth.Response, kind); + var transport = auth.Response.GetTransport(kind); - if (delivery.Kind != kind) + if (transport.Kind != kind) { - throw new InvalidOperationException( - $"Resolved grant kind '{delivery.Kind}' does not match '{kind}'."); + throw new InvalidOperationException($"Resolved surrogate kind '{transport.Kind}' does not match '{kind}'."); } - switch (delivery.Mode) + switch (transport.Mode) { case SurrogateTransport.None: return; case SurrogateTransport.Cookie: - WriteCookie(context, kind, value, delivery, auth); + WriteCookie(context, kind, value, transport, auth); return; case SurrogateTransport.Header: - WriteHeader(context, value, delivery, auth); + WriteHeader(context, value, transport, auth); return; case SurrogateTransport.Body: - throw new NotSupportedException( - $"Body grant delivery is not supported for '{kind}'."); + throw new NotSupportedException($"Body transport is not supported for surrogate '{kind}'."); default: - throw new InvalidOperationException( - $"Unsupported grant delivery mode '{delivery.Mode}'."); + throw new InvalidOperationException($"Unsupported surrogate transport '{transport.Mode}'."); } } - private void WriteCookie(HttpContext context, SurrogateKind kind, string value, EffectiveSurrogateTransport delivery, AuthFlowContext auth) + private void WriteCookie(HttpContext context, SurrogateKind kind, string value, EffectiveSurrogateTransport transport, AuthFlowContext auth) { - var cookie = delivery.Cookie - ?? throw new InvalidOperationException($"Cookie options missing for grant '{kind}'."); + var cookie = transport.Cookie + ?? throw new InvalidOperationException($"Cookie options missing for surrogate '{kind}'."); - var cookieOptions = _cookiePolicy.Build(delivery, auth, kind); + var cookieOptions = _cookiePolicy.Build(transport, auth, kind); - _cookieManager.Write( - context, - cookie.Name, - value, - cookieOptions); + _cookieManager.Write(context, cookie.Name, value, cookieOptions); } - private void WriteHeader(HttpContext context, string value, EffectiveSurrogateTransport delivery, AuthFlowContext auth) + private void WriteHeader(HttpContext context, string value, EffectiveSurrogateTransport transport, AuthFlowContext auth) { - var headerName = delivery.Name; + var headerName = transport.Name; if (string.IsNullOrWhiteSpace(headerName)) { - throw new InvalidOperationException($"Header name missing for grant '{delivery.Kind}'."); + throw new InvalidOperationException($"Header name missing for surrogate '{transport.Kind}'."); } - var formatted = _headerPolicy.BuildHeaderValue( - value, - delivery, - auth); + var formatted = _headerPolicy.BuildHeaderValue(value, transport, auth); context.Response.Headers[headerName] = formatted; } - - private static EffectiveSurrogateTransport ResolveDelivery(EffectiveAuthResponse response, SurrogateKind kind) - => kind switch - { - SurrogateKind.SessionId => response.SessionIdTransport, - SurrogateKind.AccessToken => response.AccessTokenTransport, - SurrogateKind.RefreshToken => response.RefreshTokenTransport, - _ => throw new ArgumentOutOfRangeException(nameof(kind)) - }; -} \ No newline at end of file +} diff --git a/src/CodeBeam.UltimateAuth.Server/Options/SurrogateTransportOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/SurrogateTransportOptions.cs index 2f949673..3b92b1ac 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/SurrogateTransportOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/SurrogateTransportOptions.cs @@ -3,21 +3,20 @@ namespace CodeBeam.UltimateAuth.Server.Options; /// -/// Configures how an individual authentication grant is delivered to the client. +/// Configures transport of an individual authentication surrogate. /// /// -/// These settings override the global grant delivery policy. -/// -/// Grant identity, token format, and issuance behavior are determined by the effective authentication mode -/// and cannot be changed through delivery options. +/// These settings override the default surrogate transport configuration. +///

+/// Surrogate kind, token format, and issuance behavior are determined by the effective authentication mode. ///
public sealed class SurrogateTransportOptions { /// - /// Gets or sets the delivery mode for this grant. + /// Gets or sets the transport mechanism for this surrogate. /// /// - /// Null inherits the global delivery preference or the authentication mode and application profile defaults when no global preference is configured. + /// Null inherits the default transport preference or the authentication mode and application profile defaults. /// public SurrogateTransport? Mode { get; set; } diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs index 62064df2..23df8ffc 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs @@ -89,7 +89,7 @@ public UAuthResourceSurrogateTransportOptions AccessToken } /// -/// Device security policies applied during credential validation. +/// Device security policies applied during surrogate validation. /// public sealed class UAuthResourceDeviceOptions { @@ -174,12 +174,26 @@ public sealed class UAuthResourceValidationOptions ///
public sealed class UAuthResourceSurrogateTransportOptions { + /// + /// Gets or sets the accepted transport mechanism. + /// public SurrogateTransport Mode { get; set; } + /// + /// Gets or sets the request cookie name. + /// Required when cookie transport is used. + /// public string CookieName { get; set; } = string.Empty; + /// + /// Gets or sets the request header name. + /// Required when header transport is used. + /// public string HeaderName { get; set; } = "Authorization"; + /// + /// Gets or sets the expected request header value format. + /// public HeaderValueFormat HeaderFormat { get; set; } = HeaderValueFormat.Bearer; internal UAuthResourceSurrogateTransportOptions Clone() diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs index eb138011..7c49145f 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs @@ -8,11 +8,11 @@ namespace CodeBeam.UltimateAuth.Server.Options; /// -/// Server-side configuration for UltimateAuth. -/// Does NOT duplicate Core options. -/// Instead, it composes SessionOptions, MultiTenantOptions, PaginationOptions -/// and adds server-only behaviors (routing, endpoint activation, policies). +/// Provides server-side configuration for UltimateAuth. /// +/// +/// Composes shared configuration with server-specific authentication, token issuance, surrogate transport, validation, and security options. +/// public sealed class UAuthServerOptions { // ------------------------------------------------------- @@ -26,7 +26,7 @@ public sealed class UAuthServerOptions public UAuthSessionOptions Session { get; set; } = new(); /// - /// Token issuing behavior (lifetimes, refresh policies). + /// Configures token lifetimes, expiration, and renewal behavior. /// public UAuthTokenOptions Token { get; set; } = new(); @@ -135,7 +135,7 @@ public sealed class UAuthServerOptions public UAuthDiagnosticsOptions Diagnostics { get; set; } = new(); /// - /// Configures how authentication grants are delivered to clients. + /// Configures how authentication surrogates are transported between the server and client applications. /// public UAuthSurrogateTransportOptions Transport { get; set; } = new(); diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthSurrogateTransportOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthSurrogateTransportOptions.cs index ef4ae257..15944c3e 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthSurrogateTransportOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthSurrogateTransportOptions.cs @@ -3,35 +3,37 @@ namespace CodeBeam.UltimateAuth.Server.Options; /// -/// Configures how authentication grants are delivered to clients. +/// Configures how authentication surrogates are transported between the server and client applications. /// /// -/// Delivery settings do not control grant issuance, token format, validation, or authentication mode. +/// The effective authentication mode determines which surrogate kinds are supported and their token formats. /// -/// The effective authentication mode determines which grants exist and which delivery configurations are supported. +/// Transport settings determine how those surrogates are carried. +/// They do not change token issuance, validation requirements or authentication mode semantics. /// public sealed class UAuthSurrogateTransportOptions { /// - /// Gets or sets the default delivery mode for grants issued by the authentication mode. + /// Gets or sets the default transport for supported surrogates. /// /// - /// Null uses authentication mode and application profile defaults. Individual grant settings take precedence. + /// Null uses authentication mode and application profile defaults. + /// Individual surrogate transport settings take precedence. /// public SurrogateTransport? Default { get; set; } /// - /// Configures delivery of the session grant. + /// Configures transport of the session identifier when it is used as an authentication surrogate. /// public SurrogateTransportOptions SessionId { get; set; } = new(); /// - /// Configures delivery of the access token grant. + /// Configures transport of the access token when it is used as an authentication surrogate. /// public SurrogateTransportOptions AccessToken { get; set; } = new(); /// - /// Configures delivery of the refresh token grant. + /// Configures transport of the refresh token when it is used as an authentication surrogate. /// public SurrogateTransportOptions RefreshToken { get; set; } = new(); diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs index 89a2de27..08e81ae3 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs @@ -1,6 +1,7 @@ using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.ResourceApi; using Microsoft.Extensions.Options; @@ -55,10 +56,22 @@ public ValidateOptionsResult Validate(string? name, UAuthResourceApiOptions opti return ValidateOptionsResult.Fail(errors); if (auth.SessionId is null) + { errors.Add("Auth.SessionId must be configured."); + } + else + { + ValidateTransport(auth.SessionId, "Auth.SessionId", errors); + } if (auth.AccessToken is null) + { errors.Add("Auth.AccessToken must be configured."); + } + else + { + ValidateTransport(auth.AccessToken, "Auth.AccessToken", errors); + } if (auth.Device is null) errors.Add("Auth.Device must be configured."); @@ -66,32 +79,6 @@ public ValidateOptionsResult Validate(string? name, UAuthResourceApiOptions opti if (options.Cryptography is null) errors.Add("Cryptography must be configured."); - if (auth.SessionId is not null) - { - if (!Enum.IsDefined(auth.SessionId.Mode)) - errors.Add("Auth.SessionId.Mode is invalid."); - - if (string.IsNullOrWhiteSpace(auth.SessionId.CookieName)) - errors.Add("Auth.SessionId.CookieName is required."); - } - - if (auth.AccessToken is not null) - { - var token = auth.AccessToken; - - if (!Enum.IsDefined(token.Mode)) - errors.Add("Auth.AccessToken.Mode is invalid."); - - if (!Enum.IsDefined(token.HeaderFormat)) - errors.Add("Auth.AccessToken.HeaderFormat is invalid."); - - if (string.IsNullOrWhiteSpace(token.CookieName)) - errors.Add("Auth.AccessToken.CookieName is required."); - - if (string.IsNullOrWhiteSpace(token.HeaderName)) - errors.Add("Auth.AccessToken.HeaderName is required."); - } - if (auth.Device is not null) { if (!Enum.IsDefined(auth.Device.MismatchBehavior)) @@ -162,4 +149,29 @@ public ValidateOptionsResult Validate(string? name, UAuthResourceApiOptions opti ? ValidateOptionsResult.Success : ValidateOptionsResult.Fail(errors); } + + private static void ValidateTransport(UAuthResourceSurrogateTransportOptions transport, string path, List errors) + { + switch (transport.Mode) + { + case SurrogateTransport.Cookie: + if (string.IsNullOrWhiteSpace(transport.CookieName)) + errors.Add($"{path}.CookieName is required."); + + break; + + case SurrogateTransport.Header: + if (!Enum.IsDefined(transport.HeaderFormat)) + errors.Add($"{path}.HeaderFormat is invalid."); + + if (string.IsNullOrWhiteSpace(transport.HeaderName)) + errors.Add($"{path}.HeaderName is required."); + + break; + + default: + errors.Add($"{path}.Mode is invalid."); + break; + } + } } diff --git a/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs b/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs index f2cddb3e..72f52fb4 100644 --- a/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs +++ b/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs @@ -71,8 +71,6 @@ SessionValidationResult Invalid() return Invalid(); } - var access = _options.Auth.AccessToken; - var transport = ResourceSurrogateTransportFactory.CreateAccessToken(UAuthMode.SemiHybrid, _options.Auth); var surrogate = await _surrogateResolver.ResolveAsync(context, transport); diff --git a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSurrogateTransportFactory.cs b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSurrogateTransportFactory.cs index a26da387..98e7afda 100644 --- a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSurrogateTransportFactory.cs +++ b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSurrogateTransportFactory.cs @@ -36,20 +36,25 @@ public static EffectiveSurrogateTransport Create(UAuthMode mode, SurrogateKind k private static EffectiveSurrogateTransport CreateTransport(SurrogateKind kind, TokenFormat format, UAuthResourceSurrogateTransportOptions configured) { - if (configured.Mode is not (SurrogateTransport.Cookie or SurrogateTransport.Header)) + return configured.Mode switch { - throw new InvalidOperationException($"Unsupported Resource API transport '{configured.Mode}' for '{kind}'."); - } - - return new EffectiveSurrogateTransport( - kind, - format, - configured.Mode, - name: configured.HeaderName, - headerFormat: configured.HeaderFormat, - cookie: new UAuthCookieOptions - { - Name = configured.CookieName - }); + SurrogateTransport.Cookie => new EffectiveSurrogateTransport( + kind, + format, + SurrogateTransport.Cookie, + cookie: new UAuthCookieOptions + { + Name = configured.CookieName + }), + + SurrogateTransport.Header => new EffectiveSurrogateTransport( + kind, + format, + SurrogateTransport.Header, + name: configured.HeaderName, + headerFormat: configured.HeaderFormat), + + _ => throw new InvalidOperationException($"Unsupported Resource API transport '{configured.Mode}' for '{kind}'.") + }; } } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs index f82fcef5..281e6106 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs @@ -176,6 +176,52 @@ public void MissingAuthSections_ShouldReportAllErrors() "Auth.Device must be configured."); } + [Fact] + public void HeaderTransport_ShouldNotRequireCookieName() + { + var options = ValidOptions(); + + options.Auth.SessionId.Mode = SurrogateTransport.Header; + options.Auth.SessionId.CookieName = string.Empty; + + options.Auth.AccessToken.Mode = SurrogateTransport.Header; + options.Auth.AccessToken.CookieName = string.Empty; + + AssertValid(options); + } + + [Fact] + public void CookieTransport_ShouldNotRequireHeaderSettings() + { + var options = ValidOptions(); + + options.Auth.SessionId.Mode = SurrogateTransport.Cookie; + options.Auth.SessionId.HeaderName = string.Empty; + options.Auth.SessionId.HeaderFormat = (HeaderValueFormat)999; + + options.Auth.AccessToken.Mode = SurrogateTransport.Cookie; + options.Auth.AccessToken.HeaderName = string.Empty; + options.Auth.AccessToken.HeaderFormat = (HeaderValueFormat)999; + + AssertValid(options); + } + + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData(" ")] + public void MissingAccessTokenCookieName_ShouldFail(string? value) + { + var options = ValidOptions(); + + options.Auth.AccessToken.Mode = SurrogateTransport.Cookie; + options.Auth.AccessToken.CookieName = value!; + + AssertInvalid( + options, + "Auth.AccessToken.CookieName is required."); + } + [Fact] public void InvalidSessionDeliveryMode_ShouldFail() { @@ -223,20 +269,6 @@ public void InvalidAccessTokenHeaderFormat_ShouldFail() "Auth.AccessToken.HeaderFormat is invalid."); } - [Theory] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] - public void MissingAccessTokenCookieName_ShouldFail(string? value) - { - var options = ValidOptions(); - options.Auth.AccessToken.CookieName = value!; - - AssertInvalid( - options, - "Auth.AccessToken.CookieName is required."); - } - [Theory] [InlineData(null)] [InlineData("")] @@ -498,16 +530,22 @@ public void MultipleInvalidFields_ShouldReportAllApplicableErrors() { var options = ValidOptions(UAuthMode.PureJwt); + options.Auth.SessionId.Mode = SurrogateTransport.Cookie; options.Auth.SessionId.CookieName = ""; + + options.Auth.AccessToken.Mode = SurrogateTransport.Header; options.Auth.AccessToken.HeaderName = ""; + options.Auth.Device.MismatchBehavior = DeviceMismatchBehavior.AllowAndRebind; + options.Auth.Jwt = Jwt( issuer: "", audience: "", algorithms: [], clockSkew: TimeSpan.FromSeconds(-1), maximumTokenSize: 0); + options.Cors.PolicyName = ""; AssertErrors( @@ -639,15 +677,16 @@ private static void AssertInvalid( StringComparison.Ordinal)); } - private static void AssertErrors( - UAuthResourceApiOptions options, - params string[] expectedErrors) + private static void AssertErrors(UAuthResourceApiOptions options, params string[] expectedErrors) { var result = Validate(options); Assert.True(result.Failed); + Assert.Equal( - expectedErrors, - result.Failures!.ToArray()); + expectedErrors.OrderBy(x => x, StringComparer.Ordinal).ToArray(), + result.Failures! + .OrderBy(x => x, StringComparer.Ordinal) + .ToArray()); } } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SurrogateResponseWriterTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SurrogateResponseWriterTests.cs index aa4fe84a..6190d50e 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SurrogateResponseWriterTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SurrogateResponseWriterTests.cs @@ -209,7 +209,7 @@ public void Body_delivery_should_throw_not_supported(SurrogateKind kind) act.Should() .Throw() - .WithMessage("*Body grant delivery is not supported*"); + .WithMessage("*Body transport is not supported for surrogate*"); setup.CookieManager.WriteCount.Should().Be(0); } @@ -309,7 +309,7 @@ public void Unsupported_delivery_mode_should_throw() act.Should() .Throw() - .WithMessage("*Unsupported grant delivery mode*"); + .WithMessage("*Unsupported surrogate transport*"); context.Response.Headers.Should().BeEmpty(); setup.CookieManager.WriteCount.Should().Be(0);