From 1403e3a76ae4f8c0c03c7c2f2939d21f7ebb023b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Mon, 30 Nov 2026 23:54:10 +0300 Subject: [PATCH 01/14] feat(product): Support SemiHybrid Auth Mode --- .../Contracts/Session/IssuedSession.cs | 11 +-- .../Session/SessionCredentialPurpose.cs | 18 +++++ .../Domain/Session/UAuthSession.cs | 34 ++++++--- .../Flows/Login/LoginOrchestrator.cs | 6 +- .../Issuers/UAuthSessionIssuer.cs | 43 ++++++++--- .../Issuers/UAuthTokenIssuer.cs | 8 +- .../Services/UAuthSessionValidator.cs | 7 ++ .../Data/UAuthSessionsModelBuilder.cs | 5 ++ .../Mappers/SessionProjectionMapper.cs | 10 ++- .../Projections/SessionProjection.cs | 1 + .../Server/UAuthSessionValidatorTests.cs | 75 +++++++++++++++++++ 11 files changed, 187 insertions(+), 31 deletions(-) create mode 100644 src/CodeBeam.UltimateAuth.Core/Domain/Session/SessionCredentialPurpose.cs diff --git a/src/CodeBeam.UltimateAuth.Core/Contracts/Session/IssuedSession.cs b/src/CodeBeam.UltimateAuth.Core/Contracts/Session/IssuedSession.cs index 6a76788b..90ced686 100644 --- a/src/CodeBeam.UltimateAuth.Core/Contracts/Session/IssuedSession.cs +++ b/src/CodeBeam.UltimateAuth.Core/Contracts/Session/IssuedSession.cs @@ -13,13 +13,10 @@ public sealed class IssuedSession public required UAuthSession Session { get; init; } /// - /// Opaque session identifier returned to the client. + /// Populated only for opaque credential sessions. + /// Metadata-only sessions never expose an opaque grant. /// - public required string OpaqueSessionId { get; init; } + public string? OpaqueSessionId { get; init; } - /// - /// Indicates whether this issuance is metadata-only - /// (used in SemiHybrid mode). - /// - public bool IsMetadataOnly { get; init; } + public bool IsMetadataOnly => Session.IsMetadataOnly; } diff --git a/src/CodeBeam.UltimateAuth.Core/Domain/Session/SessionCredentialPurpose.cs b/src/CodeBeam.UltimateAuth.Core/Domain/Session/SessionCredentialPurpose.cs new file mode 100644 index 00000000..7aecc82e --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Core/Domain/Session/SessionCredentialPurpose.cs @@ -0,0 +1,18 @@ +namespace CodeBeam.UltimateAuth.Core.Domain; + +/// +/// Defines whether a persisted session can authenticate an opaque credential or only represents JWT lineage. +/// +public enum SessionCredentialPurpose +{ + /// + /// The session ID is an opaque authentication credential. + /// + Opaque = 0, + + /// + /// The session ID is a non-secret correlation identifier. + /// It cannot authenticate an opaque request. + /// + MetadataOnly = 1 +} diff --git a/src/CodeBeam.UltimateAuth.Core/Domain/Session/UAuthSession.cs b/src/CodeBeam.UltimateAuth.Core/Domain/Session/UAuthSession.cs index ba3ef2c7..5a71277e 100644 --- a/src/CodeBeam.UltimateAuth.Core/Domain/Session/UAuthSession.cs +++ b/src/CodeBeam.UltimateAuth.Core/Domain/Session/UAuthSession.cs @@ -19,6 +19,11 @@ public sealed class UAuthSession : IVersionedEntity public SessionMetadata Metadata { get; } public long Version { get; set; } + public SessionCredentialPurpose CredentialPurpose { get; } + + public bool IsOpaqueCredential => CredentialPurpose == SessionCredentialPurpose.Opaque; + public bool IsMetadataOnly => CredentialPurpose == SessionCredentialPurpose.MetadataOnly; + public bool IsRevoked => RevokedAt != null; private UAuthSession( @@ -33,7 +38,8 @@ private UAuthSession( DeviceContext device, ClaimsSnapshot claims, SessionMetadata metadata, - long version) + long version, + SessionCredentialPurpose credentialPurpose) { SessionId = sessionId; Tenant = tenant; @@ -47,6 +53,7 @@ private UAuthSession( Claims = claims; Metadata = metadata; Version = version; + CredentialPurpose = credentialPurpose; } public static UAuthSession Create( @@ -59,8 +66,12 @@ public static UAuthSession Create( long securityVersion, DeviceContext device, ClaimsSnapshot? claims, - SessionMetadata metadata) + SessionMetadata metadata, + SessionCredentialPurpose credentialPurpose = SessionCredentialPurpose.Opaque) { + if (!Enum.IsDefined(credentialPurpose)) + throw new ArgumentOutOfRangeException(nameof(credentialPurpose)); + return new( sessionId, tenant, @@ -73,8 +84,8 @@ public static UAuthSession Create( device: device, claims: claims ?? ClaimsSnapshot.Empty, metadata: metadata, - version: 0 - ); + credentialPurpose: credentialPurpose, + version: 0); } public UAuthSession Revoke(DateTimeOffset at) @@ -94,7 +105,8 @@ public UAuthSession Revoke(DateTimeOffset at) Device, Claims, Metadata, - Version + 1 + Version + 1, + credentialPurpose: CredentialPurpose ); } @@ -110,7 +122,8 @@ internal static UAuthSession FromProjection( DeviceContext device, ClaimsSnapshot claims, SessionMetadata metadata, - long version) + long version, + SessionCredentialPurpose credentialPurpose) { return new UAuthSession( sessionId, @@ -124,7 +137,8 @@ internal static UAuthSession FromProjection( device, claims, metadata, - version + version, + credentialPurpose ); } @@ -156,7 +170,8 @@ public UAuthSession ExtendExpiration(DateTimeOffset expiresAt) Device, Claims, Metadata, - Version + 1 + Version + 1, + credentialPurpose: CredentialPurpose ); } @@ -177,7 +192,8 @@ public UAuthSession WithChain(SessionChainId chainId) device: Device, claims: Claims, metadata: Metadata, - version: Version + 1 + version: Version + 1, + credentialPurpose: CredentialPurpose ); } } diff --git a/src/CodeBeam.UltimateAuth.Server/Flows/Login/LoginOrchestrator.cs b/src/CodeBeam.UltimateAuth.Server/Flows/Login/LoginOrchestrator.cs index 964916c9..e4f07ad3 100644 --- a/src/CodeBeam.UltimateAuth.Server/Flows/Login/LoginOrchestrator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Flows/Login/LoginOrchestrator.cs @@ -79,9 +79,11 @@ public async Task LoginAsync(AuthFlowContext flow, LoginRequest req if (request.CredentialType != CredentialType.Password) throw new UAuthValidationException("unsupported_credential_type"); - if (flow.EffectiveMode == UAuthMode.PureJwt && loginExecution.Mode == LoginExecutionMode.Commit && !request.RequestTokens) + if (flow.EffectiveMode is UAuthMode.PureJwt or UAuthMode.SemiHybrid && + loginExecution.Mode == LoginExecutionMode.Commit && + !request.RequestTokens) { - throw new UAuthValidationException("pure_jwt_requires_token_delivery"); + throw new UAuthValidationException("jwt_mode_requires_token_delivery"); } var now = _clock.UtcNow; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs index 1a8e31a0..8e3b726b 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs @@ -34,10 +34,34 @@ public async Task IssueSessionAsync(SessionIssuanceContext contex var sessionOptions = context.SessionOptions; var now = context.Now; - var opaqueSessionId = _opaqueGenerator.Generate(); - if (!AuthSessionId.TryCreate(opaqueSessionId, out AuthSessionId sessionId)) - throw new InvalidCastException("Can't create opaque id."); + var purpose = context.Mode switch + { + UAuthMode.PureOpaque or UAuthMode.Hybrid + => SessionCredentialPurpose.Opaque, + + UAuthMode.SemiHybrid + => SessionCredentialPurpose.MetadataOnly, + + UAuthMode.PureJwt + => throw new InvalidOperationException("PureJwt does not create sessions."), + + _ => throw new InvalidOperationException($"Unsupported auth mode: {context.Mode}") + }; + + var rawSessionId = purpose switch + { + SessionCredentialPurpose.Opaque => _opaqueGenerator.Generate(), + SessionCredentialPurpose.MetadataOnly => + _opaqueGenerator.Generate(), + + _ => throw new InvalidOperationException("Unsupported session credential purpose.") + }; + + if (!AuthSessionId.TryCreate(rawSessionId, out AuthSessionId sessionId)) + { + throw new InvalidOperationException("Could not generate session identifier."); + } var absoluteExpiresAt = sessionOptions.MaxLifetime is { } max ? now.Add(max) @@ -214,7 +238,8 @@ context.Device.DeviceId is not DeviceId incomingDeviceId || securityVersion: root.SecurityVersion, device: sessionDevice, claims: context.Claims, - metadata: context.Metadata); + metadata: context.Metadata, + credentialPurpose: purpose); await kernel.CreateSessionAsync(session, innerCt); var updatedChain = chain.AttachSession(session.SessionId, now); @@ -223,8 +248,7 @@ context.Device.DeviceId is not DeviceId incomingDeviceId || return new IssuedSession { Session = session, - OpaqueSessionId = opaqueSessionId, - IsMetadataOnly = context.Mode == UAuthMode.SemiHybrid + OpaqueSessionId = purpose == SessionCredentialPurpose.Opaque ? rawSessionId : null }; } @@ -297,16 +321,15 @@ await kernel.ExecuteAsync(async _ => securityVersion: root.SecurityVersion, device: context.Device, claims: context.Claims, - metadata: context.Metadata - ); + metadata: context.Metadata, + credentialPurpose: oldSession.CredentialPurpose); var newSession = newSessionUnbound.WithChain(chain.ChainId); issued = new IssuedSession { Session = newSession, - OpaqueSessionId = opaqueSessionId, - IsMetadataOnly = context.Mode == UAuthMode.SemiHybrid + OpaqueSessionId = newSession.IsOpaqueCredential ? opaqueSessionId : null }; await kernel.CreateSessionAsync(newSession); diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthTokenIssuer.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthTokenIssuer.cs index 48e8f79d..76266da5 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthTokenIssuer.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthTokenIssuer.cs @@ -42,9 +42,15 @@ public Task IssueAccessTokenAsync(AuthFlowContext flow, TokenIssuan UAuthMode.PureOpaque or UAuthMode.Hybrid => Task.FromResult(IssueOpaqueAccessToken(expires, context.SessionId)), - UAuthMode.SemiHybrid => + UAuthMode.SemiHybrid + when context.SessionId is not null && + context.SessionChainId is not null && + context.DeviceId is not null => Task.FromResult(IssueJwtAccessToken(context, tokens, expires)), + UAuthMode.SemiHybrid => + throw new InvalidOperationException("SemiHybrid JWT requires a session, chain and device binding."), + UAuthMode.PureJwt when context.SessionId is null && context.SessionChainId is null && diff --git a/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs b/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs index ad9617f0..69292f62 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs @@ -26,6 +26,13 @@ public async Task ValidateSessionAsync(SessionValidatio var kernel = _storeFactory.Create(context.Tenant); var session = await kernel.GetSessionAsync(context.SessionId, ct); + if (session is null) + return SessionValidationResult.Invalid(SessionState.NotFound, sessionId: context.SessionId); + + // Metadata-only identifiers are not opaque credentials. + if (!session.IsOpaqueCredential) + return SessionValidationResult.Invalid(SessionState.NotFound, sessionId: context.SessionId); + if (session is null) return SessionValidationResult.Invalid(SessionState.NotFound, sessionId: context.SessionId); diff --git a/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Data/UAuthSessionsModelBuilder.cs b/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Data/UAuthSessionsModelBuilder.cs index 3e0a462f..494e7d4e 100644 --- a/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Data/UAuthSessionsModelBuilder.cs +++ b/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Data/UAuthSessionsModelBuilder.cs @@ -154,6 +154,11 @@ private static void ConfigureSessions(ModelBuilder b) .HasConversion(new JsonValueConverter()) .IsRequired(); + e.Property(x => x.CredentialPurpose) + .HasConversion() + .HasDefaultValue(SessionCredentialPurpose.Opaque) + .IsRequired(); + e.HasIndex(x => new { x.Tenant, x.SessionId }).IsUnique(); e.HasIndex(x => new { x.Tenant, x.ChainId }); e.HasIndex(x => new { x.Tenant, x.ChainId, x.RevokedAt }); diff --git a/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Mappers/SessionProjectionMapper.cs b/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Mappers/SessionProjectionMapper.cs index be5f5413..760aeb84 100644 --- a/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Mappers/SessionProjectionMapper.cs +++ b/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Mappers/SessionProjectionMapper.cs @@ -18,7 +18,8 @@ public static UAuthSession ToDomain(this SessionProjection p) p.Device, p.Claims, p.Metadata, - p.Version + p.Version, + p.CredentialPurpose ); } @@ -39,7 +40,8 @@ public static SessionProjection ToProjection(this UAuthSession s) Device = s.Device, Claims = s.Claims, Metadata = s.Metadata, - Version = s.Version + Version = s.Version, + CredentialPurpose = s.CredentialPurpose, }; } @@ -51,6 +53,10 @@ public static void UpdateProjection(this UAuthSession source, SessionProjection target.Device = source.Device; target.Claims = source.Claims; target.Metadata = source.Metadata; + + if (target.CredentialPurpose != source.CredentialPurpose) + throw new InvalidOperationException("Session credential purpose cannot be changed."); + // Version store-owned } } diff --git a/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Projections/SessionProjection.cs b/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Projections/SessionProjection.cs index 7860d578..9adcfc02 100644 --- a/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Projections/SessionProjection.cs +++ b/src/sessions/CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore/Projections/SessionProjection.cs @@ -23,6 +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 bool IsRevoked => RevokedAt != null; } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs index e7a39459..40a5e331 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs @@ -555,6 +555,81 @@ public async Task ValidateSessionAsync_PropagatesCancellationToken() Times.Once); } + [Fact] + public async Task ValidateSessionAsync_MetadataOnlySession_ReturnsNotFound() + { + var fixture = CreateFixture(); + + var metadataSession = UAuthSession.Create( + sessionId: fixture.Session.SessionId, + tenant: fixture.Tenant, + userKey: fixture.User, + chainId: fixture.Chain.ChainId, + now: Now.AddMinutes(-5), + expiresAt: Now.AddMinutes(30), + securityVersion: fixture.Root.SecurityVersion, + device: fixture.Session.Device, + claims: ClaimsSnapshot.Empty, + metadata: SessionMetadata.Empty, + credentialPurpose: SessionCredentialPurpose.MetadataOnly); + + fixture.Store + .Setup(x => x.GetSessionAsync( + metadataSession.SessionId, + It.IsAny())) + .ReturnsAsync(metadataSession); + + var result = await fixture.Sut.ValidateSessionAsync( + fixture.Context, + TestContext.Current.CancellationToken); + + result.IsValid.Should().BeFalse(); + result.State.Should().Be(SessionState.NotFound); + + fixture.Store.Verify( + x => x.GetChainAsync( + It.IsAny(), + It.IsAny()), + Times.Never); + + fixture.ClaimsProvider.Verify( + x => x.GetClaimsAsync( + It.IsAny(), + It.IsAny(), + It.IsAny()), + Times.Never); + } + + [Fact] + public void MetadataOnlySession_PreservesPurpose_AfterMutation() + { + var now = new DateTimeOffset( + 2026, 11, 30, 12, 0, 0, TimeSpan.Zero); + + var session = UAuthSession.Create( + sessionId: AuthSessionId.Parse("metadata_session_identifier_1234567890"), + tenant: TenantKey.Single, + userKey: UserKey.FromString("user-1"), + chainId: SessionChainId.New(), + now: now, + expiresAt: now.AddHours(1), + securityVersion: 0, + device: DeviceContext.Anonymous(), + claims: ClaimsSnapshot.Empty, + metadata: SessionMetadata.Empty, + credentialPurpose: SessionCredentialPurpose.MetadataOnly); + + session.IsMetadataOnly.Should().BeTrue(); + + session.ExtendExpiration(now.AddHours(2)) + .CredentialPurpose.Should() + .Be(SessionCredentialPurpose.MetadataOnly); + + session.Revoke(now.AddMinutes(10)) + .CredentialPurpose.Should() + .Be(SessionCredentialPurpose.MetadataOnly); + } + // --------------------------------------------------------------------- // Setup // --------------------------------------------------------------------- From ff41b1d238afb9f7e494d26bf3b2eca43f47cb48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Tue, 1 Dec 2026 12:01:33 +0300 Subject: [PATCH 02/14] Login Implementation --- .../Auth/Context/AuthFlowContextFactory.cs | 6 +- .../AspNetCore/UAuthAuthenticationHandler.cs | 50 ++----- .../UAuthResourceAuthenticationHandler.cs | 60 ++------ .../UAuthJwtPrincipalFactory.cs | 70 +++++++++ .../Endpoints/ValidateEndpointHandler.cs | 21 +-- .../Extensions/ServiceCollectionExtensions.cs | 47 +++--- .../Flows/Login/LoginOrchestrator.cs | 33 ++++- .../Flows/Refresh/RefreshResponsePolicy.cs | 7 +- .../Infrastructure/Token/JwtPayloadGuard.cs | 11 ++ .../Infrastructure/User/UAuthUserAccessor.cs | 2 +- .../Options/Defaults/ConfigureDefaults.cs | 5 +- .../UAuthResourceApiOptionsValidator.cs | 21 +-- .../Services/UAuthSessionValidator.cs | 3 - .../Server/UAuthJwtPrincipalFactoryTests.cs | 137 ++++++++++++++++++ 14 files changed, 313 insertions(+), 160 deletions(-) create mode 100644 src/CodeBeam.UltimateAuth.Server/Authentication/UAuthJwtPrincipalFactory.cs create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthJwtPrincipalFactoryTests.cs diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs index 1bc012d2..94e65947 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs @@ -70,10 +70,10 @@ public async ValueTask CreateAsync(HttpContext ctx, AuthFlowTyp bool isAuthenticated; UserKey? userKey; - if (effectiveMode == UAuthMode.PureJwt) + if (effectiveMode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) { - // The UserMiddleware has already populated this snapshot from the cryptographically authenticated JWT principal. - // No session validation is performed for PureJwt. + // Identity is established by the UltimateAuth JWT scheme. + // No implicit session or lineage validation. isAuthenticated = user?.IsAuthenticated == true; userKey = isAuthenticated ? user?.UserId : null; } diff --git a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs index b62d6e9d..19d4c7c9 100644 --- a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs @@ -71,15 +71,17 @@ protected override async Task HandleAuthenticateAsync() var credential = await _transportCredentialResolver.ResolveAsync(Context, mode, response); - if (mode == UAuthMode.PureJwt) + if (mode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) { if (credential is null) return AuthenticateResult.NoResult(); if (credential.Kind != TransportCredentialKind.AccessToken) - return AuthenticateResult.Fail("PureJwt requires an access token."); + { + return AuthenticateResult.Fail("JWT authentication requires an access token."); + } - return await AuthenticateJwtAsync(credential.Value, tenant, effective.Options.Session.DeviceMismatchBehavior); + return await AuthenticateJwtAsync(credential.Value, tenant, mode, effective.Options.Session.DeviceMismatchBehavior); } if (credential is null) @@ -167,36 +169,13 @@ protected override Task HandleForbiddenAsync(AuthenticationProperties properties return Task.CompletedTask; } - private async Task AuthenticateJwtAsync(string token, TenantKey tenant, DeviceMismatchBehavior mismatchBehavior) + private async Task AuthenticateJwtAsync(string token, TenantKey tenant, UAuthMode mode, DeviceMismatchBehavior mismatchBehavior) { var validated = await _jwtValidator.ValidateAsync(token, tenant, Context.RequestAborted); if (validated is null) - return AuthenticateResult.Fail("Invalid JWT access token."); - - // PureJwt credentials must not carry framework session identity. - if (validated.Claims.Any(x => x.Type == "sid")) - { - return AuthenticateResult.Fail("Session-bound JWT is not valid in PureJwt mode."); - } - - var deviceClaims = validated.Claims - .Where(x => x.Type == "device_id") - .ToArray(); - - if (deviceClaims.Length != 1 || !DeviceId.TryCreate(deviceClaims[0].Value, out var tokenDeviceId)) - { - return AuthenticateResult.Fail("PureJwt requires a valid device binding."); - } - - if (mismatchBehavior == DeviceMismatchBehavior.AllowAndRebind) { - return AuthenticateResult.Fail("Device rebinding is not supported in PureJwt."); - } - - if (mismatchBehavior is not (DeviceMismatchBehavior.Reject or DeviceMismatchBehavior.Allow)) - { - return AuthenticateResult.Fail("Unsupported device mismatch behavior."); + return AuthenticateResult.Fail("Invalid JWT access token."); } DeviceId? requestDeviceId = null; @@ -211,22 +190,11 @@ private async Task AuthenticateJwtAsync(string token, Tenant } } - if (!PureJwtDevicePolicy.IsAllowed(mismatchBehavior, tokenDeviceId, requestDeviceId)) + if (!UAuthJwtPrincipalFactory.TryCreate(validated, mode, mismatchBehavior, requestDeviceId, Scheme.Name, out var principal) || principal is null) { - return AuthenticateResult.Fail("JWT device mismatch."); + return AuthenticateResult.Fail("JWT identity does not satisfy authentication mode."); } - var claims = validated.Claims.ToList(); - - // Use the cryptographically validated subject, not an untrusted request header or client-provided identifier. - claims.RemoveAll(x => x.Type == ClaimTypes.NameIdentifier); - - claims.Add(new Claim(ClaimTypes.NameIdentifier, validated.Subject)); - - var identity = new ClaimsIdentity(claims, Scheme.Name, ClaimTypes.NameIdentifier, ClaimTypes.Role); - - var principal = new ClaimsPrincipal(identity); - RateLimiting.UAuthRateLimitPolicy.SetValidatedActor(Context, tenant.Value, validated.Subject); return AuthenticateResult.Success(new AuthenticationTicket(principal, Scheme.Name)); diff --git a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs index 3d465f41..5366576d 100644 --- a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs @@ -3,7 +3,6 @@ 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; @@ -55,9 +54,10 @@ public UAuthResourceAuthenticationHandler( protected override async Task HandleAuthenticateAsync() { var tenant = Context.GetTenant(); + var mode = _modeProvider.Mode; - return _modeProvider.Mode == UAuthMode.PureJwt - ? await AuthenticatePureJwtAsync(tenant) + return mode is UAuthMode.PureJwt or UAuthMode.SemiHybrid + ? await AuthenticateJwtAsync(tenant, mode) : await AuthenticateSessionAsync(tenant); } @@ -126,7 +126,7 @@ private async Task AuthenticateSessionAsync(TenantKey tenant return AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(identity), Scheme.Name)); } - private async Task AuthenticatePureJwtAsync(CodeBeam.UltimateAuth.Core.MultiTenancy.TenantKey tenant) + private async Task AuthenticateJwtAsync(TenantKey tenant, UAuthMode mode) { var accessDelivery = new EffectiveGrantDelivery( GrantKind.AccessToken, @@ -145,52 +145,25 @@ private async Task AuthenticatePureJwtAsync(CodeBeam.Ultimat EffectiveGrantDelivery.Disabled(GrantKind.RefreshToken), EffectiveRedirectResponse.Disabled); - var credential = await _credentialResolver.ResolveAsync( - Context, - UAuthMode.PureJwt, - response); + var credential = await _credentialResolver.ResolveAsync(Context, mode, response); if (credential is null) return AuthenticateResult.NoResult(); if (credential.Kind != TransportCredentialKind.AccessToken) - return AuthenticateResult.Fail("PureJwt requires an access token."); + { + 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(credential.Value, tenant, Context.RequestAborted); if (validated is null) return AuthenticateResult.Fail("Invalid JWT access token."); - // PureJwt must never carry a framework session identity. - if (validated.Claims.Any(x => x.Type == "sid")) - { - return AuthenticateResult.Fail("Session-bound JWT is not valid in PureJwt mode."); - } - - var deviceClaims = validated.Claims.Where(x => x.Type == "device_id").ToArray(); - - if (deviceClaims.Length != 1 || !DeviceId.TryCreate(deviceClaims[0].Value, out var tokenDeviceId)) - { - return AuthenticateResult.Fail("PureJwt requires a valid device binding."); - } - var mismatchBehavior = _resourceOptions.Auth.Device.MismatchBehavior; - if (mismatchBehavior == DeviceMismatchBehavior.AllowAndRebind) - { - return AuthenticateResult.Fail("Device rebinding is not supported in PureJwt."); - } - - if (mismatchBehavior is not (DeviceMismatchBehavior.Reject or DeviceMismatchBehavior.Allow)) - { - return AuthenticateResult.Fail("Unsupported device mismatch behavior."); - } - DeviceId? requestDeviceId = null; if (mismatchBehavior == DeviceMismatchBehavior.Reject) @@ -203,22 +176,11 @@ private async Task AuthenticatePureJwtAsync(CodeBeam.Ultimat } } - if (!PureJwtDevicePolicy.IsAllowed(mismatchBehavior, tokenDeviceId, requestDeviceId)) + if (!UAuthJwtPrincipalFactory.TryCreate(validated, mode, mismatchBehavior, requestDeviceId, Scheme.Name, out var principal) || principal is null) { - return AuthenticateResult.Fail("JWT device mismatch."); + return AuthenticateResult.Fail("JWT identity does not satisfy authentication mode."); } - var claims = validated.Claims.ToList(); - - // The identity must come from the validated JWT subject. - claims.RemoveAll(x => x.Type == ClaimTypes.NameIdentifier); - - claims.Add(new Claim(ClaimTypes.NameIdentifier, validated.Subject)); - - var identity = new ClaimsIdentity(claims, Scheme.Name, ClaimTypes.NameIdentifier, ClaimTypes.Role); - - var principal = new ClaimsPrincipal(identity); - return AuthenticateResult.Success(new AuthenticationTicket(principal, Scheme.Name)); } } diff --git a/src/CodeBeam.UltimateAuth.Server/Authentication/UAuthJwtPrincipalFactory.cs b/src/CodeBeam.UltimateAuth.Server/Authentication/UAuthJwtPrincipalFactory.cs new file mode 100644 index 00000000..25ccbb42 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Authentication/UAuthJwtPrincipalFactory.cs @@ -0,0 +1,70 @@ +using System.Security.Claims; +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.Contracts; + +namespace CodeBeam.UltimateAuth.Server.Authentication; + +internal static class UAuthJwtPrincipalFactory +{ + public static bool TryCreate( + ValidatedJwtIdentity validated, + UAuthMode mode, + DeviceMismatchBehavior mismatchBehavior, + DeviceId? requestDeviceId, + string scheme, + out ClaimsPrincipal? principal) + { + principal = null; + + if (mode is not (UAuthMode.PureJwt or UAuthMode.SemiHybrid)) + return false; + + if (mismatchBehavior is not (DeviceMismatchBehavior.Reject or DeviceMismatchBehavior.Allow)) + { + return false; + } + + if (!UserKey.TryParse(validated.Subject, null, out _)) + { + return false; + } + + var sessionClaims = validated.Claims.Where(x => x.Type == "sid").ToArray(); + + if (mode == UAuthMode.PureJwt) + { + if (sessionClaims.Length != 0) + return false; + } + else + { + if (sessionClaims.Length != 1 || !AuthSessionId.TryCreate(sessionClaims[0].Value, out _)) + { + return false; + } + } + + var deviceClaims = validated.Claims.Where(x => x.Type == "device_id").ToArray(); + + if (deviceClaims.Length != 1 || !DeviceId.TryCreate(deviceClaims[0].Value, out var tokenDeviceId)) + { + return false; + } + + if (!PureJwtDevicePolicy.IsAllowed(mismatchBehavior, tokenDeviceId, requestDeviceId)) + { + return false; + } + + // Framework identity cannot be overridden by application-supplied NameIdentifier claims. + var claims = validated.Claims.Where(x => x.Type != ClaimTypes.NameIdentifier).ToList(); + + claims.Add(new Claim(ClaimTypes.NameIdentifier, validated.Subject)); + + var identity = new ClaimsIdentity(claims, scheme, ClaimTypes.NameIdentifier, ClaimTypes.Role); + + principal = new ClaimsPrincipal(identity); + return true; + } +} diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs index 1573959e..4e096cea 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs @@ -37,9 +37,9 @@ public async Task ValidateAsync(HttpContext context, CancellationToken { var auth = _authContext.Current; - if (auth.EffectiveMode == UAuthMode.PureJwt) + if (auth.EffectiveMode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) { - return await ValidatePureJwtAsync(context); + return await ValidateJwtAsync(context); } var credential = await _credentialResolver.ResolveAsync(context, auth.EffectiveMode, auth.Response); @@ -141,11 +141,9 @@ public async Task ValidateAsync(HttpContext context, CancellationToken ); } - private static async Task ValidatePureJwtAsync( - HttpContext context) + private static async Task ValidateJwtAsync(HttpContext context) { - var result = await context.AuthenticateAsync( - UAuthConstants.SchemeDefaults.GlobalScheme); + var result = await context.AuthenticateAsync(UAuthConstants.SchemeDefaults.GlobalScheme); if (result.None) { @@ -157,8 +155,7 @@ private static async Task ValidatePureJwtAsync( statusCode: StatusCodes.Status401Unauthorized); } - if (!result.Succeeded || - result.Principal?.Identity?.IsAuthenticated != true) + if (!result.Succeeded || result.Principal?.Identity?.IsAuthenticated != true) { return Results.Json( new AuthValidationResult @@ -170,8 +167,7 @@ private static async Task ValidatePureJwtAsync( var principal = result.Principal; - var subject = principal - .FindFirst(ClaimTypes.NameIdentifier)?.Value; + var subject = principal.FindFirst(ClaimTypes.NameIdentifier)?.Value; if (!UserKey.TryParse(subject, null, out var userKey)) { @@ -183,10 +179,7 @@ private static async Task ValidatePureJwtAsync( statusCode: StatusCodes.Status401Unauthorized); } - var snapshot = PureJwtSnapshotFactory.Create( - principal, - userKey, - context.GetTenant()); + var snapshot = PureJwtSnapshotFactory.Create(principal, userKey, context.GetTenant()); return Results.Ok(new AuthValidationResult { diff --git a/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs b/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs index 14190aa6..81ae5578 100644 --- a/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs @@ -7,7 +7,6 @@ using CodeBeam.UltimateAuth.Core.Extensions; using CodeBeam.UltimateAuth.Core.Infrastructure; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Core.Runtime; using CodeBeam.UltimateAuth.Credentials; using CodeBeam.UltimateAuth.Credentials.Extensions; @@ -39,13 +38,10 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Cors.Infrastructure; using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Hosting.Internal; using Microsoft.Extensions.Options; -using Microsoft.IdentityModel.Tokens; namespace CodeBeam.UltimateAuth.Server.Extensions; @@ -82,6 +78,26 @@ public static IServiceCollection AddUltimateAuthServer(this IServiceCollection s return services; } + public static IServiceCollection AddUAuthHub(this IServiceCollection services, Action? configure = null) + { + services.PostConfigure(options => + { + configure?.Invoke(options.Hub); + }); + + services.TryAddSingleton(); + + services.TryAddScoped(); + services.TryAddScoped(); + services.TryAddScoped(); + + services.AddCors(); + + services.TryAddEnumerable(ServiceDescriptor.Singleton, UAuthHubCorsOptionsSetup>()); + + return services; + } + public static IServiceCollection AddUltimateAuthResourceApi(this IServiceCollection services, Action? configure = null, Action? configurePolicies = null) { ArgumentNullException.ThrowIfNull(services); @@ -468,27 +484,6 @@ internal static IServiceCollection AddAuthorizationInternal(IServiceCollection s return services; } - - public static IServiceCollection AddUAuthHub(this IServiceCollection services, Action? configure = null) - { - services.PostConfigure(options => - { - configure?.Invoke(options.Hub); - }); - - services.TryAddSingleton(); - - services.TryAddScoped(); - services.TryAddScoped(); - services.TryAddScoped(); - - services.AddCors(); - - services.TryAddEnumerable(ServiceDescriptor.Singleton, UAuthHubCorsOptionsSetup>()); - - return services; - } - private static IServiceCollection AddUltimateAuthResourceInternal(this IServiceCollection services) { // Resource API Specific @@ -573,7 +568,7 @@ private static IServiceCollection AddUltimateAuthResourceInternal(this IServiceC { var mode = sp.GetRequiredService().Mode; - if (mode == UAuthMode.PureJwt) + if (mode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) return; var options = sp.GetRequiredService>().Value; diff --git a/src/CodeBeam.UltimateAuth.Server/Flows/Login/LoginOrchestrator.cs b/src/CodeBeam.UltimateAuth.Server/Flows/Login/LoginOrchestrator.cs index e4f07ad3..0801676d 100644 --- a/src/CodeBeam.UltimateAuth.Server/Flows/Login/LoginOrchestrator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Flows/Login/LoginOrchestrator.cs @@ -12,6 +12,7 @@ using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Users; using CodeBeam.UltimateAuth.Users.Contracts; +using static System.Runtime.InteropServices.JavaScript.JSType; // TODO: Identifier-based throttling, Exponential lockout @@ -333,17 +334,37 @@ public async Task LoginAsync(AuthFlowContext flow, LoginRequest req if (request.RequestTokens) { + var identifiers = flow.EffectiveMode == UAuthMode.SemiHybrid + ? await _primaryIdentifiers.GetAsync(flow.Tenant, userKey.Value, ct) + : null; + + var profile = flow.EffectiveMode == UAuthMode.SemiHybrid + ? await _userProfiles.GetAsync(flow.Tenant, userKey.Value, ProfileKey.Default, ct) + : null; + var tokenContext = new TokenIssuanceContext { Tenant = flow.Tenant, UserKey = userKey.Value, SessionId = issuedSession.Session.SessionId, SessionChainId = issuedSession.Session.ChainId, - Claims = claims + DeviceId = deviceId, + Claims = claims, + + PrimaryUserName = identifiers?.UserName, + DisplayName = profile?.DisplayName, + TimeZone = profile?.TimeZone, + AuthenticatedAt = now }; var accessToken = await _tokens.IssueAccessTokenAsync(flow, tokenContext, ct); + if (flow.EffectiveMode == UAuthMode.SemiHybrid && accessToken.Format != TokenFormat.Jwt) + { + throw new InvalidOperationException( + "SemiHybrid must issue a JWT access token."); + } + var refreshIssuance = await _tokens.IssueRefreshTokenAsync(flow, tokenContext, RefreshTokenPersistence.Persist, ct); tokens = new AuthTokens @@ -355,6 +376,16 @@ public async Task LoginAsync(AuthFlowContext flow, LoginRequest req await _events.DispatchAsync(new UserLoggedInContext(flow.Tenant, userKey.Value, now, flow.Device, issuedSession.Session.SessionId)); + if (flow.EffectiveMode == UAuthMode.SemiHybrid) + { + if (tokens?.AccessToken?.Format != TokenFormat.Jwt) + { + throw new InvalidOperationException("SemiHybrid login requires a JWT."); + } + + return LoginResult.Success(tokens); + } + return LoginResult.Success(issuedSession.Session.SessionId, tokens); } diff --git a/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshResponsePolicy.cs b/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshResponsePolicy.cs index 4b8c24e6..a1f6f186 100644 --- a/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshResponsePolicy.cs +++ b/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshResponsePolicy.cs @@ -1,6 +1,5 @@ using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; namespace CodeBeam.UltimateAuth.Server.Flows; @@ -12,18 +11,14 @@ public GrantKind SelectPrimary(AuthFlowContext flow, RefreshFlowRequest request, if (flow.EffectiveMode == UAuthMode.PureOpaque) return GrantKind.Session; - if (flow.EffectiveMode == UAuthMode.PureJwt) + if (flow.EffectiveMode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) return GrantKind.AccessToken; if (!string.IsNullOrWhiteSpace(request.RefreshToken) && request.SessionId == null) - { return GrantKind.AccessToken; - } if (request.SessionId != null) - { return GrantKind.Session; - } if (flow.ApplicationProfile == UAuthApplicationProfile.Api) return GrantKind.AccessToken; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Token/JwtPayloadGuard.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Token/JwtPayloadGuard.cs index d552597f..633da423 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Token/JwtPayloadGuard.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Token/JwtPayloadGuard.cs @@ -70,6 +70,17 @@ public static bool IsValid(string token) } } + if (property.Name is "sid" or "device_id") + { + if (property.Value.ValueKind != JsonValueKind.String) + return false; + + if (string.IsNullOrWhiteSpace(property.Value.GetString())) + { + return false; + } + } + if (property.Name is "exp" or "nbf" or "iat") { if (property.Value.ValueKind != JsonValueKind.Number || !property.Value.TryGetInt64(out _)) diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/User/UAuthUserAccessor.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/User/UAuthUserAccessor.cs index 95771ab7..9fdc66fe 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/User/UAuthUserAccessor.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/User/UAuthUserAccessor.cs @@ -37,7 +37,7 @@ public async Task ResolveAsync(HttpContext context) var profile = await _applicationProfileReader.ReadAsync(context); var mode = _effectiveOptions.GetEffective(context, profile).Mode; - if (mode == UAuthMode.PureJwt) + if (mode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) { await ResolveJwtAsync(context); return; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs b/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs index 5bbe055c..53d9ec03 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs @@ -2,6 +2,7 @@ namespace CodeBeam.UltimateAuth.Server.Options; +// TODO: Check this class that it must not prevent the user from setting their own defaults. It should only set defaults for properties that are not set by the user. internal static class ConfigureDefaults { internal static void ApplyModeDefaults(UAuthMode effectiveMode, UAuthServerOptions options) @@ -59,7 +60,6 @@ private static void ApplyHybridDefaults(UAuthServerOptions options) token.IssueOpaque = true; cookie.Session.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); - cookie.RefreshToken.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); } @@ -73,7 +73,8 @@ private static void ApplySemiHybridDefaults(UAuthServerOptions options) session.TouchInterval = null; token.IssueJwt = true; - token.IssueOpaque = true; + token.IssueOpaque = false; + token.IssueRefresh = true; token.AddJwtIdClaim = true; cookie.AccessToken.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs index 91cf0a45..d34dc883 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs @@ -97,13 +97,11 @@ public ValidateOptionsResult Validate(string? name, UAuthResourceApiOptions opti if (!Enum.IsDefined(auth.Device.MismatchBehavior)) errors.Add("Auth.Device.MismatchBehavior is invalid."); - if (mode == UAuthMode.PureJwt && auth.Device.MismatchBehavior == DeviceMismatchBehavior.AllowAndRebind) - { - errors.Add("PureJwt does not support device rebinding."); - } + if (mode is UAuthMode.PureJwt or UAuthMode.SemiHybrid && auth.Device.MismatchBehavior == DeviceMismatchBehavior.AllowAndRebind) + errors.Add("JWT authentication modes do not support device rebinding."); } - if (mode == UAuthMode.PureJwt) + if (mode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) { if (auth.Jwt is null) { @@ -128,22 +126,17 @@ public ValidateOptionsResult Validate(string? name, UAuthResourceApiOptions opti errors.Add("Auth.Jwt.ClockSkew cannot be negative."); if (auth.Jwt.MaximumTokenSizeInBytes <= 0) - errors.Add( - "Auth.Jwt.MaximumTokenSizeInBytes must be positive."); + errors.Add("Auth.Jwt.MaximumTokenSizeInBytes must be positive."); } } - if (mode != UAuthMode.PureJwt) + if (mode is UAuthMode.PureOpaque or UAuthMode.Hybrid) { if (string.IsNullOrWhiteSpace(options.Hub?.BaseUrl)) { - errors.Add( - "Hub.BaseUrl is required for remote session validation."); + errors.Add("Hub.BaseUrl is required for remote session validation."); } - else if (!Uri.TryCreate( - options.Hub.BaseUrl, - UriKind.Absolute, - out var uri) || + else if (!Uri.TryCreate(options.Hub.BaseUrl, UriKind.Absolute, out var uri) || (uri.Scheme != Uri.UriSchemeHttps && uri.Scheme != Uri.UriSchemeHttp)) { diff --git a/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs b/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs index 69292f62..d9033689 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs @@ -33,9 +33,6 @@ public async Task ValidateSessionAsync(SessionValidatio if (!session.IsOpaqueCredential) return SessionValidationResult.Invalid(SessionState.NotFound, sessionId: context.SessionId); - if (session is null) - return SessionValidationResult.Invalid(SessionState.NotFound, sessionId: context.SessionId); - var state = session.GetState(context.Now); if (state != SessionState.Active) return SessionValidationResult.Invalid(state, session.UserKey, session.SessionId, session.ChainId); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthJwtPrincipalFactoryTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthJwtPrincipalFactoryTests.cs new file mode 100644 index 00000000..ab7ec6ff --- /dev/null +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthJwtPrincipalFactoryTests.cs @@ -0,0 +1,137 @@ +using System.Security.Claims; +using AwesomeAssertions; +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.Authentication; +using CodeBeam.UltimateAuth.Server.Contracts; + +namespace CodeBeam.UltimateAuth.Tests.Unit.Server; + +public sealed class UAuthJwtPrincipalFactoryTests +{ + private const string SessionId = "metadata-session-identifier-1234567890"; + + private static readonly DeviceId Device = DeviceId.Create("test-device-1234567890"); + + [Theory] + [InlineData(UAuthMode.PureJwt, false, true)] + [InlineData(UAuthMode.PureJwt, true, false)] + [InlineData(UAuthMode.SemiHybrid, false, false)] + [InlineData(UAuthMode.SemiHybrid, true, true)] + public void TryCreate_EnforcesSessionClaimByMode(UAuthMode mode, bool includeSession, bool expected) + { + var token = CreateIdentity(includeSession); + + var success = UAuthJwtPrincipalFactory.TryCreate( + token, + mode, + DeviceMismatchBehavior.Reject, + Device, + "UltimateAuth", + out var principal); + + success.Should().Be(expected); + + if (expected) + { + principal.Should().NotBeNull(); + principal!.Identity!.IsAuthenticated + .Should().BeTrue(); + } + else + { + principal.Should().BeNull(); + } + } + + [Fact] + public void SemiHybrid_DuplicateSid_IsRejected() + { + var token = CreateIdentity(true) with + { + Claims = + [ + new Claim("sub", "user-123"), + new Claim("tenant", "single"), + new Claim("sid", SessionId), + new Claim("sid", SessionId), + new Claim("device_id", Device.Value) + ] + }; + + var success = UAuthJwtPrincipalFactory.TryCreate( + token, + UAuthMode.SemiHybrid, + DeviceMismatchBehavior.Allow, + null, + "UltimateAuth", + out _); + + success.Should().BeFalse(); + } + + [Fact] + public void SemiHybrid_DeviceMismatch_IsRejected() + { + var success = UAuthJwtPrincipalFactory.TryCreate( + CreateIdentity(true), + UAuthMode.SemiHybrid, + DeviceMismatchBehavior.Reject, + DeviceId.Create("another-device-1234567890"), + "UltimateAuth", + out _); + + success.Should().BeFalse(); + } + + [Fact] + public void SemiHybrid_DoesNotRequireDeviceHeader_WhenAllowed() + { + var success = UAuthJwtPrincipalFactory.TryCreate( + CreateIdentity(true), + UAuthMode.SemiHybrid, + DeviceMismatchBehavior.Allow, + null, + "UltimateAuth", + out _); + + success.Should().BeTrue(); + } + + [Fact] + public void SemiHybrid_RejectsDeviceRebinding() + { + var success = UAuthJwtPrincipalFactory.TryCreate( + CreateIdentity(true), + UAuthMode.SemiHybrid, + DeviceMismatchBehavior.AllowAndRebind, + Device, + "UltimateAuth", + out _); + + success.Should().BeFalse(); + } + + private static ValidatedJwtIdentity CreateIdentity(bool includeSession) + { + var claims = new List + { + new("sub", "user-123"), + new("tenant", "single"), + new("device_id", Device.Value) + }; + + if (includeSession) + claims.Add(new Claim("sid", SessionId)); + + return new ValidatedJwtIdentity + { + Subject = "user-123", + TenantId = "single", + Issuer = "https://issuer.example.com", + Audience = "test-audience", + ExpiresAt = DateTimeOffset.UtcNow.AddMinutes(5), + Claims = claims + }; + } +} From daa0ea29f79c41642af2cf8b6c5cf551cd55776f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Tue, 1 Dec 2026 18:30:19 +0300 Subject: [PATCH 03/14] Refresh & Lineage Validation --- .../UAuthRefreshTokenValidator.cs | 3 + .../Abstractions/ISessionLineageValidator.cs | 9 ++ .../Extensions/ServiceCollectionExtensions.cs | 11 +- .../Services/RefreshFlowService.cs | 47 +------- .../Services/RefreshTokenRotationService.cs | 106 ++++++++++++++---- .../Services/SessionLineageValidator.cs | 95 ++++++++++++++++ .../Services/UAuthSessionValidator.cs | 75 +++---------- 7 files changed, 216 insertions(+), 130 deletions(-) create mode 100644 src/CodeBeam.UltimateAuth.Server/Abstractions/ISessionLineageValidator.cs create mode 100644 src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs diff --git a/src/CodeBeam.UltimateAuth.Core/Infrastructure/UAuthRefreshTokenValidator.cs b/src/CodeBeam.UltimateAuth.Core/Infrastructure/UAuthRefreshTokenValidator.cs index 67140f1f..afd62cdc 100644 --- a/src/CodeBeam.UltimateAuth.Core/Infrastructure/UAuthRefreshTokenValidator.cs +++ b/src/CodeBeam.UltimateAuth.Core/Infrastructure/UAuthRefreshTokenValidator.cs @@ -26,6 +26,9 @@ public async Task ValidateAsync(RefreshTokenValida if (stored is null) return RefreshTokenValidationResult.NotFound(); + if (stored.Tenant != context.Tenant) + return RefreshTokenValidationResult.Invalid(); + if (stored.IsExpired(context.Now)) return RefreshTokenValidationResult.Expired(stored); diff --git a/src/CodeBeam.UltimateAuth.Server/Abstractions/ISessionLineageValidator.cs b/src/CodeBeam.UltimateAuth.Server/Abstractions/ISessionLineageValidator.cs new file mode 100644 index 00000000..2ecd84f4 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Abstractions/ISessionLineageValidator.cs @@ -0,0 +1,9 @@ +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; + +namespace CodeBeam.UltimateAuth.Server.Abstractions; + +internal interface ISessionLineageValidator +{ + Task ValidateAsync(SessionValidationContext context, SessionCredentialPurpose expectedPurpose, CancellationToken ct = default); +} diff --git a/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs b/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs index 81ae5578..cbca9ae3 100644 --- a/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs @@ -292,6 +292,7 @@ private static IServiceCollection AddUltimateAuthServerInternal(this IServiceCol services.TryAddScoped(); services.TryAddScoped(); + services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); @@ -300,14 +301,10 @@ private static IServiceCollection AddUltimateAuthServerInternal(this IServiceCol services.TryAddSingleton>(sp => { - var serverOptions = - sp.GetRequiredService>().Value; - - var signingProvider = - sp.GetRequiredService(); + var serverOptions = sp.GetRequiredService>().Value; + var signingProvider = sp.GetRequiredService(); - var signingKey = signingProvider.Resolve( - serverOptions.Token.KeyId); + var signingKey = signingProvider.Resolve(serverOptions.Token.KeyId); return Microsoft.Extensions.Options.Options.Create( new UAuthJwtValidationOptions diff --git a/src/CodeBeam.UltimateAuth.Server/Services/RefreshFlowService.cs b/src/CodeBeam.UltimateAuth.Server/Services/RefreshFlowService.cs index 62597a33..830ffc37 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/RefreshFlowService.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/RefreshFlowService.cs @@ -32,15 +32,12 @@ public async Task RefreshAsync(AuthFlowContext flow, RefreshF UAuthMode.PureOpaque => await HandleSessionOnlyAsync(flow, request, ct), - UAuthMode.PureJwt => + UAuthMode.PureJwt or UAuthMode.SemiHybrid => await HandleTokenOnlyAsync(flow, request, ct), UAuthMode.Hybrid => await HandleHybridAsync(flow, request, ct), - UAuthMode.SemiHybrid => - await HandleSemiHybridAsync(flow, request, ct), - _ => RefreshFlowResult.ReauthRequired() }; } @@ -164,46 +161,4 @@ private async Task HandleHybridAsync(AuthFlowContext flow, Re accessToken: rotation.Result.AccessToken, refreshToken: rotation.Result.RefreshToken); } - - private async Task HandleSemiHybridAsync(AuthFlowContext flow, RefreshFlowRequest request, CancellationToken ct) - { - if (request.SessionId is null || string.IsNullOrWhiteSpace(request.RefreshToken)) - return RefreshFlowResult.ReauthRequired(); - - var now = _clock.UtcNow; - - var validation = await _sessionValidator.ValidateSessionAsync( - new SessionValidationContext - { - Tenant = flow.Tenant, - SessionId = request.SessionId.Value, - Now = now, - Device = request.Device, - SessionOptions = flow.Options.Session - }, - ct); - - if (!validation.IsValid) - return RefreshFlowResult.ReauthRequired(); - - var rotation = await _tokenRotation.RotateAsync( - flow, - new RefreshTokenRotationContext - { - RefreshToken = request.RefreshToken!, - Now = now, - Device = request.Device, - ExpectedSessionId = request.SessionId.Value - }, - ct); - - if (!rotation.Result.IsSuccess) - return RefreshFlowResult.ReauthRequired(); - - return RefreshFlowResult.Success( - outcome: RefreshOutcome.Rotated, - sessionId: request.SessionId.Value, - accessToken: rotation.Result.AccessToken, - refreshToken: rotation.Result.RefreshToken); - } } diff --git a/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs b/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs index 2c326267..c3a67cf2 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs @@ -10,7 +10,7 @@ namespace CodeBeam.UltimateAuth.Server.Services; -public sealed class RefreshTokenRotationService : IRefreshTokenRotationService +internal sealed class RefreshTokenRotationService : IRefreshTokenRotationService { private readonly IRefreshTokenValidator _validator; private readonly IRefreshTokenStoreFactory _storeFactory; @@ -18,9 +18,10 @@ public sealed class RefreshTokenRotationService : IRefreshTokenRotationService private readonly IUserClaimsProvider _claimsProvider; private readonly IPrimaryUserIdentifierProvider _primaryIdentifiers; private readonly IUserProfileSnapshotProvider _userProfiles; + private readonly ISessionLineageValidator _lineageValidator; - public RefreshTokenRotationService(IRefreshTokenValidator validator, IRefreshTokenStoreFactory storeFactory, ITokenIssuer tokenIssuer, IUserClaimsProvider claimsProvider, IPrimaryUserIdentifierProvider primaryIdentifiers, IUserProfileSnapshotProvider userProfiles) + public RefreshTokenRotationService(IRefreshTokenValidator validator, IRefreshTokenStoreFactory storeFactory, ITokenIssuer tokenIssuer, IUserClaimsProvider claimsProvider, IPrimaryUserIdentifierProvider primaryIdentifiers, IUserProfileSnapshotProvider userProfiles, ISessionLineageValidator lineageValidator) { _validator = validator; _storeFactory = storeFactory; @@ -28,6 +29,7 @@ public RefreshTokenRotationService(IRefreshTokenValidator validator, IRefreshTok _claimsProvider = claimsProvider; _primaryIdentifiers = primaryIdentifiers; _userProfiles = userProfiles; + _lineageValidator = lineageValidator; } // TODO: Handle reuse detection and make flow knows situation, but don't make security branch. @@ -70,23 +72,18 @@ validation.UserKey is not UserKey userKey || var isPureJwt = flow.EffectiveMode == UAuthMode.PureJwt; - // Enforce mode-specific refresh token structure. - if (isPureJwt) - { - if (validation.SessionId is not null || - validation.SessionChainId is not null || - validation.DeviceId is null) - { - return Failed(); - } - } - else if (validation.SessionId is null) + if (validation.Tenant != flow.Tenant) + return Failed(); + + if (validation.RefreshChainId is not { } refreshChainId || refreshChainId.Value == Guid.Empty) { return Failed(); } - if (validation.RefreshChainId is not { } refreshChainId || refreshChainId.Value == Guid.Empty) + if (!await ValidateModeBindingAsync(flow, context, validation, ct)) + { return Failed(); + } var store = _storeFactory.Create(validation.Tenant); @@ -98,10 +95,7 @@ validation.SessionChainId is not null || var tokenContext = new TokenIssuanceContext { - Tenant = flow.Options.MultiTenant.Enabled - ? validation.Tenant - : TenantKey.Single, - + Tenant = validation.Tenant, UserKey = userKey, SessionId = validation.SessionId, SessionChainId = validation.SessionChainId, @@ -123,8 +117,32 @@ validation.SessionChainId is not null || var accessToken = await _tokenIssuer.IssueAccessTokenAsync(flow, tokenContext, ct); - // Consume the old token and persist its replacement - // within the same store execution scope. + if (flow.EffectiveMode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) + { + if (accessToken.Format != TokenFormat.Jwt) + { + throw new InvalidOperationException("JWT authentication modes must issue JWT access tokens."); + } + } + + if (validation.State == RefreshTokenValidationState.Consumed) + { + if (validation.Tenant != flow.Tenant || !await ValidateModeBindingAsync(flow, context, validation, ct)) + { + return Failed(); + } + + var window = flow.Options.Token.RefreshTokenConcurrentRequestWindow; + + if (!IsLikelyConcurrentRequest(validation, context.Now, window)) + { + await HandleReplayAsync(validation, context.Now, ct); + } + + return Failed(); + } + + // Consume the old token and persist its replacement within the same store execution scope. var consumed = await store.ExecuteAsync( async transactionCt => { @@ -204,6 +222,54 @@ await store.ExecuteAsync( ct); } + private async Task ValidateModeBindingAsync(AuthFlowContext flow, RefreshTokenRotationContext context, RefreshTokenValidationResult validation, CancellationToken ct) + { + switch (flow.EffectiveMode) + { + case UAuthMode.PureJwt: + return validation.SessionId is null && + validation.SessionChainId is null && + validation.DeviceId is not null; + + case UAuthMode.Hybrid: + return validation.SessionId is not null && context.ExpectedSessionId == validation.SessionId; + + case UAuthMode.SemiHybrid: + if (validation.SessionId is not AuthSessionId sessionId || + validation.SessionChainId is not SessionChainId chainId || + validation.UserKey is not UserKey userKey || + validation.DeviceId is not DeviceId deviceId) + { + return false; + } + + if (context.Device.DeviceId != deviceId) + return false; + + var lineage = await _lineageValidator.ValidateAsync( + new SessionValidationContext + { + Tenant = flow.Tenant, + SessionId = sessionId, + Now = context.Now, + Device = context.Device, + SessionOptions = flow.Options.Session + }, + SessionCredentialPurpose.MetadataOnly, + ct); + + return lineage.IsValid && + lineage.Tenant == flow.Tenant && + lineage.UserKey == userKey && + lineage.SessionId == sessionId && + lineage.ChainId == chainId && + lineage.BoundDeviceId == deviceId; + + default: + return false; + } + } + private static bool IsLikelyConcurrentRequest(RefreshTokenValidationResult validation, DateTimeOffset now, TimeSpan window) { if (validation.State != RefreshTokenValidationState.Consumed) diff --git a/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs b/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs new file mode 100644 index 00000000..9a51646a --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs @@ -0,0 +1,95 @@ +using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.Abstractions; + +namespace CodeBeam.UltimateAuth.Server.Services; + +internal sealed class SessionLineageValidator : ISessionLineageValidator +{ + private readonly ISessionStoreFactory _storeFactory; + + public SessionLineageValidator(ISessionStoreFactory storeFactory) + { + _storeFactory = storeFactory; + } + + public async Task ValidateAsync(SessionValidationContext context, SessionCredentialPurpose expectedPurpose, CancellationToken ct = default) + { + var options = context.SessionOptions + ?? throw new InvalidOperationException("Session options are required for lineage validation."); + + var store = _storeFactory.Create(context.Tenant); + + var session = await store.GetSessionAsync(context.SessionId, ct); + + if (session is null || session.CredentialPurpose != expectedPurpose) + { + return SessionValidationResult.Invalid(SessionState.NotFound, sessionId: context.SessionId); + } + + if (session.Tenant != context.Tenant || session.SessionId != context.SessionId) + { + return SessionValidationResult.Invalid(SessionState.SecurityMismatch); + } + + var state = session.GetState(context.Now); + + if (state != SessionState.Active) + { + return SessionValidationResult.Invalid(state, session.UserKey, session.SessionId, session.ChainId); + } + + var chain = await store.GetChainAsync(session.ChainId, ct); + + if (chain is null || chain.IsRevoked) + { + return SessionValidationResult.Invalid(SessionState.Revoked, session.UserKey, session.SessionId, session.ChainId); + } + + var chainState = chain.GetState(context.Now, options.IdleTimeout); + + if (chainState != SessionState.Active) + { + return SessionValidationResult.Invalid(chainState, session.UserKey, session.SessionId, session.ChainId); + } + + if (chain.ChainId != session.ChainId || chain.Tenant != context.Tenant || chain.UserKey != session.UserKey) + { + return SessionValidationResult.Invalid(SessionState.SecurityMismatch); + } + + var root = await store.GetActiveRootByUserAsync(session.UserKey, ct); + + if (root is null || root.IsRevoked) + { + return SessionValidationResult.Invalid(SessionState.Revoked); + } + + if (root.RootId != chain.RootId || + root.Tenant != context.Tenant || + root.UserKey != session.UserKey || + root.SecurityVersion != session.SecurityVersionAtCreation) + { + return SessionValidationResult.Invalid(SessionState.SecurityMismatch); + } + + var deviceMismatch = + !chain.Device.HasDeviceId || + !context.Device.HasDeviceId || + !Equals(chain.Device.DeviceId, context.Device.DeviceId); + + var requireDeviceMatch = + expectedPurpose == SessionCredentialPurpose.MetadataOnly || + options.DeviceMismatchBehavior == DeviceMismatchBehavior.Reject; + + // TODO: Implement device mismatch behavior based on options, e.g., allow, reject or rebind. + if (deviceMismatch && requireDeviceMatch) + { + return SessionValidationResult.Invalid(SessionState.DeviceMismatch, session.UserKey, session.SessionId, chain.ChainId, root.RootId); + } + + return SessionValidationResult.Active(context.Tenant, session.UserKey, session.SessionId, chain.ChainId, root.RootId, + ClaimsSnapshot.Empty, session.CreatedAt, chain.Device.DeviceId); + } +} diff --git a/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs b/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs index d9033689..fc3cb6dd 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/UAuthSessionValidator.cs @@ -1,78 +1,39 @@ using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.Abstractions; namespace CodeBeam.UltimateAuth.Server.Services; internal sealed class UAuthSessionValidator : ISessionValidator { - private readonly ISessionStoreFactory _storeFactory; + private readonly ISessionLineageValidator _lineageValidator; private readonly IUserClaimsProvider _claimsProvider; - public UAuthSessionValidator(ISessionStoreFactory storeFactory, IUserClaimsProvider claimsProvider) + public UAuthSessionValidator(ISessionLineageValidator lineageValidator, IUserClaimsProvider claimsProvider) { - _storeFactory = storeFactory; + _lineageValidator = lineageValidator; _claimsProvider = claimsProvider; } - // Validate runs before AuthFlowContext is set, do not call _authFlow here. - - // TODO: Add GetSessionAggregate store method to 1 call instead of 3 calls of root chain session public async Task ValidateSessionAsync(SessionValidationContext context, CancellationToken ct = default) { - var options = context.SessionOptions ?? throw new InvalidOperationException("Session options are required for local session validation."); - - var kernel = _storeFactory.Create(context.Tenant); - var session = await kernel.GetSessionAsync(context.SessionId, ct); - - if (session is null) - return SessionValidationResult.Invalid(SessionState.NotFound, sessionId: context.SessionId); - - // Metadata-only identifiers are not opaque credentials. - if (!session.IsOpaqueCredential) - return SessionValidationResult.Invalid(SessionState.NotFound, sessionId: context.SessionId); - - var state = session.GetState(context.Now); - if (state != SessionState.Active) - return SessionValidationResult.Invalid(state, session.UserKey, session.SessionId, session.ChainId); - - var chain = await kernel.GetChainAsync(session.ChainId, ct); - if (chain is null || chain.IsRevoked) - return SessionValidationResult.Invalid(SessionState.Revoked, session.UserKey, session.SessionId, session.ChainId); - - var chainState = chain.GetState(context.Now, options.IdleTimeout); - if (chainState != SessionState.Active) - return SessionValidationResult.Invalid(chainState, chain.UserKey, session.SessionId, chain.ChainId); - - //if (chain.ActiveSessionId != session.SessionId) - // return SessionValidationResult.Invalid(SessionState.SecurityMismatch, chain.UserKey, session.SessionId, chain.ChainId); - - if (chain.ChainId != session.ChainId) - return SessionValidationResult.Invalid(SessionState.SecurityMismatch, chain.UserKey, session.SessionId, chain.ChainId); - - if (chain.Tenant != context.Tenant) - return SessionValidationResult.Invalid(SessionState.SecurityMismatch, chain.UserKey, session.SessionId, chain.ChainId); - - var root = await kernel.GetActiveRootByUserAsync(session.UserKey, ct); - if (root is null || root.IsRevoked) - return SessionValidationResult.Invalid(SessionState.Revoked, chain.UserKey, session.SessionId, chain.ChainId, root?.RootId); - - if (chain.RootId != root.RootId) - return SessionValidationResult.Invalid(SessionState.SecurityMismatch, chain.UserKey, session.SessionId, chain.ChainId, root.RootId); - - if (session.SecurityVersionAtCreation != root.SecurityVersion) - return SessionValidationResult.Invalid(SessionState.SecurityMismatch, session.UserKey, session.SessionId, session.ChainId, root.RootId); - - // TODO: Implement device mismatch behavior based on options, e.g., allow, reject or rebind. - var deviceMismatch = !chain.Device.HasDeviceId || !context.Device.HasDeviceId || !Equals(chain.Device.DeviceId, context.Device.DeviceId); - - if (deviceMismatch && options.DeviceMismatchBehavior == DeviceMismatchBehavior.Reject) + var result = await _lineageValidator.ValidateAsync(context, SessionCredentialPurpose.Opaque, ct); + + if (!result.IsValid || + result.UserKey is not UserKey userKey || + result.SessionId is not AuthSessionId sessionId || + result.ChainId is not SessionChainId chainId || + result.RootId is not SessionRootId rootId || + result.AuthenticatedAt is not DateTimeOffset authenticatedAt) { - return SessionValidationResult.Invalid(SessionState.DeviceMismatch, chain.UserKey, session.SessionId, chain.ChainId, root.RootId); + return result.IsValid + ? SessionValidationResult.Invalid(SessionState.Invalid) + : result; } - var claims = await _claimsProvider.GetClaimsAsync(context.Tenant, session.UserKey, ct); - return SessionValidationResult.Active(context.Tenant, session.UserKey, session.SessionId, session.ChainId, root.RootId, claims, session.CreatedAt, chain.Device.DeviceId); + var claims = await _claimsProvider.GetClaimsAsync(context.Tenant, userKey, ct); + + return SessionValidationResult.Active(context.Tenant, userKey, sessionId, chainId, rootId, claims, authenticatedAt, result.BoundDeviceId, result.UserStatus); } } From e32bc0b508073f397aefc444a68aed7f944a335c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Tue, 1 Dec 2026 20:04:18 +0300 Subject: [PATCH 04/14] Options Refactoring --- .../Options/UAuthSessionOptions.cs | 99 +++++-------------- .../Options/UAuthTokenOptions.cs | 43 ++++---- .../Issuers/UAuthTokenIssuer.cs | 10 +- .../Options/Defaults/ConfigureDefaults.cs | 28 +----- .../Options/UAuthServerOptions.cs | 15 +-- 5 files changed, 63 insertions(+), 132 deletions(-) rename src/{CodeBeam.UltimateAuth.Server => CodeBeam.UltimateAuth.Core}/Options/UAuthTokenOptions.cs (71%) diff --git a/src/CodeBeam.UltimateAuth.Core/Options/UAuthSessionOptions.cs b/src/CodeBeam.UltimateAuth.Core/Options/UAuthSessionOptions.cs index 1514da03..aeb8d2a8 100644 --- a/src/CodeBeam.UltimateAuth.Core/Options/UAuthSessionOptions.cs +++ b/src/CodeBeam.UltimateAuth.Core/Options/UAuthSessionOptions.cs @@ -4,7 +4,6 @@ namespace CodeBeam.UltimateAuth.Core.Options; // TODO: Add rotate on refresh (especially for Hybrid). Default behavior should be single session in chain for Hybrid, but can be configured. // And add RotateAsync method. -// Implement all options. /// /// Defines configuration settings that control the lifecycle, security behavior, and device constraints of UltimateAuth @@ -14,10 +13,7 @@ namespace CodeBeam.UltimateAuth.Core.Options; /// public sealed class UAuthSessionOptions { - /// - /// The standard lifetime of a session before it expires. - /// This is the duration added during login or refresh. - /// + [Obsolete("Use Token.SessionIdLifetime instead. This property has no effect and will be removed in a future version.")] public TimeSpan Lifetime { get; set; } = TimeSpan.FromDays(7); /// @@ -40,82 +36,42 @@ public sealed class UAuthSessionOptions /// public TimeSpan? IdleTimeout { get; set; } + // TODO: Implement this option on PureJwt mode. /// /// Minimum interval between LastSeenAt updates. /// Prevents excessive writes under high traffic. /// public TimeSpan? TouchInterval { get; set; } = TimeSpan.FromMinutes(5); - /// - /// Maximum number of device session chains a single user may have. - /// Set to zero to indicate no user-level chain limit. - /// - /// NOTE: - /// Enforcement is not active in v0.0.1. - /// This option is reserved for future security policies. - /// - public int MaxChainsPerUser { get; set; } = 0; - /// /// Maximum number of session rotations within a single chain. /// Used for cleanup, replay protection, and analytics. /// public int MaxSessionsPerChain { get; set; } = 100; - /// - /// Optional limit on the number of session chains allowed per platform - /// (e.g. "web" = 1, "mobile" = 1). - /// - /// NOTE: - /// Enforcement is not active in v0.0.1. - /// This option is reserved for future security policies. - /// - public Dictionary? MaxChainsPerPlatform { get; set; } - - /// - /// Defines platform categories that map multiple platforms - /// into a single abstract group (e.g. mobile: [ "ios", "android", "tablet" ]). - /// - /// NOTE: - /// Enforcement is not active in v0.0.1. - /// This option is reserved for future security policies. - /// - public Dictionary? PlatformCategories { get; set; } - - /// - /// Limits how many session chains can exist per platform category - /// (e.g. mobile = 1, desktop = 2). - /// - /// NOTE: - /// Enforcement is not active in v0.0.1. - /// This option is reserved for future security policies. - /// - public Dictionary? MaxChainsPerCategory { get; set; } - - /// - /// Enables binding sessions to the user's IP address. - /// When enabled, IP mismatches can invalidate a session. - /// - /// NOTE: - /// Enforcement is not active in v0.0.1. - /// This option is reserved for future security policies. - /// - public bool EnableIpBinding { get; set; } = false; - - /// - /// Enables binding sessions to the user's User-Agent header. - /// When enabled, UA mismatches can invalidate a session. - /// - /// NOTE: - /// Enforcement is not active in v0.0.1. - /// This option is reserved for future security policies. - /// - public bool EnableUserAgentBinding { get; set; } = false; + // TODO: Implement these. + ///// + ///// Enables binding sessions to the user's IP address. + ///// When enabled, IP mismatches can invalidate a session. + ///// + ///// NOTE: + ///// Enforcement is not active in v0.0.1. + ///// This option is reserved for future security policies. + ///// + //public bool EnableIpBinding { get; set; } = false; + + ///// + ///// Enables binding sessions to the user's User-Agent header. + ///// When enabled, UA mismatches can invalidate a session. + ///// + ///// NOTE: + ///// Enforcement is not active in v0.0.1. + ///// This option is reserved for future security policies. + ///// + //public bool EnableUserAgentBinding { get; set; } = false; /// - /// NOTE: - /// Enforcement is not active in v0.0.1. - /// This option is reserved for future security policies. + /// Gets or sets the behavior when an authentication session is used by a mismatched device. /// public DeviceMismatchBehavior DeviceMismatchBehavior { get; set; } = DeviceMismatchBehavior.Reject; @@ -123,16 +79,11 @@ public sealed class UAuthSessionOptions { SlidingExpiration = SlidingExpiration, IdleTimeout = IdleTimeout, - Lifetime = Lifetime, MaxLifetime = MaxLifetime, TouchInterval = TouchInterval, DeviceMismatchBehavior = DeviceMismatchBehavior, - MaxChainsPerUser = MaxChainsPerUser, MaxSessionsPerChain = MaxSessionsPerChain, - MaxChainsPerPlatform = MaxChainsPerPlatform is null ? null : new Dictionary(MaxChainsPerPlatform), - MaxChainsPerCategory = MaxChainsPerCategory is null ? null : new Dictionary(MaxChainsPerCategory), - PlatformCategories = PlatformCategories is null ? null : PlatformCategories.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.ToArray()), - EnableIpBinding = EnableIpBinding, - EnableUserAgentBinding = EnableUserAgentBinding + //EnableIpBinding = EnableIpBinding, + //EnableUserAgentBinding = EnableUserAgentBinding }; } diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthTokenOptions.cs b/src/CodeBeam.UltimateAuth.Core/Options/UAuthTokenOptions.cs similarity index 71% rename from src/CodeBeam.UltimateAuth.Server/Options/UAuthTokenOptions.cs rename to src/CodeBeam.UltimateAuth.Core/Options/UAuthTokenOptions.cs index 84b5e583..c6545ec2 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthTokenOptions.cs +++ b/src/CodeBeam.UltimateAuth.Core/Options/UAuthTokenOptions.cs @@ -1,4 +1,4 @@ -namespace CodeBeam.UltimateAuth.Server.Options; +namespace CodeBeam.UltimateAuth.Core.Options; /// /// Configuration settings for access and refresh token behavior @@ -7,28 +7,39 @@ /// public sealed class UAuthTokenOptions { - /// - /// Determines whether JWT-format access tokens should be issued. - /// Recommended for APIs that rely on claims-based authorization. - /// + [Obsolete("Credential format is determined by the authentication mode.")] public bool IssueJwt { get; set; } = true; - /// - /// Determines whether opaque tokens (session-id based) should be issued. - /// Useful for high-security APIs where token introspection is required. - /// + [Obsolete("Credential format is determined by the authentication mode.")] public bool IssueOpaque { get; set; } = true; - public bool IssueRefresh { get; set; } = true; + [Obsolete("Use IssueRefreshToken instead.")] + public bool IssueRefresh + { + get => IssueRefreshToken; + set => IssueRefreshToken = value; + } + + [Obsolete("JWT ID claims are generated automatically.")] + public bool AddJwtIdClaim { get; set; } = true; + + public bool IssueRefreshToken { get; set; } = true; + + /// + /// Lifetime of a session identified by a session ID. + /// Applies to both opaque and metadata-only sessions. Has no effect on PureJwt mode, which does not use session IDs. + /// + public TimeSpan SessionIdLifetime { get; set; } = TimeSpan.FromDays(7); /// /// Lifetime of access tokens (JWT or opaque). - /// Short lifetimes improve security but require more frequent refreshes. + /// Short lifetimes improve security but require more frequent refreshes. Has no effect on PureOpaque mode, which uses session id instead of access tokens. /// public TimeSpan AccessTokenLifetime { get; set; } = TimeSpan.FromMinutes(10); /// /// Lifetime of refresh tokens, used in PKCE or session rotation flows. + /// Has no effect on PureOpaque mode, which does not use refresh tokens. /// public TimeSpan RefreshTokenLifetime { get; set; } = TimeSpan.FromDays(7); @@ -58,12 +69,6 @@ public sealed class UAuthTokenOptions /// public string Audience { get; set; } = "UAuthClient"; - /// - /// If true, adds a unique 'jti' (JWT ID) claim to each issued JWT. - /// Useful for token replay detection and advanced auditing. - /// - public bool AddJwtIdClaim { get; set; } = false; - /// /// Optional key identifier to select signing key. /// If null, default key will be used. @@ -72,15 +77,11 @@ public sealed class UAuthTokenOptions internal UAuthTokenOptions Clone() => new() { - IssueOpaque = IssueOpaque, - IssueJwt = IssueJwt, - IssueRefresh = IssueRefresh, AccessTokenLifetime = AccessTokenLifetime, RefreshTokenLifetime = RefreshTokenLifetime, OpaqueIdBytes = OpaqueIdBytes, Issuer = Issuer, Audience = Audience, - AddJwtIdClaim = AddJwtIdClaim, KeyId = KeyId, RefreshTokenConcurrentRequestWindow = RefreshTokenConcurrentRequestWindow }; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthTokenIssuer.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthTokenIssuer.cs index 76266da5..b777a553 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthTokenIssuer.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthTokenIssuer.cs @@ -2,9 +2,9 @@ using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; -using CodeBeam.UltimateAuth.Server.Options; namespace CodeBeam.UltimateAuth.Server.Infrastructure; @@ -67,7 +67,7 @@ context.SessionChainId is null && public async Task IssueRefreshTokenAsync(AuthFlowContext flow, TokenIssuanceContext context, RefreshTokenPersistence persistence, CancellationToken ct = default) { - if (flow.EffectiveMode == UAuthMode.PureOpaque || !flow.Options.Token.IssueRefresh) + if (flow.EffectiveMode == UAuthMode.PureOpaque || !flow.Options.Token.IssueRefreshToken) { return null; } @@ -172,8 +172,7 @@ UAuthJwtProfileClaims.AuthenticatedAt or : values.ToArray(); } - // UltimateAuth-owned identity/security claims must never be overridable - // by caller-provided claims. + // UltimateAuth-owned identity/security claims must never be overridable by caller-provided claims. claims["sub"] = context.UserKey.Value; claims["tenant"] = context.Tenant.Value; @@ -211,8 +210,7 @@ UAuthJwtProfileClaims.AuthenticatedAt or else claims.Remove("sid"); - if (tokens.AddJwtIdClaim) - claims["jti"] = _opaqueGenerator.GenerateJwtId(); + claims["jti"] = _opaqueGenerator.GenerateJwtId(); var descriptor = new UAuthJwtTokenDescriptor { diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs b/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs index 53d9ec03..d6c07c4f 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs @@ -38,12 +38,9 @@ private static void ApplyPureOpaqueDefaults(UAuthServerOptions options) session.IdleTimeout ??= TimeSpan.FromDays(7); session.TouchInterval ??= TimeSpan.FromDays(1); - session.MaxLifetime ??= null; - token.IssueJwt = false; - token.IssueOpaque = false; - token.IssueRefresh = false; + token.IssueRefreshToken = false; cookie.Session.Lifetime.IdleBuffer = TimeSpan.FromDays(2); } @@ -54,11 +51,6 @@ private static void ApplyHybridDefaults(UAuthServerOptions options) var token = options.Token; var cookie = options.Cookie; - session.TouchInterval = null; - - token.IssueJwt = true; - token.IssueOpaque = true; - cookie.Session.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); cookie.RefreshToken.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); } @@ -69,13 +61,7 @@ private static void ApplySemiHybridDefaults(UAuthServerOptions options) var token = options.Token; var cookie = options.Cookie; - session.SlidingExpiration = false; - session.TouchInterval = null; - - token.IssueJwt = true; - token.IssueOpaque = false; - token.IssueRefresh = true; - token.AddJwtIdClaim = true; + token.IssueRefreshToken = true; cookie.AccessToken.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); cookie.RefreshToken.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); @@ -87,19 +73,11 @@ private static void ApplyPureJwtDefaults(UAuthServerOptions options) var token = options.Token; var cookie = options.Cookie; - // PureJwt does not use server-side sessions. - session.SlidingExpiration = false; session.TouchInterval = null; - session.IdleTimeout = null; - session.MaxLifetime = null; - token.IssueJwt = true; - token.IssueOpaque = false; - token.IssueRefresh = true; - token.AddJwtIdClaim = true; + token.IssueRefreshToken = true; cookie.AccessToken.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); - cookie.RefreshToken.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); } } diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs index 7f2e8b52..d6fd0c08 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs @@ -15,7 +15,6 @@ namespace CodeBeam.UltimateAuth.Server.Options; /// public sealed class UAuthServerOptions { - // ------------------------------------------------------- // CORE OPTION COMPOSITION // (Server must NOT duplicate Core options) @@ -26,6 +25,11 @@ public sealed class UAuthServerOptions /// public UAuthSessionOptions Session { get; set; } = new(); + /// + /// Token issuing behavior (lifetimes, refresh policies). + /// + public UAuthTokenOptions Token { get; set; } = new(); + /// /// Multi-tenancy behavior (resolver, normalization, etc.) Fully defined in Core. /// @@ -45,15 +49,14 @@ public sealed class UAuthServerOptions // SERVER-ONLY BEHAVIOR // ------------------------------------------------------- - public UAuthLoginOptions Login { get; set; } = new(); - /// - /// Token issuing behavior (lifetimes, refresh policies). + /// Gets or sets the server login options. /// - public UAuthTokenOptions Token { get; set; } = new(); + /// This property is used only in server-side authentication behavior. + public UAuthLoginOptions Login { get; set; } = new(); /// - /// PKCE configuration (required for WASM). + /// PKCE configuration (required for client applications like WASM). /// public UAuthPkceOptions Pkce { get; set; } = new(); From 461457afd9c137593c7de3afdef5f3d69a57a4d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Tue, 1 Dec 2026 21:07:44 +0300 Subject: [PATCH 05/14] Arrange New Options Design --- .../LabSessionDiagnosticsPolicyService.cs | 3 +- .../Session/SessionIssuanceContext.cs | 1 + .../Session/SessionRotationContext.cs | 1 + .../Contracts/Token/TokenIssuanceContext.cs | 1 + .../Flows/Login/LoginOrchestrator.cs | 8 +- .../Issuers/UAuthSessionIssuer.cs | 17 ++- .../Options/Defaults/ConfigureDefaults.cs | 6 - .../Validators/UAuthServerOptionsValidator.cs | 4 +- .../UAuthServerSessionOptionsValidator.cs | 22 ++-- .../UAuthServerTokenOptionsValidator.cs | 41 ++++--- .../Services/RefreshFlowService.cs | 4 +- .../Services/RefreshTokenRotationService.cs | 2 +- .../Services/SessionLineageValidator.cs | 19 ++- .../DeviceLimitPostgresTests.cs | 5 +- .../RefreshTests.cs | 8 +- .../SessionSlidingExpirationTests.cs | 8 +- .../EffectiveServerOptionsProviderTests.cs | 47 +------- .../Server/LoginOrchestratorTests.cs | 2 +- .../RefreshTokenRotationServiceTests.cs | 45 +++++-- .../Server/ServerOptionsValidatorTests.cs | 110 +++++++++--------- .../Server/UAuthSessionValidatorTests.cs | 8 +- .../Sessions/DeviceLimitAdmissionTests.cs | 7 +- .../Sessions/UAuthSessionIssuerTests.cs | 36 +++--- .../Tokens/UAuthTokenIssuerTests.cs | 23 ++-- 24 files changed, 212 insertions(+), 216 deletions(-) diff --git a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Services/LabSessionDiagnosticsPolicyService.cs b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Services/LabSessionDiagnosticsPolicyService.cs index 592fb970..ac9ce64b 100644 --- a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Services/LabSessionDiagnosticsPolicyService.cs +++ b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Services/LabSessionDiagnosticsPolicyService.cs @@ -25,10 +25,11 @@ public sealed class LabSessionDiagnosticsPolicyService(IOptions /// Optional chain identifier. diff --git a/src/CodeBeam.UltimateAuth.Core/Contracts/Session/SessionRotationContext.cs b/src/CodeBeam.UltimateAuth.Core/Contracts/Session/SessionRotationContext.cs index 9543328d..44b74831 100644 --- a/src/CodeBeam.UltimateAuth.Core/Contracts/Session/SessionRotationContext.cs +++ b/src/CodeBeam.UltimateAuth.Core/Contracts/Session/SessionRotationContext.cs @@ -15,4 +15,5 @@ public sealed record SessionRotationContext public required SessionMetadata Metadata { get; init; } = SessionMetadata.Empty; public required UAuthMode Mode { get; init; } public required UAuthSessionOptions SessionOptions { get; init; } + public required UAuthTokenOptions TokenOptions { get; init; } } diff --git a/src/CodeBeam.UltimateAuth.Core/Contracts/Token/TokenIssuanceContext.cs b/src/CodeBeam.UltimateAuth.Core/Contracts/Token/TokenIssuanceContext.cs index ec3da9f2..dbb3aed6 100644 --- a/src/CodeBeam.UltimateAuth.Core/Contracts/Token/TokenIssuanceContext.cs +++ b/src/CodeBeam.UltimateAuth.Core/Contracts/Token/TokenIssuanceContext.cs @@ -1,5 +1,6 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; +using CodeBeam.UltimateAuth.Core.Options; namespace CodeBeam.UltimateAuth.Core.Contracts; diff --git a/src/CodeBeam.UltimateAuth.Server/Flows/Login/LoginOrchestrator.cs b/src/CodeBeam.UltimateAuth.Server/Flows/Login/LoginOrchestrator.cs index 0801676d..c684d2ac 100644 --- a/src/CodeBeam.UltimateAuth.Server/Flows/Login/LoginOrchestrator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Flows/Login/LoginOrchestrator.cs @@ -12,7 +12,6 @@ using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Users; using CodeBeam.UltimateAuth.Users.Contracts; -using static System.Runtime.InteropServices.JavaScript.JSType; // TODO: Identifier-based throttling, Exponential lockout @@ -274,7 +273,7 @@ public async Task LoginAsync(AuthFlowContext flow, LoginRequest req PrimaryUserName = identifiers?.UserName, DisplayName = profile?.DisplayName, TimeZone = profile?.TimeZone, - AuthenticatedAt = now + AuthenticatedAt = now, }; var accessToken = await _tokens.IssueAccessTokenAsync(flow, tokenContext, ct); @@ -313,7 +312,8 @@ public async Task LoginAsync(AuthFlowContext flow, LoginRequest req ChainId = chainId, Metadata = SessionMetadata.Empty, Mode = flow.EffectiveMode, - SessionOptions = flow.Options.Session + SessionOptions = flow.Options.Session, + TokenOptions = flow.Options.Token }; var authContext = flow.ToAuthContext(now); @@ -354,7 +354,7 @@ public async Task LoginAsync(AuthFlowContext flow, LoginRequest req PrimaryUserName = identifiers?.UserName, DisplayName = profile?.DisplayName, TimeZone = profile?.TimeZone, - AuthenticatedAt = now + AuthenticatedAt = now, }; var accessToken = await _tokens.IssueAccessTokenAsync(flow, tokenContext, ct); diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs index 8e3b726b..800b8e04 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs @@ -67,7 +67,7 @@ UAuthMode.PureOpaque or UAuthMode.Hybrid ? now.Add(max) : (DateTimeOffset?)null; - var sessionExpiresAt = now.Add(sessionOptions.Lifetime); + var sessionExpiresAt = now.Add(context.TokenOptions.SessionIdLifetime); if (absoluteExpiresAt is { } absolute && sessionExpiresAt > absolute) sessionExpiresAt = absolute; @@ -268,14 +268,6 @@ public async Task RotateSessionAsync(SessionRotationContext conte if (!AuthSessionId.TryCreate(opaqueSessionId, out var newSessionId)) throw new InvalidCastException("Can't create opaque session id."); - var expiresAt = now.Add(sessionOptions.Lifetime); - if (sessionOptions.MaxLifetime is not null) - { - var absoluteExpiry = now.Add(sessionOptions.MaxLifetime.Value); - if (absoluteExpiry < expiresAt) - expiresAt = absoluteExpiry; - } - IssuedSession? issued = null; await kernel.ExecuteAsync(async _ => @@ -307,8 +299,13 @@ await kernel.ExecuteAsync(async _ => throw new SecurityException("Chain does not belong to the current user/tenant."); if (chain.RootId != root.RootId) - { throw new SecurityException("Chain does not belong to the active session root."); + + var expiresAt = now.Add(context.TokenOptions.SessionIdLifetime); + + if (chain.AbsoluteExpiresAt is { } absolute && expiresAt > absolute) + { + expiresAt = absolute; } var newSessionUnbound = UAuthSession.Create( diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs b/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs index d6c07c4f..0a7032a6 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs @@ -40,8 +40,6 @@ private static void ApplyPureOpaqueDefaults(UAuthServerOptions options) session.TouchInterval ??= TimeSpan.FromDays(1); session.MaxLifetime ??= null; - token.IssueRefreshToken = false; - cookie.Session.Lifetime.IdleBuffer = TimeSpan.FromDays(2); } @@ -61,8 +59,6 @@ private static void ApplySemiHybridDefaults(UAuthServerOptions options) var token = options.Token; var cookie = options.Cookie; - token.IssueRefreshToken = true; - cookie.AccessToken.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); cookie.RefreshToken.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); } @@ -75,8 +71,6 @@ private static void ApplyPureJwtDefaults(UAuthServerOptions options) session.TouchInterval = null; - token.IssueRefreshToken = true; - cookie.AccessToken.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); cookie.RefreshToken.Lifetime.IdleBuffer = TimeSpan.FromMinutes(5); } diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerOptionsValidator.cs index 2940b71f..54df44c6 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerOptionsValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerOptionsValidator.cs @@ -73,9 +73,9 @@ allowedModes is null || if (anySessionModeAllowed) { - if (options.Session.Lifetime <= TimeSpan.Zero) + if (options.Token.SessionIdLifetime <= TimeSpan.Zero) { - return ValidateOptionsResult.Fail("Session.Lifetime must be greater than zero."); + return ValidateOptionsResult.Fail("Token.SessionIdLifetime must be greater than zero."); } if (options.Session.MaxLifetime is { } maxLifetime) diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerSessionOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerSessionOptionsValidator.cs index 8b7baf0b..a328eeba 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerSessionOptionsValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerSessionOptionsValidator.cs @@ -8,28 +8,34 @@ public ValidateOptionsResult Validate(string? name, UAuthServerOptions options) { var errors = new List(); var session = options.Session; + var sessionLifetime = options.Token.SessionIdLifetime; - if (session.Lifetime <= TimeSpan.Zero) - errors.Add("Session.Lifetime must be greater than zero."); + if (sessionLifetime <= TimeSpan.Zero) + errors.Add("Token.SessionIdLifetime must be greater than zero."); if (session.MaxLifetime.HasValue && session.MaxLifetime <= TimeSpan.Zero) + { errors.Add("Session.MaxLifetime must be greater than zero when specified."); + } - if (session.MaxLifetime.HasValue && session.MaxLifetime < session.Lifetime) - errors.Add("Session.MaxLifetime must be greater than or equal to Session.Lifetime."); + if (session.MaxLifetime.HasValue && session.MaxLifetime < sessionLifetime) + { + errors.Add("Session.MaxLifetime must be greater than or equal to Token.SessionIdLifetime."); + } if (session.IdleTimeout.HasValue && session.IdleTimeout < TimeSpan.Zero) + { errors.Add("Session.IdleTimeout cannot be negative."); + } - if (options.Session.IdleTimeout is { } idle && options.Session.TouchInterval is { } touch && idle > TimeSpan.Zero && touch >= idle) + if (session.IdleTimeout is { } idle && session.TouchInterval is { } touch && idle > TimeSpan.Zero && touch >= idle) { errors.Add("Session.TouchInterval must be less than Session.IdleTimeout."); } - if (session.SlidingExpiration && session.TouchInterval is { } touchInterval && touchInterval >= session.Lifetime) + if (session.SlidingExpiration && session.TouchInterval is { } touchInterval && touchInterval >= sessionLifetime) { - errors.Add( - "Session.TouchInterval must be less than Session.Lifetime when SlidingExpiration is enabled."); + errors.Add("Session.TouchInterval must be less than Token.SessionIdLifetime when SlidingExpiration is enabled."); } return errors.Count == 0 diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerTokenOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerTokenOptionsValidator.cs index fe445470..b7ad2c5d 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerTokenOptionsValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerTokenOptionsValidator.cs @@ -9,42 +9,47 @@ public ValidateOptionsResult Validate(string? name, UAuthServerOptions options) var errors = new List(); var tokens = options.Token; - if (options.Token.RefreshTokenConcurrentRequestWindow < TimeSpan.Zero) + if (tokens.SessionIdLifetime <= TimeSpan.Zero) { - errors.Add("Token.RefreshTokenConcurrentRequestWindow cannot be negative."); + errors.Add("Token.SessionIdLifetime must be greater than zero."); } - if (!tokens.IssueJwt && !tokens.IssueOpaque) - errors.Add("Token: At least one of IssueJwt or IssueOpaque must be enabled."); - if (tokens.AccessTokenLifetime <= TimeSpan.Zero) + { errors.Add("Token.AccessTokenLifetime must be greater than zero."); + } - if (tokens.IssueRefresh) + if (tokens.RefreshTokenConcurrentRequestWindow < TimeSpan.Zero) + { + errors.Add("Token.RefreshTokenConcurrentRequestWindow cannot be negative."); + } + + if (tokens.IssueRefreshToken) { if (tokens.RefreshTokenLifetime <= TimeSpan.Zero) - errors.Add("Token.RefreshTokenLifetime must be greater than zero when IssueRefresh is enabled."); + { + errors.Add("Token.RefreshTokenLifetime must be greater than zero when refresh tokens are enabled."); + } if (tokens.RefreshTokenLifetime <= tokens.AccessTokenLifetime) + { errors.Add("Token.RefreshTokenLifetime must be greater than Token.AccessTokenLifetime."); + } } - if (tokens.IssueJwt) + if (string.IsNullOrWhiteSpace(tokens.Issuer) || tokens.Issuer.Trim().Length < 3) { - if (string.IsNullOrWhiteSpace(tokens.Issuer) || tokens.Issuer.Trim().Length < 3) - errors.Add("Token.Issuer must be at least 3 characters when IssueJwt is enabled."); - - if (string.IsNullOrWhiteSpace(tokens.Audience) || tokens.Audience.Trim().Length < 3) - errors.Add("Token.Audience must be at least 3 characters when IssueJwt is enabled."); + errors.Add("Token.Issuer must be at least 3 characters."); } - if (tokens.IssueOpaque) + if (string.IsNullOrWhiteSpace(tokens.Audience) || tokens.Audience.Trim().Length < 3) { - if (tokens.OpaqueIdBytes < 24) - errors.Add("Token.OpaqueIdBytes must be at least 24 bytes (192-bit entropy)."); + errors.Add("Token.Audience must be at least 3 characters."); + } - if (tokens.OpaqueIdBytes > 128) - errors.Add("Token.OpaqueIdBytes must not exceed 128 bytes."); + if (tokens.OpaqueIdBytes is < 24 or > 128) + { + errors.Add("Token.OpaqueIdBytes must be between 24 and 128 bytes."); } return errors.Count == 0 diff --git a/src/CodeBeam.UltimateAuth.Server/Services/RefreshFlowService.cs b/src/CodeBeam.UltimateAuth.Server/Services/RefreshFlowService.cs index 830ffc37..f7035dd7 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/RefreshFlowService.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/RefreshFlowService.cs @@ -66,7 +66,7 @@ private async Task HandleSessionOnlyAsync(AuthFlowContext flo var touchPolicy = new SessionTouchPolicy { TouchInterval = flow.Options.Session.TouchInterval, - Lifetime = flow.Options.Session.Lifetime, + Lifetime = flow.Options.Token.SessionIdLifetime, SlidingExpiration = flow.Options.Session.SlidingExpiration, IdleTimeout = flow.Options.Session.IdleTimeout }; @@ -129,7 +129,7 @@ private async Task HandleHybridAsync(AuthFlowContext flow, Re var touchPolicy = new SessionTouchPolicy { TouchInterval = flow.Options.Session.TouchInterval, - Lifetime = flow.Options.Session.Lifetime, + Lifetime = flow.Options.Token.SessionIdLifetime, SlidingExpiration = flow.Options.Session.SlidingExpiration, IdleTimeout = flow.Options.Session.IdleTimeout }; diff --git a/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs b/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs index c3a67cf2..7dbff855 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs @@ -35,7 +35,7 @@ public RefreshTokenRotationService(IRefreshTokenValidator validator, IRefreshTok // TODO: Handle reuse detection and make flow knows situation, but don't make security branch. public async Task RotateAsync(AuthFlowContext flow, RefreshTokenRotationContext context, CancellationToken ct = default) { - if (flow.EffectiveMode == UAuthMode.PureOpaque || !flow.Options.Token.IssueRefresh) + if (flow.EffectiveMode == UAuthMode.PureOpaque || !flow.Options.Token.IssueRefreshToken) { return Failed(); } diff --git a/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs b/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs index 9a51646a..8e956863 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs @@ -61,17 +61,32 @@ public async Task ValidateAsync(SessionValidationContex var root = await store.GetActiveRootByUserAsync(session.UserKey, ct); - if (root is null || root.IsRevoked) + if (root is null) { return SessionValidationResult.Invalid(SessionState.Revoked); } + if (root.IsRevoked) + { + return SessionValidationResult.Invalid( + SessionState.Revoked, + session.UserKey, + session.SessionId, + session.ChainId, + root.RootId); + } + if (root.RootId != chain.RootId || root.Tenant != context.Tenant || root.UserKey != session.UserKey || root.SecurityVersion != session.SecurityVersionAtCreation) { - return SessionValidationResult.Invalid(SessionState.SecurityMismatch); + return SessionValidationResult.Invalid( + SessionState.SecurityMismatch, + session.UserKey, + session.SessionId, + session.ChainId, + root.RootId); } var deviceMismatch = diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/DeviceLimitPostgresTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/DeviceLimitPostgresTests.cs index 4b4537fa..0f924939 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/DeviceLimitPostgresTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/DeviceLimitPostgresTests.cs @@ -189,8 +189,11 @@ private static async Task IssueAsync( Mode = UAuthMode.Hybrid, SessionOptions = new UAuthSessionOptions { - Lifetime = TimeSpan.FromHours(8), MaxSessionsPerChain = 20 + }, + TokenOptions = new UAuthTokenOptions + { + SessionIdLifetime = TimeSpan.FromHours(8) } }; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs index cbb3beb4..3d555f5c 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs @@ -1584,7 +1584,7 @@ public async Task Refresh_Hybrid_WhenSessionExpired_ShouldReturnUnauthorized() { await using var factory = AuthServerFactory.Create(options => { - options.Session.Lifetime = TimeSpan.FromMinutes(30); + options.Token.SessionIdLifetime = TimeSpan.FromMinutes(30); options.Session.MaxLifetime = TimeSpan.FromDays(7); options.Token.RefreshTokenLifetime = TimeSpan.FromDays(7); }); @@ -1629,7 +1629,7 @@ public async Task Refresh_Hybrid_WhenChainIdleTimeoutExceeded_ShouldReturnUnauth { await using var factory = AuthServerFactory.Create(options => { - options.Session.Lifetime = TimeSpan.FromDays(7); + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); options.Session.MaxLifetime = TimeSpan.FromDays(7); options.Session.IdleTimeout = TimeSpan.FromMinutes(30); options.Token.RefreshTokenLifetime = TimeSpan.FromDays(7); @@ -1674,7 +1674,7 @@ public async Task Refresh_Hybrid_JustBeforeChainIdleTimeout_ShouldSucceed() { await using var factory = AuthServerFactory.Create(options => { - options.Session.Lifetime = TimeSpan.FromDays(7); + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); options.Session.MaxLifetime = TimeSpan.FromDays(7); options.Session.IdleTimeout = TimeSpan.FromMinutes(30); options.Token.RefreshTokenLifetime = TimeSpan.FromDays(7); @@ -1720,7 +1720,7 @@ public async Task Refresh_Hybrid_AtChainIdleTimeout_ShouldReturnUnauthorized() { await using var factory = AuthServerFactory.Create(options => { - options.Session.Lifetime = TimeSpan.FromDays(7); + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); options.Session.MaxLifetime = TimeSpan.FromDays(7); options.Session.IdleTimeout = TimeSpan.FromMinutes(30); options.Token.RefreshTokenLifetime = TimeSpan.FromDays(7); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/SessionSlidingExpirationTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/SessionSlidingExpirationTests.cs index 89545c72..f340733a 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/SessionSlidingExpirationTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/SessionSlidingExpirationTests.cs @@ -126,7 +126,7 @@ public async Task IdentifierGet_ExpiredIdleSession_ShouldReturnUnauthorized(stri { using var factory = AuthServerFactory.Create(o => { - o.Session.Lifetime = TimeSpan.FromMinutes(5); + o.Token.SessionIdLifetime = TimeSpan.FromMinutes(5); o.Session.MaxLifetime = null; o.Session.IdleTimeout = TimeSpan.FromSeconds(10); o.Session.TouchInterval = TimeSpan.FromSeconds(5); @@ -420,7 +420,7 @@ public async Task ZeroIdleTimeout_RefreshShouldRemainValidBeforeSessionExpiry(st { await using var factory = AuthServerFactory.Create(o => { - o.Session.Lifetime = TimeSpan.FromHours(1); + o.Token.SessionIdLifetime = TimeSpan.FromHours(1); o.Session.MaxLifetime = null; o.Session.IdleTimeout = TimeSpan.Zero; o.Session.TouchInterval = TimeSpan.FromMinutes(5); @@ -442,7 +442,7 @@ private static AuthServerFactory CreateFactory(bool sliding, TimeSpan? maxLifeti { var factory = AuthServerFactory.Create(o => { - o.Session.Lifetime = TimeSpan.FromDays(4); + o.Token.SessionIdLifetime = TimeSpan.FromDays(4); o.Session.SlidingExpiration = sliding; o.Session.MaxLifetime = maxLifetime; o.Session.IdleTimeout = null; @@ -540,7 +540,7 @@ private static AuthServerFactory CreateIdleSlidingFactory() { var factory = AuthServerFactory.Create(o => { - o.Session.Lifetime = TimeSpan.FromHours(1); + o.Token.SessionIdLifetime = TimeSpan.FromHours(1); o.Session.MaxLifetime = null; o.Session.SlidingExpiration = true; o.Session.IdleTimeout = TimeSpan.FromMinutes(30); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs index 9e57fa33..a178f9a2 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs @@ -100,30 +100,6 @@ public void Effective_options_should_apply_defaults_for_each_auth_mode(UAuthMode effective.Options.Should().NotBeSameAs(original); } - [Fact] - public void SemiHybrid_should_apply_expected_session_defaults() - { - var original = new UAuthServerOptions - { - Session = - { - SlidingExpiration = true, - TouchInterval = TimeSpan.FromMinutes(5) - } - }; - - var provider = CreateProviderForMode(original, UAuthMode.SemiHybrid); - - var effective = provider.GetEffective(TenantKey.Single, UAuthApplicationProfile.BlazorServer); - - effective.Options.Session.SlidingExpiration.Should().BeFalse(); - effective.Options.Session.TouchInterval.Should().BeNull(); - - // The original configuration must remain unchanged. - original.Session.SlidingExpiration.Should().BeTrue(); - original.Session.TouchInterval.Should().Be(TimeSpan.FromMinutes(5)); - } - [Fact] public void SemiHybrid_should_apply_expected_token_defaults() { @@ -131,9 +107,6 @@ public void SemiHybrid_should_apply_expected_token_defaults() { Token = { - IssueJwt = false, - IssueOpaque = false, - AddJwtIdClaim = false, AccessTokenLifetime = TimeSpan.FromHours(1), RefreshTokenLifetime = TimeSpan.FromHours(2) } @@ -147,9 +120,6 @@ public void SemiHybrid_should_apply_expected_token_defaults() var token = effective.Options.Token; - token.IssueJwt.Should().BeTrue(); - token.IssueOpaque.Should().BeTrue(); - token.AddJwtIdClaim.Should().BeTrue(); token.AccessTokenLifetime.Should().Be(TimeSpan.FromHours(1)); token.RefreshTokenLifetime.Should().Be(TimeSpan.FromHours(2)); } @@ -193,12 +163,7 @@ public void PureOpaque_should_initialize_missing_optional_session_defaults() effective.Options.Session.IdleTimeout.Should().Be(TimeSpan.FromDays(7)); effective.Options.Session.TouchInterval.Should().Be(TimeSpan.FromDays(1)); effective.Options.Session.MaxLifetime.Should().BeNull(); - effective.Options.Session.DeviceMismatchBehavior - .Should().Be(DeviceMismatchBehavior.Reject); - - effective.Options.Token.IssueJwt.Should().BeFalse(); - effective.Options.Token.IssueOpaque.Should().BeFalse(); - effective.Options.Token.IssueRefresh.Should().BeFalse(); + effective.Options.Session.DeviceMismatchBehavior.Should().Be(DeviceMismatchBehavior.Reject); effective.Options.Cookie.Session.Lifetime.IdleBuffer .Should().Be(TimeSpan.FromDays(2)); @@ -245,10 +210,8 @@ public void Hybrid_should_apply_expected_defaults() var options = effective.Options; options.Session.SlidingExpiration.Should().BeTrue(); - options.Session.TouchInterval.Should().BeNull(); + options.Session.TouchInterval.Should().Be(TimeSpan.FromMinutes(5)); - options.Token.IssueJwt.Should().BeTrue(); - options.Token.IssueOpaque.Should().BeTrue(); options.Token.AccessTokenLifetime.Should().Be(TimeSpan.FromMinutes(10)); options.Token.RefreshTokenLifetime.Should().Be(TimeSpan.FromDays(7)); @@ -284,14 +247,8 @@ public void PureJwt_should_apply_stateless_defaults() var options = effective.Options; - options.Session.SlidingExpiration.Should().BeFalse(); - options.Session.IdleTimeout.Should().BeNull(); - options.Session.MaxLifetime.Should().BeNull(); options.Session.TouchInterval.Should().BeNull(); - options.Token.IssueJwt.Should().BeTrue(); - options.Token.IssueOpaque.Should().BeFalse(); - options.Token.AddJwtIdClaim.Should().BeTrue(); options.Token.AccessTokenLifetime.Should().Be(TimeSpan.FromMinutes(10)); options.Token.RefreshTokenLifetime.Should().Be(TimeSpan.FromDays(7)); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginOrchestratorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginOrchestratorTests.cs index 70b26d7b..5b01ee46 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginOrchestratorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginOrchestratorTests.cs @@ -940,7 +940,7 @@ public async Task PureJwt_commit_without_token_request_should_reject_early() TestContext.Current.CancellationToken); var exception = await act.Should().ThrowAsync(); - exception.Which.Code.Should().Be("pure_jwt_requires_token_delivery"); + exception.Which.Code.Should().Be("jwt_mode_requires_token_delivery"); } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenRotationServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenRotationServiceTests.cs index 4cab4673..ba39ef3e 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenRotationServiceTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenRotationServiceTests.cs @@ -4,11 +4,9 @@ using CodeBeam.UltimateAuth.Core.Contracts; 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.Infrastructure; -using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Server.Services; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; using CodeBeam.UltimateAuth.Users; @@ -464,7 +462,7 @@ public async Task RotateAsync_SingleTenant_UsesSingleTenantForIssuance() public async Task RotateAsync_RefreshDisabled_SkipsValidationAndStore() { var test = new Fixture(UAuthMode.PureJwt); - test.Flow.Options.Token.IssueRefresh = false; + test.Flow.Options.Token.IssueRefreshToken = false; AssertFailed(await test.RotateAsync()); test.Validator.VerifyNoOtherCalls(); @@ -518,6 +516,8 @@ private sealed class Fixture public Mock Claims { get; } = new(); public Mock Identifiers { get; } = new(); public Mock Profiles { get; } = new(); + public Mock LineageValidator { get; } = new(); + public AccessToken AccessToken { get; } = new() { Token = "access-token", @@ -536,7 +536,7 @@ public Fixture(UAuthMode mode, TenantKey? tenant = null, bool multiTenant = fals Tenant = tenant ?? TenantKey.Single; var options = TestServerOptions.Default(); options.MultiTenant.Enabled = multiTenant; - options.Token.IssueRefresh = true; + options.Token.IssueRefreshToken = true; Flow = new AuthFlowContext( flowType: AuthFlowType.RefreshSession, @@ -596,17 +596,43 @@ public RefreshToken CreateToken(bool? sessionFree = null) createdAt: AuthenticatedAt, expiresAt: Now.AddDays(7), refreshChainId: RefreshChainId.New(), - deviceId: noSession ? TestDevice.Default().DeviceId : null, + deviceId: noSession || Flow.EffectiveMode == UAuthMode.SemiHybrid + ? TestDevice.Default().DeviceId + : null, authenticatedAt: AuthenticatedAt); } public void Validate(RefreshToken token) - => SetValidation(RefreshTokenValidationResult.Valid(token, token.TokenHash)); + { + SetValidation( + RefreshTokenValidationResult.Valid(token, token.TokenHash)); + + if (Flow.EffectiveMode == UAuthMode.SemiHybrid && + token.SessionId is AuthSessionId sessionId && + token.SessionChainId is SessionChainId chainId) + { + LineageValidator + .Setup(x => x.ValidateAsync( + It.Is(c => + c.Tenant == Tenant && + c.SessionId == sessionId), + SessionCredentialPurpose.MetadataOnly, + It.IsAny())) + .ReturnsAsync(SessionValidationResult.Active( + Tenant, + User, + sessionId, + chainId, + SessionRootId.New(), + ClaimsSnapshot.Empty, + AuthenticatedAt, + token.DeviceId)); + } + } public void SetValidation(RefreshTokenValidationResult validation) { - Validator.Setup(x => x.ValidateAsync( - It.IsAny(), It.IsAny())) + Validator.Setup(x => x.ValidateAsync(It.IsAny(), It.IsAny())) .ReturnsAsync(validation); } @@ -658,7 +684,8 @@ public Task RotateAsync(AuthSessionId? expectedSe Issuer.Object, Claims.Object, Identifiers.Object, - Profiles.Object); + Profiles.Object, + LineageValidator.Object); return service.RotateAsync( Flow, diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ServerOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ServerOptionsValidatorTests.cs index b87a4575..58ac6440 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ServerOptionsValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ServerOptionsValidatorTests.cs @@ -1,7 +1,6 @@ using AwesomeAssertions; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Extensions; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Options; using Microsoft.Extensions.Configuration; @@ -53,7 +52,7 @@ public void Valid_server_session_options_should_pass() services.AddUltimateAuthServer(o => { - o.Session.Lifetime = TimeSpan.FromMinutes(30); + o.Token.SessionIdLifetime = TimeSpan.FromMinutes(30); o.Session.IdleTimeout = TimeSpan.FromMinutes(10); o.Cryptography.JwtSigningKey = @@ -66,16 +65,10 @@ public void Valid_server_session_options_should_pass() services.AddOptions().ValidateOnStart(); using var provider = services.BuildServiceProvider(); + var options = provider.GetRequiredService>().Value; - var options = provider - .GetRequiredService>() - .Value; - - options.Session.Lifetime.Should() - .Be(TimeSpan.FromMinutes(30)); - - options.Session.IdleTimeout.Should() - .Be(TimeSpan.FromMinutes(10)); + options.Token.SessionIdLifetime.Should().Be(TimeSpan.FromMinutes(30)); + options.Session.IdleTimeout.Should().Be(TimeSpan.FromMinutes(10)); } [Fact] @@ -87,7 +80,6 @@ public void Server_token_options_with_small_opaque_id_should_fail() services.AddUltimateAuth(); services.AddUltimateAuthServer(o => { - o.Token.IssueOpaque = true; o.Token.OpaqueIdBytes = 8; }); @@ -112,8 +104,6 @@ public void Valid_server_token_options_should_pass() services.AddUltimateAuth(); services.AddUltimateAuthServer(o => { - o.Token.IssueJwt = true; - o.Token.IssueOpaque = true; o.Token.AccessTokenLifetime = TimeSpan.FromMinutes(5); o.Token.RefreshTokenLifetime = TimeSpan.FromDays(1); o.Token.OpaqueIdBytes = 32; @@ -551,8 +541,8 @@ public void Pkce_positive_authorization_lifetime_passes() => [InlineData(0)] [InlineData(-1)] public void Session_nonpositive_lifetime_fails(int ticks) => - ShouldReject(o => o.Session.Lifetime = TimeSpan.FromTicks(ticks), - "Session.Lifetime"); + ShouldReject(o => o.Token.SessionIdLifetime = TimeSpan.FromTicks(ticks), + "Token.SessionIdLifetime"); [Fact] public void Session_nonpositive_max_lifetime_fails() => @@ -563,7 +553,7 @@ public void Session_nonpositive_max_lifetime_fails() => public void Session_max_lifetime_less_than_lifetime_fails() => ShouldReject(o => { - o.Session.Lifetime = TimeSpan.FromMinutes(30); + o.Token.SessionIdLifetime = TimeSpan.FromMinutes(30); o.Session.MaxLifetime = TimeSpan.FromMinutes(29); }, "Session.MaxLifetime"); @@ -571,7 +561,7 @@ public void Session_max_lifetime_less_than_lifetime_fails() => public void Session_equal_max_lifetime_passes() => ShouldAccept(o => { - o.Session.Lifetime = TimeSpan.FromMinutes(30); + o.Token.SessionIdLifetime = TimeSpan.FromMinutes(30); o.Session.MaxLifetime = TimeSpan.FromMinutes(30); o.Session.IdleTimeout = TimeSpan.Zero; }); @@ -590,14 +580,6 @@ public void Token_negative_concurrent_refresh_window_fails() => o.Token.RefreshTokenConcurrentRequestWindow = TimeSpan.FromTicks(-1), "RefreshTokenConcurrentRequestWindow"); - [Fact] - public void Token_no_issuance_fails_under_current_validator() => - ShouldReject(o => - { - o.Token.IssueJwt = false; - o.Token.IssueOpaque = false; - }, "IssueJwt or IssueOpaque"); - [Fact] public void Token_nonpositive_access_lifetime_fails() => ShouldReject(o => o.Token.AccessTokenLifetime = TimeSpan.Zero, @@ -607,7 +589,7 @@ public void Token_nonpositive_access_lifetime_fails() => public void Token_nonpositive_refresh_lifetime_fails_when_enabled() => ShouldReject(o => { - o.Token.IssueRefresh = true; + o.Token.IssueRefreshToken = true; o.Token.RefreshTokenLifetime = TimeSpan.Zero; }, "RefreshTokenLifetime"); @@ -615,20 +597,19 @@ public void Token_nonpositive_refresh_lifetime_fails_when_enabled() => public void Token_refresh_lifetime_equal_to_access_lifetime_fails() => ShouldReject(o => { - o.Token.IssueRefresh = true; + o.Token.IssueRefreshToken = true; o.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10); o.Token.RefreshTokenLifetime = TimeSpan.FromMinutes(10); }, "RefreshTokenLifetime"); [Theory] - [InlineData(true, " ", "UAuthClient", "Token.Issuer")] - [InlineData(true, "ab", "UAuthClient", "Token.Issuer")] - [InlineData(true, "UAuth", " ", "Token.Audience")] - [InlineData(true, "UAuth", "ab", "Token.Audience")] - public void Token_invalid_jwt_identifiers_fail(bool issueJwt, string issuer, string audience, string expected) => + [InlineData(" ", "UAuthClient", "Token.Issuer")] + [InlineData("ab", "UAuthClient", "Token.Issuer")] + [InlineData("UAuth", " ", "Token.Audience")] + [InlineData("UAuth", "ab", "Token.Audience")] + public void Token_invalid_jwt_identifiers_fail(string issuer, string audience, string expected) => ShouldReject(o => { - o.Token.IssueJwt = issueJwt; o.Token.Issuer = issuer; o.Token.Audience = audience; }, expected); @@ -640,7 +621,6 @@ public void Token_invalid_jwt_identifiers_fail(bool issueJwt, string issuer, str public void Token_opaque_entropy_outside_limits_fails(int bytes) => ShouldReject(o => { - o.Token.IssueOpaque = true; o.Token.OpaqueIdBytes = bytes; }, "OpaqueIdBytes"); @@ -650,25 +630,14 @@ public void Token_opaque_entropy_outside_limits_fails(int bytes) => public void Token_opaque_entropy_boundary_values_pass(int bytes) => ShouldAccept(o => { - o.Token.IssueOpaque = true; o.Token.OpaqueIdBytes = bytes; }); - [Fact] - public void Token_jwt_fields_are_not_required_when_jwt_disabled() => - ShouldAccept(o => - { - o.Token.IssueJwt = false; - o.Token.IssueOpaque = true; - o.Token.Issuer = ""; - o.Token.Audience = ""; - }); - [Fact] public void Token_refresh_lifetime_is_not_checked_when_refresh_disabled() => ShouldAccept(o => { - o.Token.IssueRefresh = false; + o.Token.IssueRefreshToken = false; o.Token.RefreshTokenLifetime = TimeSpan.Zero; }); @@ -712,7 +681,7 @@ public void Pagination_multiple_errors_are_reported() => private static void ConfigureValidCrossOptions(UAuthServerOptions o) { o.AllowedModes = new[] { UAuthMode.Hybrid }; - o.Session.Lifetime = TimeSpan.FromDays(7); + o.Token.SessionIdLifetime = TimeSpan.FromDays(7); o.Session.MaxLifetime = TimeSpan.FromDays(10); o.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10); o.Token.RefreshTokenLifetime = TimeSpan.FromDays(7); @@ -783,8 +752,8 @@ public void Server_session_lifetime_nonpositive_fails() => ShouldReject(o => { ConfigureValidCrossOptions(o); - o.Session.Lifetime = TimeSpan.Zero; - }, "Session.Lifetime"); + o.Token.SessionIdLifetime = TimeSpan.Zero; + }, "Token.SessionIdLifetime"); [Fact] public void Server_session_max_lifetime_nonpositive_fails() => @@ -825,17 +794,15 @@ public void Server_null_session_max_lifetime_passes_under_current_rules() => [Theory] [InlineData(1, 5)] [InlineData(5, 5)] - public void Session_sliding_expiration_touch_interval_greater_than_or_equal_to_lifetime_fails( - int lifetimeMinutes, - int touchIntervalMinutes) => + public void Session_sliding_expiration_touch_interval_greater_than_or_equal_to_lifetime_fails(int lifetimeMinutes, int touchIntervalMinutes) => ShouldReject(o => { o.Session.SlidingExpiration = true; - o.Session.Lifetime = TimeSpan.FromMinutes(lifetimeMinutes); + o.Token.SessionIdLifetime = TimeSpan.FromMinutes(lifetimeMinutes); o.Session.TouchInterval = TimeSpan.FromMinutes(touchIntervalMinutes); o.Session.IdleTimeout = null; o.Session.MaxLifetime = null; - }, "Session.TouchInterval must be less than Session.Lifetime"); + }, "Session.TouchInterval must be less than Token.SessionIdLifetime"); [Fact] @@ -843,13 +810,44 @@ public void Session_sliding_expiration_touch_interval_less_than_lifetime_passes( ShouldAccept(o => { o.Session.SlidingExpiration = true; - o.Session.Lifetime = TimeSpan.FromMinutes(5); + o.Token.SessionIdLifetime = TimeSpan.FromMinutes(5); o.Session.TouchInterval = TimeSpan.FromMinutes(1); o.Session.IdleTimeout = null; o.Session.MaxLifetime = null; }); + [Theory] + [InlineData(0)] + [InlineData(-1)] + public void Token_session_id_lifetime_must_be_positive( + int ticks) + { + ShouldReject( + o => o.Token.SessionIdLifetime = TimeSpan.FromTicks(ticks), "Token.SessionIdLifetime"); + } + [Fact] + public void Refresh_can_be_disabled_without_selecting_token_format() + { + ShouldAccept( + o => + { + o.Token.IssueRefreshToken = false; + o.Token.RefreshTokenLifetime = TimeSpan.Zero; + }); + } + + [Fact] + public void Token_format_is_not_configured_separately() + { + ShouldAccept( + o => + { + o.AuthMode = UAuthMode.PureJwt; + o.Token.AccessTokenLifetime = + TimeSpan.FromMinutes(10); + }); + } private static void ShouldReject(Action configure, string expected) diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs index 40a5e331..73abfe01 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs @@ -722,9 +722,9 @@ private static Fixture CreateFixture( options.Session.IdleTimeout = idleTimeout; options.Session.DeviceMismatchBehavior = deviceMismatchBehavior; - var sut = new UAuthSessionValidator( - storeFactory.Object, - claimsProvider.Object); + var lineageValidator = new SessionLineageValidator(storeFactory.Object); + + var sut = new UAuthSessionValidator(lineageValidator, claimsProvider.Object); var context = new SessionValidationContext { @@ -757,4 +757,4 @@ private sealed record Fixture( UAuthSessionChain Chain, UAuthSession Session, SessionValidationContext Context); -} \ No newline at end of file +} diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/DeviceLimitAdmissionTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/DeviceLimitAdmissionTests.cs index 09c188e2..4366fa75 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/DeviceLimitAdmissionTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/DeviceLimitAdmissionTests.cs @@ -21,10 +21,14 @@ public sealed class DeviceLimitAdmissionTests private static readonly UAuthSessionOptions SessionOptions = new() { - Lifetime = TimeSpan.FromHours(8), MaxSessionsPerChain = 20 }; + private static readonly UAuthTokenOptions TokenOptions = new() + { + SessionIdLifetime = TimeSpan.FromHours(8) + }; + [Fact] public async Task RejectNewLogin_WhenGlobalLimitReached_KeepsExistingSessionActive() { @@ -426,6 +430,7 @@ private static SessionIssuanceContext Context( Metadata = SessionMetadata.Empty, Mode = UAuthMode.Hybrid, SessionOptions = SessionOptions, + TokenOptions = TokenOptions, ChainId = chainId }; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs index dd54a772..ea72bc4b 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs @@ -54,8 +54,7 @@ await act.Should() [Fact] public async Task IssueSessionAsync_WhenOpaqueGeneratorReturnsInvalidId_ShouldFailBeforeStoreAccess() { - var fixture = CreateFixture( - opaqueToken: "invalid"); + var fixture = CreateFixture(opaqueToken: "invalid"); var context = CreateIssuanceContext(fixture); @@ -1682,8 +1681,7 @@ private static Fixture CreateFixture( var options = new UAuthServerOptions(); - options.Session.Lifetime = - lifetime ?? Lifetime; + options.Token.SessionIdLifetime = lifetime ?? Lifetime; options.Session.MaxLifetime = maxLifetime; @@ -1702,34 +1700,25 @@ private static Fixture CreateFixture( storeFactory, store, tokenGenerator, - options.Session); + options.Session, + options.Token); } // ===================================================================== // Setup helpers // ===================================================================== - private static void SetupNewIssuance( - Fixture fixture, - SessionIssuanceContext context) + private static void SetupNewIssuance(Fixture fixture, SessionIssuanceContext context) { - var root = - CreateRoot( - context.Tenant, - context.UserKey); + var root = CreateRoot(context.Tenant, context.UserKey); - SetupRoot( - fixture, - context.UserKey, - root); + SetupRoot(fixture, context.UserKey, root); SetupEmptySessions(fixture); SetupSessionAndChainPersistence(fixture); } - private static RotationSetup SetupSuccessfulRotation( - Fixture fixture, - SessionRotationContext context) + private static RotationSetup SetupSuccessfulRotation(Fixture fixture, SessionRotationContext context) { var root = CreateRoot( @@ -1884,7 +1873,8 @@ private static SessionIssuanceContext CreateIssuanceContext(Fixture fixture, Use Metadata = SessionMetadata.Empty, Mode = mode, ChainId = chainId, - SessionOptions = fixture.SessionOptions + SessionOptions = fixture.SessionOptions, + TokenOptions = fixture.TokenOptions }; } @@ -1902,7 +1892,8 @@ private static SessionRotationContext CreateRotationContext(Fixture fixture, UAu Claims = ClaimsSnapshot.Empty, Metadata = SessionMetadata.Empty, Mode = mode, - SessionOptions = fixture.SessionOptions + SessionOptions = fixture.SessionOptions, + TokenOptions = fixture.TokenOptions }; } @@ -1963,5 +1954,6 @@ private sealed record Fixture( Mock StoreFactory, Mock Store, Mock TokenGenerator, - UAuthSessionOptions SessionOptions); + UAuthSessionOptions SessionOptions, + UAuthTokenOptions TokenOptions); } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Tokens/UAuthTokenIssuerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Tokens/UAuthTokenIssuerTests.cs index 7dca927b..d84df266 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Tokens/UAuthTokenIssuerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Tokens/UAuthTokenIssuerTests.cs @@ -304,8 +304,7 @@ public async Task IssueAccessTokenAsync_WhenJwtIdEnabled_ShouldGenerateJti() var fixture = CreateFixture(); var flow = CreateFlow( - UAuthMode.PureJwt, - addJwtIdClaim: true); + UAuthMode.PureJwt); UAuthJwtTokenDescriptor? captured = null; @@ -337,8 +336,7 @@ public async Task IssueAccessTokenAsync_WhenJwtIdDisabled_ShouldNotGenerateJti() var fixture = CreateFixture(); var flow = CreateFlow( - UAuthMode.PureJwt, - addJwtIdClaim: false); + UAuthMode.PureJwt); UAuthJwtTokenDescriptor? captured = null; @@ -947,7 +945,7 @@ public async Task IssueAccessTokenAsync_WhenClaimsAreEmpty_ShouldOnlyIncludeFram { var fixture = CreateFixture(); - var flow = CreateFlow(UAuthMode.PureJwt, addJwtIdClaim: false); + var flow = CreateFlow(UAuthMode.PureJwt); var context = CreateTokenContext(sessionId: null, claims: ClaimsSnapshot.Empty); @@ -989,8 +987,7 @@ public async Task IssueAccessTokenAsync_WhenCustomClaimIsReserved_ShouldIgnoreIt var fixture = CreateFixture(); var flow = CreateFlow( - UAuthMode.PureJwt, - addJwtIdClaim: false); + UAuthMode.PureJwt); var context = CreateTokenContext( sessionId: null, @@ -1082,8 +1079,7 @@ public async Task IssueAccessTokenAsync_WhenCustomJtiExists_ShouldUseGeneratedJt var fixture = CreateFixture(); var flow = CreateFlow( - UAuthMode.PureJwt, - addJwtIdClaim: true); + UAuthMode.PureJwt); var context = CreateTokenContext( claims: ClaimsSnapshot.From( @@ -1112,8 +1108,7 @@ public async Task IssueAccessTokenAsync_WhenJwtIdDisabled_ShouldRejectCustomJti( var fixture = CreateFixture(); var flow = CreateFlow( - UAuthMode.PureJwt, - addJwtIdClaim: false); + UAuthMode.PureJwt); var context = CreateTokenContext( claims: ClaimsSnapshot.From( @@ -1198,7 +1193,7 @@ public async Task IssueRefreshTokenAsync_WhenIssueRefreshDisabled_ShouldReturnNu var fixture = CreateFixture(); var flow = CreateFlow(mode); - flow.Options.Token.IssueRefresh = false; + flow.Options.Token.IssueRefreshToken = false; var result = await fixture.Sut.IssueRefreshTokenAsync( flow, @@ -1231,7 +1226,6 @@ private static AuthFlowContext CreateFlow( string? issuer = null, string? audience = null, string? keyId = null, - bool addJwtIdClaim = true, bool issueRefresh = true) { /* @@ -1248,7 +1242,7 @@ private static AuthFlowContext CreateFlow( flow.Options.Token.AccessTokenLifetime = accessTokenLifetime ?? TimeSpan.FromMinutes(15); flow.Options.Token.RefreshTokenLifetime = refreshTokenLifetime ?? TimeSpan.FromDays(30); - flow.Options.Token.IssueRefresh = issueRefresh; + flow.Options.Token.IssueRefreshToken = issueRefresh; if (issuer is not null) flow.Options.Token.Issuer = issuer; @@ -1257,7 +1251,6 @@ private static AuthFlowContext CreateFlow( flow.Options.Token.Audience = audience; flow.Options.Token.KeyId = keyId; - flow.Options.Token.AddJwtIdClaim = addJwtIdClaim; return flow; } From 3e68fab4764db6c7b284e0a22fa83adc717f3f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Tue, 1 Dec 2026 21:51:47 +0300 Subject: [PATCH 06/14] Fix Tests --- .../Options/UAuthTokenOptions.cs | 2 + .../Issuers/UAuthSessionIssuer.cs | 9 +- .../SessionSlidingExpirationTests.cs | 6 +- .../UAuthResourceApiOptionsValidatorTests.cs | 9 +- .../EffectiveServerOptionsProviderTests.cs | 28 +++++ .../Server/RefreshFlowServiceTests.cs | 69 +++++------ ...UAuthResourceAuthenticationHandlerTests.cs | 10 +- .../Sessions/UAuthSessionIssuerTests.cs | 45 +++---- .../Tokens/UAuthTokenIssuerTests.cs | 114 +++++------------- 9 files changed, 128 insertions(+), 164 deletions(-) diff --git a/src/CodeBeam.UltimateAuth.Core/Options/UAuthTokenOptions.cs b/src/CodeBeam.UltimateAuth.Core/Options/UAuthTokenOptions.cs index c6545ec2..03fe97ba 100644 --- a/src/CodeBeam.UltimateAuth.Core/Options/UAuthTokenOptions.cs +++ b/src/CodeBeam.UltimateAuth.Core/Options/UAuthTokenOptions.cs @@ -77,8 +77,10 @@ public bool IssueRefresh internal UAuthTokenOptions Clone() => new() { + SessionIdLifetime = SessionIdLifetime, AccessTokenLifetime = AccessTokenLifetime, RefreshTokenLifetime = RefreshTokenLifetime, + IssueRefreshToken = IssueRefreshToken, OpaqueIdBytes = OpaqueIdBytes, Issuer = Issuer, Audience = Audience, diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs index 800b8e04..1e619d3b 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs @@ -228,13 +228,20 @@ context.Device.DeviceId is not DeviceId incomingDeviceId || ipAddress: context.Device.IpAddress); } + var effectiveExpiresAt = sessionExpiresAt; + + if (chain.AbsoluteExpiresAt is { } chainAbsolute && effectiveExpiresAt > chainAbsolute) + { + effectiveExpiresAt = chainAbsolute; + } + var session = UAuthSession.Create( sessionId: sessionId, tenant: context.Tenant, userKey: context.UserKey, chainId: chain.ChainId, now: now, - expiresAt: sessionExpiresAt, + expiresAt: effectiveExpiresAt, securityVersion: root.SecurityVersion, device: sessionDevice, claims: context.Claims, diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/SessionSlidingExpirationTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/SessionSlidingExpirationTests.cs index f340733a..4e6ec8d7 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/SessionSlidingExpirationTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/SessionSlidingExpirationTests.cs @@ -183,8 +183,7 @@ public async Task IdentifierGet_ExpiredIdleSession_ShouldReturnUnauthorized(stri [Theory] [InlineData("BlazorServer")] [InlineData("BlazorWasm")] - public async Task InfiniteSliding_ThirtyConsecutiveRefreshes_ShouldKeepSessionAlive( - string profile) + public async Task InfiniteSliding_ThirtyConsecutiveRefreshes_ShouldKeepSessionAlive(string profile) { await using var factory = CreateFactory( sliding: true, @@ -298,8 +297,7 @@ public async Task Sliding_ExactlyAtSessionExpiry_ShouldRejectRefresh( [Theory] [InlineData("BlazorServer")] [InlineData("BlazorWasm")] - public async Task Sliding_WithIdleTimeout_RegularRefreshes_ShouldRemainActive( - string profile) + public async Task Sliding_WithIdleTimeout_RegularRefreshes_ShouldRemainActive(string profile) { await using var factory = CreateIdleSlidingFactory(); using var client = CreateClient(factory, profile); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs index 1d61d284..eee7f1c2 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs @@ -272,12 +272,9 @@ public void PureJwt_DeviceRebinding_ShouldFail() { var options = ValidOptions(UAuthMode.PureJwt); - options.Auth.Device.MismatchBehavior = - DeviceMismatchBehavior.AllowAndRebind; + options.Auth.Device.MismatchBehavior = DeviceMismatchBehavior.AllowAndRebind; - AssertInvalid( - options, - "PureJwt does not support device rebinding."); + AssertInvalid(options, "JWT authentication modes do not support device rebinding."); } [Fact] @@ -523,7 +520,7 @@ public void MultipleInvalidFields_ShouldReportAllApplicableErrors() options, "Auth.Session.CookieName is required.", "Auth.AccessToken.HeaderName is required.", - "PureJwt does not support device rebinding.", + "JWT authentication modes do not support device rebinding.", "Auth.Jwt.Issuer is required.", "Auth.Jwt.Audience is required.", "Auth.Jwt.ValidAlgorithms must contain valid algorithms.", diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs index a178f9a2..c913b09a 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs @@ -422,6 +422,34 @@ public void Clone_should_not_share_profile_mode_mappings() .Should().Be(UAuthMode.PureJwt); } + [Theory] + [InlineData(UAuthMode.PureOpaque)] + [InlineData(UAuthMode.Hybrid)] + [InlineData(UAuthMode.SemiHybrid)] + [InlineData(UAuthMode.PureJwt)] + public void Effective_options_preserve_session_lifetime_and_refresh_policy(UAuthMode mode) + { + var original = new UAuthServerOptions + { + AuthMode = mode + }; + + original.Token.SessionIdLifetime = TimeSpan.FromHours(2); + original.Token.IssueRefreshToken = false; + + var provider = CreateProviderForMode(original, mode); + + var effective = provider.GetEffective( + TenantKey.Single, + UAuthApplicationProfile.BlazorServer); + + effective.Options.Token.SessionIdLifetime + .Should().Be(TimeSpan.FromHours(2)); + + effective.Options.Token.IssueRefreshToken + .Should().BeFalse(); + } + [Theory] [InlineData(UAuthMode.Hybrid)] [InlineData(UAuthMode.SemiHybrid)] diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshFlowServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshFlowServiceTests.cs index c23c3554..5a81fd48 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshFlowServiceTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshFlowServiceTests.cs @@ -1,13 +1,10 @@ -using CodeBeam.UltimateAuth.Core.Abstractions; -using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Flows; using CodeBeam.UltimateAuth.Server.Infrastructure; -using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Server.Services; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; using AwesomeAssertions; @@ -364,70 +361,56 @@ public async Task RefreshAsync_Hybrid_WhenTouchFails_DoesNotRotateRefreshToken() Times.Never); } - [Fact] - public async Task RefreshAsync_SemiHybrid_WhenSessionInvalid_ReturnsReauthWithoutRotation() - { - var (sut, validator, touch, rotation) = CreateSut(); - - validator - .Setup(x => x.ValidateSessionAsync(It.IsAny(), It.IsAny())) - .ReturnsAsync(SessionValidationResult.Invalid(SessionState.SecurityMismatch)); - - var result = await sut.RefreshAsync( - CreateFlow(UAuthMode.SemiHybrid), - CreateRequest(SessionId, "refresh-token"), ct: TestContext.Current.CancellationToken); - - AssertReauth(result); - rotation.VerifyNoOtherCalls(); - touch.VerifyNoOtherCalls(); - } - [Fact] public async Task RefreshAsync_SemiHybrid_WhenRotationSucceeds_ReturnsRotatedWithoutTouchingSession() { var (sut, validator, touch, rotation) = CreateSut(); - var validation = CreateActiveValidation(); var execution = CreateSuccessfulRotation(); - validator - .Setup(x => x.ValidateSessionAsync(It.IsAny(), It.IsAny())) - .ReturnsAsync(validation); - rotation .Setup(x => x.RotateAsync( It.IsAny(), It.Is(c => - c.ExpectedSessionId == SessionId && + c.ExpectedSessionId == null && c.RefreshToken == "refresh-token"), It.IsAny())) .ReturnsAsync(execution); var result = await sut.RefreshAsync( CreateFlow(UAuthMode.SemiHybrid), - CreateRequest(SessionId, "refresh-token"), ct: TestContext.Current.CancellationToken); + CreateRequest(null, "refresh-token"), + ct: TestContext.Current.CancellationToken); result.IsSuccess.Should().BeTrue(); result.Outcome.Should().Be(RefreshOutcome.Rotated); - result.SessionId.Should().Be(SessionId); + result.SessionId.Should().BeNull(); result.AccessToken.Should().BeSameAs(execution.Result.AccessToken); result.RefreshToken.Should().BeSameAs(execution.Result.RefreshToken); + + rotation.Verify(x => x.RotateAsync( + It.IsAny(), + It.Is(c => + c.ExpectedSessionId == null && + c.RefreshToken == "refresh-token"), + It.IsAny()), + Times.Once); + + validator.VerifyNoOtherCalls(); touch.VerifyNoOtherCalls(); + rotation.VerifyNoOtherCalls(); } [Fact] public async Task RefreshAsync_SemiHybrid_WhenRotationFails_ReturnsReauthWithoutTouch() { var (sut, validator, touch, rotation) = CreateSut(); - var validation = CreateActiveValidation(); - - validator - .Setup(x => x.ValidateSessionAsync(It.IsAny(), It.IsAny())) - .ReturnsAsync(validation); rotation .Setup(x => x.RotateAsync( It.IsAny(), - It.IsAny(), + It.Is(c => + c.ExpectedSessionId == null && + c.RefreshToken == "refresh-token"), It.IsAny())) .ReturnsAsync(new RefreshTokenRotationExecution { @@ -436,10 +419,22 @@ public async Task RefreshAsync_SemiHybrid_WhenRotationFails_ReturnsReauthWithout var result = await sut.RefreshAsync( CreateFlow(UAuthMode.SemiHybrid), - CreateRequest(SessionId, "refresh-token"), ct: TestContext.Current.CancellationToken); + CreateRequest(null, "refresh-token"), + ct: TestContext.Current.CancellationToken); AssertReauth(result); + + rotation.Verify(x => x.RotateAsync( + It.IsAny(), + It.Is(c => + c.ExpectedSessionId == null && + c.RefreshToken == "refresh-token"), + It.IsAny()), + Times.Once); + + validator.VerifyNoOtherCalls(); touch.VerifyNoOtherCalls(); + rotation.VerifyNoOtherCalls(); } private static ( diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs index 55c86c76..12646a46 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs @@ -443,7 +443,7 @@ public async Task AuthenticateAsync_PureJwt_WhenCredentialIsNotAccessToken_Shoul result.Succeeded.Should().BeFalse(); result.Failure!.Message.Should() - .Be("PureJwt requires an access token."); + .Be("JWT authentication requires an access token."); VerifyNoSessionValidation(setup); } @@ -605,7 +605,7 @@ public async Task AuthenticateAsync_PureJwt_WhenSessionClaimExists_ShouldFail() result.Succeeded.Should().BeFalse(); result.Failure!.Message.Should() - .Be("Session-bound JWT is not valid in PureJwt mode."); + .Be("JWT identity does not satisfy authentication mode."); VerifyNoSessionValidation(setup); } @@ -632,7 +632,7 @@ public async Task AuthenticateAsync_PureJwt_WhenDeviceClaimIsMissing_ShouldFail( result.Succeeded.Should().BeFalse(); result.Failure!.Message.Should() - .Be("PureJwt requires a valid device binding."); + .Be("JWT identity does not satisfy authentication mode."); } [Fact] @@ -659,7 +659,7 @@ public async Task AuthenticateAsync_PureJwt_WhenDeviceClaimIsDuplicated_ShouldFa result.Succeeded.Should().BeFalse(); result.Failure!.Message.Should() - .Be("PureJwt requires a valid device binding."); + .Be("JWT identity does not satisfy authentication mode."); } [Fact] @@ -683,7 +683,7 @@ public async Task AuthenticateAsync_PureJwt_WhenDeviceDoesNotMatch_ShouldFail() result.Succeeded.Should().BeFalse(); result.Failure!.Message.Should() - .Be("JWT device mismatch."); + .Be("JWT identity does not satisfy authentication mode."); VerifyNoSessionValidation(setup); } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs index ea72bc4b..9f02e5d9 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs @@ -62,7 +62,8 @@ public async Task IssueSessionAsync_WhenOpaqueGeneratorReturnsInvalidId_ShouldFa fixture.Sut.IssueSessionAsync(context); await act.Should() - .ThrowAsync(); + .ThrowAsync() + .WithMessage("Could not generate session identifier."); fixture.StoreFactory.Verify( x => x.Create(It.IsAny()), @@ -1196,9 +1197,7 @@ public async Task RotateSessionAsync_WhenMaxLifetimeIsShorter_ShouldCapNewSessio var context = CreateRotationContext(fixture); - SetupSuccessfulRotation( - fixture, - context); + SetupSuccessfulRotation(fixture, context, absoluteExpiresAt: Now.AddHours(2)); UAuthSession? persisted = null; @@ -1718,18 +1717,11 @@ private static void SetupNewIssuance(Fixture fixture, SessionIssuanceContext con SetupSessionAndChainPersistence(fixture); } - private static RotationSetup SetupSuccessfulRotation(Fixture fixture, SessionRotationContext context) + private static RotationSetup SetupSuccessfulRotation(Fixture fixture, SessionRotationContext context, DateTimeOffset? absoluteExpiresAt = null) { - var root = - CreateRoot( - context.Tenant, - context.UserKey); + var root = CreateRoot(context.Tenant, context.UserKey); - var chain = - CreateChain( - root, - context.UserKey, - context.Tenant); + var chain = CreateChain(root, context.UserKey, context.Tenant, absoluteExpiresAt); var oldSession = CreateSession( @@ -1737,7 +1729,10 @@ private static RotationSetup SetupSuccessfulRotation(Fixture fixture, SessionRot chain.ChainId, Now.AddHours(-1), context.CurrentSessionId, - root.SecurityVersion); + root.SecurityVersion, + credentialPurpose: context.Mode == UAuthMode.SemiHybrid + ? SessionCredentialPurpose.MetadataOnly + : SessionCredentialPurpose.Opaque); SetupRoot( fixture, @@ -1897,20 +1892,16 @@ private static SessionRotationContext CreateRotationContext(Fixture fixture, UAu }; } - private static UAuthSessionRoot CreateRoot( - TenantKey tenant, - UserKey userKey) + private static UAuthSessionRoot CreateRoot(TenantKey tenant, UserKey userKey) { - return UAuthSessionRoot.Create( - tenant, - userKey, - Now.AddDays(-1)); + return UAuthSessionRoot.Create(tenant, userKey, Now.AddDays(-1)); } private static UAuthSessionChain CreateChain( UAuthSessionRoot root, UserKey userKey, - TenantKey tenant) + TenantKey tenant, + DateTimeOffset? absoluteExpiresAt = null) { return UAuthSessionChain.Create( SessionChainId.New(), @@ -1918,7 +1909,7 @@ private static UAuthSessionChain CreateChain( tenant, userKey, Now.AddHours(-2), - Now.AddDays(7), + absoluteExpiresAt ?? Now.AddDays(7), TestDevice.Default(), ClaimsSnapshot.Empty, root.SecurityVersion); @@ -1929,7 +1920,8 @@ private static UAuthSession CreateSession( SessionChainId chainId, DateTimeOffset createdAt, AuthSessionId? sessionId = null, - long securityVersion = 0) + long securityVersion = 0, + SessionCredentialPurpose credentialPurpose = SessionCredentialPurpose.Opaque) { return UAuthSession.Create( sessionId ?? AuthSessionId.Parse(Guid.NewGuid().ToString(), null), @@ -1941,7 +1933,8 @@ private static UAuthSession CreateSession( securityVersion, TestDevice.Default(), ClaimsSnapshot.Empty, - SessionMetadata.Empty); + SessionMetadata.Empty, + credentialPurpose: credentialPurpose); } private sealed record RotationSetup( diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Tokens/UAuthTokenIssuerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Tokens/UAuthTokenIssuerTests.cs index d84df266..bceb8dd6 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Tokens/UAuthTokenIssuerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Tokens/UAuthTokenIssuerTests.cs @@ -103,26 +103,21 @@ await fixture.Sut.IssueAccessTokenAsync( [Theory] [InlineData(UAuthMode.SemiHybrid)] [InlineData(UAuthMode.PureJwt)] - public async Task IssueAccessTokenAsync_WhenModeUsesJwt_ShouldIssueJwt( - UAuthMode mode) + public async Task IssueAccessTokenAsync_WhenModeUsesJwt_ShouldIssueJwt(UAuthMode mode) { var fixture = CreateFixture(); var flow = CreateFlow(mode); - var context = CreateTokenContext(); + var context = mode == UAuthMode.SemiHybrid + ? CreateTokenContext(sessionId: CreateSessionId("jwt-session-0000000000000000000000000001"), chainId: SessionChainId.New()) + : CreateTokenContext(); - var result = - await fixture.Sut.IssueAccessTokenAsync( - flow, - context, ct: TestContext.Current.CancellationToken); + var result = await fixture.Sut.IssueAccessTokenAsync(flow, context, ct: TestContext.Current.CancellationToken); result.Format.Should().Be(TokenFormat.Jwt); result.Token.Should().Be(Jwt); - fixture.JwtGenerator.Verify( - x => x.CreateToken( - It.IsAny()), - Times.Once); + fixture.JwtGenerator.Verify(x => x.CreateToken(It.IsAny()), Times.Once); } [Fact] @@ -231,18 +226,15 @@ await fixture.Sut.IssueAccessTokenAsync( } [Fact] - public async Task IssueAccessTokenAsync_WhenJwtAndSessionExists_ShouldIncludeSessionClaim() + public async Task IssueAccessTokenAsync_WhenModeIsSemiHybrid_ShouldIncludeSessionClaim() { var fixture = CreateFixture(); - var sessionId = - CreateSessionId( - "jwt-session-0000000000000000000000000001"); + var sessionId = CreateSessionId("jwt-session-0000000000000000000000000001"); var flow = CreateFlow(UAuthMode.SemiHybrid); - var context = CreateTokenContext( - sessionId: sessionId); + var context = CreateTokenContext(sessionId: sessionId, chainId: SessionChainId.New()); UAuthJwtTokenDescriptor? captured = null; @@ -330,35 +322,6 @@ await fixture.Sut.IssueAccessTokenAsync( .Be(JwtId); } - [Fact] - public async Task IssueAccessTokenAsync_WhenJwtIdDisabled_ShouldNotGenerateJti() - { - var fixture = CreateFixture(); - - var flow = CreateFlow( - UAuthMode.PureJwt); - - UAuthJwtTokenDescriptor? captured = null; - - fixture.JwtGenerator - .Setup(x => x.CreateToken( - It.IsAny())) - .Callback( - descriptor => captured = descriptor) - .Returns(Jwt); - - await fixture.Sut.IssueAccessTokenAsync( - flow, - CreateTokenContext(), ct: TestContext.Current.CancellationToken); - - fixture.OpaqueGenerator.Verify( - x => x.GenerateJwtId(), - Times.Never); - - captured!.Claims.Should() - .NotContainKey("jti"); - } - // ===================================================================== // Refresh token - guards // ===================================================================== @@ -858,13 +821,19 @@ private static Fixture CreateFixture() [Theory] [InlineData(UAuthMode.SemiHybrid)] [InlineData(UAuthMode.PureJwt)] - public async Task IssueAccessTokenAsync_WhenMultipleRolesExist_ShouldPreserveAllRoles( - UAuthMode mode) + public async Task IssueAccessTokenAsync_WhenMultipleRolesExist_ShouldPreserveAllRoles(UAuthMode mode) { var fixture = CreateFixture(); var flow = CreateFlow(mode); var context = CreateTokenContext( + sessionId: mode == UAuthMode.SemiHybrid + ? CreateSessionId( + "jwt-session-0000000000000000000000000001") + : null, + chainId: mode == UAuthMode.SemiHybrid + ? SessionChainId.New() + : null, claims: ClaimsSnapshot.From( ("role", "Admin"), ("role", "Editor"), @@ -962,16 +931,14 @@ public async Task IssueAccessTokenAsync_WhenClaimsAreEmpty_ShouldOnlyIncludeFram captured.Should().NotBeNull(); - captured!.Claims.Should().HaveCount(3); - - captured.Claims!["sub"].Should().Be(context.UserKey.Value); + captured!.Claims.Should().HaveCount(4); + captured.Claims["sub"].Should().Be(context.UserKey.Value); captured.Claims["tenant"].Should().Be(context.Tenant.Value); - captured.Claims["device_id"].Should().Be(context.DeviceId!.Value.Value); + captured.Claims["jti"].Should().Be(JwtId); captured.Claims.Should().NotContainKey("sid"); - captured.Claims.Should().NotContainKey("jti"); } [Theory] @@ -1006,11 +973,16 @@ public async Task IssueAccessTokenAsync_WhenCustomClaimIsReserved_ShouldIgnoreIt captured.Should().NotBeNull(); - captured!.Claims.Should() - .NotContainKey(reservedType); + if (reservedType == "jti") + { + captured!.Claims!["jti"].Should().Be(JwtId); + } + else + { + captured!.Claims.Should().NotContainKey(reservedType); + } - captured.Claims!["department"] - .Should().Be("legal"); + captured.Claims["department"].Should().Be("legal"); } [Fact] @@ -1102,34 +1074,6 @@ public async Task IssueAccessTokenAsync_WhenCustomJtiExists_ShouldUseGeneratedJt Times.Once); } - [Fact] - public async Task IssueAccessTokenAsync_WhenJwtIdDisabled_ShouldRejectCustomJti() - { - var fixture = CreateFixture(); - - var flow = CreateFlow( - UAuthMode.PureJwt); - - var context = CreateTokenContext( - claims: ClaimsSnapshot.From( - ("jti", "attacker-jti"))); - - UAuthJwtTokenDescriptor? captured = null; - - fixture.JwtGenerator - .Setup(x => x.CreateToken(It.IsAny())) - .Callback(d => captured = d) - .Returns(Jwt); - - await fixture.Sut.IssueAccessTokenAsync(flow, context, ct: TestContext.Current.CancellationToken); - - captured!.Claims.Should().NotContainKey("jti"); - - fixture.OpaqueGenerator.Verify( - x => x.GenerateJwtId(), - Times.Never); - } - [Fact] public async Task IssueTokens_ShouldUseEffectiveLifetimes() { From d25b614c3fd8aaef58d4373213c97d851c5d87c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Wed, 2 Dec 2026 19:45:29 +0300 Subject: [PATCH 07/14] More Implementations --- .../Program.cs | 2 +- .../Domain/Auth/UAuthValidationRequirement.cs | 7 ++ .../Auth/Context/AuthFlowContextFactory.cs | 50 ++++++++++- .../UAuthRequireAuthenticationMetadata.cs | 8 +- .../UAuthEndpointValidationClassification.cs | 26 ++++++ .../UAuthEndpointConventionExtensions.cs | 13 ++- .../Issuers/UAuthSessionIssuer.cs | 28 ++++++- .../UAuthValidationRequirementResolver.cs | 32 +++++++ .../Options/UAuthServerOptions.cs | 7 ++ .../Options/UAuthValidationOptions.cs | 20 +++++ .../UAuthResourceApiOptionsValidator.cs | 2 +- .../Services/RefreshTokenRotationService.cs | 51 ++++++------ .../Services/SessionLineageValidator.cs | 5 ++ .../UAuthResourceApiOptionsValidatorTests.cs | 4 +- .../RefreshTokenRotationServiceTests.cs | 42 +++++++++- .../Server/UAuthSessionValidatorTests.cs | 6 +- .../Sessions/UAuthSessionIssuerTests.cs | 83 ++++++++++++++----- 17 files changed, 316 insertions(+), 70 deletions(-) create mode 100644 src/CodeBeam.UltimateAuth.Core/Domain/Auth/UAuthValidationRequirement.cs create mode 100644 src/CodeBeam.UltimateAuth.Server/Auth/UAuthEndpointValidationClassification.cs create mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Validator/UAuthValidationRequirementResolver.cs create mode 100644 src/CodeBeam.UltimateAuth.Server/Options/UAuthValidationOptions.cs diff --git a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/Program.cs b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/Program.cs index 4bf0bb98..6d126d3b 100644 --- a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/Program.cs +++ b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/Program.cs @@ -47,7 +47,7 @@ builder.Services.AddUltimateAuthServer(o => { - //o.AuthMode = UAuthMode.PureJwt; + o.AuthMode = UAuthMode.SemiHybrid; //o.Token.AccessTokenLifetime = TimeSpan.FromSeconds(30); o.Diagnostics.EnableRefreshDetails = true; diff --git a/src/CodeBeam.UltimateAuth.Core/Domain/Auth/UAuthValidationRequirement.cs b/src/CodeBeam.UltimateAuth.Core/Domain/Auth/UAuthValidationRequirement.cs new file mode 100644 index 00000000..dc484b58 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Core/Domain/Auth/UAuthValidationRequirement.cs @@ -0,0 +1,7 @@ +namespace CodeBeam.UltimateAuth.Core.Domain; + +public enum UAuthValidationRequirement +{ + Standard = 0, + HubValidated = 10 +} diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs index 94e65947..ff0a19ee 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs @@ -1,12 +1,15 @@ using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Infrastructure; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Infrastructure; +using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; +using System.Security.Claims; namespace CodeBeam.UltimateAuth.Server.Auth; @@ -19,6 +22,7 @@ internal sealed class AuthFlowContextFactory : IAuthFlowContextFactory private readonly IDeviceResolver _deviceResolver; private readonly IDeviceContextFactory _deviceContextFactory; private readonly ISessionValidator _sessionValidator; + private readonly ISessionLineageValidator _lineageValidator; private readonly IClock _clock; public AuthFlowContextFactory( @@ -29,6 +33,7 @@ public AuthFlowContextFactory( IDeviceResolver deviceResolver, IDeviceContextFactory deviceContextFactory, ISessionValidator sessionValidator, + ISessionLineageValidator lineageValidator, IClock clock) { _applicationProfileReader = applicationProfileReader; @@ -38,6 +43,7 @@ public AuthFlowContextFactory( _deviceResolver = deviceResolver; _deviceContextFactory = deviceContextFactory; _sessionValidator = sessionValidator; + _lineageValidator = lineageValidator; _clock = clock; } @@ -70,13 +76,51 @@ public async ValueTask CreateAsync(HttpContext ctx, AuthFlowTyp bool isAuthenticated; UserKey? userKey; - if (effectiveMode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) + if (effectiveMode == UAuthMode.PureJwt) { - // Identity is established by the UltimateAuth JWT scheme. - // No implicit session or lineage validation. isAuthenticated = user?.IsAuthenticated == true; userKey = isAuthenticated ? user?.UserId : null; } + else if (effectiveMode == UAuthMode.SemiHybrid) + { + isAuthenticated = false; + userKey = null; + + var authentication = await ctx.AuthenticateAsync(UAuthConstants.SchemeDefaults.GlobalScheme); + + if (authentication.Succeeded && authentication.Principal is { } principal) + { + var subject = principal.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + var sid = principal.FindFirst("sid")?.Value; + + if (UserKey.TryParse(subject, null, out var jwtUserKey) && AuthSessionId.TryCreate(sid, out var metadataSessionId)) + { + var validation = await _lineageValidator.ValidateAsync( + new SessionValidationContext + { + Tenant = tenant, + SessionId = metadataSessionId, + Device = deviceContext, + SessionOptions = options.Session, + Now = _clock.UtcNow + }, + SessionCredentialPurpose.MetadataOnly, + ct); + + if (validation.IsValid && + validation.UserKey == jwtUserKey && + validation.Tenant == tenant && + validation.SessionId == metadataSessionId) + { + sessionSecurityContext = SessionValidationMapper.ToSecurityContext(validation); + + isAuthenticated = true; + userKey = jwtUserKey; + } + } + } + } else { isAuthenticated = user?.IsAuthenticated ?? false; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Context/UAuthRequireAuthenticationMetadata.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Context/UAuthRequireAuthenticationMetadata.cs index 3a7e603e..d3800472 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Context/UAuthRequireAuthenticationMetadata.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Context/UAuthRequireAuthenticationMetadata.cs @@ -1,5 +1,5 @@ -namespace CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Core.Domain; -internal sealed class UAuthRequireAuthenticationMetadata -{ -} +namespace CodeBeam.UltimateAuth.Server.Auth; + +internal sealed record UAuthRequireAuthenticationMetadata(UAuthValidationRequirement Requirement = UAuthValidationRequirement.Standard); diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/UAuthEndpointValidationClassification.cs b/src/CodeBeam.UltimateAuth.Server/Auth/UAuthEndpointValidationClassification.cs new file mode 100644 index 00000000..0d6d978a --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Auth/UAuthEndpointValidationClassification.cs @@ -0,0 +1,26 @@ +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.RateLimiting; + +namespace CodeBeam.UltimateAuth.Server.Auth; + +internal static class UAuthEndpointValidationClassification +{ + public static UAuthValidationRequirement Get(UAuthEndpoint endpoint, UAuthMode mode) + { + if (mode != UAuthMode.SemiHybrid) + return UAuthValidationRequirement.Standard; + + return endpoint switch + { + UAuthEndpoint.Validate + or UAuthEndpoint.GetMyIdentifiers + or UAuthEndpoint.ProfileGetSelf + or UAuthEndpoint.GetMyRoles + or UAuthEndpoint.GetMyPermissions + or UAuthEndpoint.AuthorizationCheck + => UAuthValidationRequirement.Standard, + + _ => UAuthValidationRequirement.HubValidated + }; + } +} diff --git a/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthEndpointConventionExtensions.cs b/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthEndpointConventionExtensions.cs index 81a11db9..c36ae05e 100644 --- a/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthEndpointConventionExtensions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthEndpointConventionExtensions.cs @@ -1,13 +1,20 @@ -using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.Auth; using Microsoft.AspNetCore.Builder; namespace CodeBeam.UltimateAuth.Server.Extensions; internal static class UAuthEndpointConventionExtensions { - public static TBuilder RequireUAuthAuthentication(this TBuilder builder) where TBuilder : IEndpointConventionBuilder + public static TBuilder RequireUAuthAuthentication(this TBuilder builder, UAuthValidationRequirement requirement = UAuthValidationRequirement.Standard) + where TBuilder : IEndpointConventionBuilder { - builder.WithMetadata(new UAuthRequireAuthenticationMetadata()); + builder.WithMetadata(new UAuthRequireAuthenticationMetadata(requirement)); return builder; } + + public static TBuilder RequireUAuthHubValidation(this TBuilder builder) where TBuilder : IEndpointConventionBuilder + { + return builder.RequireUAuthAuthentication(UAuthValidationRequirement.HubValidated); + } } diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs index 1e619d3b..8eb4fa48 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs @@ -68,6 +68,7 @@ UAuthMode.PureOpaque or UAuthMode.Hybrid : (DateTimeOffset?)null; var sessionExpiresAt = now.Add(context.TokenOptions.SessionIdLifetime); + if (absoluteExpiresAt is { } absolute && sessionExpiresAt > absolute) sessionExpiresAt = absolute; @@ -299,8 +300,31 @@ await kernel.ExecuteAsync(async _ => var chain = await kernel.GetChainAsync(oldSession.ChainId) ?? throw new SecurityException("Chain not found"); - if (chain.IsRevoked) - throw new SecurityException("Chain is revoked"); + if (chain.GetState(now, sessionOptions.IdleTimeout) != SessionState.Active) + { + throw new SecurityException("Session chain is not active."); + } + + if (chain.ActiveSessionId != oldSession.SessionId) + { + throw new SecurityException("Session is not the active session of its chain."); + } + + var expectedPurpose = context.Mode switch + { + UAuthMode.PureOpaque or UAuthMode.Hybrid + => SessionCredentialPurpose.Opaque, + + UAuthMode.SemiHybrid + => SessionCredentialPurpose.MetadataOnly, + + _ => throw new InvalidOperationException("Session rotation is not supported in this mode.") + }; + + if (oldSession.CredentialPurpose != expectedPurpose) + { + throw new SecurityException("Session credential purpose does not match authentication mode."); + } if (chain.Tenant != context.Tenant || chain.UserKey != context.UserKey) throw new SecurityException("Chain does not belong to the current user/tenant."); diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Validator/UAuthValidationRequirementResolver.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Validator/UAuthValidationRequirementResolver.cs new file mode 100644 index 00000000..bb514f2d --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Validator/UAuthValidationRequirementResolver.cs @@ -0,0 +1,32 @@ +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.Options; +using CodeBeam.UltimateAuth.Server.RateLimiting; + +namespace CodeBeam.UltimateAuth.Server.Infrastructure; + +internal static class UAuthValidationRequirementResolver +{ + public static UAuthValidationRequirement Resolve( + UAuthValidationOptions options, + UAuthEndpoint? endpoint, + UAuthValidationRequirement frameworkDefault, + UAuthValidationRequirement frameworkMinimum, + UAuthValidationRequirement endpointMinimum) + { + var requirement = frameworkDefault; + + if (endpoint is { } value && options.Endpoints.TryGetValue(value, out var configured)) + { + requirement = configured; + } + + return Max(Max(requirement, options.Default), Max(frameworkMinimum, endpointMinimum)); + } + + private static UAuthValidationRequirement Max(UAuthValidationRequirement first, UAuthValidationRequirement second) + { + return (int)first >= (int)second + ? first + : second; + } +} diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs index d6fd0c08..206dd800 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs @@ -166,6 +166,12 @@ public sealed class UAuthServerOptions /// public UAuthServerEndpointOptions Endpoints { get; set; } = new(); + /// + /// Gets or sets the validation options. + /// Includes per-endpoint validation requirements and default validation behavior. + /// + public UAuthValidationOptions Validation { get; set; } = new(); + public UAuthIdentifierOptions Identifiers { get; set; } = new(); public UAuthIdentifierValidationOptions IdentifierValidation { get; set; } = new(); @@ -245,6 +251,7 @@ internal UAuthServerOptions Clone() LoginIdentifiers = LoginIdentifiers.Clone(), UserProfile = UserProfile.Clone(), Endpoints = Endpoints.Clone(), + Validation = Validation.Clone(), Navigation = Navigation.Clone(), Antiforgery = Antiforgery.Clone(), AuthArtifacts = AuthArtifacts.Clone(), diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthValidationOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthValidationOptions.cs new file mode 100644 index 00000000..b122b120 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthValidationOptions.cs @@ -0,0 +1,20 @@ +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.RateLimiting; + +namespace CodeBeam.UltimateAuth.Server.Options; + +public sealed class UAuthValidationOptions +{ + public UAuthValidationRequirement Default { get; set; } = UAuthValidationRequirement.Standard; + + public Dictionary Endpoints { get; set; } = new(); + + internal UAuthValidationOptions Clone() + { + return new UAuthValidationOptions + { + Default = Default, + Endpoints = new(Endpoints) + }; + } +} diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs index d34dc883..5ec790e4 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs @@ -105,7 +105,7 @@ public ValidateOptionsResult Validate(string? name, UAuthResourceApiOptions opti { if (auth.Jwt is null) { - errors.Add("Auth.Jwt is required in PureJwt mode."); + errors.Add("Auth.Jwt is required in PureJwt and SemiHybrid modes."); } else { diff --git a/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs b/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs index 7dbff855..0d809748 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs @@ -5,6 +5,7 @@ using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Flows; using CodeBeam.UltimateAuth.Users; using CodeBeam.UltimateAuth.Users.Contracts; @@ -19,9 +20,10 @@ internal sealed class RefreshTokenRotationService : IRefreshTokenRotationService private readonly IPrimaryUserIdentifierProvider _primaryIdentifiers; private readonly IUserProfileSnapshotProvider _userProfiles; private readonly ISessionLineageValidator _lineageValidator; + private readonly ISessionTouchService _sessionTouch; - public RefreshTokenRotationService(IRefreshTokenValidator validator, IRefreshTokenStoreFactory storeFactory, ITokenIssuer tokenIssuer, IUserClaimsProvider claimsProvider, IPrimaryUserIdentifierProvider primaryIdentifiers, IUserProfileSnapshotProvider userProfiles, ISessionLineageValidator lineageValidator) + public RefreshTokenRotationService(IRefreshTokenValidator validator, IRefreshTokenStoreFactory storeFactory, ITokenIssuer tokenIssuer, IUserClaimsProvider claimsProvider, IPrimaryUserIdentifierProvider primaryIdentifiers, IUserProfileSnapshotProvider userProfiles, ISessionLineageValidator lineageValidator, ISessionTouchService sessionTouch) { _validator = validator; _storeFactory = storeFactory; @@ -30,6 +32,7 @@ public RefreshTokenRotationService(IRefreshTokenValidator validator, IRefreshTok _primaryIdentifiers = primaryIdentifiers; _userProfiles = userProfiles; _lineageValidator = lineageValidator; + _sessionTouch = sessionTouch; } // TODO: Handle reuse detection and make flow knows situation, but don't make security branch. @@ -70,8 +73,6 @@ validation.UserKey is not UserKey userKey || return Failed(); } - var isPureJwt = flow.EffectiveMode == UAuthMode.PureJwt; - if (validation.Tenant != flow.Tenant) return Failed(); @@ -125,23 +126,6 @@ validation.UserKey is not UserKey userKey || } } - if (validation.State == RefreshTokenValidationState.Consumed) - { - if (validation.Tenant != flow.Tenant || !await ValidateModeBindingAsync(flow, context, validation, ct)) - { - return Failed(); - } - - var window = flow.Options.Token.RefreshTokenConcurrentRequestWindow; - - if (!IsLikelyConcurrentRequest(validation, context.Now, window)) - { - await HandleReplayAsync(validation, context.Now, ct); - } - - return Failed(); - } - // Consume the old token and persist its replacement within the same store execution scope. var consumed = await store.ExecuteAsync( async transactionCt => @@ -258,12 +242,27 @@ validation.UserKey is not UserKey userKey || SessionCredentialPurpose.MetadataOnly, ct); - return lineage.IsValid && - lineage.Tenant == flow.Tenant && - lineage.UserKey == userKey && - lineage.SessionId == sessionId && - lineage.ChainId == chainId && - lineage.BoundDeviceId == deviceId; + if (!lineage.IsValid || + lineage.Tenant != flow.Tenant || + lineage.UserKey != userKey || + lineage.SessionId != sessionId || + lineage.ChainId != chainId || + lineage.BoundDeviceId != deviceId) + { + return false; + } + + var policy = new SessionTouchPolicy + { + TouchInterval = flow.Options.Session.TouchInterval, + Lifetime = flow.Options.Token.SessionIdLifetime, + SlidingExpiration = flow.Options.Session.SlidingExpiration, + IdleTimeout = flow.Options.Session.IdleTimeout + }; + + var refresh = await _sessionTouch.RefreshAsync(lineage, policy, SessionTouchMode.IfNeeded, context.Now, ct); + + return refresh.IsSuccess && refresh.SessionId == sessionId; default: return false; diff --git a/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs b/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs index 8e956863..a243d41f 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs @@ -59,6 +59,11 @@ public async Task ValidateAsync(SessionValidationContex return SessionValidationResult.Invalid(SessionState.SecurityMismatch); } + if (chain.ActiveSessionId != session.SessionId) + { + return SessionValidationResult.Invalid(SessionState.Revoked, session.UserKey, session.SessionId, session.ChainId); + } + var root = await store.GetActiveRootByUserAsync(session.UserKey, ct); if (root is null) diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs index eee7f1c2..a85f5139 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs @@ -294,9 +294,7 @@ public void PureJwt_MissingJwt_ShouldFail() var options = ValidOptions(UAuthMode.PureJwt); options.Auth.Jwt = null; - AssertInvalid( - options, - "Auth.Jwt is required in PureJwt mode."); + AssertInvalid(options, "Auth.Jwt is required in PureJwt and SemiHybrid modes."); } [Theory] diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenRotationServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenRotationServiceTests.cs index ba39ef3e..cba42849 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenRotationServiceTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenRotationServiceTests.cs @@ -6,6 +6,7 @@ using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Flows; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Services; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; @@ -85,6 +86,24 @@ public async Task RotateAsync_ValidToken_RotatesAndPreservesLineage(UAuthMode mo c.DeviceId == original.DeviceId && c.AuthenticatedAt == AuthenticatedAt), It.IsAny()), Times.Once); + + test.SessionTouch.Verify(x => x.RefreshAsync( + It.Is(v => + v.SessionId == original.SessionId && + v.ChainId == original.SessionChainId), + It.Is(p => + p.Lifetime == test.Flow.Options.Token.SessionIdLifetime && + p.SlidingExpiration == test.Flow.Options.Session.SlidingExpiration && + p.IdleTimeout == test.Flow.Options.Session.IdleTimeout && + p.TouchInterval == test.Flow.Options.Session.TouchInterval), + SessionTouchMode.IfNeeded, + Now, + It.IsAny()), + mode == UAuthMode.SemiHybrid + ? Times.Once() + : Times.Never()); + + test.SessionTouch.VerifyNoOtherCalls(); } [Fact] @@ -517,6 +536,8 @@ private sealed class Fixture public Mock Identifiers { get; } = new(); public Mock Profiles { get; } = new(); public Mock LineageValidator { get; } = new(); + public Mock SessionTouchService { get; } = new(); + public Mock SessionTouch { get; } = new(MockBehavior.Strict); public AccessToken AccessToken { get; } = new() { @@ -604,8 +625,7 @@ public RefreshToken CreateToken(bool? sessionFree = null) public void Validate(RefreshToken token) { - SetValidation( - RefreshTokenValidationResult.Valid(token, token.TokenHash)); + SetValidation(RefreshTokenValidationResult.Valid(token, token.TokenHash)); if (Flow.EffectiveMode == UAuthMode.SemiHybrid && token.SessionId is AuthSessionId sessionId && @@ -627,6 +647,21 @@ token.SessionId is AuthSessionId sessionId && ClaimsSnapshot.Empty, AuthenticatedAt, token.DeviceId)); + + SessionTouch + .Setup(x => x.RefreshAsync( + It.Is(v => + v.IsValid && + v.Tenant == Tenant && + v.UserKey == User && + v.SessionId == sessionId && + v.ChainId == chainId), + It.IsAny(), + SessionTouchMode.IfNeeded, + Now, + It.IsAny())) + .ReturnsAsync( + SessionRefreshResult.Success(sessionId, true)); } } @@ -685,7 +720,8 @@ public Task RotateAsync(AuthSessionId? expectedSe Claims.Object, Identifiers.Object, Profiles.Object, - LineageValidator.Object); + LineageValidator.Object, + SessionTouch.Object); return service.RotateAsync( Flow, diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs index 73abfe01..01637d5d 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthSessionValidatorTests.cs @@ -7,15 +7,13 @@ using CodeBeam.UltimateAuth.Server.Services; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; using AwesomeAssertions; -using Microsoft.Extensions.Options; using Moq; namespace CodeBeam.UltimateAuth.Tests.Unit.Server; public sealed class UAuthSessionValidatorTests { - private static readonly DateTimeOffset Now = - new(2026, 9, 20, 12, 0, 0, TimeSpan.Zero); + private static readonly DateTimeOffset Now = new(2026, 9, 20, 12, 0, 0, TimeSpan.Zero); // --------------------------------------------------------------------- // Session @@ -705,6 +703,8 @@ private static Fixture CreateFixture( ClaimsSnapshot.Empty, SessionMetadata.Empty); + chain = chain.AttachSession(session.SessionId, chain.LastSeenAt); + var store = new Mock(MockBehavior.Strict); var storeFactory = diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs index 9f02e5d9..b6aa5829 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs @@ -1609,6 +1609,48 @@ await fixture.Sut.RotateSessionAsync( Times.Once); } + [Fact] + public async Task RotateSessionAsync_WhenSessionIsNotActiveOnChain_ShouldReject() + { + var fixture = CreateFixture(); + var context = CreateRotationContext(fixture); + + var setup = SetupSuccessfulRotation(fixture, context); + + var anotherSessionId = AuthSessionId.Parse("another-active-session-0000000000001"); + + var chain = setup.Chain.AttachSession( + anotherSessionId, + Now.AddMinutes(-5)); + + SetupChain(fixture, chain); + + var act = () => fixture.Sut.RotateSessionAsync( + context, + ct: TestContext.Current.CancellationToken); + + await act.Should() + .ThrowAsync() + .WithMessage("Session is not the active session of its chain."); + + fixture.Store.Verify(x => x.CreateSessionAsync( + It.IsAny(), + It.IsAny()), + Times.Never); + + fixture.Store.Verify(x => x.SaveChainAsync( + It.IsAny(), + It.IsAny(), + It.IsAny()), + Times.Never); + + fixture.Store.Verify(x => x.SaveSessionAsync( + It.IsAny(), + It.IsAny(), + It.IsAny()), + Times.Never); + } + // ===================================================================== // Fixture // ===================================================================== @@ -1721,31 +1763,30 @@ private static RotationSetup SetupSuccessfulRotation(Fixture fixture, SessionRot { var root = CreateRoot(context.Tenant, context.UserKey); - var chain = CreateChain(root, context.UserKey, context.Tenant, absoluteExpiresAt); - - var oldSession = - CreateSession( - context.UserKey, - chain.ChainId, - Now.AddHours(-1), - context.CurrentSessionId, - root.SecurityVersion, - credentialPurpose: context.Mode == UAuthMode.SemiHybrid - ? SessionCredentialPurpose.MetadataOnly - : SessionCredentialPurpose.Opaque); + var chain = CreateChain( + root, + context.UserKey, + context.Tenant, + absoluteExpiresAt); - SetupRoot( - fixture, + var oldSession = CreateSession( context.UserKey, - root); + chain.ChainId, + Now.AddHours(-1), + context.CurrentSessionId, + root.SecurityVersion, + credentialPurpose: context.Mode == UAuthMode.SemiHybrid + ? SessionCredentialPurpose.MetadataOnly + : SessionCredentialPurpose.Opaque); - SetupSession( - fixture, - oldSession); + chain = chain.AttachSession( + oldSession.SessionId, + oldSession.CreatedAt); + + SetupRoot(fixture, context.UserKey, root); + SetupSession(fixture, oldSession); + SetupChain(fixture, chain); - SetupChain( - fixture, - chain); fixture.Store .Setup(x => x.CreateSessionAsync( From 51d7ca5af7e9b0ac467793e579d45812b36406d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Wed, 2 Dec 2026 21:16:36 +0300 Subject: [PATCH 08/14] Add Migrations & Fix Tests --- ...2_005_SemiHybridSessionSupport.Designer.cs | 797 ++++++++++++ ...1202180832_005_SemiHybridSessionSupport.cs | 28 + .../Migrations/UAuthDbContextModelSnapshot.cs | 1109 +++++++++-------- ...0_005_SemiHybridSessionSupport.Designer.cs | 783 ++++++++++++ ...1202180730_005_SemiHybridSessionSupport.cs | 28 + .../Migrations/UAuthDbContextModelSnapshot.cs | 1095 ++++++++-------- .../uauthhub.db | Bin 4096 -> 352256 bytes ...5_005_SemiHybridSessionSupport.Designer.cs | 783 ++++++++++++ ...1202180605_005_SemiHybridSessionSupport.cs | 28 + .../Migrations/UAuthDbContextModelSnapshot.cs | 1095 ++++++++-------- .../uauth.db | Bin 4096 -> 352256 bytes .../Contracts/Session/AuthValidationResult.cs | 1 + .../Defaults/UAuthConstants.cs | 1 + .../Auth/Context/AuthFlowContextFactory.cs | 41 +- .../Auth/SemiHybridAuthorityValidator.cs | 106 ++ .../UAuthStatusAuthorizationResultHandler.cs | 102 +- .../Endpoints/ValidateEndpointHandler.cs | 89 +- .../Extensions/ServiceCollectionExtensions.cs | 16 + .../UAuthEndpointConventionExtensions.cs | 5 - .../UAuthHubValidationEndpointExtensions.cs | 21 + .../UAuthValidationRequirementResolver.cs | 78 +- .../Options/UAuthResourceApiOptions.cs | 14 +- .../UAuthResourceApiOptionsValidator.cs | 16 +- .../Validators/UAuthServerOptionsValidator.cs | 6 - .../UAuthValidationOptionsValidator.cs | 31 + .../ResourceApi/RemoteHubValidationService.cs | 164 +++ .../UAuthServerStatusAuthorizationTests.cs | 73 +- .../UAuthResourceApiOptionsValidatorTests.cs | 4 +- .../Server/ServerOptionsValidatorTests.cs | 9 - .../Server/ValidateEndpointHandlerTests.cs | 29 +- 30 files changed, 4789 insertions(+), 1763 deletions(-) create mode 100644 apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261202180832_005_SemiHybridSessionSupport.Designer.cs create mode 100644 apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261202180832_005_SemiHybridSessionSupport.cs create mode 100644 samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/20261202180730_005_SemiHybridSessionSupport.Designer.cs create mode 100644 samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/20261202180730_005_SemiHybridSessionSupport.cs create mode 100644 samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/20261202180605_005_SemiHybridSessionSupport.Designer.cs create mode 100644 samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/20261202180605_005_SemiHybridSessionSupport.cs create mode 100644 src/CodeBeam.UltimateAuth.Server/Auth/SemiHybridAuthorityValidator.cs create mode 100644 src/CodeBeam.UltimateAuth.Server/Extensions/UAuthHubValidationEndpointExtensions.cs create mode 100644 src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthValidationOptionsValidator.cs create mode 100644 src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs diff --git a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261202180832_005_SemiHybridSessionSupport.Designer.cs b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261202180832_005_SemiHybridSessionSupport.Designer.cs new file mode 100644 index 00000000..20b3abc7 --- /dev/null +++ b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261202180832_005_SemiHybridSessionSupport.Designer.cs @@ -0,0 +1,797 @@ +// +using System; +using CodeBeam.UltimateAuth.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CodeBeam.UltimateAuth.IdentityLab.Migrations; + +[DbContext(typeof(UAuthDbContext))] +[Migration("20261202180832_005_SemiHybridSessionSupport")] +partial class _20261202180832_005_SemiHybridSessionSupport +{ + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "11.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore.AuthenticationSecurityStateProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CredentialType") + .HasColumnType("integer"); + + b.Property("FailedAttempts") + .HasColumnType("integer"); + + b.Property("LastFailedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("LockedUntil") + .HasColumnType("timestamp with time zone"); + + b.Property("RequiresReauthentication") + .HasColumnType("boolean"); + + b.Property("ResetAttempts") + .HasColumnType("integer"); + + b.Property("ResetConsumedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ResetExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ResetRequestedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ResetTokenHash") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("Scope") + .HasColumnType("integer"); + + b.Property("SecurityVersion") + .IsConcurrencyToken() + .HasColumnType("bigint"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "LockedUntil"); + + b.HasIndex("Tenant", "ResetRequestedAt"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "UserKey", "Scope"); + + var index = b.HasIndex("Tenant", "UserKey", "Scope", "CredentialType") + .IsUnique(); + + NpgsqlIndexBuilderExtensions.AreNullsDistinct(index, false); + + b.ToTable("UAuth_Authentication"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RolePermissionProjection", b => + { + b.Property("Tenant") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("Permission") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Tenant", "RoleId", "Permission"); + + b.HasIndex("Tenant", "Permission"); + + b.HasIndex("Tenant", "RoleId"); + + b.ToTable("UAuth_RolePermissions"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RoleProjection", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "Id") + .IsUnique(); + + b.HasIndex("Tenant", "NormalizedName") + .IsUnique(); + + b.ToTable("UAuth_Roles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.UserRoleProjection", b => + { + b.Property("Tenant") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("UserKey") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("AssignedAt") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Tenant", "UserKey", "RoleId"); + + b.HasIndex("Tenant", "RoleId"); + + b.HasIndex("Tenant", "UserKey"); + + b.ToTable("UAuth_UserRoles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordCredentialProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("LastUsedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("RevokedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("SecurityStamp") + .HasColumnType("uuid"); + + b.Property("Source") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "ExpiresAt"); + + b.HasIndex("Tenant", "Id") + .IsUnique(); + + b.HasIndex("Tenant", "RevokedAt"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "UserKey", "DeletedAt"); + + b.ToTable("UAuth_PasswordCredentials"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordHistoryProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CredentialId") + .HasColumnType("uuid"); + + b.Property("ReplacedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "CredentialId", "ReplacedAt", "Id"); + + b.ToTable("UAuth_PasswordHistory"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => + { + var id = b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(id); + + b.Property("AbsoluteExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ActiveSessionId") + .HasColumnType("text"); + + b.Property("ChainId") + .HasColumnType("uuid"); + + b.Property("ClaimsSnapshot") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Device") + .IsRequired() + .HasColumnType("text"); + + b.Property("DeviceId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("LastSeenAt") + .HasColumnType("timestamp with time zone"); + + b.Property("RevokedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("RootId") + .HasColumnType("uuid"); + + b.Property("RotationCount") + .HasColumnType("integer"); + + b.Property("SecurityVersionAtCreation") + .HasColumnType("bigint"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TouchCount") + .HasColumnType("integer"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "ChainId") + .IsUnique(); + + b.HasIndex("Tenant", "RootId"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "UserKey", "DeviceId"); + + b.ToTable("UAuth_SessionChains"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => + { + var id = b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(id); + + b.Property("ChainId") + .HasColumnType("uuid"); + + b.Property("Claims") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CredentialPurpose") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(0); + + b.Property("Device") + .IsRequired() + .HasColumnType("text"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Metadata") + .IsRequired() + .HasColumnType("text"); + + b.Property("RevokedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("SecurityVersionAtCreation") + .HasColumnType("bigint"); + + b.Property("SessionId") + .IsRequired() + .HasColumnType("text"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "ChainId"); + + b.HasIndex("Tenant", "ExpiresAt"); + + b.HasIndex("Tenant", "RevokedAt"); + + b.HasIndex("Tenant", "SessionId") + .IsUnique(); + + b.HasIndex("Tenant", "ChainId", "RevokedAt"); + + b.HasIndex("Tenant", "UserKey", "RevokedAt"); + + b.ToTable("UAuth_Sessions"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", b => + { + var id = b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(id); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("RevokedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("RootId") + .HasMaxLength(128) + .HasColumnType("uuid"); + + b.Property("SecurityVersion") + .HasColumnType("bigint"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "RootId") + .IsUnique(); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "UserKey", "RevokedAt"); + + b.ToTable("UAuth_SessionRoots"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Tokens.EntityFrameworkCore.RefreshTokenProjection", b => + { + var id = b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(id); + + b.Property("AuthenticatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DeviceId") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("RefreshChainId") + .HasColumnType("uuid"); + + b.Property("ReplacedByTokenHash") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("RevokedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("SessionChainId") + .HasColumnType("uuid"); + + b.Property("SessionId") + .HasColumnType("text"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TokenHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TokenId") + .HasColumnType("uuid"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "ExpiresAt"); + + b.HasIndex("Tenant", "RefreshChainId"); + + b.HasIndex("Tenant", "ReplacedByTokenHash"); + + b.HasIndex("Tenant", "SessionChainId"); + + b.HasIndex("Tenant", "SessionId"); + + b.HasIndex("Tenant", "TokenHash") + .IsUnique(); + + b.HasIndex("Tenant", "TokenId"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "ExpiresAt", "RevokedAt"); + + b.HasIndex("Tenant", "TokenHash", "RevokedAt"); + + b.HasIndex("Tenant", "UserKey", "DeviceId"); + + b.ToTable("UAuth_RefreshTokens"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserIdentifierProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("IsPrimary") + .HasColumnType("boolean"); + + b.Property("NormalizedValue") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("VerifiedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "NormalizedValue"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "Type", "NormalizedValue") + .IsUnique(); + + b.HasIndex("Tenant", "UserKey", "IsPrimary"); + + b.HasIndex("Tenant", "UserKey", "Type", "IsPrimary", "DeletedAt", "CreatedAt", "Id"); + + b.ToTable("UAuth_UserIdentifiers"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserLifecycleProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("SecurityVersion") + .HasColumnType("bigint"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "UserKey") + .IsUnique(); + + b.HasIndex("Tenant", "DeletedAt", "CreatedAt", "Id"); + + b.HasIndex("Tenant", "Status", "DeletedAt", "CreatedAt", "Id"); + + b.ToTable("UAuth_UserLifecycles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserProfileProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Bio") + .HasMaxLength(4096) + .HasColumnType("character varying(4096)"); + + b.Property("BirthDate") + .HasColumnType("date"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Culture") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DisplayName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("FirstName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Gender") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Language") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("LastName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Metadata") + .HasColumnType("text"); + + b.Property("ProfileKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TimeZone") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "UserKey", "ProfileKey") + .IsUnique(); + + b.ToTable("UAuth_UserProfiles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => + { + b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", null) + .WithMany() + .HasForeignKey("Tenant", "RootId") + .HasPrincipalKey("Tenant", "RootId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => + { + b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", null) + .WithMany() + .HasForeignKey("Tenant", "ChainId") + .HasPrincipalKey("Tenant", "ChainId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } +} diff --git a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261202180832_005_SemiHybridSessionSupport.cs b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261202180832_005_SemiHybridSessionSupport.cs new file mode 100644 index 00000000..3e33b905 --- /dev/null +++ b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261202180832_005_SemiHybridSessionSupport.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CodeBeam.UltimateAuth.IdentityLab.Migrations; + +/// +public partial class _20261202180832_005_SemiHybridSessionSupport : Migration +{ + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CredentialPurpose", + table: "UAuth_Sessions", + type: "integer", + nullable: false, + defaultValue: 0); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "CredentialPurpose", + table: "UAuth_Sessions"); + } +} diff --git a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/UAuthDbContextModelSnapshot.cs b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/UAuthDbContextModelSnapshot.cs index 89a7e14a..7edbd686 100644 --- a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/UAuthDbContextModelSnapshot.cs +++ b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/UAuthDbContextModelSnapshot.cs @@ -1,4 +1,4 @@ -// +// using System; using CodeBeam.UltimateAuth.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; @@ -8,783 +8,792 @@ #nullable disable -namespace CodeBeam.UltimateAuth.IdentityLab.Migrations +namespace CodeBeam.UltimateAuth.IdentityLab.Migrations; + +[DbContext(typeof(UAuthDbContext))] +partial class UAuthDbContextModelSnapshot : ModelSnapshot { - [DbContext(typeof(UAuthDbContext))] - partial class UAuthDbContextModelSnapshot : ModelSnapshot + // If you encounter a merge conflict in the line below, it means you need to + // discard one of the migration branches and recreate its migrations on top of + // the other branch. See https://aka.ms/efcore-docs-migrations-conflicts for more info. + public override string LastMigrationId => "20261202180832_005_SemiHybridSessionSupport"; + + protected override void BuildModel(ModelBuilder modelBuilder) { - protected override void BuildModel(ModelBuilder modelBuilder) - { #pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.14") - .HasAnnotation("Relational:MaxIdentifierLength", 63); + modelBuilder + .HasAnnotation("ProductVersion", "11.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + modelBuilder.Entity("CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore.AuthenticationSecurityStateProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore.AuthenticationSecurityStateProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); + b.Property("CredentialType") + .HasColumnType("integer"); - b.Property("CredentialType") - .HasColumnType("integer"); + b.Property("FailedAttempts") + .HasColumnType("integer"); - b.Property("FailedAttempts") - .HasColumnType("integer"); + b.Property("LastFailedAt") + .HasColumnType("timestamp with time zone"); - b.Property("LastFailedAt") - .HasColumnType("timestamp with time zone"); + b.Property("LockedUntil") + .HasColumnType("timestamp with time zone"); - b.Property("LockedUntil") - .HasColumnType("timestamp with time zone"); + b.Property("RequiresReauthentication") + .HasColumnType("boolean"); - b.Property("RequiresReauthentication") - .HasColumnType("boolean"); + b.Property("ResetAttempts") + .HasColumnType("integer"); - b.Property("ResetAttempts") - .HasColumnType("integer"); + b.Property("ResetConsumedAt") + .HasColumnType("timestamp with time zone"); - b.Property("ResetConsumedAt") - .HasColumnType("timestamp with time zone"); + b.Property("ResetExpiresAt") + .HasColumnType("timestamp with time zone"); - b.Property("ResetExpiresAt") - .HasColumnType("timestamp with time zone"); + b.Property("ResetRequestedAt") + .HasColumnType("timestamp with time zone"); - b.Property("ResetRequestedAt") - .HasColumnType("timestamp with time zone"); + b.Property("ResetTokenHash") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); - b.Property("ResetTokenHash") - .HasMaxLength(512) - .HasColumnType("character varying(512)"); + b.Property("Scope") + .HasColumnType("integer"); - b.Property("Scope") - .HasColumnType("integer"); + b.Property("SecurityVersion") + .IsConcurrencyToken() + .HasColumnType("bigint"); - b.Property("SecurityVersion") - .IsConcurrencyToken() - .HasColumnType("bigint"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "LockedUntil"); - b.HasIndex("Tenant", "LockedUntil"); + b.HasIndex("Tenant", "ResetRequestedAt"); - b.HasIndex("Tenant", "ResetRequestedAt"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey", "Scope"); - b.HasIndex("Tenant", "UserKey", "Scope"); + var index = b.HasIndex("Tenant", "UserKey", "Scope", "CredentialType") + .IsUnique(); - b.HasIndex("Tenant", "UserKey", "Scope", "CredentialType") - .IsUnique(); + NpgsqlIndexBuilderExtensions.AreNullsDistinct(index, false); - NpgsqlIndexBuilderExtensions.AreNullsDistinct(b.HasIndex("Tenant", "UserKey", "Scope", "CredentialType"), false); + b.ToTable("UAuth_Authentication"); + }); - b.ToTable("UAuth_Authentication", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RolePermissionProjection", b => + { + b.Property("Tenant") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RolePermissionProjection", b => - { - b.Property("Tenant") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("RoleId") + .HasColumnType("uuid"); - b.Property("RoleId") - .HasColumnType("uuid"); + b.Property("Permission") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); - b.Property("Permission") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); + b.HasKey("Tenant", "RoleId", "Permission"); - b.HasKey("Tenant", "RoleId", "Permission"); + b.HasIndex("Tenant", "Permission"); - b.HasIndex("Tenant", "Permission"); + b.HasIndex("Tenant", "RoleId"); - b.HasIndex("Tenant", "RoleId"); + b.ToTable("UAuth_RolePermissions"); + }); - b.ToTable("UAuth_RolePermissions", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RoleProjection", b => + { + b.Property("Id") + .HasColumnType("uuid"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RoleProjection", b => - { - b.Property("Id") - .HasColumnType("uuid"); + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("bigint"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "Id") + .IsUnique(); - b.HasIndex("Tenant", "Id") - .IsUnique(); + b.HasIndex("Tenant", "NormalizedName") + .IsUnique(); - b.HasIndex("Tenant", "NormalizedName") - .IsUnique(); + b.ToTable("UAuth_Roles"); + }); - b.ToTable("UAuth_Roles", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.UserRoleProjection", b => + { + b.Property("Tenant") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.UserRoleProjection", b => - { - b.Property("Tenant") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("UserKey") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("UserKey") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("RoleId") + .HasColumnType("uuid"); - b.Property("RoleId") - .HasColumnType("uuid"); + b.Property("AssignedAt") + .HasColumnType("timestamp with time zone"); - b.Property("AssignedAt") - .HasColumnType("timestamp with time zone"); + b.HasKey("Tenant", "UserKey", "RoleId"); - b.HasKey("Tenant", "UserKey", "RoleId"); + b.HasIndex("Tenant", "RoleId"); - b.HasIndex("Tenant", "RoleId"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.ToTable("UAuth_UserRoles"); + }); - b.ToTable("UAuth_UserRoles", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordCredentialProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordCredentialProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone"); + b.Property("LastUsedAt") + .HasColumnType("timestamp with time zone"); - b.Property("LastUsedAt") - .HasColumnType("timestamp with time zone"); + b.Property("RevokedAt") + .HasColumnType("timestamp with time zone"); - b.Property("RevokedAt") - .HasColumnType("timestamp with time zone"); + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); - b.Property("SecretHash") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("character varying(512)"); + b.Property("SecurityStamp") + .HasColumnType("uuid"); - b.Property("SecurityStamp") - .HasColumnType("uuid"); + b.Property("Source") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Source") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("bigint"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "ExpiresAt"); - b.HasIndex("Tenant", "ExpiresAt"); + b.HasIndex("Tenant", "Id") + .IsUnique(); - b.HasIndex("Tenant", "Id") - .IsUnique(); + b.HasIndex("Tenant", "RevokedAt"); - b.HasIndex("Tenant", "RevokedAt"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey", "DeletedAt"); - b.HasIndex("Tenant", "UserKey", "DeletedAt"); + b.ToTable("UAuth_PasswordCredentials"); + }); - b.ToTable("UAuth_PasswordCredentials", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordHistoryProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordHistoryProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); + b.Property("CredentialId") + .HasColumnType("uuid"); - b.Property("CredentialId") - .HasColumnType("uuid"); + b.Property("ReplacedAt") + .HasColumnType("timestamp with time zone"); - b.Property("ReplacedAt") - .HasColumnType("timestamp with time zone"); + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("character varying(512)"); - b.Property("SecretHash") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("character varying(512)"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "CredentialId", "ReplacedAt", "Id"); - b.HasIndex("Tenant", "CredentialId", "ReplacedAt", "Id"); + b.ToTable("UAuth_PasswordHistory"); + }); - b.ToTable("UAuth_PasswordHistory", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => + { + var id = b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(id); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("AbsoluteExpiresAt") + .HasColumnType("timestamp with time zone"); - b.Property("AbsoluteExpiresAt") - .HasColumnType("timestamp with time zone"); + b.Property("ActiveSessionId") + .HasColumnType("text"); - b.Property("ActiveSessionId") - .HasColumnType("text"); + b.Property("ChainId") + .HasColumnType("uuid"); - b.Property("ChainId") - .HasColumnType("uuid"); + b.Property("ClaimsSnapshot") + .IsRequired() + .HasColumnType("text"); - b.Property("ClaimsSnapshot") - .IsRequired() - .HasColumnType("text"); + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("Device") + .IsRequired() + .HasColumnType("text"); - b.Property("Device") - .IsRequired() - .HasColumnType("text"); + b.Property("DeviceId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); + b.Property("LastSeenAt") + .HasColumnType("timestamp with time zone"); - b.Property("LastSeenAt") - .HasColumnType("timestamp with time zone"); + b.Property("RevokedAt") + .HasColumnType("timestamp with time zone"); - b.Property("RevokedAt") - .HasColumnType("timestamp with time zone"); + b.Property("RootId") + .HasColumnType("uuid"); - b.Property("RootId") - .HasColumnType("uuid"); + b.Property("RotationCount") + .HasColumnType("integer"); - b.Property("RotationCount") - .HasColumnType("integer"); + b.Property("SecurityVersionAtCreation") + .HasColumnType("bigint"); - b.Property("SecurityVersionAtCreation") - .HasColumnType("bigint"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("TouchCount") + .HasColumnType("integer"); - b.Property("TouchCount") - .HasColumnType("integer"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("bigint"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "ChainId") + .IsUnique(); - b.HasIndex("Tenant", "ChainId") - .IsUnique(); + b.HasIndex("Tenant", "RootId"); - b.HasIndex("Tenant", "RootId"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey", "DeviceId"); - b.HasIndex("Tenant", "UserKey", "DeviceId"); + b.ToTable("UAuth_SessionChains"); + }); - b.ToTable("UAuth_SessionChains", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => + { + var id = b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(id); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("ChainId") + .HasColumnType("uuid"); - b.Property("ChainId") - .HasColumnType("uuid"); + b.Property("Claims") + .IsRequired() + .HasColumnType("text"); - b.Property("Claims") - .IsRequired() - .HasColumnType("text"); + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("CredentialPurpose") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(0); - b.Property("Device") - .IsRequired() - .HasColumnType("text"); + b.Property("Device") + .IsRequired() + .HasColumnType("text"); - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone"); + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); - b.Property("Metadata") - .IsRequired() - .HasColumnType("text"); + b.Property("Metadata") + .IsRequired() + .HasColumnType("text"); - b.Property("RevokedAt") - .HasColumnType("timestamp with time zone"); + b.Property("RevokedAt") + .HasColumnType("timestamp with time zone"); - b.Property("SecurityVersionAtCreation") - .HasColumnType("bigint"); + b.Property("SecurityVersionAtCreation") + .HasColumnType("bigint"); - b.Property("SessionId") - .IsRequired() - .HasColumnType("text"); + b.Property("SessionId") + .IsRequired() + .HasColumnType("text"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("bigint"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "ChainId"); + b.HasIndex("Tenant", "ChainId"); - b.HasIndex("Tenant", "ExpiresAt"); + b.HasIndex("Tenant", "ExpiresAt"); - b.HasIndex("Tenant", "RevokedAt"); + b.HasIndex("Tenant", "RevokedAt"); - b.HasIndex("Tenant", "SessionId") - .IsUnique(); + b.HasIndex("Tenant", "SessionId") + .IsUnique(); - b.HasIndex("Tenant", "ChainId", "RevokedAt"); + b.HasIndex("Tenant", "ChainId", "RevokedAt"); - b.HasIndex("Tenant", "UserKey", "RevokedAt"); + b.HasIndex("Tenant", "UserKey", "RevokedAt"); - b.ToTable("UAuth_Sessions", (string)null); - }); + b.ToTable("UAuth_Sessions"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", b => + { + var id = b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(id); - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("RevokedAt") - .HasColumnType("timestamp with time zone"); + b.Property("RevokedAt") + .HasColumnType("timestamp with time zone"); - b.Property("RootId") - .HasMaxLength(128) - .HasColumnType("uuid"); + b.Property("RootId") + .HasMaxLength(128) + .HasColumnType("uuid"); - b.Property("SecurityVersion") - .HasColumnType("bigint"); + b.Property("SecurityVersion") + .HasColumnType("bigint"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("bigint"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "RootId") - .IsUnique(); + b.HasIndex("Tenant", "RootId") + .IsUnique(); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey", "RevokedAt"); + b.HasIndex("Tenant", "UserKey", "RevokedAt"); - b.ToTable("UAuth_SessionRoots", (string)null); - }); + b.ToTable("UAuth_SessionRoots"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Tokens.EntityFrameworkCore.RefreshTokenProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Tokens.EntityFrameworkCore.RefreshTokenProjection", b => + { + var id = b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(id); - b.Property("AuthenticatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("AuthenticatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); + b.Property("DeviceId") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); - b.Property("ExpiresAt") - .HasColumnType("timestamp with time zone"); + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); - b.Property("RefreshChainId") - .HasColumnType("uuid"); + b.Property("RefreshChainId") + .HasColumnType("uuid"); - b.Property("ReplacedByTokenHash") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("ReplacedByTokenHash") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("RevokedAt") - .HasColumnType("timestamp with time zone"); + b.Property("RevokedAt") + .HasColumnType("timestamp with time zone"); - b.Property("SessionChainId") - .HasColumnType("uuid"); + b.Property("SessionChainId") + .HasColumnType("uuid"); - b.Property("SessionId") - .HasColumnType("text"); + b.Property("SessionId") + .HasColumnType("text"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("TokenHash") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("TokenHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("TokenId") - .HasColumnType("uuid"); + b.Property("TokenId") + .HasColumnType("uuid"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("bigint"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "ExpiresAt"); + b.HasIndex("Tenant", "ExpiresAt"); - b.HasIndex("Tenant", "RefreshChainId"); + b.HasIndex("Tenant", "RefreshChainId"); - b.HasIndex("Tenant", "ReplacedByTokenHash"); + b.HasIndex("Tenant", "ReplacedByTokenHash"); - b.HasIndex("Tenant", "SessionChainId"); + b.HasIndex("Tenant", "SessionChainId"); - b.HasIndex("Tenant", "SessionId"); + b.HasIndex("Tenant", "SessionId"); - b.HasIndex("Tenant", "TokenHash") - .IsUnique(); + b.HasIndex("Tenant", "TokenHash") + .IsUnique(); - b.HasIndex("Tenant", "TokenId"); + b.HasIndex("Tenant", "TokenId"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "ExpiresAt", "RevokedAt"); + b.HasIndex("Tenant", "ExpiresAt", "RevokedAt"); - b.HasIndex("Tenant", "TokenHash", "RevokedAt"); + b.HasIndex("Tenant", "TokenHash", "RevokedAt"); - b.HasIndex("Tenant", "UserKey", "DeviceId"); + b.HasIndex("Tenant", "UserKey", "DeviceId"); - b.ToTable("UAuth_RefreshTokens", (string)null); - }); + b.ToTable("UAuth_RefreshTokens"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserIdentifierProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserIdentifierProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); - b.Property("IsPrimary") - .HasColumnType("boolean"); + b.Property("IsPrimary") + .HasColumnType("boolean"); - b.Property("NormalizedValue") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); + b.Property("NormalizedValue") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Type") - .HasColumnType("integer"); + b.Property("Type") + .HasColumnType("integer"); - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Value") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)"); + b.Property("Value") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); + b.Property("VerifiedAt") + .HasColumnType("timestamp with time zone"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("bigint"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "NormalizedValue"); + b.HasIndex("Tenant", "NormalizedValue"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "Type", "NormalizedValue") - .IsUnique(); + b.HasIndex("Tenant", "Type", "NormalizedValue") + .IsUnique(); - b.HasIndex("Tenant", "UserKey", "IsPrimary"); + b.HasIndex("Tenant", "UserKey", "IsPrimary"); - b.HasIndex("Tenant", "UserKey", "Type", "IsPrimary", "DeletedAt", "CreatedAt", "Id"); + b.HasIndex("Tenant", "UserKey", "Type", "IsPrimary", "DeletedAt", "CreatedAt", "Id"); - b.ToTable("UAuth_UserIdentifiers", (string)null); - }); + b.ToTable("UAuth_UserIdentifiers"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserLifecycleProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserLifecycleProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); - b.Property("SecurityVersion") - .HasColumnType("bigint"); + b.Property("SecurityVersion") + .HasColumnType("bigint"); - b.Property("Status") - .HasColumnType("integer"); + b.Property("Status") + .HasColumnType("integer"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("bigint"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "UserKey") - .IsUnique(); + b.HasIndex("Tenant", "UserKey") + .IsUnique(); - b.HasIndex("Tenant", "DeletedAt", "CreatedAt", "Id"); + b.HasIndex("Tenant", "DeletedAt", "CreatedAt", "Id"); - b.HasIndex("Tenant", "Status", "DeletedAt", "CreatedAt", "Id"); + b.HasIndex("Tenant", "Status", "DeletedAt", "CreatedAt", "Id"); - b.ToTable("UAuth_UserLifecycles", (string)null); - }); + b.ToTable("UAuth_UserLifecycles"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserProfileProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserProfileProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("character varying(4096)"); + b.Property("Bio") + .HasMaxLength(4096) + .HasColumnType("character varying(4096)"); - b.Property("BirthDate") - .HasColumnType("date"); + b.Property("BirthDate") + .HasColumnType("date"); - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("Culture") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); + b.Property("Culture") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); + b.Property("DeletedAt") + .HasColumnType("timestamp with time zone"); - b.Property("DisplayName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); + b.Property("DisplayName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); - b.Property("FirstName") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("FirstName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Gender") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("Gender") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Language") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); + b.Property("Language") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); - b.Property("LastName") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("LastName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Metadata") - .HasColumnType("text"); + b.Property("Metadata") + .HasColumnType("text"); - b.Property("ProfileKey") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); + b.Property("ProfileKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("TimeZone") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("TimeZone") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("bigint"); - - b.HasKey("Id"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("bigint"); + + b.HasKey("Id"); - b.HasIndex("Tenant", "UserKey", "ProfileKey") - .IsUnique(); + b.HasIndex("Tenant", "UserKey", "ProfileKey") + .IsUnique(); - b.ToTable("UAuth_UserProfiles", (string)null); - }); - - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => - { - b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", null) - .WithMany() - .HasForeignKey("Tenant", "RootId") - .HasPrincipalKey("Tenant", "RootId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); + b.ToTable("UAuth_UserProfiles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => + { + b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", null) + .WithMany() + .HasForeignKey("Tenant", "RootId") + .HasPrincipalKey("Tenant", "RootId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => - { - b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", null) - .WithMany() - .HasForeignKey("Tenant", "ChainId") - .HasPrincipalKey("Tenant", "ChainId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => + { + b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", null) + .WithMany() + .HasForeignKey("Tenant", "ChainId") + .HasPrincipalKey("Tenant", "ChainId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); #pragma warning restore 612, 618 - } } } diff --git a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/20261202180730_005_SemiHybridSessionSupport.Designer.cs b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/20261202180730_005_SemiHybridSessionSupport.Designer.cs new file mode 100644 index 00000000..de90292b --- /dev/null +++ b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/20261202180730_005_SemiHybridSessionSupport.Designer.cs @@ -0,0 +1,783 @@ +// +using System; +using CodeBeam.UltimateAuth.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore.Migrations; + +[DbContext(typeof(UAuthDbContext))] +[Migration("20261202180730_005_SemiHybridSessionSupport")] +partial class _20261202180730_005_SemiHybridSessionSupport +{ + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "11.0.0"); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore.AuthenticationSecurityStateProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CredentialType") + .HasColumnType("INTEGER"); + + b.Property("FailedAttempts") + .HasColumnType("INTEGER"); + + b.Property("LastFailedAt") + .HasColumnType("TEXT"); + + b.Property("LockedUntil") + .HasColumnType("TEXT"); + + b.Property("RequiresReauthentication") + .HasColumnType("INTEGER"); + + b.Property("ResetAttempts") + .HasColumnType("INTEGER"); + + b.Property("ResetConsumedAt") + .HasColumnType("TEXT"); + + b.Property("ResetExpiresAt") + .HasColumnType("TEXT"); + + b.Property("ResetRequestedAt") + .HasColumnType("TEXT"); + + b.Property("ResetTokenHash") + .HasMaxLength(512) + .HasColumnType("TEXT"); + + b.Property("Scope") + .HasColumnType("INTEGER"); + + b.Property("SecurityVersion") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "LockedUntil"); + + b.HasIndex("Tenant", "ResetRequestedAt"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "UserKey", "Scope"); + + b.HasIndex("Tenant", "UserKey", "Scope", "CredentialType") + .IsUnique() + .HasAnnotation("Npgsql:NullsDistinct", false); + + b.ToTable("UAuth_Authentication"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RolePermissionProjection", b => + { + b.Property("Tenant") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.Property("Permission") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Tenant", "RoleId", "Permission"); + + b.HasIndex("Tenant", "Permission"); + + b.HasIndex("Tenant", "RoleId"); + + b.ToTable("UAuth_RolePermissions"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RoleProjection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "Id") + .IsUnique(); + + b.HasIndex("Tenant", "NormalizedName") + .IsUnique(); + + b.ToTable("UAuth_Roles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.UserRoleProjection", b => + { + b.Property("Tenant") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UserKey") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.Property("AssignedAt") + .HasColumnType("TEXT"); + + b.HasKey("Tenant", "UserKey", "RoleId"); + + b.HasIndex("Tenant", "RoleId"); + + b.HasIndex("Tenant", "UserKey"); + + b.ToTable("UAuth_UserRoles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordCredentialProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("TEXT"); + + b.Property("ExpiresAt") + .HasColumnType("TEXT"); + + b.Property("LastUsedAt") + .HasColumnType("TEXT"); + + b.Property("RevokedAt") + .HasColumnType("TEXT"); + + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("TEXT"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("Source") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "ExpiresAt"); + + b.HasIndex("Tenant", "Id") + .IsUnique(); + + b.HasIndex("Tenant", "RevokedAt"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "UserKey", "DeletedAt"); + + b.ToTable("UAuth_PasswordCredentials"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordHistoryProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CredentialId") + .HasColumnType("TEXT"); + + b.Property("ReplacedAt") + .HasColumnType("TEXT"); + + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "CredentialId", "ReplacedAt", "Id"); + + b.ToTable("UAuth_PasswordHistory"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AbsoluteExpiresAt") + .HasColumnType("TEXT"); + + b.Property("ActiveSessionId") + .HasColumnType("TEXT"); + + b.Property("ChainId") + .HasColumnType("TEXT"); + + b.Property("ClaimsSnapshot") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("Device") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("DeviceId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("LastSeenAt") + .HasColumnType("TEXT"); + + b.Property("RevokedAt") + .HasColumnType("TEXT"); + + b.Property("RootId") + .HasColumnType("TEXT"); + + b.Property("RotationCount") + .HasColumnType("INTEGER"); + + b.Property("SecurityVersionAtCreation") + .HasColumnType("INTEGER"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("TouchCount") + .HasColumnType("INTEGER"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "ChainId") + .IsUnique(); + + b.HasIndex("Tenant", "RootId"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "UserKey", "DeviceId"); + + b.ToTable("UAuth_SessionChains"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ChainId") + .HasColumnType("TEXT"); + + b.Property("Claims") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("CredentialPurpose") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(0); + + b.Property("Device") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ExpiresAt") + .HasColumnType("TEXT"); + + b.Property("Metadata") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RevokedAt") + .HasColumnType("TEXT"); + + b.Property("SecurityVersionAtCreation") + .HasColumnType("INTEGER"); + + b.Property("SessionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "ChainId"); + + b.HasIndex("Tenant", "ExpiresAt"); + + b.HasIndex("Tenant", "RevokedAt"); + + b.HasIndex("Tenant", "SessionId") + .IsUnique(); + + b.HasIndex("Tenant", "ChainId", "RevokedAt"); + + b.HasIndex("Tenant", "UserKey", "RevokedAt"); + + b.ToTable("UAuth_Sessions"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("RevokedAt") + .HasColumnType("TEXT"); + + b.Property("RootId") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("SecurityVersion") + .HasColumnType("INTEGER"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "RootId") + .IsUnique(); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "UserKey", "RevokedAt"); + + b.ToTable("UAuth_SessionRoots"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Tokens.EntityFrameworkCore.RefreshTokenProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AuthenticatedAt") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("DeviceId") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("ExpiresAt") + .HasColumnType("TEXT"); + + b.Property("RefreshChainId") + .HasColumnType("TEXT"); + + b.Property("ReplacedByTokenHash") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("RevokedAt") + .HasColumnType("TEXT"); + + b.Property("SessionChainId") + .HasColumnType("TEXT"); + + b.Property("SessionId") + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("TokenHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("TokenId") + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "ExpiresAt"); + + b.HasIndex("Tenant", "RefreshChainId"); + + b.HasIndex("Tenant", "ReplacedByTokenHash"); + + b.HasIndex("Tenant", "SessionChainId"); + + b.HasIndex("Tenant", "SessionId"); + + b.HasIndex("Tenant", "TokenHash") + .IsUnique(); + + b.HasIndex("Tenant", "TokenId"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "ExpiresAt", "RevokedAt"); + + b.HasIndex("Tenant", "TokenHash", "RevokedAt"); + + b.HasIndex("Tenant", "UserKey", "DeviceId"); + + b.ToTable("UAuth_RefreshTokens"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserIdentifierProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("TEXT"); + + b.Property("IsPrimary") + .HasColumnType("INTEGER"); + + b.Property("NormalizedValue") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("VerifiedAt") + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "NormalizedValue"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "Type", "NormalizedValue") + .IsUnique(); + + b.HasIndex("Tenant", "UserKey", "IsPrimary"); + + b.HasIndex("Tenant", "UserKey", "Type", "IsPrimary", "DeletedAt", "CreatedAt", "Id"); + + b.ToTable("UAuth_UserIdentifiers"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserLifecycleProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("TEXT"); + + b.Property("SecurityVersion") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("INTEGER"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "UserKey") + .IsUnique(); + + b.HasIndex("Tenant", "DeletedAt", "CreatedAt", "Id"); + + b.HasIndex("Tenant", "Status", "DeletedAt", "CreatedAt", "Id"); + + b.ToTable("UAuth_UserLifecycles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserProfileProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Bio") + .HasMaxLength(4096) + .HasColumnType("TEXT"); + + b.Property("BirthDate") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("Culture") + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("FirstName") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Gender") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Language") + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("LastName") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Metadata") + .HasColumnType("TEXT"); + + b.Property("ProfileKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("TimeZone") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "UserKey", "ProfileKey") + .IsUnique(); + + b.ToTable("UAuth_UserProfiles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => + { + b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", null) + .WithMany() + .HasForeignKey("Tenant", "RootId") + .HasPrincipalKey("Tenant", "RootId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => + { + b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", null) + .WithMany() + .HasForeignKey("Tenant", "ChainId") + .HasPrincipalKey("Tenant", "ChainId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } +} diff --git a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/20261202180730_005_SemiHybridSessionSupport.cs b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/20261202180730_005_SemiHybridSessionSupport.cs new file mode 100644 index 00000000..ad22a101 --- /dev/null +++ b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/20261202180730_005_SemiHybridSessionSupport.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore.Migrations; + +/// +public partial class _20261202180730_005_SemiHybridSessionSupport : Migration +{ + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CredentialPurpose", + table: "UAuth_Sessions", + type: "INTEGER", + nullable: false, + defaultValue: 0); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "CredentialPurpose", + table: "UAuth_Sessions"); + } +} diff --git a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/UAuthDbContextModelSnapshot.cs b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/UAuthDbContextModelSnapshot.cs index b70b7b10..b074715b 100644 --- a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/UAuthDbContextModelSnapshot.cs +++ b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/UAuthDbContextModelSnapshot.cs @@ -1,4 +1,4 @@ -// +// using System; using CodeBeam.UltimateAuth.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; @@ -7,770 +7,779 @@ #nullable disable -namespace CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore.Migrations +namespace CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore.Migrations; + +[DbContext(typeof(UAuthDbContext))] +partial class UAuthDbContextModelSnapshot : ModelSnapshot { - [DbContext(typeof(UAuthDbContext))] - partial class UAuthDbContextModelSnapshot : ModelSnapshot + // If you encounter a merge conflict in the line below, it means you need to + // discard one of the migration branches and recreate its migrations on top of + // the other branch. See https://aka.ms/efcore-docs-migrations-conflicts for more info. + public override string LastMigrationId => "20261202180730_005_SemiHybridSessionSupport"; + + protected override void BuildModel(ModelBuilder modelBuilder) { - protected override void BuildModel(ModelBuilder modelBuilder) - { #pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.14"); + modelBuilder.HasAnnotation("ProductVersion", "11.0.0"); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore.AuthenticationSecurityStateProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore.AuthenticationSecurityStateProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + b.Property("CredentialType") + .HasColumnType("INTEGER"); - b.Property("CredentialType") - .HasColumnType("INTEGER"); + b.Property("FailedAttempts") + .HasColumnType("INTEGER"); - b.Property("FailedAttempts") - .HasColumnType("INTEGER"); + b.Property("LastFailedAt") + .HasColumnType("TEXT"); - b.Property("LastFailedAt") - .HasColumnType("TEXT"); + b.Property("LockedUntil") + .HasColumnType("TEXT"); - b.Property("LockedUntil") - .HasColumnType("TEXT"); + b.Property("RequiresReauthentication") + .HasColumnType("INTEGER"); - b.Property("RequiresReauthentication") - .HasColumnType("INTEGER"); + b.Property("ResetAttempts") + .HasColumnType("INTEGER"); - b.Property("ResetAttempts") - .HasColumnType("INTEGER"); + b.Property("ResetConsumedAt") + .HasColumnType("TEXT"); - b.Property("ResetConsumedAt") - .HasColumnType("TEXT"); + b.Property("ResetExpiresAt") + .HasColumnType("TEXT"); - b.Property("ResetExpiresAt") - .HasColumnType("TEXT"); + b.Property("ResetRequestedAt") + .HasColumnType("TEXT"); - b.Property("ResetRequestedAt") - .HasColumnType("TEXT"); + b.Property("ResetTokenHash") + .HasMaxLength(512) + .HasColumnType("TEXT"); - b.Property("ResetTokenHash") - .HasMaxLength(512) - .HasColumnType("TEXT"); + b.Property("Scope") + .HasColumnType("INTEGER"); - b.Property("Scope") - .HasColumnType("INTEGER"); + b.Property("SecurityVersion") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.Property("SecurityVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "LockedUntil"); - b.HasIndex("Tenant", "LockedUntil"); + b.HasIndex("Tenant", "ResetRequestedAt"); - b.HasIndex("Tenant", "ResetRequestedAt"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey", "Scope"); - b.HasIndex("Tenant", "UserKey", "Scope"); + b.HasIndex("Tenant", "UserKey", "Scope", "CredentialType") + .IsUnique() + .HasAnnotation("Npgsql:NullsDistinct", false); - b.HasIndex("Tenant", "UserKey", "Scope", "CredentialType") - .IsUnique() - .HasAnnotation("Npgsql:NullsDistinct", false); + b.ToTable("UAuth_Authentication"); + }); - b.ToTable("UAuth_Authentication", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RolePermissionProjection", b => + { + b.Property("Tenant") + .HasMaxLength(128) + .HasColumnType("TEXT"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RolePermissionProjection", b => - { - b.Property("Tenant") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("RoleId") + .HasColumnType("TEXT"); - b.Property("RoleId") - .HasColumnType("TEXT"); + b.Property("Permission") + .HasMaxLength(256) + .HasColumnType("TEXT"); - b.Property("Permission") - .HasMaxLength(256) - .HasColumnType("TEXT"); + b.HasKey("Tenant", "RoleId", "Permission"); - b.HasKey("Tenant", "RoleId", "Permission"); + b.HasIndex("Tenant", "Permission"); - b.HasIndex("Tenant", "Permission"); + b.HasIndex("Tenant", "RoleId"); - b.HasIndex("Tenant", "RoleId"); + b.ToTable("UAuth_RolePermissions"); + }); - b.ToTable("UAuth_RolePermissions", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RoleProjection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RoleProjection", b => - { - b.Property("Id") - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("DeletedAt") + .HasColumnType("TEXT"); - b.Property("DeletedAt") - .HasColumnType("TEXT"); + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UpdatedAt") + .HasColumnType("TEXT"); - b.Property("UpdatedAt") - .HasColumnType("TEXT"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "Id") + .IsUnique(); - b.HasIndex("Tenant", "Id") - .IsUnique(); + b.HasIndex("Tenant", "NormalizedName") + .IsUnique(); - b.HasIndex("Tenant", "NormalizedName") - .IsUnique(); + b.ToTable("UAuth_Roles"); + }); - b.ToTable("UAuth_Roles", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.UserRoleProjection", b => + { + b.Property("Tenant") + .HasMaxLength(128) + .HasColumnType("TEXT"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.UserRoleProjection", b => - { - b.Property("Tenant") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UserKey") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("RoleId") + .HasColumnType("TEXT"); - b.Property("RoleId") - .HasColumnType("TEXT"); + b.Property("AssignedAt") + .HasColumnType("TEXT"); - b.Property("AssignedAt") - .HasColumnType("TEXT"); + b.HasKey("Tenant", "UserKey", "RoleId"); - b.HasKey("Tenant", "UserKey", "RoleId"); + b.HasIndex("Tenant", "RoleId"); - b.HasIndex("Tenant", "RoleId"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.ToTable("UAuth_UserRoles"); + }); - b.ToTable("UAuth_UserRoles", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordCredentialProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordCredentialProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("DeletedAt") + .HasColumnType("TEXT"); - b.Property("DeletedAt") - .HasColumnType("TEXT"); + b.Property("ExpiresAt") + .HasColumnType("TEXT"); - b.Property("ExpiresAt") - .HasColumnType("TEXT"); + b.Property("LastUsedAt") + .HasColumnType("TEXT"); - b.Property("LastUsedAt") - .HasColumnType("TEXT"); + b.Property("RevokedAt") + .HasColumnType("TEXT"); - b.Property("RevokedAt") - .HasColumnType("TEXT"); + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("TEXT"); - b.Property("SecretHash") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); + b.Property("SecurityStamp") + .HasColumnType("TEXT"); - b.Property("SecurityStamp") - .HasColumnType("TEXT"); + b.Property("Source") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Source") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UpdatedAt") + .HasColumnType("TEXT"); - b.Property("UpdatedAt") - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "ExpiresAt"); - b.HasIndex("Tenant", "ExpiresAt"); + b.HasIndex("Tenant", "Id") + .IsUnique(); - b.HasIndex("Tenant", "Id") - .IsUnique(); + b.HasIndex("Tenant", "RevokedAt"); - b.HasIndex("Tenant", "RevokedAt"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey", "DeletedAt"); - b.HasIndex("Tenant", "UserKey", "DeletedAt"); + b.ToTable("UAuth_PasswordCredentials"); + }); - b.ToTable("UAuth_PasswordCredentials", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordHistoryProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordHistoryProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + b.Property("CredentialId") + .HasColumnType("TEXT"); - b.Property("CredentialId") - .HasColumnType("TEXT"); + b.Property("ReplacedAt") + .HasColumnType("TEXT"); - b.Property("ReplacedAt") - .HasColumnType("TEXT"); + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("TEXT"); - b.Property("SecretHash") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "CredentialId", "ReplacedAt", "Id"); - b.HasIndex("Tenant", "CredentialId", "ReplacedAt", "Id"); + b.ToTable("UAuth_PasswordHistory"); + }); - b.ToTable("UAuth_PasswordHistory", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + b.Property("AbsoluteExpiresAt") + .HasColumnType("TEXT"); - b.Property("AbsoluteExpiresAt") - .HasColumnType("TEXT"); + b.Property("ActiveSessionId") + .HasColumnType("TEXT"); - b.Property("ActiveSessionId") - .HasColumnType("TEXT"); + b.Property("ChainId") + .HasColumnType("TEXT"); - b.Property("ChainId") - .HasColumnType("TEXT"); + b.Property("ClaimsSnapshot") + .IsRequired() + .HasColumnType("TEXT"); - b.Property("ClaimsSnapshot") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("Device") + .IsRequired() + .HasColumnType("TEXT"); - b.Property("Device") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("DeviceId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT"); - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); + b.Property("LastSeenAt") + .HasColumnType("TEXT"); - b.Property("LastSeenAt") - .HasColumnType("TEXT"); + b.Property("RevokedAt") + .HasColumnType("TEXT"); - b.Property("RevokedAt") - .HasColumnType("TEXT"); + b.Property("RootId") + .HasColumnType("TEXT"); - b.Property("RootId") - .HasColumnType("TEXT"); + b.Property("RotationCount") + .HasColumnType("INTEGER"); - b.Property("RotationCount") - .HasColumnType("INTEGER"); + b.Property("SecurityVersionAtCreation") + .HasColumnType("INTEGER"); - b.Property("SecurityVersionAtCreation") - .HasColumnType("INTEGER"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("TouchCount") + .HasColumnType("INTEGER"); - b.Property("TouchCount") - .HasColumnType("INTEGER"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "ChainId") + .IsUnique(); - b.HasIndex("Tenant", "ChainId") - .IsUnique(); + b.HasIndex("Tenant", "RootId"); - b.HasIndex("Tenant", "RootId"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey", "DeviceId"); - b.HasIndex("Tenant", "UserKey", "DeviceId"); + b.ToTable("UAuth_SessionChains"); + }); - b.ToTable("UAuth_SessionChains", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + b.Property("ChainId") + .HasColumnType("TEXT"); - b.Property("ChainId") - .HasColumnType("TEXT"); + b.Property("Claims") + .IsRequired() + .HasColumnType("TEXT"); - b.Property("Claims") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("CredentialPurpose") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(0); - b.Property("Device") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("Device") + .IsRequired() + .HasColumnType("TEXT"); - b.Property("ExpiresAt") - .HasColumnType("TEXT"); + b.Property("ExpiresAt") + .HasColumnType("TEXT"); - b.Property("Metadata") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("Metadata") + .IsRequired() + .HasColumnType("TEXT"); - b.Property("RevokedAt") - .HasColumnType("TEXT"); + b.Property("RevokedAt") + .HasColumnType("TEXT"); - b.Property("SecurityVersionAtCreation") - .HasColumnType("INTEGER"); + b.Property("SecurityVersionAtCreation") + .HasColumnType("INTEGER"); - b.Property("SessionId") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("SessionId") + .IsRequired() + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "ChainId"); + b.HasIndex("Tenant", "ChainId"); - b.HasIndex("Tenant", "ExpiresAt"); + b.HasIndex("Tenant", "ExpiresAt"); - b.HasIndex("Tenant", "RevokedAt"); + b.HasIndex("Tenant", "RevokedAt"); - b.HasIndex("Tenant", "SessionId") - .IsUnique(); + b.HasIndex("Tenant", "SessionId") + .IsUnique(); - b.HasIndex("Tenant", "ChainId", "RevokedAt"); + b.HasIndex("Tenant", "ChainId", "RevokedAt"); - b.HasIndex("Tenant", "UserKey", "RevokedAt"); + b.HasIndex("Tenant", "UserKey", "RevokedAt"); - b.ToTable("UAuth_Sessions", (string)null); - }); + b.ToTable("UAuth_Sessions"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("RevokedAt") - .HasColumnType("TEXT"); + b.Property("RevokedAt") + .HasColumnType("TEXT"); - b.Property("RootId") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("RootId") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("SecurityVersion") - .HasColumnType("INTEGER"); + b.Property("SecurityVersion") + .HasColumnType("INTEGER"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UpdatedAt") - .HasColumnType("TEXT"); + b.Property("UpdatedAt") + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "RootId") - .IsUnique(); + b.HasIndex("Tenant", "RootId") + .IsUnique(); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey", "RevokedAt"); + b.HasIndex("Tenant", "UserKey", "RevokedAt"); - b.ToTable("UAuth_SessionRoots", (string)null); - }); + b.ToTable("UAuth_SessionRoots"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Tokens.EntityFrameworkCore.RefreshTokenProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Tokens.EntityFrameworkCore.RefreshTokenProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("AuthenticatedAt") - .HasColumnType("TEXT"); + b.Property("AuthenticatedAt") + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("TEXT"); + b.Property("DeviceId") + .HasMaxLength(256) + .HasColumnType("TEXT"); - b.Property("ExpiresAt") - .HasColumnType("TEXT"); + b.Property("ExpiresAt") + .HasColumnType("TEXT"); - b.Property("RefreshChainId") - .HasColumnType("TEXT"); + b.Property("RefreshChainId") + .HasColumnType("TEXT"); - b.Property("ReplacedByTokenHash") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("ReplacedByTokenHash") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("RevokedAt") - .HasColumnType("TEXT"); + b.Property("RevokedAt") + .HasColumnType("TEXT"); - b.Property("SessionChainId") - .HasColumnType("TEXT"); + b.Property("SessionChainId") + .HasColumnType("TEXT"); - b.Property("SessionId") - .HasColumnType("TEXT"); + b.Property("SessionId") + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("TokenHash") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("TokenHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("TokenId") - .HasColumnType("TEXT"); + b.Property("TokenId") + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "ExpiresAt"); + b.HasIndex("Tenant", "ExpiresAt"); - b.HasIndex("Tenant", "RefreshChainId"); + b.HasIndex("Tenant", "RefreshChainId"); - b.HasIndex("Tenant", "ReplacedByTokenHash"); + b.HasIndex("Tenant", "ReplacedByTokenHash"); - b.HasIndex("Tenant", "SessionChainId"); + b.HasIndex("Tenant", "SessionChainId"); - b.HasIndex("Tenant", "SessionId"); + b.HasIndex("Tenant", "SessionId"); - b.HasIndex("Tenant", "TokenHash") - .IsUnique(); + b.HasIndex("Tenant", "TokenHash") + .IsUnique(); - b.HasIndex("Tenant", "TokenId"); + b.HasIndex("Tenant", "TokenId"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "ExpiresAt", "RevokedAt"); + b.HasIndex("Tenant", "ExpiresAt", "RevokedAt"); - b.HasIndex("Tenant", "TokenHash", "RevokedAt"); + b.HasIndex("Tenant", "TokenHash", "RevokedAt"); - b.HasIndex("Tenant", "UserKey", "DeviceId"); + b.HasIndex("Tenant", "UserKey", "DeviceId"); - b.ToTable("UAuth_RefreshTokens", (string)null); - }); + b.ToTable("UAuth_RefreshTokens"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserIdentifierProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserIdentifierProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("DeletedAt") - .HasColumnType("TEXT"); + b.Property("DeletedAt") + .HasColumnType("TEXT"); - b.Property("IsPrimary") - .HasColumnType("INTEGER"); + b.Property("IsPrimary") + .HasColumnType("INTEGER"); - b.Property("NormalizedValue") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); + b.Property("NormalizedValue") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Type") - .HasColumnType("INTEGER"); + b.Property("Type") + .HasColumnType("INTEGER"); - b.Property("UpdatedAt") - .HasColumnType("TEXT"); + b.Property("UpdatedAt") + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Value") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); + b.Property("Value") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("TEXT"); - b.Property("VerifiedAt") - .HasColumnType("TEXT"); + b.Property("VerifiedAt") + .HasColumnType("TEXT"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "NormalizedValue"); + b.HasIndex("Tenant", "NormalizedValue"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "Type", "NormalizedValue") - .IsUnique(); + b.HasIndex("Tenant", "Type", "NormalizedValue") + .IsUnique(); - b.HasIndex("Tenant", "UserKey", "IsPrimary"); + b.HasIndex("Tenant", "UserKey", "IsPrimary"); - b.HasIndex("Tenant", "UserKey", "Type", "IsPrimary", "DeletedAt", "CreatedAt", "Id"); + b.HasIndex("Tenant", "UserKey", "Type", "IsPrimary", "DeletedAt", "CreatedAt", "Id"); - b.ToTable("UAuth_UserIdentifiers", (string)null); - }); + b.ToTable("UAuth_UserIdentifiers"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserLifecycleProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserLifecycleProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("DeletedAt") - .HasColumnType("TEXT"); + b.Property("DeletedAt") + .HasColumnType("TEXT"); - b.Property("SecurityVersion") - .HasColumnType("INTEGER"); + b.Property("SecurityVersion") + .HasColumnType("INTEGER"); - b.Property("Status") - .HasColumnType("INTEGER"); + b.Property("Status") + .HasColumnType("INTEGER"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UpdatedAt") - .HasColumnType("TEXT"); + b.Property("UpdatedAt") + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "UserKey") - .IsUnique(); + b.HasIndex("Tenant", "UserKey") + .IsUnique(); - b.HasIndex("Tenant", "DeletedAt", "CreatedAt", "Id"); + b.HasIndex("Tenant", "DeletedAt", "CreatedAt", "Id"); - b.HasIndex("Tenant", "Status", "DeletedAt", "CreatedAt", "Id"); + b.HasIndex("Tenant", "Status", "DeletedAt", "CreatedAt", "Id"); - b.ToTable("UAuth_UserLifecycles", (string)null); - }); + b.ToTable("UAuth_UserLifecycles"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserProfileProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserProfileProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("TEXT"); + b.Property("Bio") + .HasMaxLength(4096) + .HasColumnType("TEXT"); - b.Property("BirthDate") - .HasColumnType("TEXT"); + b.Property("BirthDate") + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("Culture") - .HasMaxLength(64) - .HasColumnType("TEXT"); + b.Property("Culture") + .HasMaxLength(64) + .HasColumnType("TEXT"); - b.Property("DeletedAt") - .HasColumnType("TEXT"); + b.Property("DeletedAt") + .HasColumnType("TEXT"); - b.Property("DisplayName") - .HasMaxLength(256) - .HasColumnType("TEXT"); + b.Property("DisplayName") + .HasMaxLength(256) + .HasColumnType("TEXT"); - b.Property("FirstName") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("FirstName") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Gender") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Gender") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Language") - .HasMaxLength(64) - .HasColumnType("TEXT"); + b.Property("Language") + .HasMaxLength(64) + .HasColumnType("TEXT"); - b.Property("LastName") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("LastName") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Metadata") - .HasColumnType("TEXT"); + b.Property("Metadata") + .HasColumnType("TEXT"); - b.Property("ProfileKey") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); + b.Property("ProfileKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("TimeZone") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("TimeZone") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UpdatedAt") - .HasColumnType("TEXT"); + b.Property("UpdatedAt") + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.HasKey("Id"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); - b.HasIndex("Tenant", "UserKey", "ProfileKey") - .IsUnique(); + b.HasIndex("Tenant", "UserKey", "ProfileKey") + .IsUnique(); - b.ToTable("UAuth_UserProfiles", (string)null); - }); - - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => - { - b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", null) - .WithMany() - .HasForeignKey("Tenant", "RootId") - .HasPrincipalKey("Tenant", "RootId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); + b.ToTable("UAuth_UserProfiles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => + { + b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", null) + .WithMany() + .HasForeignKey("Tenant", "RootId") + .HasPrincipalKey("Tenant", "RootId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => - { - b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", null) - .WithMany() - .HasForeignKey("Tenant", "ChainId") - .HasPrincipalKey("Tenant", "ChainId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => + { + b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", null) + .WithMany() + .HasForeignKey("Tenant", "ChainId") + .HasPrincipalKey("Tenant", "ChainId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); #pragma warning restore 612, 618 - } } } diff --git a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/uauthhub.db b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/uauthhub.db index c9cf4b4e788deb2a37a4a5eef5db1c380729a4e1..0d7a9f9959d57892c78ae269b14ed695d9403b95 100644 GIT binary patch literal 352256 zcmeI5d2AzDe&2aWqSVvsnsd3AvlM4`r#0Or)x|n`x7|}L7Q5N4lOokp&rS$REJ^H^ zNHs}yw`O+iuxEBBn~gVi5C`61;mtZe64=4o0gNQhUq)aDMl$dW5IYMS39<%q0NFpX z{{#vAPhOE#WL2qnX^x$q{??4hX1(`*@Avz>-+T3rs#j~P3+09p+o{$Lij5c_crp+Q z1zwKD0)ar7{H>F}JoyWfznkQ5jQrV$d2Y}V4$S@Xe;6mR#;6~gaj#QTfYl= z^{BB|$k&Zpresta<(;xos~1?`(@($owR4du%LdG*BnPoh-lFclt+0EDueKV%!bIX|}lINnnl)GpNHdQl)=kyIC)sk!n=8Q_Q(&!Or za=Bp~_XyQ$MzLX()SjsiOYU%DkezMTxL3X7OzQ|+Gq#Uv<;L+kDGEaNBo$l8pa@QQ zsvo>U+xmh{D8H0h&FiuAaf`~uSlkMlojxHxq6LZ)Htfy&FAlx_jn{!40P; z7bn=RwEEeVsfp-?3&G76V5<$T8+VV4%C_P8dBz3R6L`Kt-0~txIs4YsWF*S-!M7D> zp&2_hqrR6TElb5NGUur&mu#ys&N^dsi);AS*dxGE)BKy`mU=x4yRVzHl3pv;_xv3p z-oL%J+M%9VYkS3Vr5oy~by?$ZzqoCblE)`BaKsu^=k*7NWl}ypuNVEU3H|E*TQd`p z=#?wMw^tp$uu`no?^kOjqEzd`Ufj1l!Y3f&=NCTl+}<%nVR}%gG-0dy4i@VQGG&e%6UeUwlmUkBldU~{aU%+sMd~sPlnz8 z?Hi}-;2oLW>rRiMPY*#puD(*MmX5X?9Zar<+U(eb`*m!5^C_^tr_C|&q&ZM+s=?OC z@FDF(%k)}za`Q~6A15MzWH-~a&-009sH0T2KI5C8!X009sH0T6h!2)qys2bMX86KR&C87{`k zmssW!BhLvUtB}(d81joT$Nv-O{xm@Skou?8Ym`KdlOH%h00ck)1V8`;KmY_l00ck) z1VG^9O+c6kZ-2%d^s?lGl^Ka=3JjAdtQiO8YsXu)a>=?MZtdvsuv%-d>>M-4FyrCP z&$Uvqtjvmx!YCw_P*^#t8Q1TVdqui;7_ub#94n|};n(dHEUR!bmnfvm58Ss?*tc$w zo2eQ`zEU=CeI)mdTOuxo!>g7EhGRrV5=4?IU$E~wvTnDqV$X%b`F3oECrTz*MlPtO z61nSPhumb7E*tx$h4MkUVN3r~Fsxhg8HHnriX4&77BZD`qjiIlCHD*|&xv#YFF^fQ z>R(d7Nad(m@&gA5fB*=900@8p2!H?xfB*=900?|i2+W7KgCk57OuQ7{Y{wrsMKJ#5 z@auNeQRfE6z7$@y()ODa2%it<+tCKh286y4)~8x#GXB#5=K6n#x)PxNG5Np&0w4ea zAOHd&00JNY0w4eaAOHd&;76bkdNMz=7@Q>g0kpORn4DyiX;orXon~cGrUjknX*H2j zX;sw(AtlNwNfQf&dbzT@Zxjl}0mqrY88kDPG^JY^s0k&_Ya&mJswR>Q)FhphQw*)9 zr8J{TN?H>WBV<6V3Q<1@P(Pr4=w~3#fdB}A00@8p2!H?xfB*=900@8p2z=xO%ys`^ zW*9;*hVxUy%oMcN|Id9YKs`Y|aDV^^fB*=900@8p2!H?xfB*JHSc23+NFaFxSdO@A9r!NTd?q2@r zuz3ISB421NhbwX zNYE0KQfPsZRHA4qO^ZoR;`MYQ$tk>fFFeh%G$+J3<`O4eVuU$SWZ8tQG;2YR(W-Tj z#e3CU!FPU`zs#d+^nj)O;t8WOcULx-uOHQRE>!Q`P*=0}SpIlxl^DHR&xY_gSr;zq`(7Ztq=KU8w7qHAa$Tf!t~!@;plmQc|XqdYYw0 zftMvk){=@S`5Db61eWJy^ZEbQ`u`8fO#nDR00ck)1V8`;KmY_l00ck)1V8`;J`M!T z^?!T1#WM@j`e}!?*Z!3m00ck)1V8`;KmY_l00ck) z1e^q-!7v|ey`8V%eCJ?2O#RQmGgIvV>-~lGPldz0`;@j$gKc*|%R}6z;1*B0Cy2W!t0nek1y>Y_)VyuBfTS z%u*le*#Eyzu_6crKmY_l00ck)1V8`;KmY_l00e$I1kC;a?O6oR!3m00ck)1V8`;KmY_l00cnb@gr~;JQK*zEM6vS{gYx+l@c1q z(u$ChX@S=nT1}}MozxTQL|TwJUDCUY{lx*tiCX~3D*#wdmfO$&zZ0O|dHiU@Vh{iU z5C8!X009sH0T2KI5C8!Xcq9pMWCK9Q1^~m%Aeig_6HmMwpuT$Um#6>xbn5KSlOH%h z00ck)1V8`;KmY_l00bTh0?msP(_{rPI5RV)Et6$LNf$Im5CuBTFgh(Hc#$k1CN)|~ zsYx{{bBZLf-BrY`0mrk7EQtw$=UAruuMzNHFCXnU$_K@UQ9Nqw&23i? zd{6e#v`>&_#23a)BPO4Fu5E-a$g;?%7&?_E8?Os2lcHr-muXehc|FC6n$D(&H^Nlc z{OhAepCC)ai(!{nXu2#ZnvkXwx{{;?Ax+kn6_IGjsDyu7N{K?UtKop9<>Ip}#|sHj zk`<==FF&0Gg%Np??-OLHn+mnmRg^YRO-w0jDkadY#tO8+2r1&f0!I_5ij)wEPpabZ z>Ygc@55}Kx3;(lybnO#lnK2V=`9(C^HY24lx|T{NXfdIRw2&hFWr(R3AZ8+F&ol){(qSH26O#?I{bQo z`pUUao%_iX^7K2Ce|YAm=}zKfeC-WF*S-!EfGZ6u0(`yh^45 z3t3~QX4Lm`)jLL|?sIBN%j#-QkLA?lf*yp| zrToG|Oj}-B%Vkw^J{DiOQScS8lFclt+0EDueKV%!bIX|}lIxXP zt|hw@YE+7qMz28AvTMcqUXSoRnN_@D9QO!aGwStnwbCbfO(!ra zjqSDVtKy)s3|V-B~ld0AHZH%v>#1EWX7vQ(`d6!*)o8Kpjv-j6q=jD5q^qzu<2 z%x0dLh`uTfE|C?Zc2I6Lj;^wCoId;TxigWdBn98hcuL6;sasx-lTY+2IY*ps8TKs# zv%Gs&)UG)HQgS+b_u54yb`!e2!sF(xtck;SqsL9BUzwVSUbqn4Y*DeCzHZz-GAi4K z=jRz02~Xhp3h}RtB<1W|GZT^Ml`FxwR~@8RiuL;aYOO@PsAM+r#eJ)G_yj~;`B;~E zpLkvBC!qS*9A6ou)}#JyCTZJhM#Fh!^|Z(R8pab>R!23l8_l&w@!-(kL*fg?dV{Fv zf9YMT9@VxxEr3JvPorY5Mkb=hmHrjmr?l*b*C%N5>ranGqKQQCn^zrf=jc(8Zb!R* zyU&gLIh#Am$bRNc{sFt#cJ+{yqqlQwUj(`}EO+dR=P2@YvAl1(Ny9ieY>-x?mn_qv z?6|hiIm9efw@F7YPpb32PiU63B4$T1+gj(h`gOjYKU?*zQ8yZ9GNaz>YSD_)ub#9b zXw^#n=%7bMXvOH)0d7SY49BjKJ$osnb-g-15q%}m-_PCNV!OEe>_l@T)Vh2c_{7(1l|%@zxaYh2~@i{ynww0rByZ zEjhtqj{naFw4;t@uQ#ou{QXDIRyHU6%WebwM{;&(-|kiaEAybs+=)hIgbTN) zDNq}&%=)%?XX(+ zxs1f@F*9T3=j?Z;J%g;eH7c?SwN-X?d(hP>$@Fqo&s<$<&8RqsUUr1pSXNK#S$#>< z*X&sxmqg-{juBfo+42(6c0ngILRp>6>twVXsXzK>CZd~s|0dTZ-EMJRCqMu2)1Qi% z9pg859o5P7FvrNQ^Yb%)6{-{3tx@m8efy3bR5JG2tvIiDZijM~VQ1{%(9cp6Q6zS=bmjf(%*d1LzY}9c1XX(YOKrz_L*oe zzIKEz;u8&vw}o!ESWfBwEp)$mJTrCgc{)p}-VxH}TD{>MYCHQ>q|4PKC{?bL`McvD zp~-Tsv6mtfGIqP*5PH=hQyMj&fMmJqb9SLv**z-m`bo->3)ih`#V<%Bw{;%X{6f4f zmP4~at#ZFPrqj+UXwOYVZ?c2^*LE(a3)|;D{pRyew}u;EFMGUrp}b>kA8)(-xO?uo zUY^{Iaw=bTCU?|k`Y#j9&BY3WTC%Z_t4nK{ezWU7I{-;oYenG~4+tjUMc{!oM4 zAFDIcT6M4;$$9R{x7R=2T0r|Ysh^z%G*=hK)irN-%|7SnL9Rq@|M4RAzm|FgI2_1- z2w->M{JXdIT)l7K_kFZugWSNJ>sT|4O3!sIb*o<8KWZ2!1`3YLnRk)O5_vZRS<+7`WHN0M&dCgDjJ!e<8sMvXoA8^6+c@mP)Gmjsvn$1KG2o>Z=mg{~tMzhQc5K0w4ea zAOHd&00JNY0w4eaj}3v=8wG}#!f37k4>Pe~uK$P6{ceEzMJh(VaDV^^fB*=900@8p z2!H?xfB*=9z{i3>B|JW}m>=bVd#-)Z=9lNg3gS*K*$ZEuo&Q zT0e)$FF0a;taZ@lx97tS>tmn!{C}7V1*qSlZjvt?AOHd&00JNY0w4eaAOHd&00JQJ z2_=v-2i(E#4fccX`L_r0{Ra49uh0)-)*!TIYC6@`bdXSc`0tq&X#KRq%=Q1^xmbYw zj{^ii00ck)1V8`;KmY_l00cnbF(&ZltHEaidGZ|nWi4Pl%onyNrzQhIjY}$NQ54C} z^r<8*$Sg;znj+JZqNs{23u!6Ii%C^VXdFu`LQ19uUT0`ErIO9_^+Y<67GzGB^x?;{ zCzh}|Wsc=!`Na8zG{-9nBTCAqQmk)WWwUGQvAWP;udP;7`qj+F^`q6);_;@kyG)+= zFABHUgxsCWug6Qqz4Ep}-f?&-K1#y)MJr|N)uWf<_l+%bio7_vu~V%b5Md>wey34A zBqytf26-C4T-jYat~U%b?0&gYs@|`Yu&o;TChttX6yM&fRSyhus(h%HN;RWiCnqmm zV&iYT9^Y=isQuFGZ(NMms^p!&@k_6~N^&!52W9e3?rNoV;*EREt{^kF?yXj@Z!-04 zq9ijrcUQUB*!`Qg^4AtJ>(xc^_Ubi#eO(?i*Z+gmI|1@P4iEqV5C8!X009sH0T2KI z5C8!X0D(t=05>+{ygy)=S(?`V|5N$E*WX4n|VT;ill-JnNoK`ee$JZkJ+Y8aJb zr9oE3;$1#*vO>1kXdGUepRaH483)Ds+(CJ}R;^ce8gtv#gZcaQd5&S^c}AQsmyAlI z+&G?Zue8mZi)^N})^6HlP0rlk+mzSNt+-A0)-Kp_UjOP5!*E=t)c(HI{<810?RO7u zJLbjq*HZDoa7k$8-9GaMQNcf(VQxz9pN(mnolD2U?#iM`;idSiZ*&(PPeAELHkTn= zv0slD4-eOknz=R^zf?Ke-@h2&uWlDjs_kFf_1aFZddKJlZy(hgRkAp02EXx*La<$t zE^C@qk%GyaTykxLla^_NuPyR>*@D4U8}&qbx2ChnJ0kZWm%5hR-MqP_f5;WdwFK>` zMFKyk2nm*#Pd-?lVCLk6$cmDL3RXU-qk?so?(Hh`(N?gKx&9xbeiWd7LOyVS00@8p z2!H?xfB*=900@8p2!H?xJemZkv6+BlcZ1M5^4qb8!1Uyw1fB`}C@^_0lA8GC@%P65 zZ0u}!HT1WGe-!u;l{)ti&OJ4K`|Q6u`{WbGneR^hWUAPP&^-UeNc1KjY_5?f7>oy* zjY3`}^RI=hu|u9%*lSJb)eE`SY-~Z>E0!ynl243TEvu_JJ(gKY=^L^5P-5b-<)v8M zM_4>|KHknTelZreGL6qRi!Vf?_pbyWe#WipO0izQU#*q2n$eo{E$(*|Hm5>w7{`T_ zv2QetlGJ+O)8v9kKD{=OfYWE5YWSQElvL*^8&P z>{Ry5Hq-G)beEV=AKHYhagR(K_bZ++jc!Co=tyRCQ_VKznMib#7-9@$G33C(ve_>feY&jYP0{G_vV_w#IuDpIc2|BTsGBZ1dvJkUB(c zxH*Cie%jBRM*C6qo^4+Jd?b2@sQdab>Sm3)(a0Kij|}n@V5jwR^Nfw8w^!n@2AoJo z8n4eqqD5lK?l6`tRJTd{nY-w*!Z7|95SuwnIgCYdFVF`kdk&IbRE(I{^1TlIF0 zJU(eY7TH$M{`E7KVmURrpxb>3JCM}4=`%5M#LX5ovy{`X>e<-RaxS)%Us#A~%S&sy ztV+(u;wv|-ZcjJuN;b2oW;bIu^v#%>&n;(`n#vqODxE-@B}>aIozEKkgbxnR6Du(!@f8GfMN_M|9laG77dPLIZ_IOT zq-1R29D%r!+RoQf%HzmwMWvxUxgFOdZAh|K-oy!BUe-6s2I|g{s2N})(aS_lx{sPR%a**v2&%bzr9SGk`l0kZ zx%`tR({uSZqjy`h4m0z#Qz1tbzK0+7mE;BHkmp9%&X^$km^Ja{K-`VWt#{X;_$=1{ zAI)hUXbl1&00JNY0w4eaAOHd&00JNY0xkjr*8kh%|L+H=_o(l?(%}aPfB*=900@8p z2!H?xfB*=900@AI$gW|Wx|Gyfb-lcx^qcaLQfdB}A z00@8p2!H?xfB*=900@8p2y_Xs<7DtZ!s!1@Xr82)9C`fz-2nBc)OWl2;$I*D0w4ea zAOHd&00JNY0w4eaAOHd%6#;I7jQ%G_8vZjR$)t0Czv0&ZvH$-^Ri?-X1V8`;KmY_l z00ck)1V8`;KmY_j6aqs%|Nor;^$zu&4<&yH1pyEM0T2KI5C8!X009sH0T2KI5a>;S zADhWLmj090L7U&64?8Txku;8b|5fXt&2P_#9ftk?dlvyhKmY_l00ck)1V8`;KmY_l z00cnbks&bD`akyne`LxNih=+LfB*=900@8p2!H?xfB*=5G6{J0|KA#LoNoXB@0t7m zfA5nC5LSTz2!H?xfB*=900@8p2!H?xfWXI|07JI(4>%qJ7%=+ZYVH3&>i&OWYAZnf z0rhS2g#!dY00ck)1V8`;KmY_l00ck)1VG?a1TKuvXwD%#$8aLeax}xnIOY;3T}nuE z5-acwD}@Kf6@)p4W@xqAku*V2!H?xfB*=900@8p2!H?xfB*=*Zvvh@{KB5!p-W>khT~2EeXp`q zOWvrj&tKh6uN@y=Pwnz+#*w@z&o3&))ZOGQLz*wD>zlj6Wvu_d@6v$)5C8!X009sH z0T2KI5C8!X009ta6Y#9%Yg|%Ei=s%D@l#2ftlx9AswpxpDT=DdvXGXNym$S7m^9w? z|6$U!$Nwt<>W`^!Q7b4g5C8!X009sH0T2KI5C8!X009sHfnf-crTA^fetq|tT|s7U z-CM0*-(>39L`i0L?yhpLvHLe~<*zMd)~k!+?bU1g`nnwUBu(Drl4~2Bv`ia(ZIR#0 z77VW1s3+39HJwe~5xEDs)V1X9=FKfVq>x-4Hvo)~v_1Y`3{ZbWeUn-o#zMpa0T2KI z5C8!X009sH0T2KI5CDP4oWPgKefW;Sf2Ll&wae|~rHvB5$*pi3YxS-5{hb>Nd(zRy z{Qi1%L%*$WC2no*WiE$3X-Bz--+TW*x4v|=dG(rnKeM=(zA0bT5B8IMwzkA;3$>m6 zgPq%3ckXDL!Yw1UXx;xmAE5pjwNK4I=H&!3m00ck)1V8`;KmY_l00cmwP2elz zGlp|B|B;6H-ozt~@z+VtuI>Iu7~~JL|Gz=KLwyIu3<4kk0w4eaAOHd&00JNY0w4ea zAaH5|p6CA=mFHDflj)SqXyo~Sj-%zYm?r;{H94*F05GkM40p0y6z{Puj3)ppDR!PkI286cz68I#=kITy&GWayFYb^&Ch;05?!4Q zHm{Z|CF4P6qmWmR8heE`qh2ppEA>Los1z%Wg8tyJTr=uw!yWvxmetjq9?LAH^o>}2 zaPoL;c_|im3yH_h$J^P&FUI1XoZ_?1#HC2INR&J1ubj45ELSq6Le{ufyGzPSBBEtP2*=r({^|rXPdeliI&-5^9^6MvQ_d%47p|Mf;2MQM;AE?F*I`Uc4_zk!YUSu{^XLF2t>jzB0P@qvMOPKL9uo`u(TbLuJy6q5zQ`d(+kXYc&H4$ zOdRt3otu=iDY#YMwlU_9{?MAM$w;&+1s_h0#H@p>TcsTeUOgR`j?mNC-c3B)ymp1O zwo(WZK2wN>)ON%v676U`&asg@_E8>1OWu3x0) z6km=+kH|&i`Jq&9UGF?io3H-5rGJlV?@`V+!%zIsHrba>0>e2W@_PKJ2iQ`~S69`8`Yjt)KS#e|!A@ z!vOVT>W7abX4nh@AOHd&00JNY0w4eaAOHd&00NIPfoH~Mo^xz7m|xSgA#yJ2csxK& zEoPSR{Qsj|%FrDIKmY_l00ck)1V8`;KmY_l;ISm&dH!GHl1f?>MOu(jN%D3)ZFc$)o+=8r*M!`i%eeplV^-Ku2LwO> z1V8`;KmY_l00ck)1V8`;1`)vh|APo290WiB1V8`;KmY_l00ck)1V8`;J{bf~b^rgn z0qWgPhWW4p1V8`;KmY_l00ck)1V8`;KmY_D2LkitS%JU^&kC6L|A(mW1gLk&2M!Pb z0T2KI5C8!X009sH0T2KI5CDOXmHSr*-zXG@d6!?vbN~M^Y1-reuLY>D zQNQ=m8i?FL00ck)1V8`;KmY_l00ck)1VG^NARvs-h(>go=ucwX6NoI_Zqu@^H%=a zLT0_XDBfPZrmwHdA%!G$toJ8xa>=y~PFki7zP8BkWeWyZZPXL#-I~rO?}*%kTqb-mIKuPqW(VhZ>c-fZ;>B3 zKmY_l00ck)1V8`;KmY_l00ck)1o{#9-1tn;IqZMdG4B5o33Cqo&-jo0pBJTde? zA=feZf04*_j{eW|82+1r{m1|3eiWeIqrOkwrBv!E@&gA5fB*=900@8p2!H?xfB*=9 z00=y41m?$P79C6DTLX@X5#x`K7=O$Yf6%S_;SuA9=7_z{Mg9R9wATO6{bhi9m--%6 zp)ONr$qyVL00JNY0w4eaAOHd&00JNY0wD0{5HKIBpBiQ8KWc*UQ4@@L6AT!f7sI0_ z2+f;Dk2?OJ)&tZpP@g{cPtMIx{{i`d0|Y<-1V8`;KmY_l00ck)1VF%_Kx2xmF;4}w z{0O7XXHRU(#_)48$0h{w26tW17(o>1G{fk$kl;l+sV6mBNvTOSDRYV>u@k4s^h}>j znG`ECTp~>ivY4WUbV8tIAt};nPE%A}W+jmq#_Pn=$q_B>lcz4ovdE_xI+bQwT40$J zEwj2ztD?^9DNfXMHa+HN=%9hKFI_=lL|)`IU6vG0NYe>jNz#IlW@uFrNv4cS2&AQy zC?vzD$<&vwovD~o)Kp5KS&bEFfe})qGzE?()+$m$B)bEsVyI@*9bo|PN7u?Tr7*gd zN+xJAp^CJSA|}fcuhN>5WJOKlb(P`T`~MdL)bCOSf9J+o5C8!X009sH0T2KI5C8!X z009sHfdK?oCT85zLVm+_Yt~0h@M%UNvk_^IjMN2=)#zk0A=5moF=Vu^2rRFKmRkZH z^8r>hiG@J+%-@~*%cV=$9DOMWfw7-2FKAg^&FQhsQcB;5 z#YYwyk1a37;y!}ovGeh^Ch?20xQ{aN*(S3XiM}EQo3FUdSt-`*_p7ziwQ{{ttsUD2 z<;iZ2H;m(UUYJv#4e_V>k58 ziUa0c z4WmFdCat!9`bZJ=4+Nqr`-;v=~%!)WmsQpUx4jX((oz!ck zR^2I|q*k!bcN!ow3p?(jrD=XCvzkBImO7()Xgb6a{hR5pMxtdt*nGpSmv8%SN+sG9 zQpUaVc88uTYOV)CS0t}Swmc_KR{}RvOAWKN=%k!&o_{40y-5sN8{Uw%m%DOePoe*a zY7uv+U?m16@UBJA8-G$VSXI=We$3_ViqQ z^I0?M^>Vf1>o)W#{5yh%RJa>|wt0Cy5;X|u_LZi8H_u9^?G?-ZT3=;@5*|#dIktojxzZrJ)V_g;2N4a%NIaeRnm55vo9X(jmS=F!V z*#Vtcj{rv(Hm2rt%Neuhv#2lS>>i~#$TLR~+hiMi(vI8RO43QTV~~EUJIv}t+u@x{ zv(+PYB<+-qE!LCNZ2%zySgv00JNY0w4eaAOHd&00JNY0wD0w5Rk|Q z{+}CRAIXxjQ#{&lghVr)m#1Uk$-o2W@_PKJ2jYDbj>El8<8wfVB?V{Puj zh;$$T0w4eaAOHd&00JNY0w4eaAOHd`0wdnfANIr_w5&hs{r}UZa!uNC4yiPhg?KBoF`r5C8!X009sH0T2KI5C8!X z@DOP4|5pi6?^55RDxN_61OX5L0T2KI5C8!X009sH0T2KI5I6+^hPje%0Wc^BhY>mQZ@bN~PF*=XS0o70Qr3kL{*00@8p2!H?xfB*=9z~e{YAs;3$ z1=9jrJ`l)n&lvf|Nsi$}@)B{H6Ji{5iIXlRq&bNdc!rhQK^)DnCxTKk$7?dH(W!KT zr3EFOq*YND=rpf0A}gmkB`IlKQb~)VNDERbNeeQ|(W<7%w4^AiBFjQrO7i!ZT|s7U z-CM0*-(>39L`i0L?yhpLvHLe~<*zMd)~k!+?bU1g`np^w)XSCKeWOsw)T_64xt+YU zQQ|kb6>ej#zO}x;b7NsoI@*}uU$1WHxAm>Wt?tX8rLHA+H*ap~ zU26JXWvQ0DQD2|Gx}9D-KD?gV<=2cOc~PEUREnv)$y(J=V?w) z$fS4`g_gyHPD?^cVs)Ki(;7RF+G|0JnxXabHBOlmc|l@C@hX4Qo delta 28 icmZoTAljfXL7J73fq{W>vY>!Hkfk^E^tKNybNB&dLkENa diff --git a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/20261202180605_005_SemiHybridSessionSupport.Designer.cs b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/20261202180605_005_SemiHybridSessionSupport.Designer.cs new file mode 100644 index 00000000..2da4d1eb --- /dev/null +++ b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/20261202180605_005_SemiHybridSessionSupport.Designer.cs @@ -0,0 +1,783 @@ +// +using System; +using CodeBeam.UltimateAuth.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore.Migrations; + +[DbContext(typeof(UAuthDbContext))] +[Migration("20261202180605_005_SemiHybridSessionSupport")] +partial class _20261202180605_005_SemiHybridSessionSupport +{ + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "11.0.0"); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore.AuthenticationSecurityStateProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CredentialType") + .HasColumnType("INTEGER"); + + b.Property("FailedAttempts") + .HasColumnType("INTEGER"); + + b.Property("LastFailedAt") + .HasColumnType("TEXT"); + + b.Property("LockedUntil") + .HasColumnType("TEXT"); + + b.Property("RequiresReauthentication") + .HasColumnType("INTEGER"); + + b.Property("ResetAttempts") + .HasColumnType("INTEGER"); + + b.Property("ResetConsumedAt") + .HasColumnType("TEXT"); + + b.Property("ResetExpiresAt") + .HasColumnType("TEXT"); + + b.Property("ResetRequestedAt") + .HasColumnType("TEXT"); + + b.Property("ResetTokenHash") + .HasMaxLength(512) + .HasColumnType("TEXT"); + + b.Property("Scope") + .HasColumnType("INTEGER"); + + b.Property("SecurityVersion") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "LockedUntil"); + + b.HasIndex("Tenant", "ResetRequestedAt"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "UserKey", "Scope"); + + b.HasIndex("Tenant", "UserKey", "Scope", "CredentialType") + .IsUnique() + .HasAnnotation("Npgsql:NullsDistinct", false); + + b.ToTable("UAuth_Authentication"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RolePermissionProjection", b => + { + b.Property("Tenant") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.Property("Permission") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Tenant", "RoleId", "Permission"); + + b.HasIndex("Tenant", "Permission"); + + b.HasIndex("Tenant", "RoleId"); + + b.ToTable("UAuth_RolePermissions"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RoleProjection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "Id") + .IsUnique(); + + b.HasIndex("Tenant", "NormalizedName") + .IsUnique(); + + b.ToTable("UAuth_Roles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.UserRoleProjection", b => + { + b.Property("Tenant") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UserKey") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.Property("AssignedAt") + .HasColumnType("TEXT"); + + b.HasKey("Tenant", "UserKey", "RoleId"); + + b.HasIndex("Tenant", "RoleId"); + + b.HasIndex("Tenant", "UserKey"); + + b.ToTable("UAuth_UserRoles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordCredentialProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("TEXT"); + + b.Property("ExpiresAt") + .HasColumnType("TEXT"); + + b.Property("LastUsedAt") + .HasColumnType("TEXT"); + + b.Property("RevokedAt") + .HasColumnType("TEXT"); + + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("TEXT"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("Source") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "ExpiresAt"); + + b.HasIndex("Tenant", "Id") + .IsUnique(); + + b.HasIndex("Tenant", "RevokedAt"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "UserKey", "DeletedAt"); + + b.ToTable("UAuth_PasswordCredentials"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordHistoryProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CredentialId") + .HasColumnType("TEXT"); + + b.Property("ReplacedAt") + .HasColumnType("TEXT"); + + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "CredentialId", "ReplacedAt", "Id"); + + b.ToTable("UAuth_PasswordHistory"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AbsoluteExpiresAt") + .HasColumnType("TEXT"); + + b.Property("ActiveSessionId") + .HasColumnType("TEXT"); + + b.Property("ChainId") + .HasColumnType("TEXT"); + + b.Property("ClaimsSnapshot") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("Device") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("DeviceId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("LastSeenAt") + .HasColumnType("TEXT"); + + b.Property("RevokedAt") + .HasColumnType("TEXT"); + + b.Property("RootId") + .HasColumnType("TEXT"); + + b.Property("RotationCount") + .HasColumnType("INTEGER"); + + b.Property("SecurityVersionAtCreation") + .HasColumnType("INTEGER"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("TouchCount") + .HasColumnType("INTEGER"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "ChainId") + .IsUnique(); + + b.HasIndex("Tenant", "RootId"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "UserKey", "DeviceId"); + + b.ToTable("UAuth_SessionChains"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ChainId") + .HasColumnType("TEXT"); + + b.Property("Claims") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("CredentialPurpose") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(0); + + b.Property("Device") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ExpiresAt") + .HasColumnType("TEXT"); + + b.Property("Metadata") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RevokedAt") + .HasColumnType("TEXT"); + + b.Property("SecurityVersionAtCreation") + .HasColumnType("INTEGER"); + + b.Property("SessionId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "ChainId"); + + b.HasIndex("Tenant", "ExpiresAt"); + + b.HasIndex("Tenant", "RevokedAt"); + + b.HasIndex("Tenant", "SessionId") + .IsUnique(); + + b.HasIndex("Tenant", "ChainId", "RevokedAt"); + + b.HasIndex("Tenant", "UserKey", "RevokedAt"); + + b.ToTable("UAuth_Sessions"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("RevokedAt") + .HasColumnType("TEXT"); + + b.Property("RootId") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("SecurityVersion") + .HasColumnType("INTEGER"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "RootId") + .IsUnique(); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "UserKey", "RevokedAt"); + + b.ToTable("UAuth_SessionRoots"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Tokens.EntityFrameworkCore.RefreshTokenProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AuthenticatedAt") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("DeviceId") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("ExpiresAt") + .HasColumnType("TEXT"); + + b.Property("RefreshChainId") + .HasColumnType("TEXT"); + + b.Property("ReplacedByTokenHash") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("RevokedAt") + .HasColumnType("TEXT"); + + b.Property("SessionChainId") + .HasColumnType("TEXT"); + + b.Property("SessionId") + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("TokenHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("TokenId") + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "ExpiresAt"); + + b.HasIndex("Tenant", "RefreshChainId"); + + b.HasIndex("Tenant", "ReplacedByTokenHash"); + + b.HasIndex("Tenant", "SessionChainId"); + + b.HasIndex("Tenant", "SessionId"); + + b.HasIndex("Tenant", "TokenHash") + .IsUnique(); + + b.HasIndex("Tenant", "TokenId"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "ExpiresAt", "RevokedAt"); + + b.HasIndex("Tenant", "TokenHash", "RevokedAt"); + + b.HasIndex("Tenant", "UserKey", "DeviceId"); + + b.ToTable("UAuth_RefreshTokens"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserIdentifierProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("TEXT"); + + b.Property("IsPrimary") + .HasColumnType("INTEGER"); + + b.Property("NormalizedValue") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("VerifiedAt") + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "NormalizedValue"); + + b.HasIndex("Tenant", "UserKey"); + + b.HasIndex("Tenant", "Type", "NormalizedValue") + .IsUnique(); + + b.HasIndex("Tenant", "UserKey", "IsPrimary"); + + b.HasIndex("Tenant", "UserKey", "Type", "IsPrimary", "DeletedAt", "CreatedAt", "Id"); + + b.ToTable("UAuth_UserIdentifiers"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserLifecycleProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("TEXT"); + + b.Property("SecurityVersion") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("INTEGER"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "UserKey") + .IsUnique(); + + b.HasIndex("Tenant", "DeletedAt", "CreatedAt", "Id"); + + b.HasIndex("Tenant", "Status", "DeletedAt", "CreatedAt", "Id"); + + b.ToTable("UAuth_UserLifecycles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserProfileProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Bio") + .HasMaxLength(4096) + .HasColumnType("TEXT"); + + b.Property("BirthDate") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("Culture") + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("DeletedAt") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("FirstName") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Gender") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Language") + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("LastName") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Metadata") + .HasColumnType("TEXT"); + + b.Property("ProfileKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT"); + + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("TimeZone") + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("UpdatedAt") + .HasColumnType("TEXT"); + + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); + + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Tenant", "UserKey", "ProfileKey") + .IsUnique(); + + b.ToTable("UAuth_UserProfiles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => + { + b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", null) + .WithMany() + .HasForeignKey("Tenant", "RootId") + .HasPrincipalKey("Tenant", "RootId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => + { + b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", null) + .WithMany() + .HasForeignKey("Tenant", "ChainId") + .HasPrincipalKey("Tenant", "ChainId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } +} diff --git a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/20261202180605_005_SemiHybridSessionSupport.cs b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/20261202180605_005_SemiHybridSessionSupport.cs new file mode 100644 index 00000000..4186e9d1 --- /dev/null +++ b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/20261202180605_005_SemiHybridSessionSupport.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore.Migrations; + +/// +public partial class _20261202180605_005_SemiHybridSessionSupport : Migration +{ + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CredentialPurpose", + table: "UAuth_Sessions", + type: "INTEGER", + nullable: false, + defaultValue: 0); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "CredentialPurpose", + table: "UAuth_Sessions"); + } +} diff --git a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/UAuthDbContextModelSnapshot.cs b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/UAuthDbContextModelSnapshot.cs index d7cadb73..0181ce9a 100644 --- a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/UAuthDbContextModelSnapshot.cs +++ b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/UAuthDbContextModelSnapshot.cs @@ -1,4 +1,4 @@ -// +// using System; using CodeBeam.UltimateAuth.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; @@ -7,770 +7,779 @@ #nullable disable -namespace CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore.Migrations +namespace CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore.Migrations; + +[DbContext(typeof(UAuthDbContext))] +partial class UAuthDbContextModelSnapshot : ModelSnapshot { - [DbContext(typeof(UAuthDbContext))] - partial class UAuthDbContextModelSnapshot : ModelSnapshot + // If you encounter a merge conflict in the line below, it means you need to + // discard one of the migration branches and recreate its migrations on top of + // the other branch. See https://aka.ms/efcore-docs-migrations-conflicts for more info. + public override string LastMigrationId => "20261202180605_005_SemiHybridSessionSupport"; + + protected override void BuildModel(ModelBuilder modelBuilder) { - protected override void BuildModel(ModelBuilder modelBuilder) - { #pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.14"); + modelBuilder.HasAnnotation("ProductVersion", "11.0.0"); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore.AuthenticationSecurityStateProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Authentication.EntityFrameworkCore.AuthenticationSecurityStateProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + b.Property("CredentialType") + .HasColumnType("INTEGER"); - b.Property("CredentialType") - .HasColumnType("INTEGER"); + b.Property("FailedAttempts") + .HasColumnType("INTEGER"); - b.Property("FailedAttempts") - .HasColumnType("INTEGER"); + b.Property("LastFailedAt") + .HasColumnType("TEXT"); - b.Property("LastFailedAt") - .HasColumnType("TEXT"); + b.Property("LockedUntil") + .HasColumnType("TEXT"); - b.Property("LockedUntil") - .HasColumnType("TEXT"); + b.Property("RequiresReauthentication") + .HasColumnType("INTEGER"); - b.Property("RequiresReauthentication") - .HasColumnType("INTEGER"); + b.Property("ResetAttempts") + .HasColumnType("INTEGER"); - b.Property("ResetAttempts") - .HasColumnType("INTEGER"); + b.Property("ResetConsumedAt") + .HasColumnType("TEXT"); - b.Property("ResetConsumedAt") - .HasColumnType("TEXT"); + b.Property("ResetExpiresAt") + .HasColumnType("TEXT"); - b.Property("ResetExpiresAt") - .HasColumnType("TEXT"); + b.Property("ResetRequestedAt") + .HasColumnType("TEXT"); - b.Property("ResetRequestedAt") - .HasColumnType("TEXT"); + b.Property("ResetTokenHash") + .HasMaxLength(512) + .HasColumnType("TEXT"); - b.Property("ResetTokenHash") - .HasMaxLength(512) - .HasColumnType("TEXT"); + b.Property("Scope") + .HasColumnType("INTEGER"); - b.Property("Scope") - .HasColumnType("INTEGER"); + b.Property("SecurityVersion") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.Property("SecurityVersion") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "LockedUntil"); - b.HasIndex("Tenant", "LockedUntil"); + b.HasIndex("Tenant", "ResetRequestedAt"); - b.HasIndex("Tenant", "ResetRequestedAt"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey", "Scope"); - b.HasIndex("Tenant", "UserKey", "Scope"); + b.HasIndex("Tenant", "UserKey", "Scope", "CredentialType") + .IsUnique() + .HasAnnotation("Npgsql:NullsDistinct", false); - b.HasIndex("Tenant", "UserKey", "Scope", "CredentialType") - .IsUnique() - .HasAnnotation("Npgsql:NullsDistinct", false); + b.ToTable("UAuth_Authentication"); + }); - b.ToTable("UAuth_Authentication", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RolePermissionProjection", b => + { + b.Property("Tenant") + .HasMaxLength(128) + .HasColumnType("TEXT"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RolePermissionProjection", b => - { - b.Property("Tenant") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("RoleId") + .HasColumnType("TEXT"); - b.Property("RoleId") - .HasColumnType("TEXT"); + b.Property("Permission") + .HasMaxLength(256) + .HasColumnType("TEXT"); - b.Property("Permission") - .HasMaxLength(256) - .HasColumnType("TEXT"); + b.HasKey("Tenant", "RoleId", "Permission"); - b.HasKey("Tenant", "RoleId", "Permission"); + b.HasIndex("Tenant", "Permission"); - b.HasIndex("Tenant", "Permission"); + b.HasIndex("Tenant", "RoleId"); - b.HasIndex("Tenant", "RoleId"); + b.ToTable("UAuth_RolePermissions"); + }); - b.ToTable("UAuth_RolePermissions", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RoleProjection", b => + { + b.Property("Id") + .HasColumnType("TEXT"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.RoleProjection", b => - { - b.Property("Id") - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("DeletedAt") + .HasColumnType("TEXT"); - b.Property("DeletedAt") - .HasColumnType("TEXT"); + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UpdatedAt") + .HasColumnType("TEXT"); - b.Property("UpdatedAt") - .HasColumnType("TEXT"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "Id") + .IsUnique(); - b.HasIndex("Tenant", "Id") - .IsUnique(); + b.HasIndex("Tenant", "NormalizedName") + .IsUnique(); - b.HasIndex("Tenant", "NormalizedName") - .IsUnique(); + b.ToTable("UAuth_Roles"); + }); - b.ToTable("UAuth_Roles", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.UserRoleProjection", b => + { + b.Property("Tenant") + .HasMaxLength(128) + .HasColumnType("TEXT"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Authorization.EntityFrameworkCore.UserRoleProjection", b => - { - b.Property("Tenant") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UserKey") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("RoleId") + .HasColumnType("TEXT"); - b.Property("RoleId") - .HasColumnType("TEXT"); + b.Property("AssignedAt") + .HasColumnType("TEXT"); - b.Property("AssignedAt") - .HasColumnType("TEXT"); + b.HasKey("Tenant", "UserKey", "RoleId"); - b.HasKey("Tenant", "UserKey", "RoleId"); + b.HasIndex("Tenant", "RoleId"); - b.HasIndex("Tenant", "RoleId"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.ToTable("UAuth_UserRoles"); + }); - b.ToTable("UAuth_UserRoles", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordCredentialProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordCredentialProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("DeletedAt") + .HasColumnType("TEXT"); - b.Property("DeletedAt") - .HasColumnType("TEXT"); + b.Property("ExpiresAt") + .HasColumnType("TEXT"); - b.Property("ExpiresAt") - .HasColumnType("TEXT"); + b.Property("LastUsedAt") + .HasColumnType("TEXT"); - b.Property("LastUsedAt") - .HasColumnType("TEXT"); + b.Property("RevokedAt") + .HasColumnType("TEXT"); - b.Property("RevokedAt") - .HasColumnType("TEXT"); + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("TEXT"); - b.Property("SecretHash") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); + b.Property("SecurityStamp") + .HasColumnType("TEXT"); - b.Property("SecurityStamp") - .HasColumnType("TEXT"); + b.Property("Source") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Source") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UpdatedAt") + .HasColumnType("TEXT"); - b.Property("UpdatedAt") - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "ExpiresAt"); - b.HasIndex("Tenant", "ExpiresAt"); + b.HasIndex("Tenant", "Id") + .IsUnique(); - b.HasIndex("Tenant", "Id") - .IsUnique(); + b.HasIndex("Tenant", "RevokedAt"); - b.HasIndex("Tenant", "RevokedAt"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey", "DeletedAt"); - b.HasIndex("Tenant", "UserKey", "DeletedAt"); + b.ToTable("UAuth_PasswordCredentials"); + }); - b.ToTable("UAuth_PasswordCredentials", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordHistoryProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Credentials.EntityFrameworkCore.PasswordHistoryProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + b.Property("CredentialId") + .HasColumnType("TEXT"); - b.Property("CredentialId") - .HasColumnType("TEXT"); + b.Property("ReplacedAt") + .HasColumnType("TEXT"); - b.Property("ReplacedAt") - .HasColumnType("TEXT"); + b.Property("SecretHash") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("TEXT"); - b.Property("SecretHash") - .IsRequired() - .HasMaxLength(512) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "CredentialId", "ReplacedAt", "Id"); - b.HasIndex("Tenant", "CredentialId", "ReplacedAt", "Id"); + b.ToTable("UAuth_PasswordHistory"); + }); - b.ToTable("UAuth_PasswordHistory", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + b.Property("AbsoluteExpiresAt") + .HasColumnType("TEXT"); - b.Property("AbsoluteExpiresAt") - .HasColumnType("TEXT"); + b.Property("ActiveSessionId") + .HasColumnType("TEXT"); - b.Property("ActiveSessionId") - .HasColumnType("TEXT"); + b.Property("ChainId") + .HasColumnType("TEXT"); - b.Property("ChainId") - .HasColumnType("TEXT"); + b.Property("ClaimsSnapshot") + .IsRequired() + .HasColumnType("TEXT"); - b.Property("ClaimsSnapshot") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("Device") + .IsRequired() + .HasColumnType("TEXT"); - b.Property("Device") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("DeviceId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT"); - b.Property("DeviceId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); + b.Property("LastSeenAt") + .HasColumnType("TEXT"); - b.Property("LastSeenAt") - .HasColumnType("TEXT"); + b.Property("RevokedAt") + .HasColumnType("TEXT"); - b.Property("RevokedAt") - .HasColumnType("TEXT"); + b.Property("RootId") + .HasColumnType("TEXT"); - b.Property("RootId") - .HasColumnType("TEXT"); + b.Property("RotationCount") + .HasColumnType("INTEGER"); - b.Property("RotationCount") - .HasColumnType("INTEGER"); + b.Property("SecurityVersionAtCreation") + .HasColumnType("INTEGER"); - b.Property("SecurityVersionAtCreation") - .HasColumnType("INTEGER"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("TouchCount") + .HasColumnType("INTEGER"); - b.Property("TouchCount") - .HasColumnType("INTEGER"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.HasKey("Id"); - b.HasKey("Id"); + b.HasIndex("Tenant", "ChainId") + .IsUnique(); - b.HasIndex("Tenant", "ChainId") - .IsUnique(); + b.HasIndex("Tenant", "RootId"); - b.HasIndex("Tenant", "RootId"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey", "DeviceId"); - b.HasIndex("Tenant", "UserKey", "DeviceId"); + b.ToTable("UAuth_SessionChains"); + }); - b.ToTable("UAuth_SessionChains", (string)null); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + b.Property("ChainId") + .HasColumnType("TEXT"); - b.Property("ChainId") - .HasColumnType("TEXT"); + b.Property("Claims") + .IsRequired() + .HasColumnType("TEXT"); - b.Property("Claims") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("CredentialPurpose") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(0); - b.Property("Device") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("Device") + .IsRequired() + .HasColumnType("TEXT"); - b.Property("ExpiresAt") - .HasColumnType("TEXT"); + b.Property("ExpiresAt") + .HasColumnType("TEXT"); - b.Property("Metadata") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("Metadata") + .IsRequired() + .HasColumnType("TEXT"); - b.Property("RevokedAt") - .HasColumnType("TEXT"); + b.Property("RevokedAt") + .HasColumnType("TEXT"); - b.Property("SecurityVersionAtCreation") - .HasColumnType("INTEGER"); + b.Property("SecurityVersionAtCreation") + .HasColumnType("INTEGER"); - b.Property("SessionId") - .IsRequired() - .HasColumnType("TEXT"); + b.Property("SessionId") + .IsRequired() + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "ChainId"); + b.HasIndex("Tenant", "ChainId"); - b.HasIndex("Tenant", "ExpiresAt"); + b.HasIndex("Tenant", "ExpiresAt"); - b.HasIndex("Tenant", "RevokedAt"); + b.HasIndex("Tenant", "RevokedAt"); - b.HasIndex("Tenant", "SessionId") - .IsUnique(); + b.HasIndex("Tenant", "SessionId") + .IsUnique(); - b.HasIndex("Tenant", "ChainId", "RevokedAt"); + b.HasIndex("Tenant", "ChainId", "RevokedAt"); - b.HasIndex("Tenant", "UserKey", "RevokedAt"); + b.HasIndex("Tenant", "UserKey", "RevokedAt"); - b.ToTable("UAuth_Sessions", (string)null); - }); + b.ToTable("UAuth_Sessions"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("RevokedAt") - .HasColumnType("TEXT"); + b.Property("RevokedAt") + .HasColumnType("TEXT"); - b.Property("RootId") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("RootId") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("SecurityVersion") - .HasColumnType("INTEGER"); + b.Property("SecurityVersion") + .HasColumnType("INTEGER"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UpdatedAt") - .HasColumnType("TEXT"); + b.Property("UpdatedAt") + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "RootId") - .IsUnique(); + b.HasIndex("Tenant", "RootId") + .IsUnique(); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "UserKey", "RevokedAt"); + b.HasIndex("Tenant", "UserKey", "RevokedAt"); - b.ToTable("UAuth_SessionRoots", (string)null); - }); + b.ToTable("UAuth_SessionRoots"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Tokens.EntityFrameworkCore.RefreshTokenProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Tokens.EntityFrameworkCore.RefreshTokenProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("AuthenticatedAt") - .HasColumnType("TEXT"); + b.Property("AuthenticatedAt") + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("DeviceId") - .HasMaxLength(256) - .HasColumnType("TEXT"); + b.Property("DeviceId") + .HasMaxLength(256) + .HasColumnType("TEXT"); - b.Property("ExpiresAt") - .HasColumnType("TEXT"); + b.Property("ExpiresAt") + .HasColumnType("TEXT"); - b.Property("RefreshChainId") - .HasColumnType("TEXT"); + b.Property("RefreshChainId") + .HasColumnType("TEXT"); - b.Property("ReplacedByTokenHash") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("ReplacedByTokenHash") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("RevokedAt") - .HasColumnType("TEXT"); + b.Property("RevokedAt") + .HasColumnType("TEXT"); - b.Property("SessionChainId") - .HasColumnType("TEXT"); + b.Property("SessionChainId") + .HasColumnType("TEXT"); - b.Property("SessionId") - .HasColumnType("TEXT"); + b.Property("SessionId") + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("TokenHash") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("TokenHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("TokenId") - .HasColumnType("TEXT"); + b.Property("TokenId") + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "ExpiresAt"); + b.HasIndex("Tenant", "ExpiresAt"); - b.HasIndex("Tenant", "RefreshChainId"); + b.HasIndex("Tenant", "RefreshChainId"); - b.HasIndex("Tenant", "ReplacedByTokenHash"); + b.HasIndex("Tenant", "ReplacedByTokenHash"); - b.HasIndex("Tenant", "SessionChainId"); + b.HasIndex("Tenant", "SessionChainId"); - b.HasIndex("Tenant", "SessionId"); + b.HasIndex("Tenant", "SessionId"); - b.HasIndex("Tenant", "TokenHash") - .IsUnique(); + b.HasIndex("Tenant", "TokenHash") + .IsUnique(); - b.HasIndex("Tenant", "TokenId"); + b.HasIndex("Tenant", "TokenId"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "ExpiresAt", "RevokedAt"); + b.HasIndex("Tenant", "ExpiresAt", "RevokedAt"); - b.HasIndex("Tenant", "TokenHash", "RevokedAt"); + b.HasIndex("Tenant", "TokenHash", "RevokedAt"); - b.HasIndex("Tenant", "UserKey", "DeviceId"); + b.HasIndex("Tenant", "UserKey", "DeviceId"); - b.ToTable("UAuth_RefreshTokens", (string)null); - }); + b.ToTable("UAuth_RefreshTokens"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserIdentifierProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserIdentifierProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("DeletedAt") - .HasColumnType("TEXT"); + b.Property("DeletedAt") + .HasColumnType("TEXT"); - b.Property("IsPrimary") - .HasColumnType("INTEGER"); + b.Property("IsPrimary") + .HasColumnType("INTEGER"); - b.Property("NormalizedValue") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); + b.Property("NormalizedValue") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Type") - .HasColumnType("INTEGER"); + b.Property("Type") + .HasColumnType("INTEGER"); - b.Property("UpdatedAt") - .HasColumnType("TEXT"); + b.Property("UpdatedAt") + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Value") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("TEXT"); + b.Property("Value") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("TEXT"); - b.Property("VerifiedAt") - .HasColumnType("TEXT"); + b.Property("VerifiedAt") + .HasColumnType("TEXT"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "NormalizedValue"); + b.HasIndex("Tenant", "NormalizedValue"); - b.HasIndex("Tenant", "UserKey"); + b.HasIndex("Tenant", "UserKey"); - b.HasIndex("Tenant", "Type", "NormalizedValue") - .IsUnique(); + b.HasIndex("Tenant", "Type", "NormalizedValue") + .IsUnique(); - b.HasIndex("Tenant", "UserKey", "IsPrimary"); + b.HasIndex("Tenant", "UserKey", "IsPrimary"); - b.HasIndex("Tenant", "UserKey", "Type", "IsPrimary", "DeletedAt", "CreatedAt", "Id"); + b.HasIndex("Tenant", "UserKey", "Type", "IsPrimary", "DeletedAt", "CreatedAt", "Id"); - b.ToTable("UAuth_UserIdentifiers", (string)null); - }); + b.ToTable("UAuth_UserIdentifiers"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserLifecycleProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserLifecycleProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("DeletedAt") - .HasColumnType("TEXT"); + b.Property("DeletedAt") + .HasColumnType("TEXT"); - b.Property("SecurityVersion") - .HasColumnType("INTEGER"); + b.Property("SecurityVersion") + .HasColumnType("INTEGER"); - b.Property("Status") - .HasColumnType("INTEGER"); + b.Property("Status") + .HasColumnType("INTEGER"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UpdatedAt") - .HasColumnType("TEXT"); + b.Property("UpdatedAt") + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); - b.HasKey("Id"); + b.HasKey("Id"); - b.HasIndex("Tenant", "UserKey") - .IsUnique(); + b.HasIndex("Tenant", "UserKey") + .IsUnique(); - b.HasIndex("Tenant", "DeletedAt", "CreatedAt", "Id"); + b.HasIndex("Tenant", "DeletedAt", "CreatedAt", "Id"); - b.HasIndex("Tenant", "Status", "DeletedAt", "CreatedAt", "Id"); + b.HasIndex("Tenant", "Status", "DeletedAt", "CreatedAt", "Id"); - b.ToTable("UAuth_UserLifecycles", (string)null); - }); + b.ToTable("UAuth_UserLifecycles"); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserProfileProjection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); + modelBuilder.Entity("CodeBeam.UltimateAuth.Users.EntityFrameworkCore.UserProfileProjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); - b.Property("Bio") - .HasMaxLength(4096) - .HasColumnType("TEXT"); + b.Property("Bio") + .HasMaxLength(4096) + .HasColumnType("TEXT"); - b.Property("BirthDate") - .HasColumnType("TEXT"); + b.Property("BirthDate") + .HasColumnType("TEXT"); - b.Property("CreatedAt") - .HasColumnType("TEXT"); + b.Property("CreatedAt") + .HasColumnType("TEXT"); - b.Property("Culture") - .HasMaxLength(64) - .HasColumnType("TEXT"); + b.Property("Culture") + .HasMaxLength(64) + .HasColumnType("TEXT"); - b.Property("DeletedAt") - .HasColumnType("TEXT"); + b.Property("DeletedAt") + .HasColumnType("TEXT"); - b.Property("DisplayName") - .HasMaxLength(256) - .HasColumnType("TEXT"); + b.Property("DisplayName") + .HasMaxLength(256) + .HasColumnType("TEXT"); - b.Property("FirstName") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("FirstName") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Gender") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Gender") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Language") - .HasMaxLength(64) - .HasColumnType("TEXT"); + b.Property("Language") + .HasMaxLength(64) + .HasColumnType("TEXT"); - b.Property("LastName") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("LastName") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Metadata") - .HasColumnType("TEXT"); + b.Property("Metadata") + .HasColumnType("TEXT"); - b.Property("ProfileKey") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("TEXT"); + b.Property("ProfileKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT"); - b.Property("Tenant") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("Tenant") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("TimeZone") - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("TimeZone") + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("UpdatedAt") - .HasColumnType("TEXT"); + b.Property("UpdatedAt") + .HasColumnType("TEXT"); - b.Property("UserKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("TEXT"); + b.Property("UserKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("TEXT"); - b.Property("Version") - .IsConcurrencyToken() - .HasColumnType("INTEGER"); - - b.HasKey("Id"); + b.Property("Version") + .IsConcurrencyToken() + .HasColumnType("INTEGER"); + + b.HasKey("Id"); - b.HasIndex("Tenant", "UserKey", "ProfileKey") - .IsUnique(); + b.HasIndex("Tenant", "UserKey", "ProfileKey") + .IsUnique(); - b.ToTable("UAuth_UserProfiles", (string)null); - }); - - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => - { - b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", null) - .WithMany() - .HasForeignKey("Tenant", "RootId") - .HasPrincipalKey("Tenant", "RootId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); + b.ToTable("UAuth_UserProfiles"); + }); + + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b => + { + b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionRootProjection", null) + .WithMany() + .HasForeignKey("Tenant", "RootId") + .HasPrincipalKey("Tenant", "RootId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); - modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => - { - b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", null) - .WithMany() - .HasForeignKey("Tenant", "ChainId") - .HasPrincipalKey("Tenant", "ChainId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); + modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b => + { + b.HasOne("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", null) + .WithMany() + .HasForeignKey("Tenant", "ChainId") + .HasPrincipalKey("Tenant", "ChainId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); #pragma warning restore 612, 618 - } } } diff --git a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/uauth.db b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/uauth.db index c9cf4b4e788deb2a37a4a5eef5db1c380729a4e1..643cc3c64a34a97906cc58b7f3ab27a71c9ef317 100644 GIT binary patch literal 352256 zcmeI5eQX=)o!|K)iIQx2_BBkh$t^{1vgWQwo>#so*?5QK(B@jAB#N}H>}?pD97$YD zq?SY3mN$C`dN;dGbGSA|uecP!rD?Bs1@4M8Es7Q>?vF#!D-P|V3D8Ry4O(;$D2k%_ zqxq+3asTw0;S4!59KLBC$Fjd;bEui;_dL(<_j!KLGtbM+aC2j&)>1;-jply272-Wl zcziz3tD%s`&o$ZCsK28A5A_S` z=kxz%<{!_zKJ|ZRp73u^{i!$XU-bMZ^6!3a*(Ya$Z^XQwTD_{=QQz7lHkQhVt%iPF zDoTf~-BM9in%SySZ`HPIN>eSduBV@R_Zw#dL6-G?aJE&xv8Qx|HWgK^HR}0Bqowwr zp;CESD#)RNlw6TR;eLT|=-k45h-~3(H5|(33i2g6AIhy2Lb>9~N+`9K+brZIay}GZ zzhbCs%`zNX&u3Sq{8s3SycLp)g|%#s5>gUoF6%B{vtYg|j%rcya<)>=nbNl_58{Z!0EMhRHq zNpA2;9qUUbp<*t(QItdH!UmP|p|BAYS(uNcsF~n3cDN^5i^g;#>$xZHT|XTNo;~Y* z@3zH<@{K*ka31~71vjtJL+tKiD^Yh}F=APq#H2U0<+GHOBz+j zwwIcEdVOvt`0~r%Egi7Y2CK?jhf2MoI1cA+P#uBi>clP2lbDhB=4Jyyp7(x`uojxK z-Bi@w0%=+5W|3J>&Dqj68sofGqE}qwx5kbHEH%x&Io8!1SlC0|M2~v8tnRuyLU?$4 zZL~uJvrg@nYxQ2JrPk$@gS~P^sV0y5G_XjGs`K)lgBmHHf!B*+*Mwp9{=LPSK=9&4 z?*|(eUsx}z>g`6eN|e$s?BzYfBU}OkZhqk+XZMaV8ei8mEDkbOQ#`6rD@~;}#3zPP z?JE&WX_{Bz%~pB;V1U1^l+_kd&(a03CeS!+R=O7vOTZ{UDGup39QWF=5ts=o7l&UP zTuRGq&|HFMzxmWuASjC7Z(Xvuoz|Vy`jM4#i*#K&-97ucX*XxHi%jfi&gl2q#VU;h zQjX5Psp-7E8df;6$ytg#Q?Bi4Zqicr4_f46G$<|2p-frR=Pb#rG%BRiSR{P+Ttf5Y zilQ|zd8KSCg~8e76;)|z(G+!1heH<`R!?++RHLpQ?hmL4y2P-CQx_Nw$E=aV+QLiI zGr`xz;eKxS7SqM;XJ^{ieR{9x-kR>+rIMUkt?e{*w^lFL)K;T;|J*T41ES9<(foHXWYFqN^Bg1>N3oXrS z?a{R}zG0j+fgU7{jkCr$d;9$v*t&dXWi8b9iLaN5%EBeGdp=5b&wQ5bo<6fc_GHlS zq5iY>2R0A@0T2KI5C8!X009sH0T2KI5CDObMc@Um-?PRsT$E-xn&Cohe3?lsbBU#x zDDp8b_Ahm5A_lCkEpv;jM5IUfdB}A00@8p2!H?xfB*=900@AcnE%I2&c6 zyg*_JrS-$6^4e{3vql`^$E_S-4UTQ|tfR4t`guW7eF zlKaM4lHn37ocH@Tj3gM2=ou9`k|$p>?>aJWw=kraeEwobn&F9#LV}Hzq-vGi^{`ED zvdPqxz3NJBzt%ES|Dx9~8}dwoW7rt0abQc?dab43pk$;wPs(%V%>VOH|Bd<=)Ze5E zRD>L00|5{K0T2KI5C8!X009sH0T2LzM}@!zf5kh&Ji*LM{;iJu$Qgp^FZtg#MJJsb znEIlB!-zXM}5UZ{XMe71_B@e0w4eaAOHd& z00JNY0w4eak2HaH(Dy`fan(EPO{Mfl`)9p8lVPG6Mxq5dD$+taD$o*}6lqps`B*Y8 zCgeC*`nnN~#F->oNv+j)_LNeoJYt*of6c2YHmfDy$zhh`qEbrEr0BE|P16F;igY}~ z#_5E>a{|Y4f-J>L!XFlbjPLUlp5C8!X009sH0T2KI5C8!X0D;GhK)dOq$g*=g zq5t|@imW{+jg8j69Xm6ux9WUj#8z(ZH0s<7{8E&>i!QpvE?tQqeD$c&OdRk`wQ*-< zt$DRv*t-47D@#}M&3qzyA(p>hzg?*$E~qzKE3vzmcs485_jhkzu3yd7TgC0G$wcE7 zDG?K;gcPHh6i-&h<0*zt3S5R3qEV6OGYluDGTOcHG|SR#EW~o!3-NeiiM%6#;S*fD z>2(+_85^yAJ9cJR&*%|r`Q<*NqnpC5vQ%g89`dnUjjM6>;MQGngBX2O-rd=b9;J7W z_G8UlYJc;paxJ&Db*q`Za3F}8yX&vzchkGA%hhY@E3udyOUIcM&9USb1wrCtbdu*e zVqjc~b0WiWa?H(Wj%7rVjcd>UWBvaztKKjd1V8`;KmY_l00ck)1V8`;K;U5~psoL# z(=Co!82!);)7SsaDGJBTg??y;Y2$zG_y4eg00@8p2!H?xfB*=900@8p2!H?xJh}w5 z`~Rn?f9Rq9C-oERPsktGKmY_l00ck)1V8`;KmY_l00ck)1RgAbUz_r$W|i&Ir>6Y; ztp2NgCF@TSs!#d-5pUa$)yYd@cFG+L@Q{`XS<&O`oV z0|5{K0T2KI5C8!X009sH0T2KI5P0|r@ZPD#BGr2z0c&jJbqCrD4{ST_NZVf0?*GU5 z|KTrOXb1uz00JNY0w4eaAOHd&00JNY0tNwLnhgKvCLI6k@BgPRd#HavcGy4w1V8`; zKmY_l00ck)1V8`;KmY`W64>(16&Ig>rpP+~ET7={gp`nIkxz59Ag5(oiivSL#>t{A z#unY5B0S(-(C3m!fU6$Ne-}q00@8p2!H?xfB*=900^8Q z0`2oN3uGzLySO-)S|jU;u@skK5^RR%GN~jjNE}Ni*|bE0GtDhsZy)l1C92ZxwG;njU280;94$fQL+k(B5}T3gm9b&!@= zfu}{0iE}AF5f?dWd?R#i_1$1S28VPs)YkuJs8b&5ht&JjDe5EY4N5pc4INYk0T2KI z5C8!X009sH0T2KI5CDNm324vOk26s=qX~{PMK!Gnjx!B3r3sER8{^jm$C(MypZ_0c zwn1C}U+}-}p}u_PQ)hm0D!%aH?4Qp6_t{3^THy5bkEZYX-zI@4e*5NAvwExwS$lS6o>MrPgwrg}g-0hr;VuO0Eg4=d-I)ek*iE-U>;@!df;*a$S{kh4V(r zx_Vmj1^GHj*GRh?s?^K%)}TPmvdd+4cR+ZN%qLz^js}EoDymv*)CXp5gr|1PHH#3j z+te+u9PE`VN;P?;+hA41B9&??WLCB+4KhN$b5JA2G%!4`+#+UL;#<+p#mlUW~l^ zjWdBD%X&XJYjH}0YQE8E89r$}L%F%6Rp2-tX^%hBAvM){Tqg0y;r=$t5sC-Z{(>?p z$uK9_R4RwfTI*<_GnoE5O2As3C9^tP;gt${Z7i9Din;7YQ4XC8cg}~2TNy!-h53lM zFcZw4^?GXcs&YqtYp>Q)N@Q`Op&y%#MPpA-BZ zYQfDR@jM6#!5f^Wn|m&m%(+^^}4qpfT#r%&H|c0Le{#k}uk9i?Ou>Xnz}*p@UAst%y@+4no0s^*t zjLW=>T#tGmRQHQU|_77U5)fkkP z=1``r>2sE3RvH!3(JPYbyyp^{C#{IqQOxTr{6@ddwex4Ho>x?*rA1TJL01c1WLQ1X z1yYT=dbmHJBIpvsI>5TXXgFq#9N0@Ct?Q-fnc(Z8ZBl)jRO_XctPFx7wp=XMDr>XaYSr8WU$tab9TpGjQ*z)%J;x_qXH( zhc^B{?TLF%{pH-pbAKoBhjXh_9|vyuKbZRar(g8HN&*IK?@xa=5R62;-Byg_B!KQ%HMtTY-H2tUuGNNK9Vy-hjy=qUztZ;=K30y2`=1@ra)@x znGJ30I>TAB*>vQU+AG)gNxN*TDkg(frBx;aukwK4Zas6lD(U<6t_|yl&4Y&Oav2Gk zV`j$4&)Vc{wBJR`f9pjDS#qJ+CjAnlvC<-#XM%(HngTt< zeGQAVh3>Ri*3{iw=wb7CTI|8|bcRxc1v0g!+OiI{t$ixeeQTWYg;&G-Zj4;gT_4u^~p9M``7E|RIkucD|gJw3YrtySh8K5Jq3&VDNUX>b{EiWT^L)}ywf#%&dq~tk?j8CMCyJmbtGVMAon4F*@1KK z-kNjuu6^H6(2k9A18uHjQ&H*z*R`Y@YGd!PrSuIHESEFqB9+6Z$LREL*2@R#Ze!5m zn^bAlZYc)wUSG$eLcT#7Y%=snH4e3PNM{k6t#P4oSlJyR<7nE)8P*J&-W)tK>C{wf zFV(r6)A8TFp@qwWj_F;IF~%=OsnXM}tQ&dUB*zSq3oONUq}- zZT#<}f*$I($POC_fB*=900@8p2!H?xfB*=900=x@1XSO=_AZB6?PdJ&R3^bD)8s`C zQGvY3AsJ`sILBn@bRsUL1Xf6*fwN~HRQ%a>#Z=-N~Am4aTM$_BLRMIj{i;~2| zGPIcF1zLy--*HTnN*BT$Y~N7wcKDZYOUW;Nz#7cfV`=JytJX=s*+><|08k}05%W+0T2KI z5C8!X009sH0T2KI5CDOPfq?%0|1oAT^!5L7<`uN{fB%_(=Aphrg~=B-5C8!X009sH z0T2KI5C8!X009tqSP1O3>8@NH_E&h<1Mm8d!TcT5WChh~_z{_j2Wc@O!I4Fo^{ z1V8`;KmY_l00ck)1VG?%CGhUoy-$0J~9>ym>6R>%twiGSwcCB7*+*V20jVAdfznQ!ouIx4&`wBT#JCLf?rlP9k ziUUycGW9)uim*;IJ{d? z4+?67dyU_1Zqv;hEoM7kuW#hjg=^_Ilb6?aD}HVL-%EYyA^)*~00@8p2!H?xfB*=9 z00@8p2!H?xoCE^g)S~tNfN>^j^!NYIZF)|BkL<9400@8p2!H?xfB*;_hrs(8-;Uh(~n_QLE0OETm1+Qz>JbjbRc8N>-8mRq(hot?1du<&8|u(i9~QtIV;i>!%- zdwjxVeQdYYI#|ANL9Og6`(<@$zgB5B)W&vesnXcLa9h2=F--gd6TMKYD)m;ab#$S# z&UQgtV$)L7U!_e}2biW-HN!f(9OTXyV&(i7GeA$94u z!{vj6t4dQ_nG7%25BK)YhxZzlvPQLYR8gDTg~m;#8(cY5TMe=_ss+FEe%WhQq?A#S z=3?9YjW^{x`-LmpGN1V>f3;fNNw>D+?4_-{#p?Fj&7;e=uCCQ~ZmTzcnH7miEc1P9 z(4C6p8pOu5I!1y-W{DMI2}X>fj@9;6)Uoc`y;*A>Y#r0q|9#ZQ9_kllhYbWk00ck) z1V8`;KmY_l00ck)1VG>+Ch*eKV#@Lg19N6qn{}e57Cn|A-x+djd56Hl?4Ns{_I&J_ zJrhXJ{Lb`Grv75;w130**S!D6^D&h^^S94Dx$x%ce|h?eQ_B4J=6*3(?m%dt`$8ai zjrX=U$rB99o$U2eQ6e+2rM$9Do>g`6enrbTgv~PK@ ztFSg1dPO-ZrIkIUrBtO>CpVWE=LQ(yB5Km;OWbOZOFX+-Mr_T(u6D%6SI-85m5bi? z%}H$>XxWR$w(MB;MB15fAh<(JP{%eQuiPS2$HR)}i<2ACO>`nNda)wy_+lWqMGR5K zHpHwOE~Wnk!-8TiyHV_~C@wKfKO;{vS!#-lpxv>EI4OhBq-7xAIjE5uKctGhFnJkt z6P?I{UaUy_==s@T+b??W$@W6f8Yyj!r$U~?YSc|sW|iEmkVmviy#_&hq^naw?D5VH zFBH4*IGI@Ow8yp=lBM?Ry6O#GxBb$eK#R1cUkd~k(c3Me7V;7~9}2HuF}gjyxa;}ss+8XfU6Hp!Qn9d>&9xIt1Zk`fX`U=DuXh)Jx_yt{ zsgBMLF>U};hnQI(d#QDqw$DWa!A;iN-m(|5VMD&rXmyp*4$O;_HT+A476YzIR#8)v zPEuVhNMF$^WpCyTS#muR1Hl^UWxnI8s@}!x>S{LPY2!IwTakA}mj}QzG#Q?ri|U;S zcHJ#aw5bWXu$~iKyUW8ecF{j^4E-lmJJS9F9|#r+^R+RUyZA?kNqiDb2fBtE->z?5 z;5taj*upvjaYd>pK0zOd$9QQIj5`rpZ!IPnp(RS009sH0T2KI5C8!X009sH0T39Mz=-w#&iMZa9_lC555`Rrav%T#AOHd& z00JNY0w4eaAOHd&00Q@!z=f&BRm=VRqkbyEw?yPE_xF#I?~MO{&qMu~`n~(CIg$eb z5C8!X009sH0T2KI5C8!X009sfivT-K2LBU`{^xxcNQ~Ku$N%5+Q2&AY-dHL@2n0X? z1V8`;KmY_l00ck)1V8`;K;XU-;AY6^e|DnbKSQF-THo(C-uge@|9@W#4vB#P2!H?x zfB*=900@8p2!H?xfWU($FxK<`-}O)*Qr~^hsv$oR009sH0T2KI5C8!X009sH0T6iX z3Gh>kMa$BE(%5M2+p#mld>n~mx%Xc(Hd_03?94E{|NpV~Gynhr5C8!X009sH0T2KI z5C8!XcoYbXwf>Ly|33;v4I4lJ1V8`;KmY_l00ck)1V8`;PA~z-`~Po@*pB!9|L<$> z|Ns68rUcbN00ck)1V8`;KmY_l00ck)1VG><6JW^e{5_V(07i`dZ|Lv;pY;8Io+nN+ zBIphRAOHd&00JNY0w4eaAOHd&00JN|ih%a~KgR!~C?OmKKmY_l00ck)1V8`;KmY_l z00d4p0gV4ocKJbj5C8!X009sH0T2KI5C8!X009sfhXBU^<4}SO2!H?xfB*=900@8p z2!H?xfB*=bYyuenpX~C3_8z$#)KFO+}Sj_TX1jd08sRp=>TKUk`;x zM-PYAa-pz2k#Oi-xRXuzd??(_DI95w%Yk5-D7QacxzujCR?k*TdF58)rc!k(d2vi7 z`;r;0tPw@iyPG-D`jpSYy5IcU;xVHyW*Oc^6fs zc||!IfK(TKWw@fllXFp9k6`x&LklO~7h-{6k=U^|wjDOadPZNKT>Hs%jx2o6b1}F{ z)Z7}arlwN1YSXg4b}10N$$IZm_UIau^=4zcwx{%!mT{gGTqh~3?5bgKF_+ya_Saae zs9EU^{H0#9Rs_}<1B=ZPHPYrYf#8op3>5qqEf1oMJpT~D5b2r-mLAHn@1x{+mh1dA+}q@%ecezq2g*$dNPX~NseugGal(RePyg(lj&OBj!VZ1v*(u@puQRI z^w4fHR?SV}f$rCf6=^TN(&>s8?L}awVP0bVAFW(ZlqmNQ_vOi*(W}8SsbD+y(#<#aly#-KU$c)ldZ#)B9b()7 zkPb1kuzRUlfjWfkK5B^)A)~bK1h4Vl_NGI3Wt)tNb_-0`qmdLRutCo9albqmn}=Ge9Yam?J5xS`JA&MlFzZM@h{ozZwW0 zl8eUKu~gQtcaEmbRe#yge?YZ&C}*1Cmi*W@nU_q5df|w+{_mr{OVcZ zI9Zg%I3sY;SZDnI6A$&1PntR6g8&GC00@8p2!H?xfB*=900@8p2s|(XOH+%hmYe*` zBeu@?|MxxA?>{gNkr4=h00@8p2!H?xfB*=900@8p2!MbKf!C)OSCt9I^!q!P;%{*R zpV~|$F7HTuRo=Lv#&5@NC*EYR^QoEN~Ljr%g^V$|9{Ni|MOAb@KE2Ne)M1s zL~bAe0w4eaAOHd&00JNY0w4eaAnPXMVt`|~D9y4o8w;`A zGLu*qnI%?;B^WW(j~)-|uo47700ck)1V8`;KmY_l00ck)1RiPvFHJ3` zEVBjXpq>-7K|RYXGx4Q37iAJ$+!rCDmN^2uC>j6r@g*UVh$k4nGyeZG5A|o%PakUQ zp&ST+00@8p2!H?xfB*=900@8p2t4)#sHsKkjRb?n{{z?mzpah`zx~)_1ON~K0T2KI z5C8!X009sH0T2KI5cuU2Se{y}Sl0J<)hl_@SpT1)wmj4yQ(M%}$z1@yOR0}nHQ!OW0sIZRcXF@xYw%fms?8tu(i8XY3xrw zJ+=6(Luks8B+K!F7>$vq`2Am)T1;4^%hml_y)R84Ni%4*8gXyH4pW_sJ})1 zYw9NThvWbo2!H?xfB*=900@8p2!H?xfB*=9z%T;OO)q+_!~SP1;Gqd z=AnK}eV?jRuTZDS0X7f-0T2KI5C8!X009sH0T2KI5I8vmw8!e_CK>uq8ew|U2vg1o zBL?SX|D+Lo7c`?M9se&}_E5h~efG>BoZ%M!gdAW40T2KI5C8!X009sH0T2KI5Ew|H zHAj}2=RB$61Ov`z`rgaN^Gh*7U}JnNmf|u@g3ZueCY7WGiDT&`o0e!fCZ(mAz{m+P zHglXz=Z9pPN^q&9C`6>p(|PGjv70=(&ZCuJQ^eB#AHSiX;I=uTHrDw zoe46a&Eq@4e@*)vL;#?DbMnB5yS;<(2KGqV5(NH0; zzg$*#U8G-5UrtXI5(&+Mmt_f@?2(+bO$8 zYKG<;drG%Ku+^V#=-L36>k161GhLZMwdL8%f#51p?cxa4G(F8K(M>cru4bLsR+sOl zVOPu$j1X$S8@$PS?@|4Ftv4InwSHzx$H)vNrIrif3lpoYHGI7!Cow^9GWEWIp%1y7iq}aGfcQym5{q2ySTgJwPy=m6 zWjcJ9(8NYW+Dq3udOLb9uK8>#s#u;38VEtd3M1Ol~W9sjSM5^xQ_*GZFb5JAwdD2ZB zR&^tj7~zuSn3i;7c6x`ss=JgQzY25{ajCj<$FgH$?IZ8iHv&PP_kPQ7>BrhCtc!A2 z4drZoSX(4=HMI0#NoQ5QB`6Or zb}LCI*_0stR(qJyi8jN#mu90!YKht{8#7r)REI0uyR>HdW}nwG*ff)~WYu+NmoR&y zGgzQEPOv0Aw8w90=WPQFQ+MTa3Yzi|(}sx-B>Jxs>W_JSvU{m%OT*F4lep}y7~ z!s8DR009sH0T2KI5C8!X009sH0T2Lz2?%Ti7H9A8^8cEa;(c8I?~MO{puhir0>dB* z0w4eaAOHd&00JNY0w4eaAOHd&a6bt+-v2-1=L>Ee=l%aa>N_6l&&duO2!H?xfB*=9 z00@8p2!H?xfB*=9z=I(WBQNlOZi1IcR+a7Y;a(mz5f21F00ck)1V8`;KmY_l00ck)1VF$>V8Z+P{SNt2zj`?7 z{r?M^a!=Sa!~qC^00@8p2!H?xfB*=900@8p2!OyNMnGHt$N2vdD^!>R0w4eaAOHd& z00JNY0w4eaAOHdm0vP{0fZz}WKmY_l00ck)1V8`;KmY_l00bUE0vP{4f`tl`KmY_l z00ck)1V8`;KmY_l00cn5K>*`_2M`>B00@8p2!H?xfB*=900@8p2!Oz&O`t%`W66gh zp9|!(L_Re6oF|``$>$~ViIC46`CtP95C8!X009sH0T2KI5C8!X009svY>!H8zY0>)YH7185?Hv0{~}p2O9tY diff --git a/src/CodeBeam.UltimateAuth.Core/Contracts/Session/AuthValidationResult.cs b/src/CodeBeam.UltimateAuth.Core/Contracts/Session/AuthValidationResult.cs index ec6a0c54..22adaa53 100644 --- a/src/CodeBeam.UltimateAuth.Core/Contracts/Session/AuthValidationResult.cs +++ b/src/CodeBeam.UltimateAuth.Core/Contracts/Session/AuthValidationResult.cs @@ -14,6 +14,7 @@ public sealed record AuthValidationResult public SessionRootId? RootId { get; init; } public DeviceId? BoundDeviceId { get; init; } + public UAuthValidationRequirement Validation { get; init; } = UAuthValidationRequirement.Standard; public bool IsValid => State == SessionState.Active; } diff --git a/src/CodeBeam.UltimateAuth.Core/Defaults/UAuthConstants.cs b/src/CodeBeam.UltimateAuth.Core/Defaults/UAuthConstants.cs index 62ee961d..1fcb653f 100644 --- a/src/CodeBeam.UltimateAuth.Core/Defaults/UAuthConstants.cs +++ b/src/CodeBeam.UltimateAuth.Core/Defaults/UAuthConstants.cs @@ -53,6 +53,7 @@ public static class Headers public const string AuthState = "X-UAuth-AuthState"; public const string DeviceType = "X-Device-Type"; public const string AuthRecovery = "X-UAuth-Auth-Recovery"; + public const string Validation = "X-UAuth-Validation"; } public static class Routes diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs index ff0a19ee..5fc3c942 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs @@ -22,7 +22,7 @@ internal sealed class AuthFlowContextFactory : IAuthFlowContextFactory private readonly IDeviceResolver _deviceResolver; private readonly IDeviceContextFactory _deviceContextFactory; private readonly ISessionValidator _sessionValidator; - private readonly ISessionLineageValidator _lineageValidator; + private readonly SemiHybridAuthorityValidator _authorityValidator; private readonly IClock _clock; public AuthFlowContextFactory( @@ -33,7 +33,7 @@ public AuthFlowContextFactory( IDeviceResolver deviceResolver, IDeviceContextFactory deviceContextFactory, ISessionValidator sessionValidator, - ISessionLineageValidator lineageValidator, + SemiHybridAuthorityValidator authorityValidator, IClock clock) { _applicationProfileReader = applicationProfileReader; @@ -43,7 +43,7 @@ public AuthFlowContextFactory( _deviceResolver = deviceResolver; _deviceContextFactory = deviceContextFactory; _sessionValidator = sessionValidator; - _lineageValidator = lineageValidator; + _authorityValidator = authorityValidator; _clock = clock; } @@ -92,32 +92,27 @@ public async ValueTask CreateAsync(HttpContext ctx, AuthFlowTyp { var subject = principal.FindFirst(ClaimTypes.NameIdentifier)?.Value; - var sid = principal.FindFirst("sid")?.Value; - - if (UserKey.TryParse(subject, null, out var jwtUserKey) && AuthSessionId.TryCreate(sid, out var metadataSessionId)) + if (UserKey.TryParse(subject, null, out var jwtUserKey)) { - var validation = await _lineageValidator.ValidateAsync( - new SessionValidationContext - { - Tenant = tenant, - SessionId = metadataSessionId, - Device = deviceContext, - SessionOptions = options.Session, - Now = _clock.UtcNow - }, - SessionCredentialPurpose.MetadataOnly, - ct); + var requirement = UAuthValidationRequirementResolver.Resolve(ctx, effectiveMode, options.Validation); - if (validation.IsValid && - validation.UserKey == jwtUserKey && - validation.Tenant == tenant && - validation.SessionId == metadataSessionId) + if (requirement == UAuthValidationRequirement.Standard) { - sessionSecurityContext = SessionValidationMapper.ToSecurityContext(validation); - isAuthenticated = true; userKey = jwtUserKey; } + else + { + var validation = await _authorityValidator.ValidateAsync(ctx, principal, tenant, deviceContext, options.Session, ct); + + if (validation.IsValid && validation.UserKey == jwtUserKey) + { + sessionSecurityContext = SessionValidationMapper.ToSecurityContext(validation); + + isAuthenticated = true; + userKey = jwtUserKey; + } + } } } } diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/SemiHybridAuthorityValidator.cs b/src/CodeBeam.UltimateAuth.Server/Auth/SemiHybridAuthorityValidator.cs new file mode 100644 index 00000000..5db607a3 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Auth/SemiHybridAuthorityValidator.cs @@ -0,0 +1,106 @@ +using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Contracts; +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 Microsoft.AspNetCore.Http; +using System.Security.Claims; + +namespace CodeBeam.UltimateAuth.Server.Auth; + +internal sealed class SemiHybridAuthorityValidator +{ + private static readonly object CacheKey = new(); + + private readonly ISessionLineageValidator _lineageValidator; + private readonly IClock _clock; + + public SemiHybridAuthorityValidator(ISessionLineageValidator lineageValidator, IClock clock) + { + _lineageValidator = lineageValidator; + _clock = clock; + } + + public Task ValidateAsync( + HttpContext http, + ClaimsPrincipal principal, + TenantKey tenant, + DeviceContext device, + UAuthSessionOptions sessionOptions, + CancellationToken ct = default) + { + if (http.Items.TryGetValue(CacheKey, out var cached) && cached is Task existing) + { + return existing; + } + + var task = ValidateCoreAsync(principal, tenant, device, sessionOptions, ct); + + http.Items[CacheKey] = task; + return task; + } + + private async Task ValidateCoreAsync( + ClaimsPrincipal principal, + TenantKey tenant, + DeviceContext device, + UAuthSessionOptions sessionOptions, + CancellationToken ct) + { + var identities = principal.Identities + .Where(x => x.IsAuthenticated && x.AuthenticationType == UAuthConstants.SchemeDefaults.GlobalScheme) + .ToArray(); + + if (identities.Length != 1) + return Invalid(); + + var subjects = principal.FindAll(ClaimTypes.NameIdentifier).ToArray(); + var sessions = principal.FindAll("sid").ToArray(); + var devices = principal.FindAll("device_id").ToArray(); + + if (subjects.Length != 1 || + sessions.Length != 1 || + devices.Length != 1 || + !UserKey.TryParse(subjects[0].Value, null, out var userKey) || + !AuthSessionId.TryCreate(sessions[0].Value, out var sessionId) || + !DeviceId.TryCreate(devices[0].Value, out var tokenDeviceId)) + { + return Invalid(); + } + + if (!device.HasDeviceId || device.DeviceId != tokenDeviceId) + { + return SessionValidationResult.Invalid(SessionState.DeviceMismatch); + } + + var result = await _lineageValidator.ValidateAsync( + new SessionValidationContext + { + Tenant = tenant, + SessionId = sessionId, + Device = device, + SessionOptions = sessionOptions, + Now = _clock.UtcNow + }, + SessionCredentialPurpose.MetadataOnly, + ct); + + if (!result.IsValid) + return result; + + if (result.Tenant != tenant || + result.UserKey != userKey || + result.SessionId != sessionId || + result.BoundDeviceId != tokenDeviceId) + { + return SessionValidationResult.Invalid(SessionState.SecurityMismatch); + } + + return result; + } + + private static SessionValidationResult Invalid() + => SessionValidationResult.Invalid(SessionState.Invalid); +} diff --git a/src/CodeBeam.UltimateAuth.Server/Authorization/AspNetCore/UAuthStatusAuthorizationResultHandler.cs b/src/CodeBeam.UltimateAuth.Server/Authorization/AspNetCore/UAuthStatusAuthorizationResultHandler.cs index ed92157b..be69a721 100644 --- a/src/CodeBeam.UltimateAuth.Server/Authorization/AspNetCore/UAuthStatusAuthorizationResultHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Authorization/AspNetCore/UAuthStatusAuthorizationResultHandler.cs @@ -6,6 +6,8 @@ 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.Server.Runtime; using Microsoft.AspNetCore.Authentication; @@ -55,11 +57,7 @@ public async Task HandleAsync(RequestDelegate next, HttpContext context, Authori x.IsAuthenticated && x.AuthenticationType == UAuthConstants.SchemeDefaults.GlobalScheme); - if (identity is null || - !UserKey.TryParse( - identity.FindFirst(ClaimTypes.NameIdentifier)?.Value, - null, - out var userKey)) + if (identity is null || !UserKey.TryParse(identity.FindFirst(ClaimTypes.NameIdentifier)?.Value, null, out var userKey)) { await ForbidAsync(next, context, policy); return; @@ -67,35 +65,93 @@ public async Task HandleAsync(RequestDelegate next, HttpContext context, Authori var tenant = context.GetTenant(); - var runtime = context.RequestServices - .GetRequiredService(); + var runtime = context.RequestServices.GetRequiredService(); if (runtime is ResourceRuntimeMarker) { var mode = context.RequestServices.GetRequiredService().Mode; + var resourceOptions = context.RequestServices.GetRequiredService>().Value; + + var requiresHub = + resourceOptions.Auth.Validation.Default == UAuthValidationRequirement.HubValidated || + context.GetEndpoint()?.Metadata.GetMetadata() is not null; if (mode == UAuthMode.PureJwt) { - await _default.HandleAsync(next, context, policy, authorizeResult); + if (requiresHub) + { + await ForbidAsync(next, context, policy); + return; + } + await _default.HandleAsync(next, context, policy, authorizeResult); return; } + + if (mode == UAuthMode.SemiHybrid) + { + if (!requiresHub) + { + await _default.HandleAsync(next, context, policy, authorizeResult); + return; + } + + var validator = context.RequestServices.GetRequiredService(); + var validation = await validator.ValidateAsync(context, context.RequestAborted); + + if (!validation.IsValid || validation.UserKey != userKey || validation.Tenant != tenant) + { + await ForbidAsync(next, context, policy); + return; + } + + // Continue into the existing user status validation. + } } else { var profileReader = context.RequestServices.GetRequiredService(); - var optionsProvider = context.RequestServices - .GetRequiredService(); + var optionsProvider = context.RequestServices.GetRequiredService(); - var applicationProfile = await profileReader.ReadAsync(context); - var effective = optionsProvider.GetEffective(context, applicationProfile); + var profile = await profileReader.ReadAsync(context); + var effective = optionsProvider.GetEffective(context, profile); + + var requiresHub = context.GetEndpoint()?.Metadata.GetMetadata() is not null; if (effective.Mode == UAuthMode.PureJwt) { - await _default.HandleAsync(next, context, policy, authorizeResult); + if (requiresHub) + { + await ForbidAsync(next, context, policy); + return; + } + await _default.HandleAsync(next, context, policy, authorizeResult); return; } + + if (effective.Mode == UAuthMode.SemiHybrid && requiresHub) + { + var deviceInfo = await context.GetDeviceAsync(); + + var device = context.RequestServices.GetRequiredService().Create(deviceInfo); + + var validator = context.RequestServices.GetRequiredService(); + + var validation = await validator.ValidateAsync( + context, + context.User, + tenant, + device, + effective.Options.Session, + context.RequestAborted); + + if (!validation.IsValid || validation.UserKey != userKey || validation.Tenant != tenant) + { + await ForbidAsync(next, context, policy); + return; + } + } } bool isActive; @@ -126,16 +182,11 @@ UserStatus.Suspended or } else { - var provider = context.RequestServices - .GetRequiredService(); + var provider = context.RequestServices.GetRequiredService(); - var state = await provider.GetAsync( - tenant, userKey, context.RequestAborted); + var state = await provider.GetAsync(tenant, userKey, context.RequestAborted); - if (state is null || - !state.Exists || - state.IsDeleted || - !state.CanAuthenticate) + if (state is null || !state.Exists || state.IsDeleted || !state.CanAuthenticate) { await ForbidAsync(next, context, policy); return; @@ -146,18 +197,15 @@ UserStatus.Suspended or mayUseInactiveException = !state.IsActive; } - var allowInactive = context.GetEndpoint()? - .Metadata.GetMetadata() is not null; + var allowInactive = context.GetEndpoint()?.Metadata.GetMetadata() is not null; - if (!isActive && - !(allowInactive && mayUseInactiveException)) + if (!isActive && !(allowInactive && mayUseInactiveException)) { await ForbidAsync(next, context, policy); return; } - await _default.HandleAsync( - next, context, policy, authorizeResult); + await _default.HandleAsync(next, context, policy, authorizeResult); } private Task ForbidAsync( diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs index 4e096cea..35ab0d30 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs @@ -16,6 +16,7 @@ internal sealed class ValidateEndpointHandler : IValidateEndpointHandler private readonly IAuthFlowContextAccessor _authContext; private readonly ITransportCredentialResolver _credentialResolver; private readonly ISessionValidator _sessionValidator; + private readonly SemiHybridAuthorityValidator _authorityValidator; private readonly IAuthStateSnapshotFactory _snapshotFactory; private readonly IClock _clock; @@ -23,12 +24,14 @@ public ValidateEndpointHandler( IAuthFlowContextAccessor authContext, ITransportCredentialResolver credentialResolver, ISessionValidator sessionValidator, + SemiHybridAuthorityValidator authorityValidator, IAuthStateSnapshotFactory snapshotFactory, IClock clock) { _authContext = authContext; _credentialResolver = credentialResolver; _sessionValidator = sessionValidator; + _authorityValidator = authorityValidator; _snapshotFactory = snapshotFactory; _clock = clock; } @@ -39,7 +42,7 @@ public async Task ValidateAsync(HttpContext context, CancellationToken if (auth.EffectiveMode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) { - return await ValidateJwtAsync(context); + return await ValidateJwtAsync(context, auth, ct); } var credential = await _credentialResolver.ResolveAsync(context, auth.EffectiveMode, auth.Response); @@ -141,21 +144,27 @@ public async Task ValidateAsync(HttpContext context, CancellationToken ); } - private static async Task ValidateJwtAsync(HttpContext context) + private async Task ValidateJwtAsync(HttpContext context, AuthFlowContext auth, CancellationToken ct) { - var result = await context.AuthenticateAsync(UAuthConstants.SchemeDefaults.GlobalScheme); + var authentication = await context.AuthenticateAsync(UAuthConstants.SchemeDefaults.GlobalScheme); - if (result.None) + if (!authentication.Succeeded || authentication.Principal?.Identity?.IsAuthenticated != true) { return Results.Json( new AuthValidationResult { - State = SessionState.NotFound + State = authentication.None + ? SessionState.NotFound + : SessionState.Invalid }, statusCode: StatusCodes.Status401Unauthorized); } - if (!result.Succeeded || result.Principal?.Identity?.IsAuthenticated != true) + var principal = authentication.Principal; + + var subject = principal.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + if (!UserKey.TryParse(subject, null, out var userKey)) { return Results.Json( new AuthValidationResult @@ -165,26 +174,72 @@ private static async Task ValidateJwtAsync(HttpContext context) statusCode: StatusCodes.Status401Unauthorized); } - var principal = result.Principal; + var requested = UAuthValidationRequirement.Standard; - var subject = principal.FindFirst(ClaimTypes.NameIdentifier)?.Value; + var header = context.Request.Headers[UAuthConstants.Headers.Validation]; - if (!UserKey.TryParse(subject, null, out var userKey)) + if (header.Count > 1) + return Results.BadRequest(); + + if (header.Count == 1 && + (!Enum.TryParse(header[0], true, out requested) || + !Enum.IsDefined(requested))) { - return Results.Json( - new AuthValidationResult - { - State = SessionState.Invalid - }, - statusCode: StatusCodes.Status401Unauthorized); + return Results.BadRequest(); } - var snapshot = PureJwtSnapshotFactory.Create(principal, userKey, context.GetTenant()); + var configured = UAuthValidationRequirementResolver.Resolve(context, auth.EffectiveMode, auth.Options.Validation, includeValidateEndpoint: true); + + var requirement = UAuthValidationRequirementResolver.Max(configured, requested); + + if (requirement == UAuthValidationRequirement.HubValidated) + { + if (auth.EffectiveMode != UAuthMode.SemiHybrid) + { + // PureJwt has no authoritative lineage. + return Results.BadRequest(); + } + + var validation = await _authorityValidator.ValidateAsync(context, principal, auth.Tenant, auth.Device, auth.Options.Session, ct); + + if (!validation.IsValid) + { + return Results.Ok(new AuthValidationResult + { + State = validation.State + }); + } + + var snapshot = await _snapshotFactory.CreateAsync(validation, ct); + + if (snapshot is null || + snapshot.Identity is null || + snapshot.Identity.UserStatus == UserStatus.Unknown) + { + return Results.Json( + new AuthValidationResult + { + State = SessionState.Invalid + }, + statusCode: StatusCodes.Status401Unauthorized); + } + + return Results.Ok(new AuthValidationResult + { + State = SessionState.Active, + Validation = UAuthValidationRequirement.HubValidated, + ChainId = validation.ChainId, + RootId = validation.RootId, + BoundDeviceId = validation.BoundDeviceId, + Snapshot = snapshot + }); + } return Results.Ok(new AuthValidationResult { State = SessionState.Active, - Snapshot = snapshot + Validation = UAuthValidationRequirement.Standard, + Snapshot = PureJwtSnapshotFactory.Create(principal, userKey, context.GetTenant()) }); } } diff --git a/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs b/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs index cbca9ae3..e02ad2db 100644 --- a/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs @@ -180,6 +180,7 @@ private static IServiceCollection AddUltimateAuthServerInternal(this IServiceCol services.AddSingleton, UAuthConcurrencyLimitingValidator>(); services.AddSingleton, UAuthArtifactStoreOptionsValidator>(); services.AddSingleton, UAuthDeviceLimitOptionsValidator>(); + services.AddSingleton, UAuthValidationOptionsValidator>(); services.AddScoped(); services.TryAddSingleton(sp => @@ -298,6 +299,7 @@ private static IServiceCollection AddUltimateAuthServerInternal(this IServiceCol services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); + services.TryAddScoped(); services.TryAddSingleton>(sp => { @@ -544,6 +546,20 @@ private static IServiceCollection AddUltimateAuthResourceInternal(this IServiceC }; }); + services.AddHttpClient( + (sp, client) => + { + var options = sp.GetRequiredService>().Value; + client.BaseAddress = new Uri(options.Hub.BaseUrl, UriKind.Absolute); + client.Timeout = TimeSpan.FromSeconds(5); + }) + .ConfigurePrimaryHttpMessageHandler(() => + new HttpClientHandler + { + UseCookies = false, + AllowAutoRedirect = false + }); + services.AddScoped(); // ASP.NET Core Integration diff --git a/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthEndpointConventionExtensions.cs b/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthEndpointConventionExtensions.cs index c36ae05e..4ecb396d 100644 --- a/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthEndpointConventionExtensions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthEndpointConventionExtensions.cs @@ -12,9 +12,4 @@ public static TBuilder RequireUAuthAuthentication(this TBuilder builde builder.WithMetadata(new UAuthRequireAuthenticationMetadata(requirement)); return builder; } - - public static TBuilder RequireUAuthHubValidation(this TBuilder builder) where TBuilder : IEndpointConventionBuilder - { - return builder.RequireUAuthAuthentication(UAuthValidationRequirement.HubValidated); - } } diff --git a/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthHubValidationEndpointExtensions.cs b/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthHubValidationEndpointExtensions.cs new file mode 100644 index 00000000..d1985191 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthHubValidationEndpointExtensions.cs @@ -0,0 +1,21 @@ +using Microsoft.AspNetCore.Builder; + +namespace CodeBeam.UltimateAuth.Server.Extensions; + +[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] +public sealed class UAuthHubValidatedAttribute : Attribute +{ +} + +public static class UAuthHubValidationEndpointExtensions +{ + public static TBuilder RequireUAuthHubValidation(this TBuilder builder) where TBuilder : IEndpointConventionBuilder + { + builder.WithMetadata(new UAuthHubValidatedAttribute()); + + // Ensure ASP.NET Core authorization middleware runs. + builder.RequireAuthorization(); + + return builder; + } +} diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Validator/UAuthValidationRequirementResolver.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Validator/UAuthValidationRequirementResolver.cs index bb514f2d..7f1bb9e6 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Validator/UAuthValidationRequirementResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Validator/UAuthValidationRequirementResolver.cs @@ -1,32 +1,76 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Server.RateLimiting; +using Microsoft.AspNetCore.Http; -namespace CodeBeam.UltimateAuth.Server.Infrastructure; +namespace CodeBeam.UltimateAuth.Server.Auth; internal static class UAuthValidationRequirementResolver { - public static UAuthValidationRequirement Resolve( - UAuthValidationOptions options, - UAuthEndpoint? endpoint, - UAuthValidationRequirement frameworkDefault, - UAuthValidationRequirement frameworkMinimum, - UAuthValidationRequirement endpointMinimum) + public static UAuthValidationRequirement Resolve(HttpContext context, UAuthMode mode, UAuthValidationOptions options, bool includeValidateEndpoint = false) { - var requirement = frameworkDefault; + var endpoint = context.GetEndpoint(); - if (endpoint is { } value && options.Endpoints.TryGetValue(value, out var configured)) + var id = endpoint?.Metadata.GetMetadata()?.Endpoint; + + if (id is { } value && IsIndependentFlow(value)) + return UAuthValidationRequirement.Standard; + + if (id == UAuthEndpoint.Validate && !includeValidateEndpoint) + return UAuthValidationRequirement.Standard; + + var baseline = id is { } classified + ? UAuthEndpointValidationClassification.Get(classified, mode) + : UAuthValidationRequirement.Standard; + + if (id is { } configuredEndpoint && options.Endpoints.TryGetValue(configuredEndpoint, out var configured)) { - requirement = configured; + baseline = configured; } - return Max(Max(requirement, options.Default), Max(frameworkMinimum, endpointMinimum)); - } + var explicitMinimum = endpoint?.Metadata + .GetMetadata()? + .Requirement ?? UAuthValidationRequirement.Standard; - private static UAuthValidationRequirement Max(UAuthValidationRequirement first, UAuthValidationRequirement second) - { - return (int)first >= (int)second - ? first - : second; + var frameworkMinimum = mode == UAuthMode.SemiHybrid && id is { } builtIn + ? Minimum(builtIn) + : UAuthValidationRequirement.Standard; + + return Max(Max(baseline, options.Default), Max(explicitMinimum, frameworkMinimum)); } + + public static UAuthValidationRequirement Max(UAuthValidationRequirement a, UAuthValidationRequirement b) + => (int)a >= (int)b ? a : b; + + private static UAuthValidationRequirement Minimum(UAuthEndpoint endpoint) + => endpoint switch + { + UAuthEndpoint.LogoutOthersSelf + or UAuthEndpoint.RevokeOtherChains + or UAuthEndpoint.RevokeAllMyChains + or UAuthEndpoint.GetMyChains + or UAuthEndpoint.GetMyChainDetail + or UAuthEndpoint.RevokeMyChain + => UAuthValidationRequirement.HubValidated, + + _ => UAuthValidationRequirement.Standard + }; + + private static bool IsIndependentFlow(UAuthEndpoint endpoint) + => endpoint is + UAuthEndpoint.Login + or UAuthEndpoint.TryLogin + or UAuthEndpoint.Logout + or UAuthEndpoint.Refresh + or UAuthEndpoint.PkceAuthorize + or UAuthEndpoint.PkceComplete + or UAuthEndpoint.PkceTryComplete + or UAuthEndpoint.CredentialResetBeginAnonymous + or UAuthEndpoint.CredentialResetCompleteAnonymous + or UAuthEndpoint.CheckIdentifierAvailability + or UAuthEndpoint.UserCreateAnonymous + or UAuthEndpoint.AntiforgeryToken + or UAuthEndpoint.PasswordPolicy + or UAuthEndpoint.LoginTransport + or UAuthEndpoint.HubEntry; } diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs index e21fb79e..9b3016ee 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs @@ -50,6 +50,7 @@ public sealed class UAuthResourceAuthOptions public UAuthResourceDeviceOptions Device { get; set; } = new(); public UAuthJwtValidationOptions? Jwt { get; set; } + public UAuthResourceValidationOptions Validation { get; set; } = new(); internal UAuthResourceAuthOptions Clone() => new() { @@ -66,7 +67,8 @@ public sealed class UAuthResourceAuthOptions ValidAlgorithms = Jwt.ValidAlgorithms.ToArray(), ClockSkew = Jwt.ClockSkew, MaximumTokenSizeInBytes = Jwt.MaximumTokenSizeInBytes - } + }, + Validation = Validation.Clone() }; } @@ -178,3 +180,13 @@ public sealed class UAuthJwtVerificationKeyOptions /// public string Key { get; set; } = string.Empty; } + +public sealed class UAuthResourceValidationOptions +{ + public UAuthValidationRequirement Default { get; set; } = UAuthValidationRequirement.Standard; + + internal UAuthResourceValidationOptions Clone() => new() + { + Default = Default + }; +} diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs index 5ec790e4..0070c43a 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs @@ -130,20 +130,28 @@ public ValidateOptionsResult Validate(string? name, UAuthResourceApiOptions opti } } - if (mode is UAuthMode.PureOpaque or UAuthMode.Hybrid) + if (mode is UAuthMode.PureOpaque or UAuthMode.Hybrid or UAuthMode.SemiHybrid) { if (string.IsNullOrWhiteSpace(options.Hub?.BaseUrl)) { errors.Add("Hub.BaseUrl is required for remote session validation."); } - else if (!Uri.TryCreate(options.Hub.BaseUrl, UriKind.Absolute, out var uri) || - (uri.Scheme != Uri.UriSchemeHttps && - uri.Scheme != Uri.UriSchemeHttp)) + else if (!Uri.TryCreate(options.Hub.BaseUrl, UriKind.Absolute, out var uri) || (uri.Scheme != Uri.UriSchemeHttps && uri.Scheme != Uri.UriSchemeHttp)) { errors.Add("Hub.BaseUrl must be an absolute HTTP(S) URL."); } } + if (auth.Validation is null || !Enum.IsDefined(auth.Validation.Default)) + { + errors.Add("Auth.Validation.Default is invalid."); + } + + if (mode == UAuthMode.PureJwt && auth.Validation?.Default == UAuthValidationRequirement.HubValidated) + { + errors.Add("PureJwt does not support HubValidated."); + } + if (string.IsNullOrWhiteSpace(options?.Cors?.PolicyName)) errors.Add("Cors.PolicyName is required."); diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerOptionsValidator.cs index 54df44c6..ebbba2a5 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerOptionsValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerOptionsValidator.cs @@ -55,12 +55,6 @@ public ValidateOptionsResult Validate(string? name, UAuthServerOptions options) { if (!Enum.IsDefined(typeof(UAuthMode), mode)) return ValidateOptionsResult.Fail($"Invalid UAuthMode value: {mode}"); - - // TODO: Keep unsupported modes disabled until their implementation and conformance tests are complete. - if (mode is UAuthMode.SemiHybrid) - { - return ValidateOptionsResult.Fail($"Auth mode '{mode}' is not implemented yet and cannot be enabled."); - } } } diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthValidationOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthValidationOptionsValidator.cs new file mode 100644 index 00000000..46550fd1 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthValidationOptionsValidator.cs @@ -0,0 +1,31 @@ +using Microsoft.Extensions.Options; + +namespace CodeBeam.UltimateAuth.Server.Options; + +public sealed class UAuthValidationOptionsValidator : IValidateOptions +{ + public ValidateOptionsResult Validate(string? name, UAuthServerOptions options) + { + var validation = options.Validation; + + if (validation is null) + return ValidateOptionsResult.Fail("Validation options are required."); + + if (!Enum.IsDefined(validation.Default)) + return ValidateOptionsResult.Fail("Validation.Default is invalid."); + + if (validation.Endpoints is null) + return ValidateOptionsResult.Fail("Validation.Endpoints cannot be null."); + + foreach (var (endpoint, requirement) in validation.Endpoints) + { + if (!Enum.IsDefined(endpoint)) + return ValidateOptionsResult.Fail($"Invalid endpoint: {endpoint}."); + + if (!Enum.IsDefined(requirement)) + return ValidateOptionsResult.Fail($"Invalid validation requirement for {endpoint}."); + } + + return ValidateOptionsResult.Success; + } +} diff --git a/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs b/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs new file mode 100644 index 00000000..6d8a1eb8 --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs @@ -0,0 +1,164 @@ +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Defaults; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Infrastructure; +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Extensions; +using CodeBeam.UltimateAuth.Server.Infrastructure; +using CodeBeam.UltimateAuth.Server.Options; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Options; +using System.Net.Http.Headers; +using System.Security.Claims; +using System.Text.Json; + +namespace CodeBeam.UltimateAuth.Server.ResourceApi; + +internal sealed class RemoteHubValidationService +{ + private static readonly object CacheKey = new(); + + private readonly HttpClient _http; + private readonly ITransportCredentialResolver _credentials; + private readonly UAuthResourceApiOptions _options; + + public RemoteHubValidationService(HttpClient http, ITransportCredentialResolver credentials, IOptions options) + { + _http = http; + _credentials = credentials; + _options = options.Value; + } + + public async Task ValidateAsync(HttpContext context, CancellationToken ct = default) + { + if (context.Items.TryGetValue(CacheKey, out var cached) && cached is SessionValidationResult previous) + { + return previous; + } + + var result = await ValidateCoreAsync(context, ct); + + context.Items[CacheKey] = result; + + if (result.IsValid) + { + context.Items[UAuthConstants.HttpItems.SessionValidationResult] = result; + } + + return result; + } + + private async Task ValidateCoreAsync(HttpContext context, CancellationToken ct) + { + SessionValidationResult Invalid() + => SessionValidationResult.Invalid(SessionState.Invalid); + + var principal = context.User; + + var subjects = principal.FindAll(ClaimTypes.NameIdentifier).ToArray(); + + var sessions = principal.FindAll("sid").ToArray(); + var devices = principal.FindAll("device_id").ToArray(); + + if (principal.Identity?.IsAuthenticated != true || + subjects.Length != 1 || + sessions.Length != 1 || + devices.Length != 1 || + !UserKey.TryParse(subjects[0].Value, null, out var userKey) || + !AuthSessionId.TryCreate(sessions[0].Value, out var sessionId) || + !DeviceId.TryCreate(devices[0].Value, out var tokenDeviceId)) + { + return 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 credential = await _credentials.ResolveAsync(context, UAuthMode.SemiHybrid, response); + + if (credential is null || credential.Kind != TransportCredentialKind.AccessToken) + { + return Invalid(); + } + + var requestDevice = await context.GetDeviceAsync(); + + if (!DeviceId.TryCreate(requestDevice.DeviceId.Value, out var requestDeviceId) || requestDeviceId != tokenDeviceId) + { + return SessionValidationResult.Invalid(SessionState.DeviceMismatch); + } + + using var request = new HttpRequestMessage(HttpMethod.Post, "/auth/validate"); + + request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", credential.Value); + + request.Headers.TryAddWithoutValidation(UAuthConstants.Headers.Validation, nameof(UAuthValidationRequirement.HubValidated)); + + request.Headers.TryAddWithoutValidation(UAuthConstants.Headers.DeviceId, requestDeviceId.Value); + + try + { + using var responseMessage = await _http.SendAsync(request, ct); + + if (!responseMessage.IsSuccessStatusCode) + return Invalid(); + + await using var stream = await responseMessage.Content.ReadAsStreamAsync(ct); + + var dto = await JsonSerializer.DeserializeAsync(stream, new JsonSerializerOptions(JsonSerializerDefaults.Web), ct); + + // Fail closed if an older Hub ignores the requirement. + if (dto is null || + !dto.IsValid || + dto.Validation != UAuthValidationRequirement.HubValidated || + dto.Snapshot?.Identity is null || + dto.Snapshot.Identity.UserKey != userKey || + dto.Snapshot.Identity.Tenant != context.GetTenant() || + dto.BoundDeviceId != tokenDeviceId) + { + return Invalid(); + } + + var validation = SessionValidationMapper.ToDomain(dto, sessionId); + + if (!validation.IsValid || + validation.UserKey != userKey || + validation.Tenant != context.GetTenant() || + validation.SessionId != sessionId) + { + return Invalid(); + } + + return validation; + } + catch (HttpRequestException) + { + return Invalid(); + } + catch (JsonException) + { + return Invalid(); + } + catch (OperationCanceledException) + when (!ct.IsCancellationRequested) + { + return Invalid(); + } + } +} diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/Server/UAuthServerStatusAuthorizationTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/Server/UAuthServerStatusAuthorizationTests.cs index e1de8ee2..7f4da1a5 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/Server/UAuthServerStatusAuthorizationTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/Server/UAuthServerStatusAuthorizationTests.cs @@ -174,7 +174,6 @@ public async Task ExistingSession_ShouldReflectUserStateChanges() [Theory] [InlineData(UAuthMode.PureOpaque)] [InlineData(UAuthMode.Hybrid)] - [InlineData(UAuthMode.SemiHybrid)] public async Task ResourceApi_SessionMode_WithoutSessionValidation_ShouldForbid(UAuthMode mode) { var builder = WebApplication.CreateBuilder(); @@ -246,6 +245,78 @@ public async Task ResourceApi_SessionMode_WithoutSessionValidation_ShouldForbid( } } + [Fact] + public async Task ResourceApi_SemiHybrid_Standard_WithoutSessionValidation_ShouldAllow() + { + var builder = WebApplication.CreateBuilder(); + builder.WebHost.UseTestServer(); + + builder.Services.AddSingleton>( + Options.Create(new UAuthResourceApiOptions + { + Auth = new UAuthResourceAuthOptions + { + Mode = UAuthMode.SemiHybrid + } + })); + + builder.Services.AddSingleton(); + + builder.Services.AddSingleton( + new EffectiveAuthModeResolver()); + + builder.Services.AddSingleton(); + + builder.Services + .AddAuthentication(UAuthConstants.SchemeDefaults.GlobalScheme) + .AddScheme( + UAuthConstants.SchemeDefaults.GlobalScheme, _ => { }); + + builder.Services.AddAuthorization(); + + builder.Services.AddSingleton< + IAuthorizationMiddlewareResultHandler, + UAuthStatusAuthorizationResultHandler>(); + + var app = builder.Build(); + + app.UseRouting(); + + app.Use(async (context, next) => + { + context.Items[UAuthConstants.HttpItems.TenantContextKey] = + UAuthTenantContext.SingleTenant(); + + await next(); + }); + + app.UseAuthentication(); + app.UseAuthorization(); + + app.MapGet("/resource-protected", () => Results.Ok()) + .RequireAuthorization(); + + await app.StartAsync(TestContext.Current.CancellationToken); + + try + { + using var client = app.GetTestClient(); + + client.DefaultRequestHeaders.Add("X-Test-Auth", "true"); + + using var response = await client.GetAsync( + "/resource-protected", + TestContext.Current.CancellationToken); + + response.StatusCode.Should().Be(HttpStatusCode.OK); + } + finally + { + await app.StopAsync(TestContext.Current.CancellationToken); + await app.DisposeAsync(); + } + } + [Fact] public async Task ResourceApi_PureJwt_ShouldAuthorizeWithoutSessionValidation() { diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs index a85f5139..e426d64c 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs @@ -1,6 +1,5 @@ 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; @@ -11,8 +10,7 @@ namespace CodeBeam.UltimateAuth.Tests.Unit.ResourceApi; public sealed class UAuthResourceApiOptionsValidatorTests { - private static readonly IEffectiveAuthModeResolver DefaultResolver = - new EffectiveAuthModeResolver(); + private static readonly IEffectiveAuthModeResolver DefaultResolver = new EffectiveAuthModeResolver(); [Theory] [InlineData(UAuthMode.PureOpaque)] diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ServerOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ServerOptionsValidatorTests.cs index 58ac6440..16843088 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ServerOptionsValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ServerOptionsValidatorTests.cs @@ -711,15 +711,6 @@ public void Server_undefined_mode_fails() => o.AllowedModes = new[] { (UAuthMode)999 }; }, "Invalid UAuthMode"); - [Theory] - [InlineData(UAuthMode.SemiHybrid)] - public void Server_unimplemented_mode_fails(UAuthMode mode) => - ShouldReject(o => - { - ConfigureValidCrossOptions(o); - o.AllowedModes = new[] { mode }; - }, "not implemented yet"); - [Theory] [InlineData(UAuthMode.Hybrid)] [InlineData(UAuthMode.PureOpaque)] diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs index f3232233..6ccf01b2 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs @@ -5,6 +5,7 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Server; +using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Contracts; using CodeBeam.UltimateAuth.Server.Endpoints; @@ -560,25 +561,17 @@ public async Task ValidateAsync_PureJwt_UnauthenticatedPrincipal_ReturnsUnauthor [InlineData(null)] [InlineData("")] [InlineData(" ")] - public async Task ValidateAsync_PureJwt_InvalidSubject_ReturnsUnauthorizedInvalid( - string? subject) + public async Task ValidateAsync_PureJwt_InvalidSubject_ReturnsUnauthorizedInvalid(string? subject) { var claims = subject is null ? Array.Empty() : new[] { new Claim(ClaimTypes.NameIdentifier, subject) }; - var principal = new ClaimsPrincipal( - new ClaimsIdentity( - claims, - UAuthConstants.SchemeDefaults.GlobalScheme)); - + var principal = new ClaimsPrincipal(new ClaimsIdentity(claims, UAuthConstants.SchemeDefaults.GlobalScheme)); var fixture = CreatePureJwtFixture(JwtSuccess(principal)); - var result = await fixture.Sut.ValidateAsync(fixture.HttpContext, TestContext.Current.CancellationToken); - var json = result.Should() - .BeOfType>() - .Subject; + var json = result.Should().BeOfType>().Subject; json.StatusCode.Should().Be(StatusCodes.Status401Unauthorized); json.Value!.State.Should().Be(SessionState.Invalid); @@ -641,6 +634,7 @@ private static Fixture CreateFixture(UAuthMode mode = UAuthMode.PureOpaque) var credentialResolver = new Mock(MockBehavior.Strict); var sessionValidator = new Mock(MockBehavior.Strict); var snapshotFactory = new Mock(MockBehavior.Strict); + var lineageValidator = new Mock(MockBehavior.Strict); var clock = new Mock(MockBehavior.Strict); authContext @@ -651,10 +645,14 @@ private static Fixture CreateFixture(UAuthMode mode = UAuthMode.PureOpaque) .SetupGet(x => x.UtcNow) .Returns(Now); - var httpContext = - new DefaultHttpContext(); + var authorityValidator = new SemiHybridAuthorityValidator( + lineageValidator.Object, + clock.Object); + + var httpContext = new DefaultHttpContext(); - httpContext.Items[UAuthConstants.HttpItems.TenantContextKey] = UAuthTenantContext.Resolved(flow.Tenant); + httpContext.Items[UAuthConstants.HttpItems.TenantContextKey] = + UAuthTenantContext.Resolved(flow.Tenant); var cancellationToken = new CancellationTokenSource().Token; @@ -662,6 +660,7 @@ private static Fixture CreateFixture(UAuthMode mode = UAuthMode.PureOpaque) authContext.Object, credentialResolver.Object, sessionValidator.Object, + authorityValidator, snapshotFactory.Object, clock.Object); @@ -670,6 +669,7 @@ private static Fixture CreateFixture(UAuthMode mode = UAuthMode.PureOpaque) flow, credentialResolver, sessionValidator, + lineageValidator, snapshotFactory, httpContext, cancellationToken); @@ -753,6 +753,7 @@ private sealed record Fixture( AuthFlowContext Flow, Mock CredentialResolver, Mock SessionValidator, + Mock LineageValidator, Mock SnapshotFactory, DefaultHttpContext HttpContext, CancellationToken CancellationToken); From 1831062cda3b82142e0d45e3b8fdc6c06e591062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Wed, 2 Dec 2026 22:34:15 +0300 Subject: [PATCH 09/14] More Improvements & Add Tests --- .../Program.cs | 7 +- .../Refresh/RefreshTokenValidationContext.cs | 1 + .../UAuthRefreshTokenValidator.cs | 5 +- ...tLogoutService.cs => IJwtLogoutService.cs} | 2 +- .../Abstractions/ISessionLineageValidator.cs | 2 +- .../Auth/SemiHybridAuthorityValidator.cs | 2 +- .../AspNetCore/UAuthAuthenticationHandler.cs | 3 +- .../Endpoints/LogoutEndpointHandler.cs | 38 +- .../Extensions/ServiceCollectionExtensions.cs | 2 +- .../LogoutChainBySessionCommand.cs | 4 +- .../UAuthValidationRequirementResolver.cs | 4 +- .../ResourceApi/RemoteHubValidationService.cs | 9 +- .../Services/JwtLogoutService.cs | 122 +++ .../Services/PureJwtLogoutService.cs | 68 -- .../Services/RefreshTokenRotationService.cs | 6 +- .../Services/SessionLineageValidator.cs | 4 +- .../RemoteHubValidationServiceTests.cs | 869 ++++++++++++++++++ .../Server/LogoutEndpointHandlerTests.cs | 8 +- .../SemiHybridAuthorityValidatorTests.cs | 486 ++++++++++ 19 files changed, 1524 insertions(+), 118 deletions(-) rename src/CodeBeam.UltimateAuth.Server/Abstractions/{IPureJwtLogoutService.cs => IJwtLogoutService.cs} (84%) create mode 100644 src/CodeBeam.UltimateAuth.Server/Services/JwtLogoutService.cs delete mode 100644 src/CodeBeam.UltimateAuth.Server/Services/PureJwtLogoutService.cs create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/RemoteHubValidationServiceTests.cs create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SemiHybridAuthorityValidatorTests.cs diff --git a/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/Program.cs b/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/Program.cs index bc6b264d..994ded73 100644 --- a/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/Program.cs +++ b/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/Program.cs @@ -1,4 +1,5 @@ using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Extensions; @@ -31,11 +32,11 @@ Key = UAuthCryptographyConstants.DevelopmentJwtSigningKey }); - //o.Auth.Mode = UAuthMode.PureJwt; + o.Auth.Mode = UAuthMode.SemiHybrid; // TODO: Make multiple UAuthHub support via resolver, then different client apps can use different UAuthHub instances if needed. - o.Hub.BaseUrl = "https://localhost:6110"; // PureJwt auth mode doesn't need UAuthHub, but other auth modes do. This is the URL of the UAuthHub instance that this resource API trusts. - //o.Hub.BaseUrl = "https://localhost:7213"; // Comment upper line and uncomment this if you want to try blazor server sample. + //o.Hub.BaseUrl = "https://localhost:6110"; // PureJwt auth mode doesn't need UAuthHub, but other auth modes do. This is the URL of the UAuthHub instance that this resource API trusts. + o.Hub.BaseUrl = "https://localhost:7213"; // Comment upper line and uncomment this if you want to try blazor server sample. // Standalone WASM o.Cors.AllowedOrigins.Add("https://localhost:6130"); diff --git a/src/CodeBeam.UltimateAuth.Core/Contracts/Refresh/RefreshTokenValidationContext.cs b/src/CodeBeam.UltimateAuth.Core/Contracts/Refresh/RefreshTokenValidationContext.cs index a7cda668..6797fcd1 100644 --- a/src/CodeBeam.UltimateAuth.Core/Contracts/Refresh/RefreshTokenValidationContext.cs +++ b/src/CodeBeam.UltimateAuth.Core/Contracts/Refresh/RefreshTokenValidationContext.cs @@ -11,4 +11,5 @@ public sealed record RefreshTokenValidationContext public required DeviceContext Device { get; init; } public AuthSessionId? ExpectedSessionId { get; init; } + public DeviceMismatchBehavior DeviceMismatchBehavior { get; init; } = DeviceMismatchBehavior.Reject; } diff --git a/src/CodeBeam.UltimateAuth.Core/Infrastructure/UAuthRefreshTokenValidator.cs b/src/CodeBeam.UltimateAuth.Core/Infrastructure/UAuthRefreshTokenValidator.cs index afd62cdc..3ae4eaf4 100644 --- a/src/CodeBeam.UltimateAuth.Core/Infrastructure/UAuthRefreshTokenValidator.cs +++ b/src/CodeBeam.UltimateAuth.Core/Infrastructure/UAuthRefreshTokenValidator.cs @@ -37,8 +37,9 @@ public async Task ValidateAsync(RefreshTokenValida return RefreshTokenValidationResult.Invalid(); } - // Device-bound refresh tokens must be presented from the same device identity. - if (stored.DeviceId is DeviceId boundDeviceId && context.Device.DeviceId != boundDeviceId) + if (stored.DeviceId is DeviceId boundDeviceId && + context.Device.DeviceId != boundDeviceId && + context.DeviceMismatchBehavior != DeviceMismatchBehavior.Allow) { return RefreshTokenValidationResult.Invalid(); } diff --git a/src/CodeBeam.UltimateAuth.Server/Abstractions/IPureJwtLogoutService.cs b/src/CodeBeam.UltimateAuth.Server/Abstractions/IJwtLogoutService.cs similarity index 84% rename from src/CodeBeam.UltimateAuth.Server/Abstractions/IPureJwtLogoutService.cs rename to src/CodeBeam.UltimateAuth.Server/Abstractions/IJwtLogoutService.cs index 7f47c29a..73b4158b 100644 --- a/src/CodeBeam.UltimateAuth.Server/Abstractions/IPureJwtLogoutService.cs +++ b/src/CodeBeam.UltimateAuth.Server/Abstractions/IJwtLogoutService.cs @@ -2,7 +2,7 @@ namespace CodeBeam.UltimateAuth.Server.Abstractions; -public interface IPureJwtLogoutService +public interface IJwtLogoutService { Task LogoutAsync(AuthFlowContext flow, string refreshToken, CancellationToken ct = default); } diff --git a/src/CodeBeam.UltimateAuth.Server/Abstractions/ISessionLineageValidator.cs b/src/CodeBeam.UltimateAuth.Server/Abstractions/ISessionLineageValidator.cs index 2ecd84f4..aa8d6a39 100644 --- a/src/CodeBeam.UltimateAuth.Server/Abstractions/ISessionLineageValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Abstractions/ISessionLineageValidator.cs @@ -3,7 +3,7 @@ namespace CodeBeam.UltimateAuth.Server.Abstractions; -internal interface ISessionLineageValidator +public interface ISessionLineageValidator { Task ValidateAsync(SessionValidationContext context, SessionCredentialPurpose expectedPurpose, CancellationToken ct = default); } diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/SemiHybridAuthorityValidator.cs b/src/CodeBeam.UltimateAuth.Server/Auth/SemiHybridAuthorityValidator.cs index 5db607a3..08d1f133 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/SemiHybridAuthorityValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/SemiHybridAuthorityValidator.cs @@ -70,7 +70,7 @@ private async Task ValidateCoreAsync( return Invalid(); } - if (!device.HasDeviceId || device.DeviceId != tokenDeviceId) + if (sessionOptions.DeviceMismatchBehavior == DeviceMismatchBehavior.Reject && (!device.HasDeviceId || device.DeviceId != tokenDeviceId)) { return SessionValidationResult.Invalid(SessionState.DeviceMismatch); } diff --git a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs index 19d4c7c9..6e5b8abf 100644 --- a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs @@ -13,7 +13,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using System.Security.Claims; using System.Text.Encodings.Web; namespace CodeBeam.UltimateAuth.Server.Authentication; @@ -96,7 +95,7 @@ protected override async Task HandleAuthenticateAsync() Tenant = tenant, SessionId = sessionId, Device = _deviceContextFactory.Create(credential.Device), - SessionOptions = _serverOptions.Session, + SessionOptions = effective.Options.Session, Now = _clock.UtcNow }); diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs index 93663610..4376b73f 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs @@ -1,13 +1,11 @@ using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; 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; using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Infrastructure; -using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Server.Services; using CodeBeam.UltimateAuth.Users.Contracts; using Microsoft.AspNetCore.Http; @@ -23,9 +21,9 @@ public sealed class LogoutEndpointHandler : ILogoutEndpointHandler private readonly IUAuthCookieManager _cookieManager; private readonly IAuthRedirectResolver _redirectResolver; private readonly IRefreshTokenResolver _refreshTokenResolver; - private readonly IPureJwtLogoutService _pureJwtLogout; + private readonly IJwtLogoutService _jwtLogout; - public LogoutEndpointHandler(IAuthFlowContextAccessor authContext, IUAuthFlowService flow, IAccessContextFactory accessContextFactory, ISessionApplicationService sessionApplicationService, IUAuthCookieManager cookieManager, IAuthRedirectResolver redirectResolver, IRefreshTokenResolver refreshTokenResolver, IPureJwtLogoutService pureJwtLogout) + public LogoutEndpointHandler(IAuthFlowContextAccessor authContext, IUAuthFlowService flow, IAccessContextFactory accessContextFactory, ISessionApplicationService sessionApplicationService, IUAuthCookieManager cookieManager, IAuthRedirectResolver redirectResolver, IRefreshTokenResolver refreshTokenResolver, IJwtLogoutService jwtLogout) { _authContext = authContext; _flow = flow; @@ -34,36 +32,30 @@ public LogoutEndpointHandler(IAuthFlowContextAccessor authContext, IUAuthFlowSer _cookieManager = cookieManager; _redirectResolver = redirectResolver; _refreshTokenResolver = refreshTokenResolver; - _pureJwtLogout = pureJwtLogout; + _jwtLogout = jwtLogout; } public async Task LogoutAsync(HttpContext ctx) { var authFlow = _authContext.Current; - if (authFlow.EffectiveMode == UAuthMode.PureJwt) + if (authFlow.Session is SessionSecurityContext session) { - if (authFlow.IsAuthenticated) - { - var refreshToken = _refreshTokenResolver.Resolve(ctx); - - if (!string.IsNullOrWhiteSpace(refreshToken)) + await _flow.LogoutAsync( + new LogoutRequest { - var revoked = await _pureJwtLogout.LogoutAsync(authFlow, refreshToken, ctx.RequestAborted); - - if (!revoked) - return Results.Unauthorized(); - } - } + SessionId = session.SessionId + }, + ctx.RequestAborted); } - else if (authFlow.Session is SessionSecurityContext session) + else if (authFlow.EffectiveMode is UAuthMode.PureJwt or UAuthMode.SemiHybrid) { - var request = new LogoutRequest - { - SessionId = session.SessionId - }; + var refreshToken = _refreshTokenResolver.Resolve(ctx); - await _flow.LogoutAsync(request, ctx.RequestAborted); + if (!string.IsNullOrWhiteSpace(refreshToken)) + { + await _jwtLogout.LogoutAsync(authFlow, refreshToken, ctx.RequestAborted); + } } DeleteIfCookie(ctx, authFlow.Response.SessionIdDelivery); diff --git a/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs b/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs index e02ad2db..2cae5fe3 100644 --- a/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs @@ -241,7 +241,7 @@ private static IServiceCollection AddUltimateAuthServerInternal(this IServiceCol services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); - services.TryAddScoped(); + services.TryAddScoped(); services.TryAddSingleton(); diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Orchestrator/LogoutChainBySessionCommand.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Orchestrator/LogoutChainBySessionCommand.cs index 62ea3e68..59e4dab5 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Orchestrator/LogoutChainBySessionCommand.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Orchestrator/LogoutChainBySessionCommand.cs @@ -13,8 +13,6 @@ public async Task ExecuteAsync(AuthContext context, ISessionIssuer issuer, if (chainId is null) return false; - await issuer.LogoutChainAsync(context.Tenant, chainId.Value, context.At, ct); - - return true; + return await issuer.LogoutChainAsync(context.Tenant, chainId.Value, context.At, ct); } } diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Validator/UAuthValidationRequirementResolver.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Validator/UAuthValidationRequirementResolver.cs index 7f1bb9e6..cd9f78a7 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Validator/UAuthValidationRequirementResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Validator/UAuthValidationRequirementResolver.cs @@ -45,7 +45,8 @@ public static UAuthValidationRequirement Max(UAuthValidationRequirement a, UAuth private static UAuthValidationRequirement Minimum(UAuthEndpoint endpoint) => endpoint switch { - UAuthEndpoint.LogoutOthersSelf + UAuthEndpoint.Logout + or UAuthEndpoint.LogoutOthersSelf or UAuthEndpoint.RevokeOtherChains or UAuthEndpoint.RevokeAllMyChains or UAuthEndpoint.GetMyChains @@ -60,7 +61,6 @@ private static bool IsIndependentFlow(UAuthEndpoint endpoint) => endpoint is UAuthEndpoint.Login or UAuthEndpoint.TryLogin - or UAuthEndpoint.Logout or UAuthEndpoint.Refresh or UAuthEndpoint.PkceAuthorize or UAuthEndpoint.PkceComplete diff --git a/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs b/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs index 6d8a1eb8..5a37fb78 100644 --- a/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs +++ b/src/CodeBeam.UltimateAuth.Server/ResourceApi/RemoteHubValidationService.cs @@ -99,7 +99,9 @@ SessionValidationResult Invalid() var requestDevice = await context.GetDeviceAsync(); - if (!DeviceId.TryCreate(requestDevice.DeviceId.Value, out var requestDeviceId) || requestDeviceId != tokenDeviceId) + var hasRequestDeviceId = DeviceId.TryCreate(requestDevice.DeviceId.Value, out var requestDeviceId); + + if (_options.Auth.Device.MismatchBehavior == DeviceMismatchBehavior.Reject && (!hasRequestDeviceId || requestDeviceId != tokenDeviceId)) { return SessionValidationResult.Invalid(SessionState.DeviceMismatch); } @@ -110,7 +112,10 @@ SessionValidationResult Invalid() request.Headers.TryAddWithoutValidation(UAuthConstants.Headers.Validation, nameof(UAuthValidationRequirement.HubValidated)); - request.Headers.TryAddWithoutValidation(UAuthConstants.Headers.DeviceId, requestDeviceId.Value); + if (hasRequestDeviceId) + { + request.Headers.TryAddWithoutValidation(UAuthConstants.Headers.DeviceId, requestDeviceId.Value); + } try { diff --git a/src/CodeBeam.UltimateAuth.Server/Services/JwtLogoutService.cs b/src/CodeBeam.UltimateAuth.Server/Services/JwtLogoutService.cs new file mode 100644 index 00000000..667f818d --- /dev/null +++ b/src/CodeBeam.UltimateAuth.Server/Services/JwtLogoutService.cs @@ -0,0 +1,122 @@ +using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.Abstractions; +using CodeBeam.UltimateAuth.Server.Auth; + +namespace CodeBeam.UltimateAuth.Server.Services; + +public sealed class JwtLogoutService : IJwtLogoutService +{ + private readonly IRefreshTokenValidator _validator; + private readonly IRefreshTokenStoreFactory _storeFactory; + private readonly ISessionLineageValidator _lineageValidator; + private readonly ISessionIssuer _sessionIssuer; + private readonly IClock _clock; + + public JwtLogoutService( + IRefreshTokenValidator validator, + IRefreshTokenStoreFactory storeFactory, + ISessionLineageValidator lineageValidator, + ISessionIssuer sessionIssuer, + IClock clock) + { + _validator = validator; + _storeFactory = storeFactory; + _lineageValidator = lineageValidator; + _sessionIssuer = sessionIssuer; + _clock = clock; + } + + public async Task LogoutAsync(AuthFlowContext flow, string refreshToken, CancellationToken ct = default) + { + if (flow.EffectiveMode is not (UAuthMode.PureJwt or UAuthMode.SemiHybrid)) + { + return false; + } + + if (string.IsNullOrWhiteSpace(refreshToken)) + return false; + + var now = _clock.UtcNow; + + var validation = await _validator.ValidateAsync( + new RefreshTokenValidationContext + { + Tenant = flow.Tenant, + RefreshToken = refreshToken, + Now = now, + Device = flow.Device, + DeviceMismatchBehavior = + flow.Options.Session.DeviceMismatchBehavior + }, + ct); + + if (!validation.IsValid || + validation.Tenant != flow.Tenant || + validation.UserKey is not UserKey userKey || + validation.DeviceId is not DeviceId deviceId || + validation.RefreshChainId is not { } refreshChainId || + refreshChainId.Value == Guid.Empty) + { + return false; + } + + if (flow.IsAuthenticated && flow.UserKey != userKey) + return false; + + if (flow.EffectiveMode == UAuthMode.PureJwt) + { + if (validation.SessionId is not null || validation.SessionChainId is not null) + { + return false; + } + + var store = _storeFactory.Create(flow.Tenant); + + await store.ExecuteAsync( + innerCt => store.RevokeByRefreshChainAsync( + refreshChainId, + now, + innerCt), + ct); + + return true; + } + + // SemiHybrid + if (validation.SessionId is not AuthSessionId sessionId || validation.SessionChainId is not SessionChainId chainId) + { + return false; + } + + if (flow.Session is { } currentSession && currentSession.SessionId != sessionId) + { + return false; + } + + var lineage = await _lineageValidator.ValidateAsync( + new SessionValidationContext + { + Tenant = flow.Tenant, + SessionId = sessionId, + Device = flow.Device, + SessionOptions = flow.Options.Session, + Now = now + }, + SessionCredentialPurpose.MetadataOnly, + ct); + + if (!lineage.IsValid || + lineage.Tenant != flow.Tenant || + lineage.UserKey != userKey || + lineage.SessionId != sessionId || + lineage.ChainId != chainId || + lineage.BoundDeviceId != deviceId) + { + return false; + } + + return await _sessionIssuer.LogoutChainAsync(flow.Tenant, chainId, now, ct); + } +} diff --git a/src/CodeBeam.UltimateAuth.Server/Services/PureJwtLogoutService.cs b/src/CodeBeam.UltimateAuth.Server/Services/PureJwtLogoutService.cs deleted file mode 100644 index 93714dd3..00000000 --- a/src/CodeBeam.UltimateAuth.Server/Services/PureJwtLogoutService.cs +++ /dev/null @@ -1,68 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Abstractions; -using CodeBeam.UltimateAuth.Core.Contracts; -using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Server.Abstractions; -using CodeBeam.UltimateAuth.Server.Auth; - -namespace CodeBeam.UltimateAuth.Server.Services; - -public sealed class PureJwtLogoutService : IPureJwtLogoutService -{ - private readonly IRefreshTokenValidator _validator; - private readonly IRefreshTokenStoreFactory _storeFactory; - private readonly IClock _clock; - - public PureJwtLogoutService( - IRefreshTokenValidator validator, - IRefreshTokenStoreFactory storeFactory, - IClock clock) - { - _validator = validator; - _storeFactory = storeFactory; - _clock = clock; - } - - public async Task LogoutAsync(AuthFlowContext flow, string refreshToken, CancellationToken ct = default) - { - if (flow.EffectiveMode != UAuthMode.PureJwt || - !flow.IsAuthenticated || - flow.UserKey is not UserKey userKey || - string.IsNullOrWhiteSpace(refreshToken)) - { - return false; - } - - var now = _clock.UtcNow; - - var validation = await _validator.ValidateAsync( - new RefreshTokenValidationContext - { - Tenant = flow.Tenant, - RefreshToken = refreshToken, - Now = now, - Device = flow.Device - }, - ct); - - if (!validation.IsValid || - validation.Tenant != flow.Tenant || - validation.UserKey != userKey || - validation.SessionId is not null || - validation.SessionChainId is not null || - validation.DeviceId is null || - validation.RefreshChainId is not { } refreshChainId || - refreshChainId.Value == Guid.Empty) - { - return false; - } - - var store = _storeFactory.Create(flow.Tenant); - - await store.ExecuteAsync( - transactionCt => - store.RevokeByRefreshChainAsync(refreshChainId, now, transactionCt), - ct); - - return true; - } -} diff --git a/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs b/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs index 0d809748..845e3dcc 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/RefreshTokenRotationService.cs @@ -50,7 +50,8 @@ public async Task RotateAsync(AuthFlowContext flo RefreshToken = context.RefreshToken, Now = context.Now, Device = context.Device, - ExpectedSessionId = context.ExpectedSessionId + ExpectedSessionId = context.ExpectedSessionId, + DeviceMismatchBehavior = flow.Options.Session.DeviceMismatchBehavior }, ct); @@ -227,9 +228,6 @@ validation.UserKey is not UserKey userKey || return false; } - if (context.Device.DeviceId != deviceId) - return false; - var lineage = await _lineageValidator.ValidateAsync( new SessionValidationContext { diff --git a/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs b/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs index a243d41f..54643755 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/SessionLineageValidator.cs @@ -99,9 +99,7 @@ public async Task ValidateAsync(SessionValidationContex !context.Device.HasDeviceId || !Equals(chain.Device.DeviceId, context.Device.DeviceId); - var requireDeviceMatch = - expectedPurpose == SessionCredentialPurpose.MetadataOnly || - options.DeviceMismatchBehavior == DeviceMismatchBehavior.Reject; + var requireDeviceMatch = options.DeviceMismatchBehavior == DeviceMismatchBehavior.Reject; // TODO: Implement device mismatch behavior based on options, e.g., allow, reject or rebind. if (deviceMismatch && requireDeviceMatch) diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/RemoteHubValidationServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/RemoteHubValidationServiceTests.cs new file mode 100644 index 00000000..4e34eeee --- /dev/null +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/RemoteHubValidationServiceTests.cs @@ -0,0 +1,869 @@ +using AwesomeAssertions; +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Defaults; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.MultiTenancy; +using CodeBeam.UltimateAuth.Server.Abstractions; +using CodeBeam.UltimateAuth.Server.Auth; +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.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Moq; +using System.Net; +using System.Security.Claims; + +namespace CodeBeam.UltimateAuth.Tests.Unit.ResourceApi; + +public sealed class RemoteHubValidationServiceTests +{ + private const string AccessToken = "test-jwt-access-token"; + private static readonly TenantKey Tenant = TenantKey.FromExternal("tenant-a"); + private static readonly UserKey User = UserKey.New(); + private static readonly AuthSessionId Session = TestIds.Session("semi-hybrid-session"); + private static readonly SessionChainId Chain = SessionChainId.New(); + private static readonly SessionRootId Root = SessionRootId.New(); + private static readonly DeviceId Device = TestDevice.Default().DeviceId!.Value; + private static readonly DateTimeOffset Now = new(2026, 12, 1, 12, 0, 0, TimeSpan.Zero); + + [Fact] + public async Task ValidateAsync_ShouldSendExpectedHubValidationRequest() + { + using var fixture = CreateFixture(); + + var result = await ValidateAsync(fixture); + + result.IsValid.Should().BeTrue(); + + fixture.Handler.Method.Should().Be(HttpMethod.Post); + + fixture.Handler.RequestUri.Should().Be( + new Uri("https://uauth.test/auth/validate")); + + fixture.Handler.Authorization.Should() + .Be($"Bearer {AccessToken}"); + + fixture.Handler.Validation.Should() + .Be(nameof(UAuthValidationRequirement.HubValidated)); + + fixture.Handler.DeviceId.Should().Be(Device.Value); + + fixture.Handler.CallCount.Should().Be(1); + + fixture.Credentials.Verify(x => x.ResolveAsync( + fixture.Context, + UAuthMode.SemiHybrid, + It.IsAny()), Times.Once); + } + + [Fact] + public async Task ValidateAsync_ValidHubResponse_ShouldReturnActiveResult() + { + using var fixture = CreateFixture(); + + var result = await ValidateAsync(fixture); + + result.IsValid.Should().BeTrue(); + result.State.Should().Be(SessionState.Active); + + result.Tenant.Should().Be(Tenant); + result.UserKey.Should().Be(User); + result.SessionId.Should().Be(Session); + result.ChainId.Should().Be(Chain); + result.RootId.Should().Be(Root); + result.BoundDeviceId.Should().Be(Device); + result.AuthenticatedAt.Should().Be(Now); + result.UserStatus.Should().Be(UserStatus.Active); + + fixture.Context.Items[ + UAuthConstants.HttpItems.SessionValidationResult] + .Should().BeSameAs(result); + } + + [Fact] + public async Task ValidateAsync_UnauthenticatedPrincipal_ShouldReject() + { + using var fixture = CreateFixture(); + + fixture.Context.User = new ClaimsPrincipal( + new ClaimsIdentity(CreateClaims())); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + + fixture.Handler.CallCount.Should().Be(0); + fixture.Credentials.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(ClaimTypes.NameIdentifier)] + [InlineData("sid")] + [InlineData("device_id")] + public async Task ValidateAsync_MissingClaim_ShouldReject( + string claimType) + { + using var fixture = CreateFixture(); + + fixture.Context.User = CreatePrincipal( + CreateClaims().Where(x => x.Type != claimType)); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + + fixture.Handler.CallCount.Should().Be(0); + fixture.Credentials.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(ClaimTypes.NameIdentifier)] + [InlineData("sid")] + [InlineData("device_id")] + public async Task ValidateAsync_DuplicateClaim_ShouldReject( + string claimType) + { + using var fixture = CreateFixture(); + + var claims = CreateClaims(); + + claims.Add(claims.Single(x => x.Type == claimType)); + + fixture.Context.User = CreatePrincipal(claims); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + + fixture.Handler.CallCount.Should().Be(0); + fixture.Credentials.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(ClaimTypes.NameIdentifier, " ")] + [InlineData("sid", "invalid")] + [InlineData("device_id", "invalid")] + public async Task ValidateAsync_InvalidClaim_ShouldReject( + string claimType, + string value) + { + using var fixture = CreateFixture(); + + fixture.Context.User = CreatePrincipal( + CreateClaims() + .Where(x => x.Type != claimType) + .Append(new Claim(claimType, value))); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + + fixture.Handler.CallCount.Should().Be(0); + fixture.Credentials.VerifyNoOtherCalls(); + } + + [Fact] + public async Task ValidateAsync_MissingCredential_ShouldReject() + { + using var fixture = CreateFixture(); + + fixture.Credentials + .Setup(x => x.ResolveAsync( + fixture.Context, + UAuthMode.SemiHybrid, + It.IsAny())) + .ReturnsAsync((TransportCredential?)null); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + + fixture.Handler.CallCount.Should().Be(0); + } + + [Theory] + [InlineData(TransportCredentialKind.Session)] + [InlineData(TransportCredentialKind.RefreshToken)] + [InlineData(TransportCredentialKind.Hub)] + public async Task ValidateAsync_WrongCredentialKind_ShouldReject( + TransportCredentialKind kind) + { + using var fixture = CreateFixture(); + + fixture.Credentials + .Setup(x => x.ResolveAsync( + fixture.Context, + UAuthMode.SemiHybrid, + It.IsAny())) + .ReturnsAsync(CreateCredential(kind)); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + + fixture.Handler.CallCount.Should().Be(0); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task ValidateAsync_RejectPolicy_ShouldRejectDeviceMismatch( + bool missingDevice) + { + using var fixture = CreateFixture(); + + fixture.Options.Auth.Device.MismatchBehavior = + DeviceMismatchBehavior.Reject; + + var requestDevice = missingDevice + ? default(DeviceId) + : TestDevice.Alternative().DeviceId!.Value; + + SetupDevice(fixture, requestDevice); + + var result = await ValidateAsync(fixture); + + result.IsValid.Should().BeFalse(); + result.State.Should().Be(SessionState.DeviceMismatch); + + fixture.Handler.CallCount.Should().Be(0); + + fixture.Context.Items.ContainsKey( + UAuthConstants.HttpItems.SessionValidationResult) + .Should().BeFalse(); + } + + [Fact] + public async Task ValidateAsync_AllowPolicy_ShouldForwardActualRequestDevice() + { + using var fixture = CreateFixture(); + + fixture.Options.Auth.Device.MismatchBehavior = + DeviceMismatchBehavior.Allow; + + var requestDevice = + TestDevice.Alternative().DeviceId!.Value; + + SetupDevice(fixture, requestDevice); + + var result = await ValidateAsync(fixture); + + result.IsValid.Should().BeTrue(); + + // The actual request device must be forwarded. + fixture.Handler.DeviceId.Should() + .Be(requestDevice.Value); + + // The original credential binding must remain unchanged. + result.BoundDeviceId.Should().Be(Device); + } + + [Fact] + public async Task ValidateAsync_AllowPolicy_MissingDevice_ShouldNotForwardTokenDevice() + { + using var fixture = CreateFixture(); + + fixture.Options.Auth.Device.MismatchBehavior = + DeviceMismatchBehavior.Allow; + + SetupDevice(fixture, default); + + var result = await ValidateAsync(fixture); + + result.IsValid.Should().BeTrue(); + + fixture.Handler.DeviceId.Should().BeNull(); + + result.BoundDeviceId.Should().Be(Device); + } + + [Fact] + public async Task ValidateAsync_AllowPolicy_ShouldNotBypassHubDeviceBinding() + { + using var fixture = CreateFixture(); + + fixture.Options.Auth.Device.MismatchBehavior = + DeviceMismatchBehavior.Allow; + + var otherDevice = + TestDevice.Alternative().DeviceId!.Value; + + SetupDevice(fixture, otherDevice); + + SetResponse(fixture, CreateValidResponse() with + { + BoundDeviceId = otherDevice + }); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + } + + [Theory] + [InlineData(HttpStatusCode.BadRequest)] + [InlineData(HttpStatusCode.Unauthorized)] + [InlineData(HttpStatusCode.Forbidden)] + [InlineData(HttpStatusCode.NotFound)] + [InlineData(HttpStatusCode.InternalServerError)] + [InlineData(HttpStatusCode.ServiceUnavailable)] + public async Task ValidateAsync_HubReturnsNonSuccess_ShouldFailClosed( + HttpStatusCode statusCode) + { + using var fixture = CreateFixture(); + + fixture.Handler.OnSendAsync = (_, _) => + Task.FromResult(new HttpResponseMessage(statusCode)); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + + fixture.Handler.CallCount.Should().Be(1); + } + + [Fact] + public async Task ValidateAsync_HubReturnsJsonNull_ShouldFailClosed() + { + using var fixture = CreateFixture(); + + SetResponse(fixture, null); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + } + + [Theory] + [InlineData(SessionState.Revoked)] + [InlineData(SessionState.Expired)] + [InlineData(SessionState.NotFound)] + [InlineData(SessionState.Invalid)] + [InlineData(SessionState.SecurityMismatch)] + [InlineData(SessionState.DeviceMismatch)] + public async Task ValidateAsync_HubReturnsInvalidState_ShouldFailClosed( + SessionState state) + { + using var fixture = CreateFixture(); + + SetResponse(fixture, CreateValidResponse() with + { + State = state + }); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + } + + [Fact] + public async Task ValidateAsync_HubReturnsStandardValidation_ShouldFailClosed() + { + using var fixture = CreateFixture(); + + SetResponse(fixture, CreateValidResponse() with + { + Validation = UAuthValidationRequirement.Standard + }); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + } + + [Fact] + public async Task ValidateAsync_HubReturnsMissingSnapshot_ShouldFailClosed() + { + using var fixture = CreateFixture(); + + SetResponse(fixture, CreateValidResponse() with + { + Snapshot = null + }); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + } + + [Fact] + public async Task ValidateAsync_HubReturnsMissingIdentity_ShouldFailClosed() + { + using var fixture = CreateFixture(); + + SetResponse(fixture, CreateValidResponse() with + { + Snapshot = new AuthStateSnapshot + { + Identity = null!, + Claims = ClaimsSnapshot.Empty + } + }); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + } + + [Theory] + [InlineData("user")] + [InlineData("tenant")] + [InlineData("device")] + [InlineData("missing-device")] + public async Task ValidateAsync_HubReturnsBindingMismatch_ShouldFailClosed( + string mismatch) + { + using var fixture = CreateFixture(); + + var dto = CreateValidResponse(); + + var snapshot = dto.Snapshot!; + + dto = dto with + { + Snapshot = snapshot with + { + Identity = snapshot.Identity with + { + UserKey = mismatch == "user" + ? UserKey.New() + : User, + + Tenant = mismatch == "tenant" + ? TenantKey.FromExternal("tenant-b") + : Tenant + } + }, + + BoundDeviceId = mismatch switch + { + "device" => TestDevice.Alternative().DeviceId, + "missing-device" => null, + _ => Device + } + }; + + SetResponse(fixture, dto); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task ValidateAsync_HubReturnsIncompleteLineage_ShouldFailClosed( + bool missingChain) + { + using var fixture = CreateFixture(); + + var dto = CreateValidResponse() with + { + ChainId = missingChain ? null : Chain, + RootId = missingChain ? Root : null + }; + + SetResponse(fixture, dto); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + } + + [Fact] + public async Task ValidateAsync_HubReturnsMalformedJson_ShouldFailClosed() + { + using var fixture = CreateFixture(); + + fixture.Handler.OnSendAsync = (_, _) => + Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent("invalid-json") + }); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + } + + [Fact] + public async Task ValidateAsync_HubUnavailable_ShouldFailClosed() + { + using var fixture = CreateFixture(); + + fixture.Handler.OnSendAsync = (_, _) => + Task.FromException( + new HttpRequestException("Hub unavailable")); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + } + + [Fact] + public async Task ValidateAsync_HubTimeout_ShouldFailClosed() + { + using var fixture = CreateFixture(); + + fixture.Handler.OnSendAsync = (_, _) => + Task.FromException( + new TaskCanceledException("Hub timeout")); + + var result = await ValidateAsync(fixture); + + AssertInvalid(result, fixture); + } + + [Fact] + public async Task ValidateAsync_CallerCancellation_ShouldPropagate() + { + using var fixture = CreateFixture(); + + using var cts = CancellationTokenSource + .CreateLinkedTokenSource( + TestContext.Current.CancellationToken); + + fixture.Handler.OnSendAsync = async (_, ct) => + { + await Task.Delay(Timeout.InfiniteTimeSpan, ct); + + return new HttpResponseMessage(HttpStatusCode.OK); + }; + + var task = fixture.Sut.ValidateAsync( + fixture.Context, + cts.Token); + + cts.Cancel(); + + var act = async () => await task; + + await act.Should() + .ThrowAsync(); + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task ValidateAsync_SameRequest_ShouldCacheResult( + bool valid) + { + using var fixture = CreateFixture(); + + if (!valid) + { + SetResponse(fixture, CreateValidResponse() with + { + State = SessionState.Revoked + }); + } + + var first = await ValidateAsync(fixture); + var second = await ValidateAsync(fixture); + + first.IsValid.Should().Be(valid); + + second.Should().BeSameAs(first); + + fixture.Handler.CallCount.Should().Be(1); + + fixture.Credentials.Verify(x => x.ResolveAsync( + fixture.Context, + UAuthMode.SemiHybrid, + It.IsAny()), Times.Once); + } + + [Fact] + public async Task ValidateAsync_DifferentRequests_ShouldNotShareCache() + { + using var fixture = CreateFixture(); + + var first = await ValidateAsync(fixture); + + var secondContext = CreateHttpContext( + fixture.Services); + + fixture.Credentials + .Setup(x => x.ResolveAsync( + secondContext, + UAuthMode.SemiHybrid, + It.IsAny())) + .ReturnsAsync(CreateCredential()); + + fixture.DeviceResolver + .Setup(x => x.ResolveAsync(secondContext)) + .ReturnsAsync(new DeviceInfo + { + DeviceId = Device + }); + + var second = await fixture.Sut.ValidateAsync( + secondContext, + TestContext.Current.CancellationToken); + + first.IsValid.Should().BeTrue(); + second.IsValid.Should().BeTrue(); + + second.Should().NotBeSameAs(first); + + fixture.Handler.CallCount.Should().Be(2); + } + + // Helpers + + private static Fixture CreateFixture() + { + var options = new UAuthResourceApiOptions(); + + options.Auth.Mode = UAuthMode.SemiHybrid; + + options.Auth.Device.MismatchBehavior = + DeviceMismatchBehavior.Reject; + + var credentials = + new Mock( + MockBehavior.Strict); + + var deviceResolver = + new Mock(MockBehavior.Strict); + + var services = new ServiceCollection() + .AddSingleton(deviceResolver.Object) + .BuildServiceProvider(); + + var context = CreateHttpContext(services); + + credentials + .Setup(x => x.ResolveAsync( + context, + UAuthMode.SemiHybrid, + It.IsAny())) + .ReturnsAsync(CreateCredential()); + + deviceResolver + .Setup(x => x.ResolveAsync(context)) + .ReturnsAsync(new DeviceInfo + { + DeviceId = Device + }); + + var handler = new RecordingHttpHandler(); + + var client = new HttpClient(handler) + { + BaseAddress = new Uri("https://uauth.test") + }; + + var sut = new RemoteHubValidationService( + client, + credentials.Object, + Options.Create(options)); + + var fixture = new Fixture( + sut, + context, + credentials, + deviceResolver, + handler, + options, + services, + client); + + SetResponse(fixture, CreateValidResponse()); + + return fixture; + } + + private static DefaultHttpContext CreateHttpContext( + IServiceProvider services) + { + var context = new DefaultHttpContext + { + RequestServices = services, + User = CreatePrincipal() + }; + + context.Items[ + UAuthConstants.HttpItems.TenantContextKey] = + UAuthTenantContext.Resolved(Tenant); + + return context; + } + + private static List CreateClaims() + { + return + [ + new Claim(ClaimTypes.NameIdentifier, User.Value), + new Claim("sid", Session.Value), + new Claim("device_id", Device.Value) + ]; + } + + private static ClaimsPrincipal CreatePrincipal( + IEnumerable? claims = null) + { + return new ClaimsPrincipal(new ClaimsIdentity( + claims ?? CreateClaims(), + UAuthConstants.SchemeDefaults.GlobalScheme)); + } + + private static TransportCredential CreateCredential( + TransportCredentialKind kind = + TransportCredentialKind.AccessToken) + { + return new TransportCredential + { + Kind = kind, + Value = AccessToken, + TenantId = Tenant.Value, + Device = new DeviceInfo + { + DeviceId = Device + } + }; + } + + private static AuthValidationResult CreateValidResponse() + { + return new AuthValidationResult + { + State = SessionState.Active, + + Validation = + UAuthValidationRequirement.HubValidated, + + ChainId = Chain, + RootId = Root, + BoundDeviceId = Device, + + Snapshot = new AuthStateSnapshot + { + Identity = new AuthIdentitySnapshot + { + UserKey = User, + Tenant = Tenant, + AuthenticatedAt = Now, + SessionState = SessionState.Active, + UserStatus = UserStatus.Active + }, + + Claims = ClaimsSnapshot.Empty + } + }; + } + + private static void SetupDevice( + Fixture fixture, + DeviceId deviceId) + { + fixture.DeviceResolver + .Setup(x => x.ResolveAsync(fixture.Context)) + .ReturnsAsync(new DeviceInfo + { + DeviceId = deviceId + }); + } + + private static void SetResponse( + Fixture fixture, + AuthValidationResult? response) + { + fixture.Handler.OnSendAsync = (_, _) => + Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK) + { + Content = JsonContent.Create(response) + }); + } + + private static Task ValidateAsync( + Fixture fixture) + { + return fixture.Sut.ValidateAsync( + fixture.Context, + TestContext.Current.CancellationToken); + } + + private static void AssertInvalid( + SessionValidationResult result, + Fixture fixture) + { + result.IsValid.Should().BeFalse(); + result.State.Should().Be(SessionState.Invalid); + + fixture.Context.Items.ContainsKey( + UAuthConstants.HttpItems.SessionValidationResult) + .Should().BeFalse(); + } + + private sealed record Fixture( + RemoteHubValidationService Sut, + DefaultHttpContext Context, + Mock Credentials, + Mock DeviceResolver, + RecordingHttpHandler Handler, + UAuthResourceApiOptions Options, + ServiceProvider Services, + HttpClient Client) : IDisposable + { + public void Dispose() + { + Client.Dispose(); + Services.Dispose(); + } + } + + private sealed class RecordingHttpHandler : HttpMessageHandler + { + public int CallCount { get; private set; } + + public HttpMethod? Method { get; private set; } + + public Uri? RequestUri { get; private set; } + + public string? Authorization { get; private set; } + + public string? Validation { get; private set; } + + public string? DeviceId { get; private set; } + + public Func< + HttpRequestMessage, + CancellationToken, + Task> OnSendAsync + { get; set; } + = (_, _) => Task.FromResult( + new HttpResponseMessage(HttpStatusCode.OK)); + + protected override Task SendAsync( + HttpRequestMessage request, + CancellationToken cancellationToken) + { + CallCount++; + + Method = request.Method; + RequestUri = request.RequestUri; + + Authorization = + request.Headers.Authorization?.ToString(); + + Validation = request.Headers.TryGetValues( + UAuthConstants.Headers.Validation, + out var validationValues) + ? validationValues.SingleOrDefault() + : null; + + DeviceId = request.Headers.TryGetValues( + UAuthConstants.Headers.DeviceId, + out var deviceValues) + ? deviceValues.SingleOrDefault() + : null; + + return OnSendAsync(request, cancellationToken); + } + } +} diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LogoutEndpointHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LogoutEndpointHandlerTests.cs index c133fa17..cab1d97c 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LogoutEndpointHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LogoutEndpointHandlerTests.cs @@ -661,6 +661,8 @@ public async Task LogoutAsync_ValidRefreshToken_RevokesRefreshChain() var validator = new Mock(); var storeFactory = new Mock(); var store = new Mock(); + var lineageValidator = new Mock(); + var sessionIssuer = new Mock(); var clock = new Mock(); var now = DateTimeOffset.UtcNow; @@ -707,9 +709,11 @@ public async Task LogoutAsync_ValidRefreshToken_RevokesRefreshChain() It.IsAny())) .Returns(Task.CompletedTask); - var sut = new PureJwtLogoutService( + var sut = new JwtLogoutService( validator.Object, storeFactory.Object, + lineageValidator.Object, + sessionIssuer.Object, clock.Object); var result = await sut.LogoutAsync( @@ -760,7 +764,7 @@ private static Fixture CreateFixture( new Mock(MockBehavior.Strict); var jwtLogoutService = - new Mock(MockBehavior.Strict); + new Mock(MockBehavior.Strict); authContext .SetupGet(x => x.Current) diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SemiHybridAuthorityValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SemiHybridAuthorityValidatorTests.cs new file mode 100644 index 00000000..ef5164f0 --- /dev/null +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/SemiHybridAuthorityValidatorTests.cs @@ -0,0 +1,486 @@ +using AwesomeAssertions; +using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Contracts; +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.Tests.Unit.Helpers; +using Microsoft.AspNetCore.Http; +using Moq; +using System.Security.Claims; + +namespace CodeBeam.UltimateAuth.Tests.Unit.Server; + +public sealed class SemiHybridAuthorityValidatorTests +{ + private static readonly TenantKey Tenant = TenantKey.FromExternal("tenant-a"); + private static readonly UserKey User = UserKey.New(); + private static readonly AuthSessionId Session = TestIds.Session("semi-hybrid-session"); + private static readonly SessionChainId Chain = SessionChainId.New(); + private static readonly SessionRootId Root = SessionRootId.New(); + private static readonly DeviceId Device = TestDevice.Default().DeviceId!.Value; + private static readonly DateTimeOffset Now = new(2026, 12, 1, 12, 0, 0, TimeSpan.Zero); + + [Fact] + public async Task ValidateAsync_ValidPrincipal_ShouldValidateMetadataLineage() + { + var fixture = CreateFixture(); + var expected = CreateActiveResult(); + + SessionValidationContext? captured = null; + + fixture.Lineage + .Setup(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken)) + .Callback((context, _, _) => + { + captured = context; + }) + .ReturnsAsync(expected); + + var result = await ValidateAsync(fixture); + + result.Should().BeSameAs(expected); + result.IsValid.Should().BeTrue(); + + captured.Should().NotBeNull(); + captured!.Tenant.Should().Be(Tenant); + captured.SessionId.Should().Be(Session); + captured.Device.DeviceId.Should().Be(Device); + captured.SessionOptions.Should().BeSameAs(fixture.Options); + captured.Now.Should().Be(Now); + + fixture.Lineage.Verify(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken), Times.Once); + + fixture.Lineage.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData("Bearer")] + [InlineData("OtherScheme")] + public async Task ValidateAsync_InvalidAuthenticationScheme_ShouldReject( + string? scheme) + { + var fixture = CreateFixture(); + + var principal = new ClaimsPrincipal( + new ClaimsIdentity(CreateClaims(), scheme)); + + var result = await ValidateAsync( + fixture, principal: principal); + + result.IsValid.Should().BeFalse(); + result.State.Should().Be(SessionState.Invalid); + + fixture.Lineage.VerifyNoOtherCalls(); + } + + [Fact] + public async Task ValidateAsync_MultipleAuthenticatedIdentities_ShouldReject() + { + var fixture = CreateFixture(); + + var principal = CreatePrincipal(); + + principal.AddIdentity(new ClaimsIdentity( + CreateClaims(), + UAuthConstants.SchemeDefaults.GlobalScheme)); + + var result = await ValidateAsync( + fixture, principal: principal); + + result.State.Should().Be(SessionState.Invalid); + + fixture.Lineage.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(ClaimTypes.NameIdentifier)] + [InlineData("sid")] + [InlineData("device_id")] + public async Task ValidateAsync_MissingRequiredClaim_ShouldReject( + string claimType) + { + var fixture = CreateFixture(); + + var principal = CreatePrincipal( + CreateClaims().Where(x => x.Type != claimType)); + + var result = await ValidateAsync( + fixture, principal: principal); + + result.State.Should().Be(SessionState.Invalid); + + fixture.Lineage.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(ClaimTypes.NameIdentifier)] + [InlineData("sid")] + [InlineData("device_id")] + public async Task ValidateAsync_DuplicateRequiredClaim_ShouldReject( + string claimType) + { + var fixture = CreateFixture(); + + var claims = CreateClaims(); + + claims.Add(claims.Single(x => x.Type == claimType)); + + var result = await ValidateAsync( + fixture, principal: CreatePrincipal(claims)); + + result.State.Should().Be(SessionState.Invalid); + + fixture.Lineage.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(ClaimTypes.NameIdentifier, " ")] + [InlineData("sid", "invalid")] + [InlineData("device_id", "invalid")] + public async Task ValidateAsync_InvalidClaimValue_ShouldReject( + string claimType, + string value) + { + var fixture = CreateFixture(); + + var claims = CreateClaims() + .Where(x => x.Type != claimType) + .Append(new Claim(claimType, value)); + + var result = await ValidateAsync( + fixture, principal: CreatePrincipal(claims)); + + result.State.Should().Be(SessionState.Invalid); + + fixture.Lineage.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task ValidateAsync_RejectPolicy_ShouldRejectMissingOrDifferentDevice( + bool missingDevice) + { + var fixture = CreateFixture(); + + fixture.Options.DeviceMismatchBehavior = + DeviceMismatchBehavior.Reject; + + var device = missingDevice + ? DeviceContext.Anonymous() + : TestDevice.Alternative(); + + var result = await ValidateAsync( + fixture, device: device); + + result.State.Should().Be(SessionState.DeviceMismatch); + + fixture.Lineage.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task ValidateAsync_AllowPolicy_ShouldAcceptMissingOrDifferentDevice( + bool missingDevice) + { + var fixture = CreateFixture(); + + fixture.Options.DeviceMismatchBehavior = + DeviceMismatchBehavior.Allow; + + var device = missingDevice + ? DeviceContext.Anonymous() + : TestDevice.Alternative(); + + var expected = CreateActiveResult(); + + fixture.Lineage + .Setup(x => x.ValidateAsync( + It.Is(c => + c.Device == device && + c.SessionOptions == fixture.Options), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken)) + .ReturnsAsync(expected); + + var result = await ValidateAsync( + fixture, device: device); + + result.IsValid.Should().BeTrue(); + + // Allow must not change the original binding. + result.BoundDeviceId.Should().Be(Device); + + fixture.Lineage.Verify(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken), Times.Once); + } + + [Theory] + [InlineData(SessionState.NotFound)] + [InlineData(SessionState.Revoked)] + [InlineData(SessionState.Expired)] + [InlineData(SessionState.Invalid)] + [InlineData(SessionState.DeviceMismatch)] + [InlineData(SessionState.SecurityMismatch)] + public async Task ValidateAsync_InvalidLineage_ShouldPreserveFailure( + SessionState state) + { + var fixture = CreateFixture(); + + var expected = SessionValidationResult.Invalid(state); + + SetupLineage(fixture, expected); + + var result = await ValidateAsync(fixture); + + result.Should().BeSameAs(expected); + result.IsValid.Should().BeFalse(); + result.State.Should().Be(state); + } + + [Theory] + [InlineData("tenant")] + [InlineData("user")] + [InlineData("session")] + [InlineData("device")] + public async Task ValidateAsync_LineageBindingMismatch_ShouldReject( + string mismatch) + { + var fixture = CreateFixture(); + + var validation = SessionValidationResult.Active( + tenant: mismatch == "tenant" + ? TenantKey.FromExternal("tenant-b") + : Tenant, + userKey: mismatch == "user" + ? UserKey.New() + : User, + sessionId: mismatch == "session" + ? TestIds.Session("other-session") + : Session, + chainId: Chain, + rootId: Root, + claims: ClaimsSnapshot.Empty, + authenticatedAt: Now, + boundDeviceId: mismatch == "device" + ? TestDevice.Alternative().DeviceId + : Device); + + SetupLineage(fixture, validation); + + var result = await ValidateAsync(fixture); + + result.IsValid.Should().BeFalse(); + result.State.Should().Be(SessionState.SecurityMismatch); + } + + [Fact] + public async Task ValidateAsync_AllowPolicy_ShouldNotBypassLineageBinding() + { + var fixture = CreateFixture(); + + fixture.Options.DeviceMismatchBehavior = + DeviceMismatchBehavior.Allow; + + var validation = SessionValidationResult.Active( + Tenant, + User, + Session, + Chain, + Root, + ClaimsSnapshot.Empty, + Now, + TestDevice.Alternative().DeviceId); + + SetupLineage(fixture, validation); + + var result = await ValidateAsync( + fixture, device: TestDevice.Alternative()); + + result.IsValid.Should().BeFalse(); + result.State.Should().Be(SessionState.SecurityMismatch); + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task ValidateAsync_SameRequest_ShouldCacheResult( + bool valid) + { + var fixture = CreateFixture(); + + var expected = valid + ? CreateActiveResult() + : SessionValidationResult.Invalid(SessionState.Revoked); + + SetupLineage(fixture, expected); + + var first = await ValidateAsync(fixture); + var second = await ValidateAsync(fixture); + + first.Should().BeSameAs(expected); + second.Should().BeSameAs(first); + + fixture.Lineage.Verify(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken), Times.Once); + } + + [Fact] + public async Task ValidateAsync_DifferentRequests_ShouldNotShareCache() + { + var fixture = CreateFixture(); + + SetupLineage(fixture, CreateActiveResult()); + + await ValidateAsync(fixture); + + await ValidateAsync(fixture with + { + HttpContext = new DefaultHttpContext() + }); + + fixture.Lineage.Verify(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken), Times.Exactly(2)); + } + + [Fact] + public async Task ValidateAsync_ConcurrentCalls_ShouldShareInFlightTask() + { + var fixture = CreateFixture(); + + var completion = + new TaskCompletionSource( + TaskCreationOptions.RunContinuationsAsynchronously); + + fixture.Lineage + .Setup(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken)) + .Returns(completion.Task); + + var first = ValidateAsync(fixture); + var second = ValidateAsync(fixture); + + first.Should().BeSameAs(second); + + completion.SetResult(CreateActiveResult()); + + await Task.WhenAll(first, second); + + fixture.Lineage.Verify(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken), Times.Once); + } + + // Helpers + + private static Fixture CreateFixture() + { + var lineage = + new Mock(MockBehavior.Strict); + + var clock = new Mock(MockBehavior.Strict); + + clock.SetupGet(x => x.UtcNow).Returns(Now); + + return new Fixture( + new SemiHybridAuthorityValidator( + lineage.Object, clock.Object), + lineage, + new DefaultHttpContext(), + new UAuthSessionOptions + { + DeviceMismatchBehavior = + DeviceMismatchBehavior.Reject + }, + TestContext.Current.CancellationToken); + } + + private static List CreateClaims() + { + return + [ + new Claim(ClaimTypes.NameIdentifier, User.Value), + new Claim("sid", Session.Value), + new Claim("device_id", Device.Value) + ]; + } + + private static ClaimsPrincipal CreatePrincipal( + IEnumerable? claims = null) + { + return new ClaimsPrincipal(new ClaimsIdentity( + claims ?? CreateClaims(), + UAuthConstants.SchemeDefaults.GlobalScheme)); + } + + private static SessionValidationResult CreateActiveResult() + { + return SessionValidationResult.Active( + Tenant, + User, + Session, + Chain, + Root, + ClaimsSnapshot.Empty, + Now, + Device, + UserStatus.Active); + } + + private static void SetupLineage( + Fixture fixture, + SessionValidationResult result) + { + fixture.Lineage + .Setup(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken)) + .ReturnsAsync(result); + } + + private static Task ValidateAsync( + Fixture fixture, + ClaimsPrincipal? principal = null, + DeviceContext? device = null) + { + return fixture.Sut.ValidateAsync( + fixture.HttpContext, + principal ?? CreatePrincipal(), + Tenant, + device ?? TestDevice.Default(), + fixture.Options, + fixture.CancellationToken); + } + + private sealed record Fixture( + SemiHybridAuthorityValidator Sut, + Mock Lineage, + DefaultHttpContext HttpContext, + UAuthSessionOptions Options, + CancellationToken CancellationToken); +} From 2d683b816f4d825a47155cee81a1f5066f6cccff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Thu, 3 Dec 2026 10:50:32 +0300 Subject: [PATCH 10/14] Refactor Docs --- .../Pages/Dashboard/SessionDiagnostics.razor | 2 +- docs/content/auth-flows/logout-flow.md | 78 ++- docs/content/auth-flows/refresh-flow.md | 61 +- .../client-sdk/resource-api-requests.md | 95 ++- .../configuration/advanced-configuration.md | 65 +- docs/content/configuration/overview.md | 63 +- docs/content/configuration/server-options.md | 275 +++++--- docs/content/fundamentals/auth-modes.md | 663 +++++++----------- docs/content/fundamentals/overview.md | 30 +- .../content/fundamentals/request-lifecycle.md | 134 +++- .../fundamentals/runtime-architecture.md | 77 +- docs/content/security/token-security.md | 109 +-- .../wwwroot/docs/auth-flows/logout-flow.json | 17 +- .../wwwroot/docs/auth-flows/refresh-flow.json | 14 +- .../client-sdk/resource-api-requests.json | 13 +- .../configuration/advanced-configuration.json | 26 +- .../wwwroot/docs/configuration/overview.json | 18 +- .../docs/configuration/server-options.json | 63 +- .../wwwroot/docs/fundamentals/auth-modes.json | 171 ++--- .../wwwroot/docs/fundamentals/overview.json | 17 +- .../docs/fundamentals/request-lifecycle.json | 30 +- .../fundamentals/runtime-architecture.json | 14 +- .../wwwroot/docs/security/token-security.json | 36 +- .../Program.cs | 2 +- .../Program.cs | 2 +- .../Program.cs | 2 +- .../Program.cs | 4 +- 27 files changed, 1162 insertions(+), 919 deletions(-) diff --git a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Components/Pages/Dashboard/SessionDiagnostics.razor b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Components/Pages/Dashboard/SessionDiagnostics.razor index f94420bb..421bac74 100644 --- a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Components/Pages/Dashboard/SessionDiagnostics.razor +++ b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Components/Pages/Dashboard/SessionDiagnostics.razor @@ -70,7 +70,7 @@ diff --git a/docs/content/auth-flows/logout-flow.md b/docs/content/auth-flows/logout-flow.md index 7f7fd2ef..1a5e741d 100644 --- a/docs/content/auth-flows/logout-flow.md +++ b/docs/content/auth-flows/logout-flow.md @@ -30,6 +30,19 @@ This structure gives termination a meaningful scope. An application can end acce > **Mental model:** Logout is a controlled exit from authentication. Revoke is a permanent invalidation of the selected authentication state. A later login may establish new state, but it does not undo a revocation. +### Logout behavior across authentication modes + +| Mode | Server-side termination | Effect on previously issued access credentials | +|---|---|---| +| PureOpaque | Session-chain logout | Subsequent authoritative validation rejects the session | +| Hybrid | Session-chain logout | Subsequent authoritative validation rejects the session | +| SemiHybrid | Session-chain logout | HubValidated requests are rejected; Standard JWT validation may continue until expiration | +| PureJwt | Refresh-chain revocation, when a valid refresh credential is available | Existing JWTs may remain valid until expiration | + +Logout always aims to end the client's authentication continuity. + +The selected authentication mode determines how server-side termination affects credentials that have already been issued. + ## Logout versus revoke ### Logout: end access without necessarily destroying the device lineage @@ -112,20 +125,25 @@ The ordinary logout endpoint does not accept an arbitrary session ID from the br ### 2. Request server-side termination -When a `SessionSecurityContext` is present, the endpoint constructs a `LogoutRequest` using that session ID and calls the flow service: +The effective authentication mode determines which authentication state can be terminated. -```csharp -var request = new LogoutRequest -{ - SessionId = session.SessionId -}; +When a validated session context is available, UltimateAuth performs the corresponding session-chain logout operation. + +For JWT-based modes, the endpoint can also use a valid refresh credential to resolve the authentication state that must be terminated. + +In SemiHybrid, this allows logout to resolve and terminate the associated session lineage. + +In PureJwt, the corresponding refresh chain can be revoked without an authentication session. + +The application uses the same client API: -await _client.Flows.LogoutAsync(request); +```csharp +await UAuthClient.Flows.LogoutAsync(); ``` -The logout command resolves the session's chain and invokes the session issuer's `LogoutChainAsync` operation. The session-store implementation performs the chain logout transition. +Applications do not need to extract session identifiers, inspect JWT claims, or implement mode-specific logout behavior. -This is the authoritative part of logout. Removing a client cookie alone is not a substitute for this state transition. +Server-side termination requires valid evidence of the authentication context being terminated. ### 3. Clear cookies configured for this flow @@ -180,25 +198,39 @@ This is useful when an application needs to clear its own state, perform additio **Important:** The `navigate` parameter controls client-side navigation, not session termination or server-side redirect configuration. If logout fails, including with HTTP 429, the operation does not publish a successful logout event. Applications should perform post-logout actions only after `LogoutAsync` completes successfully. -### PureJwt logout +### Logout in JWT-based modes + +SemiHybrid and PureJwt use JWT access tokens that can be validated locally. + +Logout can terminate the corresponding server-managed authentication continuity, but it cannot remove every copy of a previously issued JWT. + +#### SemiHybrid logout -PureJwt does not have a server-side authentication session to terminate. +UltimateAuth terminates the associated session chain when valid authentication evidence is available. -Instead, UltimateAuth can revoke the refresh chain associated with the authenticated client. +After successful session termination: -When a refresh token is supplied, the logout flow validates its relationship to the authenticated user, tenant, device, and refresh chain before revocation. +- Refresh operations associated with that session cannot continue. +- HubValidated requests cannot satisfy authoritative session validation. +- Standard JWT validation may continue to succeed until the access token expires. -The refresh chain is revoked through the configured refresh-token store. +#### PureJwt logout -Cookie-based credentials are cleared according to the effective delivery configuration. +PureJwt does not have an authentication session to terminate. -An important distinction applies: +When a valid refresh credential is available, UltimateAuth can revoke its associated refresh chain. -- Refresh-chain revocation prevents further token renewal. -- Clearing client credentials removes locally accessible authentication material. -- Already issued JWT access tokens remain valid until expiration unless an additional validation condition invalidates them. +This prevents further renewal through that refresh chain. -A logout request without a refresh token does not revoke a refresh chain. Applications should not treat local credential removal alone as proof of server-side refresh-token revocation. +Previously issued JWT access tokens remain subject to their own validation and expiration requirements. + +#### Logout success and server-side termination + +A logout request can successfully clear client credentials even when no valid authentication context can be resolved. + +This allows users to sign out when their browser contains stale or expired credentials. + +However, successful client cleanup is not proof that a server-side session or refresh chain was found and terminated. ## Why redirect matters @@ -247,9 +279,11 @@ The default current-device logout endpoint follows its own flow-based path. Do n ## Security properties and boundaries -### Server-side invalidation comes first +### Server-side termination and credential cleanup + +When valid authentication evidence is available, UltimateAuth attempts server-side termination before completing credential cleanup. -The server must stop recognizing the affected authentication state. Browser cleanup improves user experience and reduces accidental credential reuse, but it is not the source of truth. +The authentication mode determines which server-side state can be terminated and whether previously issued access credentials remain independently valid. ### Revoked state is terminal diff --git a/docs/content/auth-flows/refresh-flow.md b/docs/content/auth-flows/refresh-flow.md index c909b5b6..18e06aba 100644 --- a/docs/content/auth-flows/refresh-flow.md +++ b/docs/content/auth-flows/refresh-flow.md @@ -28,10 +28,16 @@ This distinction matters for both security and client behavior. A refresh reques | Mode | Continuation mechanism | Required state | |---|---|---| -| PureOpaque | Session touch | Valid server-side session | +| PureOpaque | Session touch | Valid authoritative session | | Hybrid | Session-backed refresh-token rotation | Valid session and refresh token | -| SemiHybrid | Planned | Not currently supported | -| PureJwt | Refresh-token rotation | Valid refresh token and refresh chain | +| SemiHybrid | JWT renewal with authoritative session validation | Valid session-bound refresh token and session lineage | +| PureJwt | Session-independent refresh-token rotation | Valid refresh token and refresh chain | + +The authentication mode determines how authentication continuity is maintained. + +The application uses the same refresh API regardless of the selected mode. + +Refresh-token-based continuation is available when refresh-token issuance is enabled for the effective mode. ### PureJwt: refresh without a session @@ -77,7 +83,7 @@ Touch behavior is governed by the effective session options: - `TouchInterval` avoids writing activity state on every request. If the interval has not elapsed, the operation may succeed as **NoOp**. - `TouchMode` is `IfNeeded` by default; `Force` requests a touch even when the normal interval has not elapsed. -- `SlidingExpiration` allows a touch to extend the session expiration using the configured `Lifetime`. +- `Session.SlidingExpiration` allows an eligible touch to extend session expiration using the configured `Token.SessionIdLifetime`. - An absolute chain expiration remains an upper bound; sliding expiration cannot extend the session beyond it. - `IdleTimeout` participates in chain-state validation. An idle or otherwise inactive chain cannot be revived merely by touching it. @@ -96,7 +102,7 @@ Refresh token → Return new credentials ``` -The rotation service first rejects modes or configurations that do not permit refresh-token issuance (`PureOpaque` or `IssueRefresh = false`). 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's execution boundary and `TryConsumeAsync`, so competing requests cannot both successfully consume the same old token. +The rotation service first rejects modes or configurations that do not permit refresh-token issuance (`PureOpaque` or `IssueRefreshToken = false`). 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's execution boundary and `TryConsumeAsync`, so competing requests cannot both successfully consume the same old token. Rotation preserves the validated user, session and chain association; it is **not** a new authentication or a new session. Claims for the replacement access token are obtained through the configured claims provider. @@ -130,11 +136,50 @@ No access token or refresh token is issued. The existing session ID remains the The order is important: **session touch happens before token rotation** 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. +### SemiHybrid: JWT and session continuity + +SemiHybrid combines JWT access-token renewal with authoritative session lifecycle management. + +The refresh operation: + +1. Validates the presented refresh token. +2. Resolves its associated user, tenant, device and session lineage. +3. Validates the authoritative session state. +4. Applies eligible session touch behavior. +5. Generates replacement access and refresh tokens. +6. Atomically consumes the previous refresh token and persists its replacement. + +The replacement JWT retains its association with the existing session lineage. + +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. + +However, a revoked, expired, or otherwise invalid session cannot be renewed through refresh. + +Session touch and refresh-token rotation are separate persistence operations. They should not be interpreted as one cross-store transaction. + +### PureJwt: session-independent token continuity + +PureJwt refresh validates the refresh credential 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. + +No session root, session chain, or authentication session is created as part of this operation. + +Previously issued access tokens remain subject to their own expiration and validation requirements. + ## Request resolution and response delivery -The refresh endpoint uses the server's `AuthFlowContext`. It obtains the session ID from `flow.Session`, the device from `flow.Device`, and the refresh token through `RefreshTokenResolver`. +The refresh endpoint uses the effective `AuthFlowContext` to resolve the authentication mode, tenant, device and available authentication context. + +In PureOpaque and Hybrid, the session credential participates in authentication continuation. + +In SemiHybrid, the refresh credential identifies the associated session lineage, which must be validated authoritatively. -For refresh-token input, the resolver checks: +In PureJwt, continuation is based on the session-independent refresh chain. Refresh-token input is resolved exclusively from the effective refresh grant delivery configuration. @@ -178,7 +223,7 @@ Refresh continues existing trust only while the relevant state remains valid: - **Single-use refresh tokens:** successful rotation consumes the old credential and persists a replacement. - **Replay response:** suspicious reuse can revoke refresh-token state associated with the chain or session. - **Expiration:** idle, session, chain and refresh-token validity rules can end continuation. Refresh does not bypass those limits. -- **Issuance policy:** `IssueRefresh = false` prevents rotation before the old token is consumed. +- **Issuance policy:** `IssueRefreshToken = false` prevents rotation before the old token is consumed. These controls complement one another. A refresh token should be treated as a sensitive credential, not as a harmless request to generate another access token. diff --git a/docs/content/client-sdk/resource-api-requests.md b/docs/content/client-sdk/resource-api-requests.md index 71f0c8c2..ed25e7dc 100644 --- a/docs/content/client-sdk/resource-api-requests.md +++ b/docs/content/client-sdk/resource-api-requests.md @@ -573,73 +573,112 @@ It does not replace the receiving server's security responsibilities. UAuthHub and Resource APIs are configured independently. -UAuthHub determines which authentication credentials are issued to a client. A Resource API determines which credentials it accepts and how they are validated. +UAuthHub determines which authentication credentials are issued. A Resource API determines which credentials it accepts and how they are validated. -Using the same UltimateAuth infrastructure does not automatically make all authentication modes interchangeable. +All four authentication modes are supported by the UltimateAuth Resource API integration. -| Client Credential | Resource API Validation | Current Support | +| Mode | Primary credential | Resource API validation | |---|---|---| -| PureOpaque session | Remote session validation | Supported | -| PureJwt access token | Local JWT validation | Supported | -| Hybrid session credential | Remote session validation | Supported when correctly configured | -| Hybrid JWT access token | Hybrid-aware JWT validation | Not yet implemented | -| PureOpaque session | PureJwt-only validation | Not supported | +| PureOpaque | Opaque session credential | Remote authoritative validation | +| Hybrid | Opaque session credential | Remote authoritative validation | +| SemiHybrid | JWT access token | Local JWT validation with optional remote authoritative validation | +| PureJwt | JWT access token | Local JWT validation | -A PureJwt Resource API cannot authenticate an opaque session credential as a JWT. +The configured Resource API mode must be compatible with the credentials issued by UAuthHub. -Likewise, configuring a Resource API URL in the client SDK does not automatically exchange session credentials for JWT access tokens. +Changing the authentication mode does not require rewriting Resource Client calls made through the shared UltimateAuth Client SDK. ### Credential Delivery -The client and Resource API must agree on the credential used for authentication and its transport. +The client and Resource API must agree on the authentication credential and its transport. #### Session-based Resource APIs -PureOpaque and Hybrid Resource APIs use opaque session credentials. +PureOpaque and Hybrid Resource APIs authenticate requests using opaque session credentials. -Cookie delivery is the default for incoming session credentials. +Cookie delivery is the default for incoming session credentials. Other supported transports can be configured when required. -The Resource API validates the selected session through UAuthHub using the configured Hub address. +The Resource API validates the presented session through UAuthHub. -The browser must be able to send the session cookie to the Resource API. +When cookie delivery is used, the browser must be able to send the session cookie to the Resource API. #### JWT-based Resource APIs -PureJwt Resource APIs use JWT access tokens. +SemiHybrid and PureJwt Resource APIs authenticate requests using JWT access tokens. -The default Blazor Resource Client attaches the current access token using: +The default header-based access-token transport is: ```http Authorization: Bearer ``` -For a Resource API that exclusively uses header-based JWT authentication, browser cookies can be omitted: +The UltimateAuth Resource Client automatically attaches the current access token when configured to use header-based authentication. + +For Resource APIs that do not require browser cookies: ```csharp options.Resource.Credentials = UAuthResourceCredentialsMode.Omit; ``` -Omitting browser cookies does not prevent the client from attaching its access-token authorization header. - This option affects Resource API requests, not authentication or refresh requests sent to UAuthHub. #### Credential compatibility -A JWT issued in Hybrid mode is not interchangeable with a PureJwt access token. +JWT access tokens issued for different authentication modes are not necessarily interchangeable. -Hybrid-aware JWT validation in separate Resource APIs is not currently implemented. +SemiHybrid requires an access token associated with server-managed session lineage. -Authentication mode selection and credential compatibility remain explicit configuration responsibilities. +PureJwt requires a session-independent access token. -### PureJwt and UAuthHub Connectivity +A SemiHybrid session identifier is metadata and must never be accepted as an opaque authentication credential. -A PureJwt Resource API does not need to contact UAuthHub to validate each JWT. +### Resource API validation requirements -However, clients still use UAuthHub for login, refresh, and logout operations. +SemiHybrid Resource APIs support both Standard and HubValidated authentication. -This separation allows protected APIs to validate access tokens independently while the authentication authority manages refresh-token state. +Standard validation establishes the authenticated identity locally without contacting UAuthHub. ---- +HubValidated additionally requires authoritative validation of the associated session lineage. + +To require authoritative validation for a particular endpoint: + +```csharp +app.MapPost("/api/security/settings", UpdateSecuritySettings) + .RequireUAuthHubValidation(); +``` + +To require authoritative validation by default: + +```csharp +builder.Services.AddUltimateAuthResourceApi(options => +{ + options.Auth.Mode = UAuthMode.SemiHybrid; + + options.Auth.Validation.Default = UAuthValidationRequirement.HubValidated; + + // Configure Hub connectivity and JWT validation. +}); +``` + +The client does not need to select a validation requirement or make a separate validation request. + +The requirement is enforced by the Resource API. + +### UAuthHub connectivity + +| Mode | UAuthHub connectivity for protected requests | +|---|---| +| PureOpaque | Required | +| Hybrid | Required | +| SemiHybrid | Required for HubValidated operations | +| PureJwt | Not required for ordinary JWT validation | + +SemiHybrid Resource APIs require a configured Hub address, even when their default validation requirement is Standard. + +Clients continue to use UAuthHub for authentication flows such as login, refresh, and logout. + +See [Request Lifecycle](/docs/fundamentals/request-lifecycle) for validation requirements and +[Authentication Modes](/docs/fundamentals/auth-modes) for mode-specific guarantees. ## 8. Device and Application Profile Metadata diff --git a/docs/content/configuration/advanced-configuration.md b/docs/content/configuration/advanced-configuration.md index 48bfa134..73dc4573 100644 --- a/docs/content/configuration/advanced-configuration.md +++ b/docs/content/configuration/advanced-configuration.md @@ -306,43 +306,48 @@ Test mode overrides carefully, especially when changing token issuance, session ## 6. Mode Defaults -UltimateAuth provides mode-specific defaults for authentication behavior. +UltimateAuth applies authentication-mode-specific defaults when resolving effective server options. -The current implementation includes templates for: +These defaults adapt the authentication infrastructure to the selected mode without requiring mode-specific application code. -- `PureOpaque` -- `Hybrid` -- `SemiHybrid` -- `PureJwt` +### Mode-defined credential behavior -These templates configure relevant token, session, cookie, and response behavior. +The effective authentication mode determines which credential types are issued and how they participate in authentication. -### PureOpaque +JWT and opaque credential issuance are not independent mode-selection flags. -The `PureOpaque` defaults include: +Applications select the authentication strategy through `AuthMode` or `ApplicationProfileModes`. -```csharp -Token.IssueJwt = false; -Token.IssueOpaque = false; -Token.IssueRefresh = false; -``` +### Mode-specific configuration behavior -In this mode, the session identifier is the primary opaque authentication credential. +| Mode | Relevant defaults | +|---|---| +| PureOpaque | Session-based continuation, longer default idle timeout and touch interval | +| Hybrid | Authoritative session validation with separate token lifecycle | +| SemiHybrid | JWT authentication with server-managed session lineage | +| PureJwt | Session-independent JWT authentication without session touch | -The defaults also configure a longer idle timeout and session touch interval where no explicit values were supplied. +Mode defaults also configure applicable credential delivery and cookie lifetime behavior. -### Hybrid +### Global values and mode overrides -The `Hybrid` defaults include: +Token lifetimes can be configured globally. -```csharp -Token.IssueJwt = true; -Token.IssueOpaque = true; -Token.AccessTokenLifetime = TimeSpan.FromMinutes(10); -Token.RefreshTokenLifetime = TimeSpan.FromDays(7); -``` +Mode-specific overrides allow applications to customize the effective configuration for particular authentication modes. + +The effective configuration is resolved from the configured values, applicable mode defaults, and explicit mode-specific overrides. -Hybrid also configures refresh-token delivery through a cookie. +Use `ConfigureMode()` when a configuration value must differ between authentication modes. + +See [Server Options](/docs/configuration/server-options) for the available token and session properties. + +### Validation requirements are independent of mode selection + +SemiHybrid supports Standard and HubValidated authentication requirements without introducing additional authentication modes. + +The validation requirement determines whether a particular operation needs authoritative session validation. + +This allows applications to tune authentication behavior without introducing mode-specific client integration. ## 7. Inspect Effective Options @@ -1080,11 +1085,15 @@ Use `ConfigureMode()` for explicit mode-specific customization. It does not replace `IEffectiveAuthModeResolver`. -### Enabling an Unsupported Mode +### Configuring incompatible authentication components + +Supporting all four authentication modes does not mean that every issued credential can be accepted by every Resource API configuration. + +Ensure that the issuing server, Resource API, cryptographic settings and credential delivery configuration are compatible. -An enum value or default template does not establish that a mode is ready for production. +Mode changes should be applied as coordinated configuration changes. -Use only modes supported by the current implementation. +Existing credentials are not automatically converted to the new authentication mode. ### Replacing Security Components Unnecessarily diff --git a/docs/content/configuration/overview.md b/docs/content/configuration/overview.md index 9ecca145..c34ad96e 100644 --- a/docs/content/configuration/overview.md +++ b/docs/content/configuration/overview.md @@ -116,52 +116,34 @@ The server applies its validation rules to the resulting configuration. **Configuration values should be chosen together.** For example, token lifetime settings must remain compatible with the configured session lifetime limits. -## 3. Core Options Are Composed into Server Options +## 3. Configuration Ownership -`UAuthServerOptions` includes the following Core-defined option groups: +UltimateAuth separates configuration according to the component responsible for applying it. -```csharp -public UAuthLoginOptions Login { get; set; } = new(); - -public UAuthSessionOptions Session { get; set; } = new(); - -public UAuthTokenOptions Token { get; set; } = new(); - -public UAuthPkceOptions Pkce { get; set; } = new(); - -public UAuthMultiTenantOptions MultiTenant { get; set; } = new(); -``` +| 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 | -This is composition, not duplication. +Shared authentication contracts and domain concepts are provided by UltimateAuth Core. -The Core package owns the shared option definitions, while the Server package uses those definitions as part of its effective server configuration. +Server-specific configuration belongs to the Server integration. -### Recommended +Configure server behavior through the primary server registration API: ```csharp builder.Services.AddUltimateAuthServer(options => { - options.Session.Lifetime = TimeSpan.FromHours(8); - options.Pkce.Enabled = true; -}); -``` - -### Not Recommended for Server Configuration - -```csharp -builder.Services.AddUltimateAuth(options => -{ - options.Session.Lifetime = TimeSpan.FromHours(8); + options.AuthMode = UAuthMode.Hybrid; + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); + options.Session.SlidingExpiration = true; }); - -builder.Services.AddUltimateAuthServer(); ``` -The second example configures `UAuthOptions`, not the `UAuthServerOptions` instance consumed by the server's authentication runtime. +Applications should not independently configure internal option groups when the corresponding component exposes a primary configuration entry point. -**When using UltimateAuth Server, configure Core-defined behavior through `AddUltimateAuthServer()` or the `UltimateAuth:Server` configuration section.** - -Direct Core configuration is intended for scenarios that explicitly consume `UAuthOptions` rather than the server configuration model. +This keeps configuration ownership explicit and allows UltimateAuth to resolve effective options consistently. ## 4. Server Configuration Groups @@ -472,15 +454,20 @@ Setting `AllowedModes` does not directly choose which mode every client will use ### Supported Authentication Modes -UltimateAuth currently implements PureOpaque, Hybrid, and PureJwt. +UltimateAuth supports four authentication modes: + +- PureOpaque +- Hybrid +- SemiHybrid +- PureJwt -SemiHybrid remains unavailable. +All modes share the same application-level authentication programming model. -The effective authentication mode is resolved from server-controlled configuration and application profile defaults. +The selected mode determines the underlying credential, validation and lifecycle strategy. -Resource API mode resolution is independent from UAuthHub mode resolution. A Resource API does not automatically discover or adopt the mode selected for a particular client by UAuthHub. +Hybrid is the recommended general-purpose starting point when no specialized authentication requirements have been identified. -For supported modes and their behavior, see [Authentication Modes](/docs/fundamentals/auth-modes). +See [Authentication Modes](/docs/fundamentals/auth-modes) for a complete comparison and selection guidance. ## 10. Configure Credential Session Policies diff --git a/docs/content/configuration/server-options.md b/docs/content/configuration/server-options.md index 1c459769..6ab2645c 100644 --- a/docs/content/configuration/server-options.md +++ b/docs/content/configuration/server-options.md @@ -90,42 +90,35 @@ For configuration source ordering and environment-specific overrides, see [Confi ## 2. Server Options Architecture -`UAuthServerOptions` contains two categories of configuration. +`UAuthServerOptions` is the primary configuration entry point for UltimateAuth Server. -### Core-defined options +It composes authentication configuration into logical groups according to their responsibilities. -These types are defined in UltimateAuth Core and composed into the server options: +| Configuration group | Responsibility | +|---|---| +| `AuthMode` | Explicit authentication mode selection | +| `ApplicationProfileModes` | Application-profile-specific mode selection | +| `AllowedModes` | Restrict permitted authentication modes | +| `Session` | Session lifecycle and security policies | +| `Token` | Credential lifetimes and token configuration | +| `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 | +| `Events` | Authentication lifecycle callbacks | -| Property | Type | Purpose | -|---|---|---| -| `Login` | `UAuthLoginOptions` | Login attempts and lockout behavior | -| `Session` | `UAuthSessionOptions` | Session lifetime and lifecycle | -| `Token` | `UAuthTokenOptions` | Access and refresh token behavior | -| `Pkce` | `UAuthPkceOptions` | PKCE authorization code lifetime | -| `MultiTenant` | `UAuthMultiTenantOptions` | Tenant identification and resolution | -| `Pagination` | `UAuthPaginationOptions` | Pagination defaults and limits | -| `Events` | `UAuthEvents` | Authentication lifecycle callbacks | +Configure these groups through the server's registration API. -### Server-specific options +UltimateAuth resolves the effective configuration according to the application profile, authentication mode and applicable mode-specific overrides. -| Property | Purpose | -|---|---| -| `AllowedModes` | Restrict permitted authentication modes | -| `HubDeploymentMode` | Describe the relationship between UAuthHub and the application | -| `Hub` | Hub integration and flow settings | -| `Cookie` | Cookie names, security attributes, and lifetime behavior | -| `GrantDelivery` | Authentication grant delivery and incoming credential resolution | -| `Endpoints` | Endpoint groups and disabled actions | -| `CredentialSessionPolicy` | Session invalidation after credential changes | -| `ResetCredential` | Credential recovery code and token settings | -| `Identifiers` | Identifier behavior, normalization, and uniqueness | -| `IdentifierValidation` | Username, email, and phone validation | -| `LoginIdentifiers` | Identifier types allowed for login | -| `UserProfile` | User profile capabilities | -| `Navigation` | Authentication navigation behavior | -| `Diagnostics` | Optional diagnostic response details | +Server configuration and client configuration remain separate responsibilities. -Advanced configuration hooks are also available, including `ConfigureMode()` and `OnConfigureEndpoints`. +See [Advanced Configuration](/docs/configuration/advanced-configuration) for effective-options resolution. ## 3. Login Options @@ -171,12 +164,11 @@ Production deployments should also consider infrastructure protections against a ## 4. Session Options -`options.Session` controls session lifetime, expiration, sliding behavior, and session-chain limits. +`options.Session` controls session expiration, sliding behavior, and session-chain limits. ```csharp builder.Services.AddUltimateAuthServer(options => { - options.Session.Lifetime = TimeSpan.FromDays(7); options.Session.SlidingExpiration = true; options.Session.IdleTimeout = TimeSpan.FromDays(3); options.Session.MaxLifetime = TimeSpan.FromDays(30); @@ -187,7 +179,6 @@ builder.Services.AddUltimateAuthServer(options => | Property | Default | Description | |---|---|---| -| `Lifetime` | 7 days | Standard session lifetime | | `MaxLifetime` | `null` | Optional absolute lifetime limit | | `SlidingExpiration` | `true` | Allow eligible activity or refresh operations to extend expiration | | `IdleTimeout` | `null` | Optional inactivity timeout | @@ -195,8 +186,6 @@ builder.Services.AddUltimateAuthServer(options => These settings have different purposes. -`Lifetime` determines the standard lifetime assigned to a session. - `MaxLifetime` establishes an optional hard boundary that cannot be extended indefinitely. `IdleTimeout` limits how long a session can remain inactive. @@ -207,26 +196,9 @@ These settings have different purposes. | Property | Default | Description | |---|---|---| -| `MaxChainsPerUser` | `0` | Reserved user-level chain limit | | `MaxSessionsPerChain` | `100` | Session-chain rotation limit | -| `MaxChainsPerPlatform` | `null` | Reserved platform-specific chain limits | -| `PlatformCategories` | `null` | Reserved platform group definitions | -| `MaxChainsPerCategory` | `null` | Reserved category-specific chain limits | -| `EnableIpBinding` | `false` | Reserved IP binding setting | -| `EnableUserAgentBinding` | `false` | Reserved User-Agent binding setting | | `DeviceMismatchBehavior` | `Reject` | Reserved device mismatch behavior | -**Current implementation limitation:** The source identifies several device limits and binding settings as reserved for future enforcement. Setting these properties must not be treated as proof that the corresponding protection is active. - -For example, do not rely on: - -```csharp -options.Session.MaxChainsPerUser = 1; -``` - -as a production guarantee that only one device chain can exist unless the current runtime implementation has been verified to enforce that restriction. - - ### Enforced Device Limits Active-device admission limits are configured separately from `options.Session`: @@ -262,21 +234,25 @@ Session settings can also be affected by authentication mode defaults. For example, `PureOpaque` supplies a longer idle timeout and touch interval when those values have not been configured. -`Hybrid` explicitly sets `TouchInterval` to `null`. - See [Advanced Configuration](/docs/configuration/advanced-configuration) for the effective-options resolution order. ## 5. Token Options -`options.Token` configures access and refresh token behavior. +`options.Token` configures authentication credential lifetimes and token-related behavior. + +UltimateAuth determines which credential types are issued according to the effective authentication mode. + +Applications do not need to enable JWT or opaque credential issuance independently. ```csharp builder.Services.AddUltimateAuthServer(options => { - options.Token.Issuer = "MyApplication"; - options.Token.Audience = "MyApplicationApi"; + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10); options.Token.RefreshTokenLifetime = TimeSpan.FromDays(7); + + options.Token.Issuer = "MyApplication"; + options.Token.Audience = "MyApplicationApi"; }); ``` @@ -284,18 +260,39 @@ builder.Services.AddUltimateAuthServer(options => | Property | Default | Description | |---|---|---| -| `IssueJwt` | `true` | Enable JWT issuance where supported by the effective mode | -| `IssueOpaque` | `true` | Enable opaque token issuance where supported | -| `IssueRefresh` | `true` | Enable refresh token issuance where supported | -| `AccessTokenLifetime` | 10 minutes | Access token lifetime | -| `RefreshTokenLifetime` | 7 days | Refresh token lifetime | -| `OpaqueIdBytes` | `32` | Random byte length used for opaque token identifiers | +| `SessionIdLifetime` | 7 days | Lifetime of the session identifier | +| `AccessTokenLifetime` | 10 minutes | Access-token lifetime | +| `RefreshTokenLifetime` | 7 days | Refresh-token lifetime | +| `IssueRefreshToken` | `true` | Enable refresh-token issuance where supported | +| `OpaqueIdBytes` | `32` | Random byte length used for opaque identifiers | | `RefreshTokenConcurrentRequestWindow` | 2 seconds | Concurrent duplicate refresh classification window | | `Issuer` | `UAuth` | JWT issuer | | `Audience` | `UAuthClient` | JWT audience | -| `AddJwtIdClaim` | `false` | Include a JWT identifier claim | | `KeyId` | `null` | Optional signing key identifier | +### Mode-specific applicability + +Not every token option applies to every authentication mode. + +For example: + +- PureOpaque uses `SessionIdLifetime` but does not issue access or refresh tokens. +- Hybrid maintains authoritative session state together with a separate token lifecycle. +- SemiHybrid uses JWT access tokens associated with server-managed session lineage. +- PureJwt uses JWT access tokens without authentication sessions. + +Configuring a credential lifetime does not enable a credential type that is unsupported by the effective mode. + +### Session identifiers and credentials + +The purpose of a session identifier depends on the authentication mode. + +In PureOpaque and Hybrid, the session identifier is an opaque authentication credential. + +In SemiHybrid, the session identifier represents session lineage metadata. + +A metadata-only session identifier must never be accepted as an opaque authentication credential. + ### Refresh Token Concurrency Window ```csharp @@ -305,38 +302,32 @@ builder.Services.AddUltimateAuthServer(options => }); ``` -This option controls how the server distinguishes a closely timed duplicate refresh request from a confirmed replay. +This option distinguishes likely concurrent refresh requests from later token reuse. -A duplicate refresh request is still rejected. +A consumed refresh token cannot be successfully rotated again. -The window affects the replay-response classification, including whether the token family should be revoked. +The concurrency window affects replay classification, not token validity. -It does **not** allow the same consumed refresh token to be used successfully more than once. +See [Refresh Flow](/docs/auth-flows/refresh-flow) +and [Refresh Rotation](/docs/security/refresh-rotation). -### Mode Defaults May Override Token Values +### Mode-specific token configuration -The effective `Hybrid` configuration explicitly sets: - -```csharp -Token.AccessTokenLifetime = TimeSpan.FromMinutes(10); -Token.RefreshTokenLifetime = TimeSpan.FromDays(7); -``` - -Therefore, a different value configured globally may be replaced when the effective mode is resolved. - -To customize the lifetime for `Hybrid`, use: +Token lifetimes can be configured globally or overridden for a particular authentication mode. ```csharp builder.Services.AddUltimateAuthServer(options => { - options.ConfigureMode(UAuthMode.Hybrid, mode => + options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10); + + options.ConfigureMode(UAuthMode.SemiHybrid, mode => { mode.Token.AccessTokenLifetime = TimeSpan.FromMinutes(5); }); }); ``` -This distinction is essential when configuring token lifetimes. +Mode-specific overrides are useful when a server supports multiple authentication modes. ## 6. PKCE Options @@ -411,6 +402,40 @@ The server controls the effective authentication mode. Application profile metad `AllowedModes` restricts permitted modes but does not select a mode. +### Application-profile-specific modes + +An authentication mode can be selected globally: + +```csharp +builder.Services.AddUltimateAuthServer(options => +{ + options.AuthMode = UAuthMode.Hybrid; +}); +``` + +Alternatively, authentication modes can be selected for individual application profiles: + +```csharp +builder.Services.AddUltimateAuthServer(options => +{ + options.ApplicationProfileModes[ApplicationProfile.BlazorServer] = UAuthMode.PureOpaque; + options.ApplicationProfileModes[ApplicationProfile.BlazorWasm] = UAuthMode.SemiHybrid; + options.ApplicationProfileModes[ApplicationProfile.Maui] = UAuthMode.Hybrid; +}); +``` + +`AuthMode` and `ApplicationProfileModes` are alternative explicit mode-selection mechanisms. + +Do not configure both simultaneously. + +`AllowedModes` restricts which modes are permitted. It does not select the effective authentication mode. + +When no explicit selection is provided, UltimateAuth uses its application-profile-aware defaults. + +Hybrid is the general-purpose default for most application profiles, while Blazor Server defaults to PureOpaque. + +See [Authentication Modes](/docs/fundamentals/auth-modes) for selection guidance and mode transition considerations. + ### Explicit PureJwt Configuration ```csharp @@ -431,7 +456,6 @@ Use a cryptographically secure, independently generated key in production. Do no PureJwt does not create authentication sessions, but refresh-token persistence is still required. - ### Configure Mode-Specific Behavior Use `ConfigureMode()` for behavior that should differ by mode. @@ -455,6 +479,77 @@ The mode override runs after the built-in mode defaults. See [Advanced Configuration](/docs/configuration/advanced-configuration) for details. + +## 7/A. Validation Options + +`options.Validation` configures authentication validation requirements for applicable UltimateAuth server operations. + +The available requirements are: + +| Requirement | Description | +|---|---| +| `Standard` | Normal authentication guarantees of the effective mode | +| `HubValidated` | Authoritative validation of the associated session | + +### Default validation requirement + +```csharp +builder.Services.AddUltimateAuthServer(options => +{ + options.AuthMode = UAuthMode.SemiHybrid; + + options.Validation.Default = UAuthValidationRequirement.Standard; +}); +``` + +Standard is the default configured requirement. + +Individual UltimateAuth operations may require stronger validation according to their security classification. + +### Endpoint-specific validation + +Validation requirements can be customized for supported UltimateAuth endpoints: + +```csharp +builder.Services.AddUltimateAuthServer(options => +{ + options.Validation.Endpoints[UAuthEndpoint.GetMyIdentifiers] = UAuthValidationRequirement.HubValidated; +}); +``` + +Endpoint-specific configuration cannot weaken mandatory framework security requirements. + +The effective requirement considers the endpoint classification, configured default, explicit requirements, and applicable framework-enforced minimums. + +Authentication flows such as login, refresh and credential recovery retain their own security requirements. + +### Application-defined endpoints + +Custom ASP.NET Core endpoints can explicitly require authoritative validation: + +```csharp +app.MapPost("/api/security/settings", UpdateSecuritySettings) + .RequireUAuthHubValidation(); +``` + +Controller actions can use `UAuthHubValidated` together with the applicable authorization requirement. + +Server validation options for built-in UltimateAuth operations should not be interpreted as automatically applying the same requirement to every custom endpoint. + +### Resource API validation + +Resource APIs configure their own default validation requirement through: + +```csharp +options.Auth.Validation.Default = UAuthValidationRequirement.HubValidated; +``` + +This is particularly useful for SemiHybrid Resource APIs that require authoritative session validation by default. + +PureJwt cannot satisfy a HubValidated requirement because it has no associated authentication session. + +See [Request Lifecycle](/docs/fundamentals/request-lifecycle) for validation behavior. + ## 8. Endpoint Options `options.Endpoints` controls endpoint paths, feature groups, and individual action restrictions. @@ -1442,20 +1537,6 @@ builder.Services.AddUltimateAuthServer(options => The general server validator rejects paths containing `//`. -### Unsupported Modes - -```csharp -builder.Services.AddUltimateAuthServer(options => -{ - options.AllowedModes = - [ - UAuthMode.PureJwt - ]; -}); -``` - -The current validator rejects explicitly enabling `PureJwt` because that mode is not yet implemented as a supported server mode. - ### Validation Limitations Startup validation protects the configured options according to the registered validators. @@ -1484,7 +1565,7 @@ builder.Services.AddUltimateAuthServer(options => options.Login.IncludeFailureDetails = false; // Sessions - options.Session.Lifetime = TimeSpan.FromDays(7); + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); options.Session.MaxLifetime = TimeSpan.FromDays(30); // Token identity diff --git a/docs/content/fundamentals/auth-modes.md b/docs/content/fundamentals/auth-modes.md index 6ac0fff0..10c32e5e 100644 --- a/docs/content/fundamentals/auth-modes.md +++ b/docs/content/fundamentals/auth-modes.md @@ -4,548 +4,395 @@ order: 4 group: fundamentals --- -# Auth Modes +# Authentication Modes -UltimateAuth provides four authentication modes: **PureOpaque**, **Hybrid**, **SemiHybrid**, and **PureJwt**. +UltimateAuth introduces four authentication modes: **PureOpaque**, **Hybrid**, **SemiHybrid**, and **PureJwt**. -Each mode defines how authentication credentials are issued, validated, renewed, and revoked. The modes share the same authentication and authorization architecture, but differ in their reliance on server-side sessions, credential formats, and lifecycle guarantees. +They use the same authentication flows, application profiles, authorization model, and client abstractions. What changes is **how an authenticated request proves identity, which server-side state must be checked, and when revocation becomes effective**. -The choice of authentication mode affects more than performance. It determines where authentication state is maintained, whether a server-side session must be consulted during an authenticated request, and how quickly previously issued credentials can be invalidated. +There is no universally best mode. Choose the validation and lifecycle guarantees your application needs, then choose how to deliver credentials to each client. +## The four modes at a glance -> **Availability** -> -> PureOpaque, Hybrid, and PureJwt are implemented authentication modes. -> SemiHybrid remains reserved for a future implementation and should not be used in production. -> -> PureJwt supports locally validated JWT access tokens and stateful refresh-token rotation without requiring server-side authentication sessions. -> -> Resource API authentication is configured independently from the issuing UAuthHub. Matching authentication mode names alone do not guarantee credential compatibility. +All four authentication modes provide the same unified developer experience. When using UltimateAuth's shared APIs, choosing a mode does not make authentication easier or harder to implement. +The difference lies in the underlying authentication strategy, not in how you write your application code. -## Auth credentials - -UltimateAuth distinguishes three credential concepts. - -**Session credential** - -A session credential identifies an authenticated session maintained by the server. In PureOpaque, it is the credential presented by the client to authenticate requests. - -A session credential may be represented by an opaque, randomly generated value. It does not need to expose the internal database identifier of the session. - -**Access token** - -An access token is a credential used to authenticate requests to protected resources. - -Depending on the mode, it may be: - -- An opaque token resolved and validated by the server. -- A JWT validated cryptographically without a session lookup. - -An access token is not a session identifier. In Hybrid, the JWT access token is a separate credential issued alongside a server-side session. The session remains authoritative for session-backed authentication and lifecycle management. - -**Refresh token** - -A refresh token allows an existing authentication context to continue by obtaining replacement credentials without requiring the user to authenticate again. - -Refresh tokens have their own validation, expiration, rotation, and replay-protection requirements. +| Mode | Philosophy | Why choose it? | +|---|---|---| +| **PureOpaque** | Minimalist authentication | You want a streamlined authentication model without unnecessary complexity. | +| **Hybrid** | General-purpose default | You want a balanced, comprehensive solution that grows with your application. | +| **SemiHybrid** | Performance tuning | You want fine-grained control over the balance between performance and centralized security. | +| **PureJwt** | Conventional JWT authentication | You prefer session-independent JWT authentication and do not require UltimateAuth's session-based capabilities. | -Not every authentication mode requires all three credential types. +Not sure which mode to choose? **Start with Hybrid.** You can always change your authentication strategy later without rewriting your UltimateAuth integration. -## Mode comparison +| | PureOpaque | Hybrid | SemiHybrid | PureJwt | +|---|---|---|---|---| +| Primary authentication for protected requests | Opaque session | Opaque session | JWT access token | JWT access token | +| Server-side Root / Chain / Session | Yes | Yes | Yes, metadata and lifecycle | No | +| Session record is an authentication credential | Yes | Yes | **No** (`sid` is metadata) | No session ID | +| Server-side session validation for ordinary access | Required | Required | **Optional**, per validation requirement | Not applicable | +| JWT validation for ordinary access | No | Not the supported Resource API path | Yes | Yes | +| Refresh token | No | Yes | Yes | Yes | +| Refresh mechanism | Session touch | Stateful refresh rotation | Stateful refresh rotation + lineage check | Stateful refresh rotation | +| Can invalidate a session-backed request promptly | Yes | Yes | Only where `HubValidated` is enforced | No session-based mechanism | +| Already issued JWT survives session logout | Not applicable | JWT is not the primary Resource API authentication path | On `Standard` requests, until expiry | Until expiry | +| Separate Resource API | Remote session validation | Remote session validation | Local JWT or remote Hub validation | Local JWT validation | +| Main cost | Session infrastructure on each authenticated request | Session infrastructure plus token lifecycle | Choosing appropriate validation for each operation | Stale JWT identity until expiration | +**Important:** An opaque session credential is not the same as a JWT containing a session identifier. In SemiHybrid, the JWT's `sid` claim identifies server-side lineage for applicable checks; it must never be accepted as an opaque session credential. -| Characteristic | PureOpaque | Hybrid | SemiHybrid | PureJwt | -|---|---|---|---|---| -| Session credential | Opaque | Opaque | Session-backed | None | -| Access token | None | JWT | JWT | JWT | -| Refresh token | None | Stateful | Stateful | Stateful | -| Server-side session | Required | Required | Required | Not required | -| Access validation | Session validation | Mode-specific session authority | JWT validation | Local JWT validation | -| Refresh continuity | Session touch | Session and refresh lifecycle | Session and refresh lifecycle | Refresh chain rotation | -| Immediate session revocation | Yes | Session-backed operations | Session-backed operations | Not applicable | -| Immediate JWT revocation | Not applicable | Depends on validation strategy | Additional enforcement required | Not supported by local validation | -| Device binding | Session-based | Session/token-based | Planned | JWT and refresh-token binding | -| Resource API support | Opaque session validation | Session validation path; JWT integration incomplete | Not implemented | Local JWT validation | -| Main advantage | Simple, centrally controlled sessions | Separate token lifecycle with session authority | Stateless access validation with session management | Minimal authentication-state dependencies | -| Main trade-off | Session lookup on each authenticated request | More credentials and lifecycle complexity | Existing JWTs can remain valid after session revocation | No immediate server-side session revocation | +The table describes current framework authentication paths, not benchmark results. Cryptographic validation, session stores, network latency, and infrastructure design all affect real-world performance. -The comparison describes authentication behavior, not guaranteed throughput rankings. Actual performance depends on token validation costs, storage infrastructure, caching, network latency, request volume, and application architecture. +## One decision matters most: when must the server be consulted? -## PureOpaque +Think about what should happen after a user signs out, an administrator terminates a session, or a device is revoked. -### Fully session-based authentication +- **Every protected request must observe session termination:** use **PureOpaque** or **Hybrid**. Their supported protected-resource authentication paths validate server-side session state. +- **Most reads can use a JWT, but important operations must observe session termination:** use **SemiHybrid**. Mark important operations `HubValidated` and allow eligible requests to use `Standard`. +- **Protected resource APIs should not depend on a session service:** use **PureJwt**. Use short-lived JWTs, because server-side session revocation is not part of JWT authentication. -PureOpaque is UltimateAuth's simplest stateful authentication mode. +A JWT's signature proves that a trusted issuer signed it. It does **not** prove that the user is still active, the session still exists, or permissions have not changed since issuance. -Authentication is represented by a server-side session. The client receives an opaque session credential and presents it on subsequent authenticated requests. +## PureOpaque — one credential, server-authoritative sessions -The server resolves the credential, validates the session and its applicable security policies, and establishes the authenticated identity. +PureOpaque uses a randomly generated opaque session credential. The server resolves the session and validates its current state before accepting the request. ```text -Client - | - | Session Credential - v -Session Resolution - | - v -Session Validation - | - v -Authenticated Identity - | - v -AccessContext +Client -- opaque session --> Server + | + v + Session / Chain / Root + | + v + Authenticated ``` -PureOpaque does not issue a separate access token or refresh token. - -The session credential itself is sufficient to identify the authentication context, provided the server determines that the session remains valid. - -### Session continuation - -PureOpaque does not use refresh-token rotation. - -Instead, an existing session may continue through session touch operations, subject to the configured session policies. - -Depending on the configuration, these policies may include: - -- Session lifetime. -- Sliding expiration. -- Idle timeout. -- Touch interval. -- Absolute expiration limits. -- Session revocation. - -A touch operation does not necessarily extend the session lifetime. It updates session state only when the applicable policy requires it. - -An expired or revoked session cannot be restored merely by touching it. - -### Advantages - -**Minimal credential complexity** - -There is no separate access-token lifecycle, refresh-token storage, or refresh-token rotation. +**Choose PureOpaque when:** you prefer a small credential surface, predictable server-side revocation, and a simple session lifecycle. It is especially convenient for Blazor Server, MVC, Razor Pages, internal tools, and browser applications with secure session cookies. -**Immediate session revocation** +**What to expect:** -When a session is revoked, subsequent authentication evaluations that validate that session reject the credential. +- No separate JWT access token or rotating refresh-token lifecycle. +- Session continuation uses session touch and the configured expiration policies. +- A revoked or expired session is rejected when the server next validates it. +- Each authenticated request depends on the availability and performance of the session-validation infrastructure. -**Centralized authentication control** +**Practical tip:** If you deploy multiple application instances, configure a shared session store. A fast local process cache is not a substitute for shared authoritative state unless your invalidation design makes that safe. -The server remains authoritative for session validity and can enforce current session policies. +### PureOpaque is not limited to server-side applications -**Natural integration with server-rendered applications** +PureOpaque is often associated with server-rendered applications, but it is equally a valid authentication model for client-side and distributed applications. -Applications already maintaining server-side authentication state can use a single session credential without introducing additional token-management mechanisms. +Blazor WebAssembly, JavaScript SPAs, .NET MAUI, desktop applications, and separate Resource APIs can all use opaque session credentials when credential delivery and server-side validation are configured appropriately. -### Limitations +A client-side application does not inherently need JWTs. An opaque credential can be transported through a cookie or an HTTP header without exposing identity claims to the client. -**Session validation is required** +The main consideration is whether the protected resource can consult the authentication authority when validating requests. -Every authenticated request must validate the server-side session. Depending on the deployment, this can involve a database or distributed cache lookup. +For many applications, including distributed ones, PureOpaque may be the simplest sufficient authentication mode. -**Availability depends on session infrastructure** +## Hybrid — authoritative sessions with a separate token lifecycle -A distributed deployment needs reliable access to shared session state or an equivalent session-validation mechanism. - -**The session credential is sensitive** - -Possession of a valid session credential may be sufficient to authenticate as the session owner. It must be protected against disclosure, replay, and session fixation. - -**Long-lived connections require special handling** - -In environments such as Blazor Server, an established SignalR circuit may outlive the authentication state initially used to establish it. Appropriate revalidation and authorization checks remain necessary. - -### Recommended applications - -PureOpaque is generally a strong default for: - -- Blazor Server applications. -- ASP.NET Core MVC and Razor Pages applications. -- Internal applications using centrally managed sessions. -- Browser applications using secure, HttpOnly session cookies. -- Systems that prioritize simple session lifecycle management and immediate server-side revocation. - -PureOpaque is not restricted to server-to-server communication. It can also be used safely with browser and mobile clients when credentials are stored, transported, and validated appropriately. - - -## Hybrid - -### Session-backed authentication with separate tokens - -Hybrid combines server-authoritative authentication sessions with JWT access tokens and opaque refresh tokens. - -A successful login establishes a server-side session and issues separate access and refresh credentials. +Hybrid retains the server-side Root / Chain / Session model while supporting separate token issuance and stateful refresh-token rotation. ```text -Authentication - | - +----> Opaque Session Credential - | | - | Session Validation - | | - | Root / Chain / Session - | - +----> JWT Access Token - | - +----> Opaque Refresh Token +Client -- opaque session --> Resource API / Server + | + v + Session validation + | + v + Root / Chain / Session + + Refresh token --> Refresh rotation ``` -The session identifier, access token, and refresh token represent different credentials with different responsibilities. - -The server-side session remains authoritative for session-backed authentication. Issuing a JWT does not automatically make Hybrid authentication stateless. - -### Current Resource API support - -In the current implementation, Hybrid Resource APIs authenticate requests using the opaque session credential and validate the session remotely through UAuthHub. - -Hybrid-aware JWT access-token validation in separate Resource APIs is not yet implemented. - -Applications requiring independent JWT validation should explicitly select PureJwt and configure compatible signing and verification keys. - -### Refresh and session lifecycle - -Hybrid uses refresh tokens to continue authentication without requiring the user to authenticate again. - -A successful refresh validates the relevant session and refresh-token state, applies the configured session policies, and issues replacement credentials. - -Session lifetime, access-token lifetime, and refresh-token lifetime are separate concerns. - -### Advantages - -**Server-authoritative authentication** - -Session-backed requests remain subject to server-side session validation and lifecycle policies. - -**Centralized session management** +**Choose Hybrid when:** you need centrally managed devices and sessions, immediate rejection when authoritative session validation runs, and a separate refresh-token lifecycle. It is a useful general-purpose choice for applications that communicate with a central UAuthHub. -Applications retain access to device-associated sessions, session chains, revocation, and other session-management capabilities. +**A common misunderstanding:** Hybrid having JWT-related token capabilities does **not** make its supported Resource API authentication path stateless. The current separate Resource API path authenticates Hybrid through the opaque session credential and session validation. Do not configure the Resource API as PureJwt simply because the issuing system can produce a JWT; mode-specific binding and validation rules differ. -**Separate credential lifetimes** +**What to expect:** -Access and refresh credentials can have lifetimes appropriate to their individual responsibilities. +- Session validity remains authoritative for the supported request authentication path. +- Refresh-token rotation and session lifetime are distinct controls. +- A separate Resource API using session validation depends on UAuthHub availability. +- More credential and lifecycle concepts must be configured than in PureOpaque. -**Unified application integration** +**Practical tip:** Choose Hybrid for its *authority and lifecycle model*, not as an assumed JWT performance optimization. If local JWT validation is the requirement, evaluate SemiHybrid or PureJwt instead. -Hybrid provides a common authentication model for browser applications, native clients, and centralized authentication deployments. +## SemiHybrid — JWT access with selective authoritative validation -### Limitations +SemiHybrid uses signed JWT access tokens, **and** maintains Root / Chain / Session records for authentication lifecycle and selected authoritative operations. -**Server-side state** +Its defining feature is that **JWT validation and authoritative session validation are separate decisions**. -Hybrid requires session infrastructure and refresh-token lifecycle management. +A SemiHybrid JWT includes a `sid` claim, but the session identifier is **metadata**, not a bearer session credential. A valid JWT can establish identity without a session lookup when the operation requires only `Standard` validation. -**Remote validation dependency** +### Two validation levels -Separate Resource APIs using session validation depend on the availability of the authentication server. - -**JWT integration boundaries** - -Hybrid JWT access tokens must not be treated as interchangeable with PureJwt access tokens. The current Resource API implementation does not support Hybrid-aware JWT validation. - -**Credential confidentiality** - -JWT payloads are readable by their holders. Signing protects integrity and authenticity, not confidentiality. - -### Recommended applications - -Hybrid is particularly useful for: - -- Blazor WebAssembly applications. -- Native and mobile applications. -- Applications using centralized authentication through UAuthHub. -- Applications requiring token-based credential delivery while retaining server-authoritative session management. - -Hybrid is the default authentication mode for application profiles other than BlazorServer under the built-in mode resolver. - - -## SemiHybrid - -### Stateless JWT validation with server-side session lifecycle - -SemiHybrid combines JWT access tokens with server-side session management. - -Its defining characteristic is the separation between **access-token validation** and **session lifecycle operations**. - -For normal authenticated requests, the server validates the JWT cryptographically. A session lookup is not required by default. +| Requirement | What is checked | What it does not guarantee | +|---|---|---| +| `Standard` | JWT signature, lifetime, issuer/audience, identity, and applicable device policy | Current server-side session or chain state | +| `HubValidated` | JWT validation **plus** authoritative session lineage validation | Automatic reload of every application role, permission, or business policy | ```text -Client - | - | JWT Access Token - v -JWT Validation - | - v -Authenticated Identity - | - v -AccessContext + SemiHybrid JWT + | + v + Local JWT validation + | + Required validation? + / \ + Standard HubValidated + | | + | Session / Chain / Root + | | + +---------+---------+ + | + v + Authorization / API ``` -The server-side session is not consulted during this normal authentication path. - -However, the session remains relevant when the authentication lifecycle must be managed. - -### What session metadata is used for - -SemiHybrid maintains server-side session state for operations such as: - -- Refresh-token validation and rotation. -- Logout and session termination. -- Revoking an individual session. -- Revoking all sessions belonging to a user. -- Listing active sessions or devices. -- Enforcing session expiration and continuation policies. -- Recording session lifecycle information. - -This state is a **lifecycle control mechanism**, not a mandatory source of identity validation on every API request. - -For example, when a user logs out, the server can revoke the session and prevent subsequent refresh operations from continuing it. - -However, a previously issued JWT may remain valid until its expiration because normal JWT validation does not consult that session. - -### Revocation semantics - -SemiHybrid must distinguish two separate guarantees. - -**Session revocation** - -Revoking the session prevents authentication continuation through that session, including refresh operations that require it. +**`HubValidated` is a request-time check, not a permanent upgrade to the JWT.** A previous successful Hub validation does not make subsequent `Standard` requests session-aware. UltimateAuth avoids a cross-request authoritative-validation cache by default; same-request reuse is a different optimization. -**Access-token revocation** +### What happens after revocation? -Revoking the session does not automatically invalidate an already issued JWT. +Suppose an administrator terminates the session while its JWT is still within its lifetime: -Immediate rejection of an issued JWT requires an additional mechanism, such as a revocation lookup against a distributed cache. +| Next operation | Outcome | +|---|---| +| `Standard` endpoint | The JWT may still authenticate until expiry | +| `HubValidated` endpoint | The revoked or invalid lineage is rejected | +| Refresh | Session lineage is checked; invalid lineage prevents continuation | +| New login | Requires the normal authentication flow and applicable admission policies | -Such a mechanism can be supported as an explicit policy, but it introduces an additional request-time dependency and validation cost. +This makes SemiHybrid useful when **the cost of querying session state on every request is unnecessary, but selected operations need current lifecycle authority**. -Without that policy, JWT expiration remains the boundary for an already issued access token. +### Choosing which operations need HubValidated -### Advantages +A sensible starting policy is: -**Stateless normal request validation** - -Protected API requests can authenticate JWTs without consulting the session store. - -**Centralized lifecycle management** - -Applications retain the ability to manage sessions, devices, refresh operations, and future authentication continuity. - -**Reduced request-time storage dependencies** - -Session infrastructure is not part of the default JWT validation path. - -**Configurable revocation trade-offs** - -Applications can choose whether to introduce additional request-time revocation enforcement when stronger invalidation guarantees are required. - -### Limitations - -**Session revocation does not automatically revoke issued JWTs** - -An access token can remain valid after logout until its expiration unless an additional revocation mechanism is enforced. - -**Lifecycle state is still required** - -SemiHybrid is not a session-free mode. Refresh and session management depend on server-side state. - -**More complex expiration semantics** - -JWT expiration, refresh-token expiration, session expiration, and session activity policies must be coordinated. - -**Optional revocation checks reduce statelessness** - -If immediate access-token revocation is enabled, the request pipeline may need an additional cache or store lookup. - -### Recommended applications - -SemiHybrid is intended for: +| Operation | Suggested requirement | Why | +|---|---|---| +| Low-risk catalog reads or user-neutral queries | `Standard` | A short-lived JWT is often sufficient | +| Profile display, when eventual consistency is acceptable | `Standard` | Avoids an additional session validation | +| Payment, high-impact changes, or sensitive administrative actions | `HubValidated` | Check that the session lineage remains active | +| Session and device management | `HubValidated` | These operations rely on authoritative session state | +| Login and refresh | Their own authentication proof/flow | Do not treat them as ordinary protected GET requests | -- High-throughput APIs that still require centralized session management. -- Distributed applications using short-lived JWT access tokens. -- Applications offering device and active-session management. -- Systems that need JWT validation performance without giving up refresh and session lifecycle control. -- Architectures where access-token expiration is an acceptable default revocation boundary. +These are **application design recommendations**, not a promise that every listed example has that default classification. UltimateAuth classifies built-in endpoints separately and imposes minimum requirements on specific session-management operations. Custom endpoints require an explicit protection decision. -SemiHybrid should not be described as providing immediate JWT revocation unless an additional enforcement mechanism is enabled. +For an application endpoint, use the supported endpoint extension: +```csharp +app.MapPost("/api/account/sensitive-action", HandleSensitiveAction) + .RequireUAuthHubValidation(); +``` -## PureJwt +`RequireUAuthHubValidation()` adds both Hub-validation metadata and an ASP.NET Core authorization requirement. Simply placing `[UAuthHubValidated]` on an endpoint is not a replacement for requiring authorization. -### Session-independent authentication with stateful refresh +For an entire Resource API, you can require Hub validation globally: -PureJwt authenticates protected requests using cryptographically signed JWT access tokens without requiring Root, Chain, or Session records. +```csharp +builder.Services.AddUltimateAuthResourceApi(options => +{ + options.Auth.Mode = UAuthMode.SemiHybrid; + options.Auth.Validation.Default = UAuthValidationRequirement.HubValidated; +}); +``` -Unlike a fully stateless authentication system, UltimateAuth's PureJwt implementation maintains server-side state for refresh-token lifecycle management. +That configuration prioritizes authoritative checking over the normal stateless performance advantage. Use it deliberately. -This distinction is intentional: +On UltimateAuth Server, `options.Validation.Default` and per-built-in-endpoint entries control the applicable minimum validation requirement. Request metadata and framework-imposed minimums can raise a requirement; they are not intended to let a request weaken it. -- Access-token validation is stateless. -- Refresh-token validation and rotation are stateful. -- Refresh tokens are associated with a refresh chain and device context. -- Logout can revoke the corresponding refresh chain. -- Previously issued JWT access tokens remain independently valid until expiration unless another validation condition invalidates them. +### Integrated server versus separate Resource API -### Authentication +The *validation requirement* is the same, but the authority can be reached differently: -After successful authentication, UltimateAuth issues a JWT access token and a refresh token. +- **Integrated server:** `HubValidated` checks session lineage through local server services. +- **Separate Resource API:** `HubValidated` performs a remote validation call to UAuthHub. The Resource API first validates the JWT, and the Hub must explicitly confirm the higher validation level. -The JWT includes the authenticated subject, tenant, device identifier, and applicable identity claims. +The remote request carries the access credential and requests `HubValidated`. A successful ordinary (`Standard`) JWT response is insufficient; the Resource API fails closed if the Hub does not confirm authoritative validation. -A PureJwt access token does not contain a framework session identity. +In a distributed deployment, a `Standard` endpoint can avoid a Hub round trip. A `HubValidated` endpoint pays that cost and depends on the Hub being available. This is the central SemiHybrid trade-off. -### Access-token validation +### What SemiHybrid does not do automatically -A Resource API validates JWT access tokens locally using: +- It does not make every JWT request immediately revocable. +- It does not transform the JWT `sid` into a session credential. +- It does not guarantee that the JWT's roles or permissions reflect recent account changes. +- It does not replace action-level authorization policies or a fresh-authentication requirement for highly sensitive operations. +- It does not make refresh or logout fully stateless; they still depend on persisted state and proof validation. -- Trusted verification keys selected by key ID (`kid`). -- An explicitly allowed signing algorithm. -- Expected issuer and audience. -- Token signature and lifetime. -- The UltimateAuth access-token type (`uauth-access+jwt`). -- Tenant and subject claims. -- Device binding according to the configured device policy. +**Choose SemiHybrid when:** you own multiple APIs, have meaningful session/device-management requirements, and can deliberately separate operations that tolerate JWT staleness from those requiring current session authority. -PureJwt Resource APIs do not require `Hub.BaseUrl` for normal access-token validation. +**Practical tip:** Keep JWT access-token lifetimes reasonably short even when you use `HubValidated`. The token's lifetime determines the exposure window for endpoints that remain `Standard`. -### Refresh-token lifecycle +## PureJwt — locally validated access, no session lineage -Refresh tokens are persisted and rotated through a dedicated refresh chain. +PureJwt signs JWT access tokens without creating UltimateAuth Root / Chain / Session records for authentication. -A successful refresh consumes the previous refresh token and issues replacement access and refresh credentials. +```text +Client -- JWT --> Resource API + | + v + Local JWT validation + | + v + Authorization + +Refresh token --> Persisted refresh chain / rotation +``` -Refresh rotation preserves the authenticated user, tenant, device, and refresh-chain relationships without creating a server-side authentication session. +**Choose PureJwt when:** independent API validation and minimal request-time dependencies matter more than server-side session management. It is a natural fit for distributed resource services and integrations where short JWT validity windows are acceptable. -Refresh-token reuse outside the configured concurrent-request window can trigger refresh-chain revocation. +PureJwt is **stateless for access-token validation**, but it is not entirely persistence-free when refresh tokens are enabled. The refresh-token chain is stored, rotated, and revocable. A successfully revoked refresh chain prevents further refresh, but it cannot retroactively invalidate an access token that a Resource API validates locally. -### Logout +A PureJwt access token does not include an UltimateAuth `sid` claim. `HubValidated` is not supported because there is no server-side session lineage to check. -PureJwt logout can revoke the refresh chain associated with a validated refresh token. +**Practical tips:** -Revocation prevents subsequent refresh operations using that chain. +- Prefer short JWT lifetimes and explicit issuer, audience, signing-algorithm, and key validation. +- Treat JWT claims as a snapshot taken at issuance, not a live user directory. +- Use separate application authorization mechanisms when account changes must become effective immediately. +- Do not confuse revoking refresh capability with revoking an already issued access token. -Logout does not retroactively invalidate JWT access tokens already issued to the client. +## Selecting a mode for your application -### Security considerations +### Not sure which mode to choose? Start with Hybrid. -PureJwt provides independent access-token validation, but it does not provide immediate access-token revocation through session state. +If you are unsure which authentication mode best fits your application, **Hybrid is the recommended general-purpose starting point.** -Changes to user status, permissions, or account existence do not automatically invalidate an existing JWT when the Resource API performs only local token validation. +It combines server-authoritative session control with a separate token lifecycle, providing a balanced foundation for security, flexibility, and application growth. -Applications should use appropriately short access-token lifetimes and avoid placing sensitive information in JWT payloads. +Hybrid is also the default authentication mode for most UltimateAuth Application Profiles. +It is suitable for both new and growing applications, including those that may later introduce additional clients, separate Resource APIs, or distributed infrastructure. -## Choosing a mode +You do not need to anticipate every future requirement. If your needs change, you can switch to another authentication mode without rewriting your UltimateAuth integration. -The most useful selection criterion is not the client technology alone, but the authentication guarantees the application requires. +Start with the required security behavior, not the UI framework. These are useful starting points rather than hard restrictions: -| Application or requirement | Recommended mode | Reason | +| Your priority | Start with | Consider instead when... | |---|---|---| -| Blazor Server | PureOpaque | Server-controlled sessions without a separate access/refresh token lifecycle | -| ASP.NET Core MVC or Razor Pages | PureOpaque | Simple cookie-based session authentication | -| Internal administrative application | PureOpaque or Hybrid | Centralized session control and immediate revocation | -| Blazor WebAssembly with a separate API | Hybrid | Access/refresh tokens with authoritative session validation | -| Mobile or desktop client | Hybrid | Independent token lifetimes with centralized session control | -| Web application with separate frontend and API | Hybrid | Token-based access without losing server-side revocation | -| High-throughput API with session management | SemiHybrid | Stateless JWT validation alongside managed session lifecycle | -| Multi-device application with session controls | SemiHybrid or Hybrid | Centralized device/session management; different access-validation costs | -| Distributed resource APIs | PureJwt | Independent JWT validation without mandatory session lookup | -| External service integration | PureJwt | Stateless token validation across service boundaries | -| Immediate access revocation is essential | PureOpaque or Hybrid | Every authentication evaluation enforces server-side session validity | -| No session infrastructure is desired | PureJwt | Authentication does not require session persistence | +| Simple server-rendered app with cookies | **PureOpaque** | You need a separate token lifecycle | +| Client-side or native application with simple, centrally validated authentication | **PureOpaque** | You need independent access and refresh token lifecycles or local JWT validation | +| Internal/admin system requiring session authority on each request | **PureOpaque** or **Hybrid** | Some operations can tolerate a short JWT validity window | +| Central UAuthHub, managed devices, and rotating refresh tokens | **Hybrid** | Separate APIs should authenticate JWTs locally | +| Distributed APIs, but selected operations require session revocation checks | **SemiHybrid** | No server-side session management is needed | +| APIs where most reads should avoid Hub calls | **SemiHybrid** | No operation needs authoritative lineage; then choose PureJwt | +| Standalone JWT resource validation | **PureJwt** | Users need managed session/device lifecycles | +| Strong current session guarantees for sensitive operations | **Hybrid** or **SemiHybrid** with `HubValidated` | Every request must be authoritative; prefer a fully session-backed path | -These are recommendations, not restrictions. +### Decision examples -For example, Blazor WebAssembly can use PureOpaque through a secure cookie-based backend-for-frontend architecture. Similarly, a server-rendered application can use JWT authentication when its broader system requirements justify it. +**Blazor Server dashboard:** PureOpaque is often simplest. The server already handles interaction state, and a short opaque credential lifecycle is easy to reason about. Long-lived SignalR circuits still need appropriate revalidation. -The runtime does not inherently determine the security model. +**Mobile app with device management:** Hybrid works well when server-authoritative sessions are a hard requirement. SemiHybrid is an alternative if the app consumes separate JWT APIs and only selected actions need authoritative checks. -## Application Profiles and authentication modes +**Public product API with account management:** SemiHybrid can authenticate product reads with `Standard` JWTs and require `HubValidated` for account or high-impact operations. This must be an explicit endpoint protection design, not a reliance on default routing alone. -UltimateAuth supports different client environments through Application Profiles. +**Independent service-to-service resource API:** PureJwt is usually simpler if the service only needs locally verifiable access tokens. For immediate authorization changes, add an independent enforcement design rather than assuming JWT revocation. -An Application Profile can provide suitable defaults for a runtime, including credential delivery and authentication-mode selection. +## Configuration boundaries: do not mix them up -However, an Application Profile and an authentication mode represent different concerns. +Four different choices are involved: -**Application Profile** +| Concern | Question it answers | +|---|---| +| **Authentication mode** | What validates identity and which session state exists? | +| **Application Profile** | What type of application is communicating and which defaults are appropriate? | +| **Credential delivery** | Is the credential transported in a cookie or header? | +| **Deployment topology** | Is UAuthHub integrated into the application or hosted separately? | -Describes how the application interacts with the authentication system, including runtime characteristics and credential transport. +For example, Blazor WebAssembly does not inherently require Hybrid, and a separate Resource API does not inherently require PureJwt. Those are configurable design choices. -**Authentication Mode** +The built-in mode resolver currently selects **PureOpaque for `BlazorServer`** and **Hybrid for other application profiles**. These defaults do not automatically select SemiHybrid for a JWT-enabled application. -Defines the authentication credential model, session dependencies, validation strategy, and lifecycle guarantees. +To choose a mode explicitly on UltimateAuth Server: -A Blazor Server profile may default to PureOpaque, while a Blazor WebAssembly profile may default to Hybrid. - -These defaults do not mean the modes are exclusive to those environments. +```csharp +builder.Services.AddUltimateAuthServer(options => +{ + options.AuthMode = UAuthMode.SemiHybrid; +}); +``` -Applications can override the effective mode through supported configuration and context-resolution mechanisms. +To choose the mode for a separate Resource API: -When different clients share the same UAuthHub, the server must resolve the effective mode through trusted configuration and framework-controlled context. An untrusted client must not be allowed to select a weaker authentication policy arbitrarily. +```csharp +builder.Services.AddUltimateAuthResourceApi(options => +{ + options.Auth.Mode = UAuthMode.SemiHybrid; + options.Hub.BaseUrl = "https://auth.example.com"; +}); +``` -The effective mode must remain stable throughout a single authentication operation. +These snippets show **mode selection**, not complete production setup. For JWT modes, configure compatible issuer, audience, algorithms, verification keys, and device policy. For Remote Hub validation, configure the authoritative Hub address. A matching mode name alone does not establish cryptographic or credential compatibility. -## Security considerations +`AllowedModes` restricts which modes a server permits; it does **not** select a mode. For profile-specific selection use `ApplicationProfileModes`, or choose `AuthMode` when the server should enforce one mode for all profiles. The two explicit selection mechanisms are mutually exclusive. -All four modes can support secure applications when implemented and configured correctly. None should be described as universally more secure than the others. +See [Application Profiles](/docs/fundamentals/application-profiles), [Server Options](/docs/configuration/server-options), and [Advanced Configuration](/docs/configuration/advanced-configuration) for the full configuration rules. -Their security guarantees differ. +## Can i change the authentication mode later and safely? -### Credential confidentiality +**Yes. Changing the authentication mode is primarily a configuration change, not an application rewrite.** -Opaque credentials do not expose readable claims, but possession of a valid bearer credential may still permit authentication. +All four authentication modes share the same UltimateAuth APIs, authentication flows, client abstractions, user management, credential management, and authorization architecture. -JWT signatures protect integrity and authenticity; they do not conceal the payload. +When using UltimateAuth's unified APIs, switching modes does not require changes to your application-level authentication code. -All credentials require appropriate transport and storage protections. +Your login forms, authentication services, client integration, user accounts, credentials, roles, and permissions remain unchanged. No database schema migration is required solely because of a mode change. -### Revocation guarantees +To switch modes: -PureOpaque and Hybrid enforce server-side session validity during authenticated requests. +1. Change the authentication mode in your configuration. +2. Align the relevant server and Resource API settings, including cryptographic configuration where required. +3. Retire incompatible authentication credentials and require users to sign in again as necessary. -SemiHybrid enforces session validity during lifecycle operations but does not require it during normal JWT validation. +Existing sessions and tokens are not automatically converted between authentication modes. Treat the transition as a controlled configuration change, similar to replacing a signing key. -PureJwt does not depend on sessions and does not provide session-based revocation. +Application code that explicitly depends on mode-specific features, such as session identifiers or JWT-specific claims, may require adjustments. -These differences must be considered when selecting token lifetimes and logout behavior. +### Start simple, evolve when needed -### Browser security +You do not need to anticipate every future authentication requirement. -When authentication credentials are delivered through cookies, appropriate `HttpOnly`, `Secure`, and `SameSite` settings should be applied. +Start with PureOpaque if simple session-based authentication meets your needs. Switch to Hybrid, SemiHybrid, or PureJwt when your requirements change — or move back to a simpler mode whenever appropriate. -Cookie-based authentication also requires appropriate CSRF protections. +Authentication modes are not permanent architectural commitments, nor are they stages of application maturity. -When tokens are accessible to browser application code, XSS and token-exfiltration risks require particular attention. +**Change your authentication strategy, not your application architecture.** -The authentication mode does not eliminate these browser security requirements. +## Security rules that apply to every mode -### Authorization remains separate +### Device mismatch is a policy, not an authentication mode -Authentication establishes the identity of the current actor. +The device mismatch policy is configured independently of the authentication mode. `Reject` enforces the configured device match; `Allow` permits the request-device mismatch where supported. Allowing a different request device **does not rewrite the credential's original device binding**. -Authorization determines what that actor is permitted to do. +For JWT modes, automatic device rebinding (`AllowAndRebind`) is not supported by the current built-in Resource API validation implementation. Do not treat `Allow` as implicit rebinding. -All modes must produce trusted authentication state before authorization policies are evaluated. +### JWT validity and current authorization are different -Choosing a stateless mode does not remove the need for authorization checks or appropriate handling of stale authorization claims. +JWTs carry claims issued at a point in time. A valid JWT can contain stale role or permission data. `HubValidated` checks current session lineage; it should not be read as an automatic guarantee that every authorization claim was reloaded. Define application authorization and user-status requirements explicitly. -## Summary +### Session revocation and token revocation are different -UltimateAuth's four authentication modes represent four distinct strategies: +Session-backed requests reject a revoked session when session validation runs. JWT-only requests can remain valid until their expiry. Refresh-token revocation stops future rotation; it does not erase access tokens already held by clients. -**PureOpaque** uses a server-side session as the authentication authority and avoids a separate access/refresh token lifecycle. +### Cookie and header security still matter -**Hybrid** combines server-authoritative sessions with JWT access tokens and opaque refresh tokens. The current Resource API implementation authenticates Hybrid requests through remote session validation. +`HttpOnly`, `Secure`, `SameSite`, CSRF protection, token confidentiality, and XSS defenses depend on credential transport and application architecture, not just authentication mode. JWT signatures do not encrypt claims. -**SemiHybrid** uses JWT access tokens for stateless request authentication while retaining server-side sessions for refresh, logout, revocation, and device management. +## Where to go next -**PureJwt** uses JWT access tokens without requiring server-side session infrastructure. +This page helps you **choose an authentication mode**. Keep detailed configuration, endpoint contracts, and lifecycle internals in their dedicated guides: -The correct mode is the one whose validation, lifecycle, revocation, and operational guarantees match the application's requirements. +- [Authentication Model](/docs/fundamentals/auth-model) — Identity, server authority, and lineage concepts. +- [Runtime Architecture](/docs/fundamentals/runtime-architecture) — Integrated Hub, distributed Hub, and Resource API boundaries. +- [Request Lifecycle](/docs/fundamentals/request-lifecycle) — How authentication and authorization are applied to requests. +- [Server Options](/docs/configuration/server-options) — Effective modes, token lifetimes, and validation settings. +- [Refresh Flow](/docs/auth-flows/refresh-flow) and [Logout Flow](/docs/auth-flows/logout-flow) — Credential continuation and termination. -UltimateAuth preserves a consistent authentication and authorization architecture while allowing these underlying strategies to differ. \ No newline at end of file +**Rule of thumb:** Prefer the simplest mode that meets your *revocation and authorization freshness requirements*. Use SemiHybrid when the distinction between `Standard` and `HubValidated` is a deliberate part of your API design—not simply because JWTs appear faster. diff --git a/docs/content/fundamentals/overview.md b/docs/content/fundamentals/overview.md index 01ba45e5..934e62c2 100644 --- a/docs/content/fundamentals/overview.md +++ b/docs/content/fundamentals/overview.md @@ -6,11 +6,37 @@ group: fundamentals # Overview - This section explains how UltimateAuth works internally. +## One programming model, multiple authentication strategies + +UltimateAuth separates how applications implement authentication from how authentication works internally. + +Applications use a consistent set of APIs for authentication flows, identity management, credential management, and authorization. + +The underlying authentication strategy can be selected through configuration. + +UltimateAuth supports four authentication modes: + +| Mode | Philosophy | +|---|---| +| PureOpaque | Minimalist authentication | +| Hybrid | General-purpose default | +| SemiHybrid | Performance tuning | +| PureJwt | Conventional JWT authentication | + +Application profiles adapt the integration to the runtime environment. + +Authentication modes adapt the underlying authentication architecture. + +Flow-based authentication provides a consistent execution model across both. + +Together, these abstractions allow authentication architecture to evolve with the application without requiring a different authentication programming model. + +See [Authentication Modes](/docs/fundamentals/auth-modes) +and [Application Profiles](/docs/fundamentals/application-profiles). -# Section Order +## Section Order If you are new, follow this order: diff --git a/docs/content/fundamentals/request-lifecycle.md b/docs/content/fundamentals/request-lifecycle.md index e2a55074..6292231b 100644 --- a/docs/content/fundamentals/request-lifecycle.md +++ b/docs/content/fundamentals/request-lifecycle.md @@ -111,51 +111,139 @@ A successfully authenticated request is not automatically authorized. ## Credential validation -The most important mode-dependent difference in the request lifecycle is how authentication credentials are validated. +The effective authentication mode determines how the presented credential establishes an authenticated identity. -UltimateAuth supports different authentication strategies. +| Mode | Primary credential | Authentication validation | +|---|---|---| +| PureOpaque | Opaque session credential | Server-authoritative session validation | +| Hybrid | Opaque session credential | Server-authoritative session validation | +| SemiHybrid | JWT access token | Local JWT validation with optional authoritative session validation | +| PureJwt | JWT access token | Local JWT validation | + +The authentication mode determines the validation strategy, not the credential transport or application runtime. + +For a complete comparison, see +[Authentication Modes](/docs/fundamentals/auth-modes). + +## Validation requirements + +UltimateAuth separates the authentication mode from the validation requirement of a protected operation. + +Two validation requirements are available: + +| Requirement | Meaning | +|---|---| +| `Standard` | Apply the normal authentication guarantees of the effective mode. | +| `HubValidated` | Require authoritative validation of the associated server-side session. | + +`Standard` does not mean stateless authentication. + +In PureOpaque and Hybrid, standard authentication already requires authoritative session validation. + +In SemiHybrid, the distinction allows applications to use local JWT validation for ordinary operations and require authoritative validation for operations that need stronger session guarantees. + +PureJwt does not have an associated authentication session and cannot satisfy a HubValidated requirement. -### PureOpaque +### Standard request validation -The client presents an opaque session credential. +For a SemiHybrid Resource API, a standard protected request can be authenticated without contacting UAuthHub. -The server resolves the associated session and evaluates the applicable session, chain, and security requirements. +```text +Incoming request + | + v +Resolve authentication credential + | + v +Validate JWT and applicable security requirements + | + v +Establish authenticated identity + | + v +Evaluate authorization requirements + | + v +Execute protected operation +``` + +The JWT establishes an authenticated identity according to its signature, lifetime, claims, and configured validation requirements. -The session remains authoritative for authentication. +This does not establish that the associated session is still active. -A revoked or expired session must not continue to authenticate subsequent requests. +### Authoritative request validation -### Hybrid +When a SemiHybrid operation requires HubValidated authentication, successful JWT validation alone is insufficient. -The client presents an opaque access token. +The associated session lineage must also satisfy the current authoritative security requirements. + +```text +Incoming request + | + v +Validate JWT + | + v +Establish authenticated identity + | + v +Required access checks + | + +-- Authorization requirements + | + +-- Authoritative session validation + | + v +Execute protected operation +``` -The server resolves the token and validates its relationship to the authoritative server-side session. +Authoritative validation can execute locally in an integrated deployment or remotely through UAuthHub in a distributed deployment. -The access token and session are separate concepts. +The protected operation must not execute unless all required access checks succeed. -Authentication requires both a valid access credential and the applicable session validation requirements to succeed. +### Require authoritative validation -### SemiHybrid +An ASP.NET Core endpoint can explicitly require authoritative session validation. + +```csharp +app.MapPost("/api/security/settings", UpdateSecuritySettings) + .RequireUAuthHubValidation(); +``` + +Controller actions can declare the same requirement: + +```csharp +[Authorize] +[UAuthHubValidated] +public IActionResult UpdateSecuritySettings() +{ + // Protected operation. + return Ok(); +} +``` -The client presents a JWT access token. +The requirement is particularly useful in SemiHybrid applications where ordinary resource authentication does not require a session lookup. -Normal resource authentication validates the JWT cryptographically and applies the relevant token-validation rules. +### Authentication flows have their own requirements -A server-side session remains relevant for lifecycle operations such as refresh and session management, but normal JWT validation does not require a session lookup. +Login, refresh, PKCE completion, credential recovery and other authentication flows validate the evidence required by their respective operations. -Revoking a session therefore does not automatically invalidate an already issued JWT. +They do not become stateless or bypass their security requirements merely because the application uses JWT access tokens. -### PureJwt +For example, SemiHybrid refresh requires authoritative validation of the associated session lineage, even when ordinary resource requests use Standard validation. -The client presents a JWT access token. +### Validation is not authorization -The resource validates the token cryptographically and applies the configured issuer, audience, lifetime, and other relevant validation requirements. +HubValidated authentication establishes that the associated authentication session remains valid. -Authentication does not require a server-side session. +It does not automatically: -Previously issued JWTs may remain valid until expiration unless an additional invalidation mechanism is explicitly configured. +- Reload every role or permission. +- Require a new login or recent authentication. +- Establish multi-factor authentication. +- Grant access to a protected resource. -For the complete guarantees and tradeoffs, see [Authentication Modes](/docs/fundamentals/auth-modes). +Authorization remains a separate responsibility. ## When identity becomes trusted diff --git a/docs/content/fundamentals/runtime-architecture.md b/docs/content/fundamentals/runtime-architecture.md index f8d27344..5a0f34fa 100644 --- a/docs/content/fundamentals/runtime-architecture.md +++ b/docs/content/fundamentals/runtime-architecture.md @@ -210,18 +210,24 @@ It must then enforce the relevant authorization policies. ### Authentication validation depends on the mode -The authentication mode determines how a resource application establishes the caller's authenticated identity. +Resource applications use the authentication strategy selected for their deployment. -In PureOpaque and Hybrid, the current Resource API implementation relies on remote session validation through UAuthHub. +UltimateAuth supports three validation paths across its four authentication modes. + +#### Server-authoritative validation + +PureOpaque and Hybrid require authoritative validation of the presented opaque session credential. + +In a distributed deployment, a Resource API delegates session validation to UAuthHub. ```text Client | - | Session credential + | Opaque session credential v Resource API | - | Remote session validation + | Authoritative validation v UAuthHub | @@ -229,7 +235,9 @@ UAuthHub Session infrastructure ``` -In PureJwt, the Resource API validates JWT access tokens locally using trusted verification keys and explicit token-validation configuration. +#### Local JWT validation + +SemiHybrid and PureJwt support local JWT validation using trusted verification keys and explicit token-validation configuration. ```text Client @@ -242,15 +250,60 @@ Resource API Local JWT validation ``` -UAuthHub remains responsible for authentication flows, credential issuance, and refresh-token lifecycle management. +A Resource API does not need to contact UAuthHub for ordinary local JWT validation. + +#### Selective authoritative validation + +SemiHybrid combines local JWT validation with authoritative session validation when required by the protected operation. + +```text +Client + | + | JWT access token + v +Resource API + | + v +Local JWT validation + | + +-- Standard + | | + | v + | Continue access checks + | + +-- HubValidated + | + v + UAuthHub + | + v + Session infrastructure +``` + +In an integrated deployment, authoritative validation can execute directly against the local session infrastructure without a remote HTTP call. + +### UAuthHub is a logical authentication authority + +Authoritative validation does not imply that every application must deploy a separate authentication server. + +UltimateAuth can execute authentication and lifecycle operations within the application itself or delegate them to a separately hosted UAuthHub. + +The deployment topology determines where authoritative operations execute. + +The authentication mode determines when those operations are required. + +These are independent architectural decisions. + +### Authentication architecture can evolve -A PureJwt Resource API does not need to contact UAuthHub for ordinary access-token validation. +Applications can start with integrated authentication and later introduce a dedicated UAuthHub, separate Resource APIs, or local JWT validation. -Hybrid-aware JWT validation in separate Resource APIs is not yet implemented. +The shared UltimateAuth APIs remain consistent across these architectural choices. -SemiHybrid remains a planned authentication mode. +Changing the deployment topology may require infrastructure and configuration changes, but does not inherently require a different application-level authentication programming model. -Authentication mode selection therefore determines the resource application's infrastructure dependencies, revocation semantics, and authorization freshness guarantees. +See [Authentication Modes](/docs/fundamentals/auth-modes) +and [Request Lifecycle](/docs/fundamentals/request-lifecycle). ### Authorization remains local to the protected operation @@ -520,9 +573,9 @@ These dependencies vary by authentication mode. For example, PureOpaque and Hybrid require session infrastructure for authentication. -SemiHybrid requires session infrastructure for lifecycle management but not for normal JWT validation. +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 server-side session infrastructure. Optional refresh-token functionality may introduce independent renewal-state requirements. +PureJwt does not require session lineage infrastructure. When refresh tokens are enabled, it still requires refresh-token persistence for secure credential renewal and revocation. The architecture must preserve these distinctions. diff --git a/docs/content/security/token-security.md b/docs/content/security/token-security.md index 1fa25141..cbbe55c1 100644 --- a/docs/content/security/token-security.md +++ b/docs/content/security/token-security.md @@ -151,86 +151,109 @@ Whether such changes immediately affect access depends on additional validation ## Authentication Mode Behavior -UltimateAuth selects credential behavior according to the configured authentication mode. +Authentication modes define how credentials participate in authentication and continuation. -| Mode | Access mechanism | Continuation mechanism | Protected request authority | -|---|---|---|---| -| **PureOpaque** | Opaque session credential | Session lifecycle | Server-managed session state | -| **Hybrid** | Opaque session credential and JWT access token | Opaque refresh credential | Server-managed session state for the current session-backed path | -| **SemiHybrid** | JWT access token | Server-managed refresh flow | Locally validated JWT | -| **PureJwt** | JWT access token | Stateful refresh-token rotation | Locally validated JWT | +| Mode | Primary authentication credential | Server-managed continuity | +|---|---|---| +| PureOpaque | Opaque session credential | Session lifecycle | +| Hybrid | Opaque session credential | Session and refresh-token lifecycle | +| SemiHybrid | Session-associated JWT access token | Session lineage and refresh-token lifecycle | +| PureJwt | Session-independent JWT access token | Optional refresh-token lifecycle | -### PureOpaque +See [Authentication Modes](/docs/fundamentals/auth-modes) for the architectural guarantees of each mode. -PureOpaque uses an opaque session credential. +### Session identifiers are not always credentials -It does not require a separate access-token and refresh-token pair. +A session identifier can have different security purposes depending on the mode. -The credential is validated through the authoritative session mechanism. +In PureOpaque and Hybrid, the opaque session identifier acts as an authentication credential. -Session lifecycle operations govern the continuation and validity of authentication state. +Possession of this value must therefore be treated as possession of sensitive authentication material. -### Hybrid +In SemiHybrid, the session identifier is included in the JWT as lineage metadata. -Hybrid establishes server-side sessions and issues JWT access tokens together with opaque refresh credentials. +The metadata identifies the associated server-managed session but does not independently authenticate the caller. -The current session-backed authentication path relies on authoritative server-managed session state. +UltimateAuth distinguishes opaque session credentials from metadata-only session identifiers. -Refresh operations validate the relevant session and refresh credential before issuing replacement credentials. +A metadata-only identifier must never be accepted through an opaque session authentication path. -Hybrid-aware JWT validation in separate Resource APIs is not yet implemented. +### Credential purpose isolation -JWT payloads are readable by their holders. The use of signed JWTs does not provide payload confidentiality. +Authentication credentials must be validated according to their intended purpose. -### SemiHybrid +A session identifier, access token, and refresh token are not interchangeable. -SemiHybrid issues JWT access tokens while maintaining server-side session state for relevant lifecycle operations. +A valid refresh token does not directly authorize access to a protected resource. -Protected requests can validate JWT access tokens locally. +A valid JWT does not automatically establish that its associated server-managed session remains active. -Refresh and logout interact with the server-managed authentication lifecycle. +A session identifier exposed as JWT metadata does not become an authentication credential. -This means that server-side revocation does not necessarily invalidate an already-issued JWT immediately. +Credential purpose isolation prevents authentication material from being reused outside its intended security boundary. -### PureJwt +## JWT Validation Requirements -PureJwt uses JWT access tokens without requiring the Root → Chain → Session hierarchy for ordinary protected request validation. +SemiHybrid and PureJwt Resource APIs validate JWT access tokens locally using trusted verification keys and explicit validation configuration. -An optional refresh mechanism may maintain refresh-specific state. +Successful validation requires the applicable: -The existence of a refresh store does not make JWT access validation session-authoritative. +- Cryptographic signature validation. +- Trusted signing or verification key. +- Issuer validation. +- Audience validation. +- Token lifetime validation. +- Supported signing algorithm. +- Required identity and device claims. +- Authentication-mode-specific claim requirements. -For more detail, see [Authentication Modes](/docs/fundamentals/auth-modes). +A valid signature alone is insufficient. -## PureJwt Validation Requirements +The token must also satisfy the authentication requirements of the configured mode. -PureJwt Resource APIs validate JWT access tokens locally using trusted verification keys and explicit validation policies. +### Mode-specific session association -A valid signature alone is insufficient. +SemiHybrid requires a valid session identifier claim associated with server-managed lineage. -The current validation pipeline enforces the expected token type, issuer, audience, lifetime, allowed algorithm, key ID, tenant, subject, and device binding requirements. +PureJwt requires a session-independent access token and does not accept a session-bound JWT as a PureJwt authentication credential. -### Trusted verification keys +The presence or absence of session association is part of the authentication mode's security boundary. -Verification keys must come from trusted application configuration or an explicitly registered verification-key provider. +### Device binding -The Resource API does not accept signing keys supplied by an untrusted JWT header or automatically retrieve keys from token-provided URLs. +JWT access tokens contain a device identifier. -The built-in configured verification-key provider supports Base64-encoded symmetric keys. +UltimateAuth applies the configured device mismatch behavior during authentication. -For the built-in HS256 signing implementation, use at least 32 bytes of cryptographically secure random key material. +`Reject` requires the request device to match the device associated with the token. -### Device binding +`Allow` permits authentication despite a request-device mismatch. + +`AllowAndRebind` is not supported for JWT-based authentication modes. + +Allowing a request-device mismatch does not permit inconsistent credential-to-session binding during authoritative validation. -PureJwt access tokens contain a device identifier. +A device identifier is not a substitute for cryptographic proof of possession. -By default, Resource API validation rejects requests when the required device identifier is missing or does not match the token. +### Authoritative JWT validation -`DeviceMismatchBehavior.Allow` permits a mismatch when explicitly configured, but weakens device-binding enforcement. +SemiHybrid can additionally require authoritative validation of the session associated with the JWT. -`AllowAndRebind` is not supported in PureJwt. +This validates the current session lineage and its relationship to the authenticated identity. -A matching device identifier is an additional binding check, not cryptographic proof that the requesting device has exclusive possession of the token. +It does not replace JWT signature validation or automatically establish fresh authorization claims. + +PureJwt does not support session-authoritative validation because it has no associated authentication session. + +### Trusted verification keys + +Verification keys must come from trusted application configuration or an explicitly registered verification-key provider. + +The Resource API does not accept signing keys supplied by an untrusted JWT header or automatically retrieve keys from token-provided URLs. + +The built-in configured verification-key provider supports Base64-encoded symmetric keys. + +For the built-in HS256 signing implementation, use at least 32 bytes of cryptographically secure random key material. ### Stateless authorization freshness diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/logout-flow.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/logout-flow.json index 0d8b9037..5c65bc01 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/logout-flow.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/auth-flows/logout-flow.json @@ -1,13 +1,18 @@ { "Slug": "auth-flows/logout-flow", "Title": "Logout", - "Html": "\n\u003Cp\u003EAuthentication does not end when a client deletes a cookie or forgets a token. In UltimateAuth, ending access is a \u003Cstrong\u003Eserver-side lifecycle decision\u003C/strong\u003E: the system determines which authentication state must stop being usable, at what scope, and whether the associated device relationship should survive a future login.\u003C/p\u003E\n\u003Cp\u003EThat distinction is central to UltimateAuth\u0027s design. \u003Cstrong\u003ELogout ends access; revoke permanently invalidates the selected trust boundary.\u003C/strong\u003E Both can prevent a session from being used, but they express different intentions and have different consequences for the session hierarchy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-is-more-than-clearing-credentials\u0022\u003ELogout is more than clearing credentials\u003C/h2\u003E\n\u003Cp\u003EA traditional application may implement logout by removing a browser cookie or deleting a locally stored token. That is useful client cleanup, but by itself it does not necessarily invalidate a credential already issued by the server. A copied token could remain usable until its expiration if the server has no corresponding invalidation mechanism.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth instead models authentication around 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 Global authentication lineage\n \u251C\u2500\u2500 Chain Device-associated authentication lineage\n \u2502 \u251C\u2500\u2500 Session Individual authentication instance\n \u2502 \u2514\u2500\u2500 Session Another instance in the same chain\n \u2514\u2500\u2500 Chain Another device\n \u2514\u2500\u2500 Session\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis structure gives termination a meaningful scope. An application can end access on the current device, sign out other devices, sign out all devices, or explicitly revoke a session, chain, or root. The correct choice depends on the intent: ordinary sign-out, account security, device compromise, or global trust reset.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003EMental model:\u003C/strong\u003E Logout is a controlled exit from authentication. Revoke is a permanent invalidation of the selected authentication state. A later login may establish new state, but it does not undo a revocation.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-versus-revoke\u0022\u003ELogout versus revoke\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-end-access-without-necessarily-destroying-the-device-lineage\u0022\u003ELogout: end access without necessarily destroying the device lineage\u003C/h3\u003E\n\u003Cp\u003EAn ordinary logout is designed for situations such as a user selecting \u003Cstrong\u003ESign out\u003C/strong\u003E in an application. It ends the relevant authenticated access while allowing the device-associated chain to remain available for a subsequent login, subject to its state and lifetime rules.\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\u003EBefore logout\nRoot (active)\n\u2514\u2500\u2500 Chain (active)\n \u2514\u2500\u2500 Session (authenticated)\n\nAfter logout\nRoot (active)\n\u2514\u2500\u2500 Chain (retained)\n \u2514\u2500\u2500 Session (no longer usable)\n\nAfter a later successful login\nRoot (active)\n\u2514\u2500\u2500 Chain (reusable if still eligible)\n \u2514\u2500\u2500 New Session\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003ERetaining a chain does not mean retaining an authenticated session.\u003C/strong\u003E The user must authenticate again. Reuse is conditional: an expired, revoked, or otherwise ineligible chain must not be treated as active merely because it still exists in storage.\u003C/p\u003E\n\u003Cp\u003EA subtle but important implementation detail: the current HTTP logout flow resolves the authenticated session and invokes the flow service, whose logout command identifies and logs out the \u003Cstrong\u003Eassociated chain\u003C/strong\u003E. Consequently, the default logout endpoint should not be described as a guarantee that \u003Cem\u003Eonly one session record\u003C/em\u003E changes. Its practical boundary is the current device chain.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022revoke-permanently-invalidate-the-selected-trust-boundary\u0022\u003ERevoke: permanently invalidate the selected trust boundary\u003C/h3\u003E\n\u003Cp\u003ERevocation is a stronger security operation. A revoked session, chain, or root is not restored by a subsequent login, refresh, or cookie update.\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\u003EChain (active)\n\u2514\u2500\u2500 Session (active)\n\nRevoke chain\n\nChain (revoked \u2014 terminal state)\n\u2514\u2500\u2500 Sessions (invalidated)\n\nFuture authentication \u2192 new eligible chain, not restoration of the old one\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003ERevocation is irreversible for the revoked entity.\u003C/strong\u003E This does not mean the user is permanently locked out of the application. A legitimate user may authenticate again and establish a new session lineage if account policy allows it. What cannot happen is bringing the \u003Cem\u003Erevoked\u003C/em\u003E session or chain back to life.\u003C/p\u003E\n\u003Cp\u003EThis distinction is useful in security-sensitive scenarios: a lost device, suspected credential theft, administrator intervention, or a decision to invalidate all existing authentication relationships.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-the-termination-scope\u0022\u003EChoosing the termination scope\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOperation\u003C/th\u003E\n\u003Cth\u003EIntended scope\u003C/th\u003E\n\u003Cth\u003EWhat it means\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ELogout current device\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ECurrent session\u0027s chain\u003C/td\u003E\n\u003Ctd\u003EEnds authenticated access for the current device while preserving the possibility of later eligible chain reuse.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ELogout a device\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ESelected chain\u003C/td\u003E\n\u003Ctd\u003EEnds access on the chosen device; can be initiated by the user or an authorized administrator.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ELogout other devices\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EOther device sessions\u003C/td\u003E\n\u003Ctd\u003EEnds access elsewhere while preserving the specified current device context.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ELogout all devices\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAll user sessions\u003C/td\u003E\n\u003Ctd\u003ESigns the user out across devices without treating this as a root revocation.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERevoke session\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EOne session\u003C/td\u003E\n\u003Ctd\u003EPermanently invalidates the selected session.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERevoke chain\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EOne device lineage\u003C/td\u003E\n\u003Ctd\u003EPermanently invalidates that chain and its sessions.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERevoke other/all chains\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EMultiple device lineages\u003C/td\u003E\n\u003Ctd\u003EPermanently invalidates selected device relationships.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERevoke root\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EGlobal authentication lineage\u003C/td\u003E\n\u003Ctd\u003EInvalidates the root and cascades to its chains and sessions.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese are not interchangeable aliases. In particular, \u003Cstrong\u003Elogout all devices\u003C/strong\u003E and \u003Cstrong\u003Erevoke root\u003C/strong\u003E both disrupt broad access, but they do not express the same lifecycle intent.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-session-level-revoke-is-separate\u0022\u003EWhy session-level revoke is separate\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth exposes a session revocation operation distinct from the ordinary logout endpoint. A single session can be revoked without necessarily revoking its parent chain. This is useful when an application needs to invalidate a particular authentication instance rather than the entire device relationship.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-root-revoke-is-exceptional\u0022\u003EWhy root revoke is exceptional\u003C/h3\u003E\n\u003Cp\u003EThe root represents the user\u0027s active authentication lineage, not the user\u0027s existence in the user directory. Root revocation cascades through the associated authentication hierarchy. A later permitted login may establish a \u003Cstrong\u003Enew\u003C/strong\u003E active root; it does not reverse the old root\u0027s revocation.\u003C/p\u003E\n\u003Cp\u003ERoot revocation should therefore be reserved for an intentional global trust reset rather than ordinary sign-out.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022how-the-current-logout-flow-executes\u0022\u003EHow the current logout flow executes\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resolve-the-flow-context\u0022\u003E1. Resolve the flow context\u003C/h3\u003E\n\u003Cp\u003EThe HTTP endpoint obtains the current \u003Ccode\u003EAuthFlowContext\u003C/code\u003E. This carries the relevant authentication state and response configuration, including the resolved session when one is available.\u003C/p\u003E\n\u003Cp\u003EThe ordinary logout endpoint does not accept an arbitrary session ID from the browser and blindly invalidate it. It uses the session already resolved for the current flow.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022request-server-side-termination\u0022\u003E2. Request server-side termination\u003C/h3\u003E\n\u003Cp\u003EWhen a \u003Ccode\u003ESessionSecurityContext\u003C/code\u003E is present, the endpoint constructs a \u003Ccode\u003ELogoutRequest\u003C/code\u003E using that session ID and calls the flow service:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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 request = new LogoutRequest\n{\n SessionId = session.SessionId\n};\n\nawait _client.Flows.LogoutAsync(request);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe logout command resolves the session\u0027s chain and invokes the session issuer\u0027s \u003Ccode\u003ELogoutChainAsync\u003C/code\u003E operation. The session-store implementation performs the chain logout transition.\u003C/p\u003E\n\u003Cp\u003EThis is the authoritative part of logout. Removing a client cookie alone is not a substitute for this state transition.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022clear-cookies-configured-for-this-flow\u0022\u003E3. Clear cookies configured for this flow\u003C/h3\u003E\n\u003Cp\u003EAfter the server-side operation, the HTTP handler attempts to delete credentials whose \u003Cstrong\u003Eeffective delivery mode is Cookie\u003C/strong\u003E:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESession ID cookie\u003C/li\u003E\n\u003Cli\u003ERefresh token cookie\u003C/li\u003E\n\u003Cli\u003EAccess token cookie\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe handler uses the configured cookie names through \u003Ccode\u003EIUAuthCookieManager\u003C/code\u003E. It does not assume that all three credentials are cookies, and it does not attempt to delete header-delivered credentials from a remote client\u0027s storage.\u003C/p\u003E\n\u003Cp\u003EWhen the flow has no resolved session, the endpoint can still perform cookie cleanup and return a successful logout response. This makes sign-out useful even when a browser holds stale credentials.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resolve-the-response-and-optional-redirect\u0022\u003E4. Resolve the response and optional redirect\u003C/h3\u003E\n\u003Cp\u003EOnce termination and cookie cleanup have been handled, UltimateAuth evaluates the logout response configuration. The result is either a redirect to the configured destination or a normal HTTP success response.\u003C/p\u003E\n\u003Cp\u003EWith redirect disabled, the ordinary endpoint returns:\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;isSuccess\u0026quot;: true\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWith redirect enabled, it returns an HTTP redirect to the resolved target instead. Applications should not expect the JSON success body in that case.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-controlled-navigation\u0022\u003EClient-controlled navigation\u003C/h3\u003E\n\u003Cp\u003EThe UltimateAuth Client API allows applications to control navigation after a successful logout through the optional \u003Ccode\u003Enavigate\u003C/code\u003E parameter.\u003C/p\u003E\n\u003Cp\u003EBy default, logout follows the server-configured redirect 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\u003Eawait UAuthClient.Flows.LogoutAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ETo complete logout without automatic navigation, set \u003Ccode\u003Enavigate\u003C/code\u003E to \u003Ccode\u003Efalse\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\u003Eawait UAuthClient.Flows.LogoutAsync(navigate: false);\n\n// Perform application-specific cleanup after logout.\nawait YourApplicationCleanupAsync();\n\nNavigation.NavigateTo(\u0026quot;/goodbye\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen \u003Ccode\u003Enavigate\u003C/code\u003E is \u003Ccode\u003Efalse\u003C/code\u003E, UltimateAuth still performs the server-side logout, clears applicable authentication cookies, and publishes the logout event so the client authentication state can be cleared. Only automatic navigation is suppressed.\u003C/p\u003E\n\u003Cp\u003EThis is useful when an application needs to clear its own state, perform additional cleanup, display a confirmation, or choose a destination after logout.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E The \u003Ccode\u003Enavigate\u003C/code\u003E parameter controls client-side navigation, not session termination or server-side redirect configuration. If logout fails, including with HTTP 429, the operation does not publish a successful logout event. Applications should perform post-logout actions only after \u003Ccode\u003ELogoutAsync\u003C/code\u003E completes successfully.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-logout\u0022\u003EPureJwt logout\u003C/h3\u003E\n\u003Cp\u003EPureJwt does not have a server-side authentication session to terminate.\u003C/p\u003E\n\u003Cp\u003EInstead, UltimateAuth can revoke the refresh chain associated with the authenticated client.\u003C/p\u003E\n\u003Cp\u003EWhen a refresh token is supplied, the logout flow validates its relationship to the authenticated user, tenant, device, and refresh chain before revocation.\u003C/p\u003E\n\u003Cp\u003EThe refresh chain is revoked through the configured refresh-token store.\u003C/p\u003E\n\u003Cp\u003ECookie-based credentials are cleared according to the effective delivery configuration.\u003C/p\u003E\n\u003Cp\u003EAn important distinction applies:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ERefresh-chain revocation prevents further token renewal.\u003C/li\u003E\n\u003Cli\u003EClearing client credentials removes locally accessible authentication material.\u003C/li\u003E\n\u003Cli\u003EAlready issued JWT access tokens remain valid until expiration unless an additional validation condition invalidates them.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA logout request without a refresh token does not revoke a refresh chain. Applications should not treat local credential removal alone as proof of server-side refresh-token revocation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-redirect-matters\u0022\u003EWhy redirect matters\u003C/h2\u003E\n\u003Cp\u003EA redirect is \u003Cstrong\u003Enot required to invalidate authentication state\u003C/strong\u003E. It is a navigation concern that becomes important in browser-based authentication flows.\u003C/p\u003E\n\u003Cp\u003EConsider a server-rendered application with a dedicated sign-out page. Once the session has ended and cookies are cleared, the browser should often return to a public page, a login screen, or the page originally requested by the user. Redirecting completes that user journey without requiring the application to parse a logout response and navigate manually.\u003C/p\u003E\n\u003Cp\u003ERedirects can also help when the authentication endpoint and the client application are on different origins or when a centralized authentication service serves multiple clients. The server can perform the security operation and then send the browser back to the appropriate application destination.\u003C/p\u003E\n\u003Cp\u003EIn contrast, a mobile client or API consumer commonly prefers an ordinary HTTP result and controls its own navigation. \u003Cstrong\u003ERedirect is a response behavior, not a security primitive.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022redirect-resolution-in-ultimateauth\u0022\u003ERedirect resolution in UltimateAuth\u003C/h3\u003E\n\u003Cp\u003EThe response resolver selects the effective redirect settings for the logout flow. The redirect resolver then:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EChecks whether redirect is enabled.\u003C/li\u003E\n\u003Cli\u003EOn success, considers an allowed return URL override when configured.\u003C/li\u003E\n\u003Cli\u003EOtherwise uses the configured success path, resolved against the client base address.\u003C/li\u003E\n\u003Cli\u003EIf no valid destination is configured, leaves redirect disabled and allows a normal success response.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EFor absolute return URL overrides, the resolver restricts schemes to HTTP or HTTPS and validates the origin against configured allowed client origins when that allowlist is populated. Relative paths are resolved against the selected client base address.\u003C/p\u003E\n\u003Cp\u003EThis is why a return URL should be treated as \u003Cstrong\u003Evalidated navigation input\u003C/strong\u003E, never as an unrestricted arbitrary destination. Applications should configure allowed origins carefully, especially in multi-client or hosted scenarios.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E Do not use a redirect as proof that logout succeeded, or assume that clearing browser cookies invalidates every credential issued to every device. The server-side termination scope determines what access has actually ended.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-aware-logout\u0022\u003EDevice-aware logout\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth treats the device-associated chain as a first-class authentication boundary. That allows applications to build features such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ESign out of this device\u003C/strong\u003E \u2014 end the current device\u0027s authenticated access.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESign out of another device\u003C/strong\u003E \u2014 target a specific chain after the appropriate access checks.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESign out of other devices\u003C/strong\u003E \u2014 preserve the current device while ending other sessions.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESign out everywhere\u003C/strong\u003E \u2014 end all device sessions for the user.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ERevoke a lost device\u003C/strong\u003E \u2014 permanently invalidate the compromised chain instead of merely signing it out.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese operations are exposed through distinct application-service methods, rather than overloading a single logout call with ambiguous behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022self-service-and-administrative-actions\u0022\u003ESelf-service and administrative actions\u003C/h3\u003E\n\u003Cp\u003EDevice and all-device HTTP endpoints use access contexts carrying explicit action identifiers. They are executed through the access orchestrator, which enforces the applicable authorization decision before the requested state mutation.\u003C/p\u003E\n\u003Cp\u003EFor example, \u003Ccode\u003ELogoutDeviceSelfAsync\u003C/code\u003E targets the authenticated user\u0027s device, whereas \u003Ccode\u003ELogoutDeviceAdminAsync\u003C/code\u003E accepts a target user and executes under an administrative action context. Both ultimately call the device logout application service; authorization and target ownership are not left to the client.\u003C/p\u003E\n\u003Cp\u003EThe default current-device logout endpoint follows its own flow-based path. Do not assume every termination operation shares the same exact handler or authorization pipeline.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-properties-and-boundaries\u0022\u003ESecurity properties and boundaries\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-side-invalidation-comes-first\u0022\u003EServer-side invalidation comes first\u003C/h3\u003E\n\u003Cp\u003EThe server must stop recognizing the affected authentication state. Browser cleanup improves user experience and reduces accidental credential reuse, but it is not the source of truth.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022revoked-state-is-terminal\u0022\u003ERevoked state is terminal\u003C/h3\u003E\n\u003Cp\u003ERevocation cannot be undone by setting \u003Ccode\u003EIsRevoked\u003C/code\u003E back to false, presenting an old refresh token, or logging in again with the same device. A new authentication path must establish new eligible state.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022scope-must-be-explicit\u0022\u003EScope must be explicit\u003C/h3\u003E\n\u003Cp\u003EA session revoke should not be casually described as a chain revoke. A logout-all operation should not be described as a root revoke. These distinctions determine whether existing device lineages are retained, ended, or permanently invalidated.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-and-ownership-matter\u0022\u003EAuthorization and ownership matter\u003C/h3\u003E\n\u003Cp\u003ESelf-service operations must stay within the authenticated user\u0027s permitted scope. Administrative operations must be evaluated under their corresponding action and target context. A client-provided chain identifier is not sufficient authorization to terminate someone else\u0027s session.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-delivery-affects-cleanup-not-the-termination-model\u0022\u003EToken delivery affects cleanup, not the termination model\u003C/h3\u003E\n\u003Cp\u003EWhether a client receives credentials through cookies or headers, the server-side hierarchy still governs session-backed authentication. Clients using non-cookie delivery must also clear their own local credentials after successful termination.\u003C/p\u003E\n\u003Cp\u003EThe precise behavior of already-issued, independently validated tokens depends on the active authentication mode and token validation strategy. Avoid assuming every token format provides instantaneous server-side revocation without checking its validation model.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022practical-examples\u0022\u003EPractical examples\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-user-signs-out-at-the-end-of-the-day\u0022\u003EA user signs out at the end of the day\u003C/h3\u003E\n\u003Cp\u003EUse the ordinary logout flow. The current device\u0027s authenticated access ends, configured cookies are cleared, and the browser may be redirected to a public page. A later successful login can reuse the retained device chain if it remains eligible.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-user-loses-a-phone\u0022\u003EA user loses a phone\u003C/h3\u003E\n\u003Cp\u003EUse \u003Cstrong\u003Echain revoke\u003C/strong\u003E, not merely a soft device logout, when the goal is to permanently invalidate that device\u0027s existing trust lineage. The user may later authenticate on a replacement device, but the revoked chain stays revoked.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-user-wants-to-keep-this-device-but-sign-out-elsewhere\u0022\u003EA user wants to keep this device but sign out elsewhere\u003C/h3\u003E\n\u003Cp\u003EUse \u003Cstrong\u003Elogout other devices\u003C/strong\u003E. The current device\u0027s chain is excluded while other device sessions are terminated. This is different from permanently revoking every other chain.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022an-account-is-believed-to-be-compromised\u0022\u003EAn account is believed to be compromised\u003C/h3\u003E\n\u003Cp\u003EDepending on the security policy, revoke all chains or the root. This is a stronger response than ordinary logout because it deliberately invalidates existing authentication lineages. Credential rotation and additional account recovery steps may also be required; revocation alone does not prove that compromised credentials have been changed.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-misconceptions\u0022\u003ECommon misconceptions\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u201CLogout just deletes the cookie.\u201D\u003C/strong\u003E No. The ordinary endpoint performs server-side termination when a session is resolved, then clears applicable cookies.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u201CLogout and revoke are the same operation.\u201D\u003C/strong\u003E No. Both can stop access, but revocation is permanent for the selected entity; soft logout can retain eligible device lineage.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u201CLogout always means exactly one session.\u201D\u003C/strong\u003E Not in the current default HTTP flow. The resolved session identifies a chain, and the logout command operates on that chain.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u201CRevocation permanently bans the user.\u201D\u003C/strong\u003E No. It permanently invalidates existing authentication state at the selected scope. A permitted future login may create new state.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u201CRedirect makes logout secure.\u201D\u003C/strong\u003E No. Redirect controls where the browser goes after logout; the session-store transition is what ends server-recognized access.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u201CLogout all devices is the same as revoke root.\u201D\u003C/strong\u003E No. They are different lifecycle operations with different implications for the authentication hierarchy.\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\u003ELogout is a lifecycle operation\u003C/strong\u003E, not merely client-side credential deletion.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ERevoke is irreversible\u003C/strong\u003E for the revoked session, chain, or root; a future login never restores that entity.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ERoot \u2192 Chain \u2192 Session\u003C/strong\u003E makes termination scope explicit and device-aware.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ECurrent-device logout operates through the associated chain\u003C/strong\u003E in the current server implementation.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EOther-device and all-device logout\u003C/strong\u003E are separate from hard chain/root revocation.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ERedirect is optional navigation behavior\u003C/strong\u003E, especially useful for browser-based flows; it does not perform revocation.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EServer-side state is authoritative\u003C/strong\u003E for session-backed access; client credential cleanup remains important.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003E\u27A1\uFE0F Next step\u003C/h2\u003E\n\u003Cp\u003EContinue to \u003Cstrong\u003ESession Lifecycle\u003C/strong\u003E to understand how roots, chains, and sessions are created, rotated, expired, logged out, and revoked over time.\u003C/p\u003E\n", + "Html": "\n\u003Cp\u003EAuthentication does not end when a client deletes a cookie or forgets a token. In UltimateAuth, ending access is a \u003Cstrong\u003Eserver-side lifecycle decision\u003C/strong\u003E: the system determines which authentication state must stop being usable, at what scope, and whether the associated device relationship should survive a future login.\u003C/p\u003E\n\u003Cp\u003EThat distinction is central to UltimateAuth\u0027s design. \u003Cstrong\u003ELogout ends access; revoke permanently invalidates the selected trust boundary.\u003C/strong\u003E Both can prevent a session from being used, but they express different intentions and have different consequences for the session hierarchy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-is-more-than-clearing-credentials\u0022\u003ELogout is more than clearing credentials\u003C/h2\u003E\n\u003Cp\u003EA traditional application may implement logout by removing a browser cookie or deleting a locally stored token. That is useful client cleanup, but by itself it does not necessarily invalidate a credential already issued by the server. A copied token could remain usable until its expiration if the server has no corresponding invalidation mechanism.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth instead models authentication around 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 Global authentication lineage\n \u251C\u2500\u2500 Chain Device-associated authentication lineage\n \u2502 \u251C\u2500\u2500 Session Individual authentication instance\n \u2502 \u2514\u2500\u2500 Session Another instance in the same chain\n \u2514\u2500\u2500 Chain Another device\n \u2514\u2500\u2500 Session\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis structure gives termination a meaningful scope. An application can end access on the current device, sign out other devices, sign out all devices, or explicitly revoke a session, chain, or root. The correct choice depends on the intent: ordinary sign-out, account security, device compromise, or global trust reset.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003EMental model:\u003C/strong\u003E Logout is a controlled exit from authentication. Revoke is a permanent invalidation of the selected authentication state. A later login may establish new state, but it does not undo a revocation.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-behavior-across-authentication-modes\u0022\u003ELogout behavior across authentication 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\u003EServer-side termination\u003C/th\u003E\n\u003Cth\u003EEffect on previously issued access credentials\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-chain logout\u003C/td\u003E\n\u003Ctd\u003ESubsequent authoritative validation rejects the session\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003ESession-chain logout\u003C/td\u003E\n\u003Ctd\u003ESubsequent authoritative validation rejects the session\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003ESession-chain logout\u003C/td\u003E\n\u003Ctd\u003EHubValidated requests are rejected; Standard JWT validation may continue until expiration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ERefresh-chain revocation, when a valid refresh credential is available\u003C/td\u003E\n\u003Ctd\u003EExisting JWTs may remain valid until expiration\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003ELogout always aims to end the client\u0027s authentication continuity.\u003C/p\u003E\n\u003Cp\u003EThe selected authentication mode determines how server-side termination affects credentials that have already been issued.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-versus-revoke\u0022\u003ELogout versus revoke\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-end-access-without-necessarily-destroying-the-device-lineage\u0022\u003ELogout: end access without necessarily destroying the device lineage\u003C/h3\u003E\n\u003Cp\u003EAn ordinary logout is designed for situations such as a user selecting \u003Cstrong\u003ESign out\u003C/strong\u003E in an application. It ends the relevant authenticated access while allowing the device-associated chain to remain available for a subsequent login, subject to its state and lifetime rules.\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\u003EBefore logout\nRoot (active)\n\u2514\u2500\u2500 Chain (active)\n \u2514\u2500\u2500 Session (authenticated)\n\nAfter logout\nRoot (active)\n\u2514\u2500\u2500 Chain (retained)\n \u2514\u2500\u2500 Session (no longer usable)\n\nAfter a later successful login\nRoot (active)\n\u2514\u2500\u2500 Chain (reusable if still eligible)\n \u2514\u2500\u2500 New Session\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003ERetaining a chain does not mean retaining an authenticated session.\u003C/strong\u003E The user must authenticate again. Reuse is conditional: an expired, revoked, or otherwise ineligible chain must not be treated as active merely because it still exists in storage.\u003C/p\u003E\n\u003Cp\u003EA subtle but important implementation detail: the current HTTP logout flow resolves the authenticated session and invokes the flow service, whose logout command identifies and logs out the \u003Cstrong\u003Eassociated chain\u003C/strong\u003E. Consequently, the default logout endpoint should not be described as a guarantee that \u003Cem\u003Eonly one session record\u003C/em\u003E changes. Its practical boundary is the current device chain.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022revoke-permanently-invalidate-the-selected-trust-boundary\u0022\u003ERevoke: permanently invalidate the selected trust boundary\u003C/h3\u003E\n\u003Cp\u003ERevocation is a stronger security operation. A revoked session, chain, or root is not restored by a subsequent login, refresh, or cookie update.\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\u003EChain (active)\n\u2514\u2500\u2500 Session (active)\n\nRevoke chain\n\nChain (revoked \u2014 terminal state)\n\u2514\u2500\u2500 Sessions (invalidated)\n\nFuture authentication \u2192 new eligible chain, not restoration of the old one\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003ERevocation is irreversible for the revoked entity.\u003C/strong\u003E This does not mean the user is permanently locked out of the application. A legitimate user may authenticate again and establish a new session lineage if account policy allows it. What cannot happen is bringing the \u003Cem\u003Erevoked\u003C/em\u003E session or chain back to life.\u003C/p\u003E\n\u003Cp\u003EThis distinction is useful in security-sensitive scenarios: a lost device, suspected credential theft, administrator intervention, or a decision to invalidate all existing authentication relationships.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-the-termination-scope\u0022\u003EChoosing the termination scope\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOperation\u003C/th\u003E\n\u003Cth\u003EIntended scope\u003C/th\u003E\n\u003Cth\u003EWhat it means\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ELogout current device\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ECurrent session\u0027s chain\u003C/td\u003E\n\u003Ctd\u003EEnds authenticated access for the current device while preserving the possibility of later eligible chain reuse.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ELogout a device\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ESelected chain\u003C/td\u003E\n\u003Ctd\u003EEnds access on the chosen device; can be initiated by the user or an authorized administrator.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ELogout other devices\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EOther device sessions\u003C/td\u003E\n\u003Ctd\u003EEnds access elsewhere while preserving the specified current device context.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ELogout all devices\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAll user sessions\u003C/td\u003E\n\u003Ctd\u003ESigns the user out across devices without treating this as a root revocation.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERevoke session\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EOne session\u003C/td\u003E\n\u003Ctd\u003EPermanently invalidates the selected session.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERevoke chain\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EOne device lineage\u003C/td\u003E\n\u003Ctd\u003EPermanently invalidates that chain and its sessions.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERevoke other/all chains\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EMultiple device lineages\u003C/td\u003E\n\u003Ctd\u003EPermanently invalidates selected device relationships.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ERevoke root\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EGlobal authentication lineage\u003C/td\u003E\n\u003Ctd\u003EInvalidates the root and cascades to its chains and sessions.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese are not interchangeable aliases. In particular, \u003Cstrong\u003Elogout all devices\u003C/strong\u003E and \u003Cstrong\u003Erevoke root\u003C/strong\u003E both disrupt broad access, but they do not express the same lifecycle intent.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-session-level-revoke-is-separate\u0022\u003EWhy session-level revoke is separate\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth exposes a session revocation operation distinct from the ordinary logout endpoint. A single session can be revoked without necessarily revoking its parent chain. This is useful when an application needs to invalidate a particular authentication instance rather than the entire device relationship.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-root-revoke-is-exceptional\u0022\u003EWhy root revoke is exceptional\u003C/h3\u003E\n\u003Cp\u003EThe root represents the user\u0027s active authentication lineage, not the user\u0027s existence in the user directory. Root revocation cascades through the associated authentication hierarchy. A later permitted login may establish a \u003Cstrong\u003Enew\u003C/strong\u003E active root; it does not reverse the old root\u0027s revocation.\u003C/p\u003E\n\u003Cp\u003ERoot revocation should therefore be reserved for an intentional global trust reset rather than ordinary sign-out.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022how-the-current-logout-flow-executes\u0022\u003EHow the current logout flow executes\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resolve-the-flow-context\u0022\u003E1. Resolve the flow context\u003C/h3\u003E\n\u003Cp\u003EThe HTTP endpoint obtains the current \u003Ccode\u003EAuthFlowContext\u003C/code\u003E. This carries the relevant authentication state and response configuration, including the resolved session when one is available.\u003C/p\u003E\n\u003Cp\u003EThe ordinary logout endpoint does not accept an arbitrary session ID from the browser and blindly invalidate it. It uses the session already resolved for the current flow.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022request-server-side-termination\u0022\u003E2. Request server-side termination\u003C/h3\u003E\n\u003Cp\u003EThe effective authentication mode determines which authentication state can be terminated.\u003C/p\u003E\n\u003Cp\u003EWhen a validated session context is available, UltimateAuth performs the corresponding session-chain logout operation.\u003C/p\u003E\n\u003Cp\u003EFor JWT-based modes, the endpoint can also use a valid refresh credential to resolve the authentication state that must be terminated.\u003C/p\u003E\n\u003Cp\u003EIn SemiHybrid, this allows logout to resolve and terminate the associated session lineage.\u003C/p\u003E\n\u003Cp\u003EIn PureJwt, the corresponding refresh chain can be revoked without an authentication session.\u003C/p\u003E\n\u003Cp\u003EThe application uses the same client 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\u003Eawait UAuthClient.Flows.LogoutAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApplications do not need to extract session identifiers, inspect JWT claims, or implement mode-specific logout behavior.\u003C/p\u003E\n\u003Cp\u003EServer-side termination requires valid evidence of the authentication context being terminated.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022clear-cookies-configured-for-this-flow\u0022\u003E3. Clear cookies configured for this flow\u003C/h3\u003E\n\u003Cp\u003EAfter the server-side operation, the HTTP handler attempts to delete credentials whose \u003Cstrong\u003Eeffective delivery mode is Cookie\u003C/strong\u003E:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESession ID cookie\u003C/li\u003E\n\u003Cli\u003ERefresh token cookie\u003C/li\u003E\n\u003Cli\u003EAccess token cookie\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe handler uses the configured cookie names through \u003Ccode\u003EIUAuthCookieManager\u003C/code\u003E. It does not assume that all three credentials are cookies, and it does not attempt to delete header-delivered credentials from a remote client\u0027s storage.\u003C/p\u003E\n\u003Cp\u003EWhen the flow has no resolved session, the endpoint can still perform cookie cleanup and return a successful logout response. This makes sign-out useful even when a browser holds stale credentials.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resolve-the-response-and-optional-redirect\u0022\u003E4. Resolve the response and optional redirect\u003C/h3\u003E\n\u003Cp\u003EOnce termination and cookie cleanup have been handled, UltimateAuth evaluates the logout response configuration. The result is either a redirect to the configured destination or a normal HTTP success response.\u003C/p\u003E\n\u003Cp\u003EWith redirect disabled, the ordinary endpoint returns:\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;isSuccess\u0026quot;: true\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWith redirect enabled, it returns an HTTP redirect to the resolved target instead. Applications should not expect the JSON success body in that case.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-controlled-navigation\u0022\u003EClient-controlled navigation\u003C/h3\u003E\n\u003Cp\u003EThe UltimateAuth Client API allows applications to control navigation after a successful logout through the optional \u003Ccode\u003Enavigate\u003C/code\u003E parameter.\u003C/p\u003E\n\u003Cp\u003EBy default, logout follows the server-configured redirect 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\u003Eawait UAuthClient.Flows.LogoutAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ETo complete logout without automatic navigation, set \u003Ccode\u003Enavigate\u003C/code\u003E to \u003Ccode\u003Efalse\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\u003Eawait UAuthClient.Flows.LogoutAsync(navigate: false);\n\n// Perform application-specific cleanup after logout.\nawait YourApplicationCleanupAsync();\n\nNavigation.NavigateTo(\u0026quot;/goodbye\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen \u003Ccode\u003Enavigate\u003C/code\u003E is \u003Ccode\u003Efalse\u003C/code\u003E, UltimateAuth still performs the server-side logout, clears applicable authentication cookies, and publishes the logout event so the client authentication state can be cleared. Only automatic navigation is suppressed.\u003C/p\u003E\n\u003Cp\u003EThis is useful when an application needs to clear its own state, perform additional cleanup, display a confirmation, or choose a destination after logout.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E The \u003Ccode\u003Enavigate\u003C/code\u003E parameter controls client-side navigation, not session termination or server-side redirect configuration. If logout fails, including with HTTP 429, the operation does not publish a successful logout event. Applications should perform post-logout actions only after \u003Ccode\u003ELogoutAsync\u003C/code\u003E completes successfully.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-in-jwt-based-modes\u0022\u003ELogout in JWT-based modes\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid and PureJwt use JWT access tokens that can be validated locally.\u003C/p\u003E\n\u003Cp\u003ELogout can terminate the corresponding server-managed authentication continuity, but it cannot remove every copy of a previously issued JWT.\u003C/p\u003E\n\u003Ch4 id=\u0022semihybrid-logout\u0022\u003ESemiHybrid logout\u003C/h4\u003E\n\u003Cp\u003EUltimateAuth terminates the associated session chain when valid authentication evidence is available.\u003C/p\u003E\n\u003Cp\u003EAfter successful session termination:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ERefresh operations associated with that session cannot continue.\u003C/li\u003E\n\u003Cli\u003EHubValidated requests cannot satisfy authoritative session validation.\u003C/li\u003E\n\u003Cli\u003EStandard JWT validation may continue to succeed until the access token expires.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch4 id=\u0022purejwt-logout\u0022\u003EPureJwt logout\u003C/h4\u003E\n\u003Cp\u003EPureJwt does not have an authentication session to terminate.\u003C/p\u003E\n\u003Cp\u003EWhen a valid refresh credential is available, UltimateAuth can revoke its associated refresh chain.\u003C/p\u003E\n\u003Cp\u003EThis prevents further renewal through that refresh chain.\u003C/p\u003E\n\u003Cp\u003EPreviously issued JWT access tokens remain subject to their own validation and expiration requirements.\u003C/p\u003E\n\u003Ch4 id=\u0022logout-success-and-server-side-termination\u0022\u003ELogout success and server-side termination\u003C/h4\u003E\n\u003Cp\u003EA logout request can successfully clear client credentials even when no valid authentication context can be resolved.\u003C/p\u003E\n\u003Cp\u003EThis allows users to sign out when their browser contains stale or expired credentials.\u003C/p\u003E\n\u003Cp\u003EHowever, successful client cleanup is not proof that a server-side session or refresh chain was found and terminated.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-redirect-matters\u0022\u003EWhy redirect matters\u003C/h2\u003E\n\u003Cp\u003EA redirect is \u003Cstrong\u003Enot required to invalidate authentication state\u003C/strong\u003E. It is a navigation concern that becomes important in browser-based authentication flows.\u003C/p\u003E\n\u003Cp\u003EConsider a server-rendered application with a dedicated sign-out page. Once the session has ended and cookies are cleared, the browser should often return to a public page, a login screen, or the page originally requested by the user. Redirecting completes that user journey without requiring the application to parse a logout response and navigate manually.\u003C/p\u003E\n\u003Cp\u003ERedirects can also help when the authentication endpoint and the client application are on different origins or when a centralized authentication service serves multiple clients. The server can perform the security operation and then send the browser back to the appropriate application destination.\u003C/p\u003E\n\u003Cp\u003EIn contrast, a mobile client or API consumer commonly prefers an ordinary HTTP result and controls its own navigation. \u003Cstrong\u003ERedirect is a response behavior, not a security primitive.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022redirect-resolution-in-ultimateauth\u0022\u003ERedirect resolution in UltimateAuth\u003C/h3\u003E\n\u003Cp\u003EThe response resolver selects the effective redirect settings for the logout flow. The redirect resolver then:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EChecks whether redirect is enabled.\u003C/li\u003E\n\u003Cli\u003EOn success, considers an allowed return URL override when configured.\u003C/li\u003E\n\u003Cli\u003EOtherwise uses the configured success path, resolved against the client base address.\u003C/li\u003E\n\u003Cli\u003EIf no valid destination is configured, leaves redirect disabled and allows a normal success response.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EFor absolute return URL overrides, the resolver restricts schemes to HTTP or HTTPS and validates the origin against configured allowed client origins when that allowlist is populated. Relative paths are resolved against the selected client base address.\u003C/p\u003E\n\u003Cp\u003EThis is why a return URL should be treated as \u003Cstrong\u003Evalidated navigation input\u003C/strong\u003E, never as an unrestricted arbitrary destination. Applications should configure allowed origins carefully, especially in multi-client or hosted scenarios.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E Do not use a redirect as proof that logout succeeded, or assume that clearing browser cookies invalidates every credential issued to every device. The server-side termination scope determines what access has actually ended.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-aware-logout\u0022\u003EDevice-aware logout\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth treats the device-associated chain as a first-class authentication boundary. That allows applications to build features such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ESign out of this device\u003C/strong\u003E \u2014 end the current device\u0027s authenticated access.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESign out of another device\u003C/strong\u003E \u2014 target a specific chain after the appropriate access checks.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESign out of other devices\u003C/strong\u003E \u2014 preserve the current device while ending other sessions.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESign out everywhere\u003C/strong\u003E \u2014 end all device sessions for the user.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ERevoke a lost device\u003C/strong\u003E \u2014 permanently invalidate the compromised chain instead of merely signing it out.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese operations are exposed through distinct application-service methods, rather than overloading a single logout call with ambiguous behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022self-service-and-administrative-actions\u0022\u003ESelf-service and administrative actions\u003C/h3\u003E\n\u003Cp\u003EDevice and all-device HTTP endpoints use access contexts carrying explicit action identifiers. They are executed through the access orchestrator, which enforces the applicable authorization decision before the requested state mutation.\u003C/p\u003E\n\u003Cp\u003EFor example, \u003Ccode\u003ELogoutDeviceSelfAsync\u003C/code\u003E targets the authenticated user\u0027s device, whereas \u003Ccode\u003ELogoutDeviceAdminAsync\u003C/code\u003E accepts a target user and executes under an administrative action context. Both ultimately call the device logout application service; authorization and target ownership are not left to the client.\u003C/p\u003E\n\u003Cp\u003EThe default current-device logout endpoint follows its own flow-based path. Do not assume every termination operation shares the same exact handler or authorization pipeline.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-properties-and-boundaries\u0022\u003ESecurity properties and boundaries\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-side-termination-and-credential-cleanup\u0022\u003EServer-side termination and credential cleanup\u003C/h3\u003E\n\u003Cp\u003EWhen valid authentication evidence is available, UltimateAuth attempts server-side termination before completing credential cleanup.\u003C/p\u003E\n\u003Cp\u003EThe authentication mode determines which server-side state can be terminated and whether previously issued access credentials remain independently valid.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022revoked-state-is-terminal\u0022\u003ERevoked state is terminal\u003C/h3\u003E\n\u003Cp\u003ERevocation cannot be undone by setting \u003Ccode\u003EIsRevoked\u003C/code\u003E back to false, presenting an old refresh token, or logging in again with the same device. A new authentication path must establish new eligible state.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022scope-must-be-explicit\u0022\u003EScope must be explicit\u003C/h3\u003E\n\u003Cp\u003EA session revoke should not be casually described as a chain revoke. A logout-all operation should not be described as a root revoke. These distinctions determine whether existing device lineages are retained, ended, or permanently invalidated.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-and-ownership-matter\u0022\u003EAuthorization and ownership matter\u003C/h3\u003E\n\u003Cp\u003ESelf-service operations must stay within the authenticated user\u0027s permitted scope. Administrative operations must be evaluated under their corresponding action and target context. A client-provided chain identifier is not sufficient authorization to terminate someone else\u0027s session.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-delivery-affects-cleanup-not-the-termination-model\u0022\u003EToken delivery affects cleanup, not the termination model\u003C/h3\u003E\n\u003Cp\u003EWhether a client receives credentials through cookies or headers, the server-side hierarchy still governs session-backed authentication. Clients using non-cookie delivery must also clear their own local credentials after successful termination.\u003C/p\u003E\n\u003Cp\u003EThe precise behavior of already-issued, independently validated tokens depends on the active authentication mode and token validation strategy. Avoid assuming every token format provides instantaneous server-side revocation without checking its validation model.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022practical-examples\u0022\u003EPractical examples\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-user-signs-out-at-the-end-of-the-day\u0022\u003EA user signs out at the end of the day\u003C/h3\u003E\n\u003Cp\u003EUse the ordinary logout flow. The current device\u0027s authenticated access ends, configured cookies are cleared, and the browser may be redirected to a public page. A later successful login can reuse the retained device chain if it remains eligible.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-user-loses-a-phone\u0022\u003EA user loses a phone\u003C/h3\u003E\n\u003Cp\u003EUse \u003Cstrong\u003Echain revoke\u003C/strong\u003E, not merely a soft device logout, when the goal is to permanently invalidate that device\u0027s existing trust lineage. The user may later authenticate on a replacement device, but the revoked chain stays revoked.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-user-wants-to-keep-this-device-but-sign-out-elsewhere\u0022\u003EA user wants to keep this device but sign out elsewhere\u003C/h3\u003E\n\u003Cp\u003EUse \u003Cstrong\u003Elogout other devices\u003C/strong\u003E. The current device\u0027s chain is excluded while other device sessions are terminated. This is different from permanently revoking every other chain.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022an-account-is-believed-to-be-compromised\u0022\u003EAn account is believed to be compromised\u003C/h3\u003E\n\u003Cp\u003EDepending on the security policy, revoke all chains or the root. This is a stronger response than ordinary logout because it deliberately invalidates existing authentication lineages. Credential rotation and additional account recovery steps may also be required; revocation alone does not prove that compromised credentials have been changed.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-misconceptions\u0022\u003ECommon misconceptions\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u201CLogout just deletes the cookie.\u201D\u003C/strong\u003E No. The ordinary endpoint performs server-side termination when a session is resolved, then clears applicable cookies.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u201CLogout and revoke are the same operation.\u201D\u003C/strong\u003E No. Both can stop access, but revocation is permanent for the selected entity; soft logout can retain eligible device lineage.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u201CLogout always means exactly one session.\u201D\u003C/strong\u003E Not in the current default HTTP flow. The resolved session identifies a chain, and the logout command operates on that chain.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u201CRevocation permanently bans the user.\u201D\u003C/strong\u003E No. It permanently invalidates existing authentication state at the selected scope. A permitted future login may create new state.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u201CRedirect makes logout secure.\u201D\u003C/strong\u003E No. Redirect controls where the browser goes after logout; the session-store transition is what ends server-recognized access.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u201CLogout all devices is the same as revoke root.\u201D\u003C/strong\u003E No. They are different lifecycle operations with different implications for the authentication hierarchy.\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\u003ELogout is a lifecycle operation\u003C/strong\u003E, not merely client-side credential deletion.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ERevoke is irreversible\u003C/strong\u003E for the revoked session, chain, or root; a future login never restores that entity.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ERoot \u2192 Chain \u2192 Session\u003C/strong\u003E makes termination scope explicit and device-aware.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ECurrent-device logout operates through the associated chain\u003C/strong\u003E in the current server implementation.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EOther-device and all-device logout\u003C/strong\u003E are separate from hard chain/root revocation.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ERedirect is optional navigation behavior\u003C/strong\u003E, especially useful for browser-based flows; it does not perform revocation.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EServer-side state is authoritative\u003C/strong\u003E for session-backed access; client credential cleanup remains important.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003E\u27A1\uFE0F Next step\u003C/h2\u003E\n\u003Cp\u003EContinue to \u003Cstrong\u003ESession Lifecycle\u003C/strong\u003E to understand how roots, chains, and sessions are created, rotated, expired, logged out, and revoked over time.\u003C/p\u003E\n", "Headings": [ { "Id": "logout-is-more-than-clearing-credentials", "Text": "Logout is more than clearing credentials", "Level": 0 }, + { + "Id": "logout-behavior-across-authentication-modes", + "Text": "Logout behavior across authentication modes", + "Level": 1 + }, { "Id": "logout-versus-revoke", "Text": "Logout versus revoke", @@ -69,8 +74,8 @@ "Level": 1 }, { - "Id": "purejwt-logout", - "Text": "PureJwt logout", + "Id": "logout-in-jwt-based-modes", + "Text": "Logout in JWT-based modes", "Level": 1 }, { @@ -99,8 +104,8 @@ "Level": 0 }, { - "Id": "server-side-invalidation-comes-first", - "Text": "Server-side invalidation comes first", + "Id": "server-side-termination-and-credential-cleanup", + "Text": "Server-side termination and credential cleanup", "Level": 1 }, { @@ -164,6 +169,6 @@ "Level": 0 } ], - "SourceHash": "6FAABF3C6610F1EE4BBBB8CB31F7494EF0207D0B0BFE7275A20D0E4364F6F90F", + "SourceHash": "4DA8D5378C66FB80568648D686E516531CB28079053CF92920C338F062F58627", "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 14a9370a..ddb987a7 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 server-side 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\u003EPlanned\u003C/td\u003E\n\u003Ctd\u003ENot currently supported\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ERefresh-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\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\u003ESlidingExpiration\u003C/code\u003E allows a touch to extend the session expiration using the configured \u003Ccode\u003ELifetime\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\u003EIssueRefresh = 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\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 server\u0027s \u003Ccode\u003EAuthFlowContext\u003C/code\u003E. It obtains the session ID from \u003Ccode\u003Eflow.Session\u003C/code\u003E, the device from \u003Ccode\u003Eflow.Device\u003C/code\u003E, and the refresh token through \u003Ccode\u003ERefreshTokenResolver\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor refresh-token input, the resolver checks:\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\u003EIssueRefresh = 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 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", "Headings": [ { "Id": "the-model-continuity-not-a-second-login", @@ -53,6 +53,16 @@ "Text": "Hybrid: session and token continuity", "Level": 1 }, + { + "Id": "semihybrid-jwt-and-session-continuity", + "Text": "SemiHybrid: JWT and session continuity", + "Level": 1 + }, + { + "Id": "purejwt-session-independent-token-continuity", + "Text": "PureJwt: session-independent token continuity", + "Level": 1 + }, { "Id": "request-resolution-and-response-delivery", "Text": "Request resolution and response delivery", @@ -79,6 +89,6 @@ "Level": 0 } ], - "SourceHash": "A3DE3418AFC0284D9E3A66CF26CE7EF6DA3FB07781DE4E4BCDF4E4C1B339DB42", + "SourceHash": "AA20B576060982167415BCA0861B5C0878FA493935093448C365DC94C7F0C97E", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/client-sdk/resource-api-requests.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/client-sdk/resource-api-requests.json index 9c350dd7..23a085e0 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/client-sdk/resource-api-requests.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/client-sdk/resource-api-requests.json @@ -1,7 +1,7 @@ { "Slug": "client-sdk/resource-api-requests", "Title": "Resource API Requests", - "Html": "\n\u003Cp\u003E\u003Cstrong\u003EAuthenticate once. Access your application resources through the same unified client.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EAuthentication is only the beginning of an application.\u003C/p\u003E\n\u003Cp\u003EOnce a user signs in, the application still needs to retrieve data, create records, update resources, and communicate with protected APIs.\u003C/p\u003E\n\u003Cp\u003ETraditionally, this introduces another layer of integration work.\u003C/p\u003E\n\u003Cp\u003EDevelopers configure authentication through one library, then build a separate HTTP client to access their application APIs. They must handle credentials, browser restrictions, response parsing, errors, and differences between hosting environments.\u003C/p\u003E\n\u003Cp\u003EThe result is often two separate programming models: one for authentication and another for everything that comes after it.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUltimateAuth brings these operations together through \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EInstead of introducing another client abstraction, applications can use the same UltimateAuth entry point for authentication, identity management, and protected resource requests.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource\n .GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ENo custom JavaScript wrapper. No application-specific response type. No separate HTTP client configuration for ordinary authenticated resource requests.\u003C/p\u003E\n\u003Cp\u003EThe goal is straightforward: \u003Cstrong\u003Emake accessing protected application resources feel like a natural continuation of authentication.\u003C/strong\u003E\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-problem-authentication-ends-integration-work-begins\u0022\u003E1. The Problem: Authentication Ends, Integration Work Begins\u003C/h2\u003E\n\u003Cp\u003EConsider a typical application with three components:\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 Application\n |\n \u002B----\u0026gt; UAuthHub\n | Authentication\n | Sessions\n | Identity\n |\n \u002B----\u0026gt; Resource API\n Products\n Orders\n Application Data\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUltimateAuth handles authentication and identity operations.\u003C/p\u003E\n\u003Cp\u003EBut the application also needs to communicate with its Resource API.\u003C/p\u003E\n\u003Cp\u003EWithout a unified resource client, developers typically need to:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EConfigure an additional HTTP client.\u003C/li\u003E\n\u003Cli\u003EDetermine how authentication credentials should accompany requests.\u003C/li\u003E\n\u003Cli\u003EHandle browser credential policies and cross-origin restrictions.\u003C/li\u003E\n\u003Cli\u003EMaintain device and application profile metadata where applicable.\u003C/li\u003E\n\u003Cli\u003EDeserialize successful responses.\u003C/li\u003E\n\u003Cli\u003ETranslate unsuccessful HTTP responses into application-friendly results.\u003C/li\u003E\n\u003Cli\u003EImplement similar request handling across multiple components.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThese responsibilities are not necessarily complicated individually.\u003C/p\u003E\n\u003Cp\u003EThe problem is their repetition.\u003C/p\u003E\n\u003Cp\u003EA framework that simplifies authentication should not require developers to rebuild the surrounding integration layer every time they need application data.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-unified-client-model\u0022\u003EA Unified Client Model\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth already exposes specialized operations through \u003Ccode\u003EIUAuthClient\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\u003EUAuthClient.Flows\nUAuthClient.Users\nUAuthClient.Sessions\nUAuthClient.Credentials\nUAuthClient.Authorization\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EResource requests follow the same 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\u003EUAuthClient.Resource\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis preserves a consistent entry point without mixing application-specific business operations into UltimateAuth\u0027s authentication services.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth does not need to know what a \u003Ccode\u003EProduct\u003C/code\u003E, \u003Ccode\u003EOrder\u003C/code\u003E, or \u003Ccode\u003EInvoice\u003C/code\u003E represents.\u003C/p\u003E\n\u003Cp\u003EIt only needs to provide a predictable way to communicate with the API that owns those resources.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022getting-started\u0022\u003E2. Getting Started\u003C/h2\u003E\n\u003Cp\u003EThe Resource API client is available through the UltimateAuth Client SDK.\u003C/p\u003E\n\u003Cp\u003EFor Blazor applications, register the Blazor client integration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe registration includes the shared client services and the browser-specific resource transport.\u003C/p\u003E\n\u003Cp\u003EYou do not need to register a separate Resource Client.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022inject-iuauthclient\u0022\u003EInject IUAuthClient\u003C/h3\u003E\n\u003Cp\u003EIn a Blazor component:\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@using CodeBeam.UltimateAuth.Client\n@inject IUAuthClient UAuthClient\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThen call a protected application endpoint:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\nif (result.IsSuccess \u0026amp;\u0026amp; result.Value is not null)\n{\n products = result.Value;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe response uses the same structured result model found throughout UltimateAuth.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-happens-behind-the-call\u0022\u003EWhat Happens Behind the Call?\u003C/h3\u003E\n\u003Cp\u003EFor the Blazor integration, the request follows this path:\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 Component\n |\n v\nIUAuthClient.Resource\n |\n v\nResource Client\n |\n v\nUltimateAuth Browser Transport\n |\n v\nProtected Resource API\n |\n v\nUAuthResult\u0026lt;T\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe browser transport handles request construction and browser-specific behavior.\u003C/p\u003E\n\u003Cp\u003EThe Resource API remains responsible for validating authentication and enforcing authorization.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA successful client request does not bypass server-side security.\u003C/strong\u003E\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022supported-http-operations\u0022\u003E3. Supported HTTP Operations\u003C/h2\u003E\n\u003Cp\u003EThe Resource Client provides five standard HTTP operations.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EMethod\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003Cth\u003EReturn type\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EGetAsync\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERetrieve a resource\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPostAsync\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECreate or submit a resource\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPutAsync\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReplace or update a resource\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPatchAsync\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPartially update a resource\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeleteAsync\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDelete a resource\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthResult\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EAll methods accept a relative endpoint and support cancellation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022get\u0022\u003EGET\u003C/h3\u003E\n\u003Cp\u003ERetrieve application data:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\nif (result.IsSuccess \u0026amp;\u0026amp; result.Value is not null)\n{\n products = result.Value;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERetrieve a single resource:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;Product\u0026gt;($\u0026quot;/api/products/{productId}\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022post\u0022\u003EPOST\u003C/h3\u003E\n\u003Cp\u003ESubmit a new resource:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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 product = new Product\n{\n Name = \u0026quot;Example Product\u0026quot;,\n Price = 29.99m\n};\n\nvar result = await UAuthClient.Resource.PostAsync\u0026lt;Product\u0026gt;(\u0026quot;/api/products\u0026quot;, product);\n\nif (result.IsSuccess)\n{\n // Product created successfully.\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe request payload is serialized for transport.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022put\u0022\u003EPUT\u003C/h3\u003E\n\u003Cp\u003EUpdate a resource:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource\n .PutAsync\u0026lt;Product\u0026gt;($\u0026quot;/api/products/{product.Id}\u0026quot;, product);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022patch\u0022\u003EPATCH\u003C/h3\u003E\n\u003Cp\u003ESubmit a partial update:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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 changes = new\n{\n Price = 24.99m\n};\n\nvar result = await UAuthClient.Resource\n .PatchAsync\u0026lt;Product\u0026gt;($\u0026quot;/api/products/{productId}\u0026quot;, changes);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource Client sends the request payload.\u003C/p\u003E\n\u003Cp\u003EThe receiving API determines which partial-update formats and operations it supports.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022delete\u0022\u003EDELETE\u003C/h3\u003E\n\u003Cp\u003EDelete a resource:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.DeleteAsync($\u0026quot;/api/products/{productId}\u0026quot;);\n\nif (result.IsSuccess)\n{\n // Resource deleted successfully.\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUnlike the other methods, \u003Ccode\u003EDeleteAsync\u003C/code\u003E returns the non-generic \u003Ccode\u003EUAuthResult\u003C/code\u003E because the operation does not require a response value.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022consistent-results-with-uauthresult\u0022\u003E4. Consistent Results with UAuthResult\u003C/h2\u003E\n\u003Cp\u003EA common source of unnecessary complexity is response handling.\u003C/p\u003E\n\u003Cp\u003EOne API client returns \u003Ccode\u003EHttpResponseMessage\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EAnother returns a custom response wrapper.\u003C/p\u003E\n\u003Cp\u003EA third throws exceptions for ordinary HTTP failures.\u003C/p\u003E\n\u003Cp\u003EApplications then need different handling logic for operations that are conceptually similar.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth uses \u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E to provide a consistent response contract.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;Product\u0026gt;(\u0026quot;/api/products/42\u0026quot;);\n\nif (result.IsSuccess)\n{\n var product = result.Value;\n}\nelse\n{\n var status = result.Status;\n var problem = result.Problem;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022result-properties\u0022\u003EResult 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\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIsSuccess\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIndicates whether the HTTP operation succeeded\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EStatus\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHTTP response status code\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EValue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDeserialized response value for successful generic operations\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EProblem\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EStructured problem information when available\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EA failed HTTP response does not automatically mean a transport exception.\u003C/p\u003E\n\u003Cp\u003EFor example, an API may return:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003E400 Bad Request\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003E401 Unauthorized\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003E403 Forbidden\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003E404 Not Found\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003E409 Conflict\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese responses can be represented through \u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe application can inspect the status and decide how to respond.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022structured-problems\u0022\u003EStructured Problems\u003C/h3\u003E\n\u003Cp\u003EWhen an unsuccessful response contains a compatible UltimateAuth problem payload, the Resource Client attempts to deserialize it into \u003Ccode\u003EUAuthProblem\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\u003Eif (!result.IsSuccess)\n{\n if (result.Problem is not null)\n {\n // Handle the structured API problem.\n }\n else\n {\n // Handle the HTTP status without a structured problem.\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ENot every API returns a compatible problem body.\u003C/p\u003E\n\u003Cp\u003ETherefore, \u003Ccode\u003EProblem\u003C/code\u003E may be \u003Ccode\u003Enull\u003C/code\u003E even when the request failed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022transport-failures-are-different\u0022\u003ETransport Failures Are Different\u003C/h3\u003E\n\u003Cp\u003ENetwork failures, protocol errors, and request cancellation are different from ordinary unsuccessful HTTP responses.\u003C/p\u003E\n\u003Cp\u003EFor example, an unreachable API does not necessarily produce an HTTP status code.\u003C/p\u003E\n\u003Cp\u003EApplications should distinguish transport exceptions from valid HTTP responses indicating failure.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E standardizes HTTP response handling; it does not guarantee that every network or runtime failure becomes a result object.\u003C/strong\u003E\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-configuration\u0022\u003E5. Resource API Configuration\u003C/h2\u003E\n\u003Cp\u003EResource API configuration is part of \u003Ccode\u003EUAuthClientOptions\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n options.Resource.Credentials = UAuthResourceCredentialsMode.Auto;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe \u003Ccode\u003EResource\u003C/code\u003E options are separate from the authentication endpoint configuration.\u003C/p\u003E\n\u003Cp\u003EThis distinction allows applications to authenticate against one server while accessing resources hosted elsewhere.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022baseaddress\u0022\u003EBaseAddress\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EBaseAddress\u003C/code\u003E identifies the Resource API 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.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIf \u003Ccode\u003EBaseAddress\u003C/code\u003E is not configured, requests use the application\u0027s current 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\u003Ebuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA call 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Ethen targets the application\u0027s origin.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022baseaddress-validation\u0022\u003EBaseAddress Validation\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth validates the configured Resource API address.\u003C/p\u003E\n\u003Cp\u003EThe address must:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EBe an absolute HTTP or HTTPS URL.\u003C/li\u003E\n\u003Cli\u003EUse HTTPS, except for loopback development addresses.\u003C/li\u003E\n\u003Cli\u003ERepresent an origin without an additional path.\u003C/li\u003E\n\u003Cli\u003EExclude embedded credentials, query strings, and fragments.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EValid examples:\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\u003Ehttps://api.example.com\nhttps://localhost:7001\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EInvalid examples:\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\u003Ehttps://api.example.com/api\nhttps://api.example.com?version=1\nhttp://api.example.com\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EKeep endpoint paths in individual Resource Client calls:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis separates deployment configuration from application resource paths.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022browser-credential-handling\u0022\u003E6. Browser Credential Handling\u003C/h2\u003E\n\u003Cp\u003EBrowser-based applications do not have unrestricted control over authentication credentials.\u003C/p\u003E\n\u003Cp\u003ECookies, origins, cross-origin requests, and browser security policies all influence how requests are sent.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth exposes credential handling through \u003Ccode\u003EUAuthResourceCredentialsMode\u003C/code\u003E.\u003C/p\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\u003EBehavior\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuto\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELet UltimateAuth select the appropriate browser credential policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESameOrigin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESend browser credentials only for same-origin requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EInclude\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EInclude browser credentials for the configured Resource API origin\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOmit\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDo not send browser credentials\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\u003Eoptions.Resource.Credentials = UAuthResourceCredentialsMode.Auto;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022same-origin-resource-api\u0022\u003ESame-Origin Resource API\u003C/h3\u003E\n\u003Cp\u003EWhen the application and Resource API share an 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\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\u003Ehttps://app.example.com\nhttps://app.example.com/api/products\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Eyou can 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.Resource.Credentials = UAuthResourceCredentialsMode.SameOrigin;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is appropriate when the Resource API relies on browser credentials available to the application origin.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022separate-resource-api\u0022\u003ESeparate Resource API\u003C/h3\u003E\n\u003Cp\u003EConsider:\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\u003EApplication: https://app.example.com\nResource API: https://api.example.com\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor a cross-origin API that requires browser cookies, 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\u003Ebuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n options.Resource.Credentials = UAuthResourceCredentialsMode.Include;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe receiving API must also support the relevant browser security requirements.\u003C/p\u003E\n\u003Cp\u003EFor credentialed cross-origin requests, this typically includes:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EExplicitly permitted origins.\u003C/li\u003E\n\u003Cli\u003EAppropriate CORS configuration.\u003C/li\u003E\n\u003Cli\u003ECompatible cookie attributes and browser policies.\u003C/li\u003E\n\u003Cli\u003EServer-side authentication and authorization.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EConfiguring \u003Ccode\u003EInclude\u003C/code\u003E does not override browser restrictions or guarantee that a cookie is available for the destination.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022when-to-use-omit\u0022\u003EWhen to Use Omit\u003C/h3\u003E\n\u003Cp\u003ESome resource endpoints do not require browser cookies.\u003C/p\u003E\n\u003Cp\u003EFor those cases:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.Credentials = UAuthResourceCredentialsMode.Omit;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis prevents browser credentials from being included in the resource request.\u003C/p\u003E\n\u003Cp\u003EThe API must still enforce whichever authentication mechanism it requires.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ECredential transmission is not the same as authorization.\u003C/strong\u003E\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022separate-uauthhub-and-resource-api\u0022\u003E7. Separate UAuthHub and Resource API\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports architectures where authentication and application resources are hosted independently.\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\u003E Blazor Application\n |\n \u002B------------\u002B------------\u002B\n | |\n v v\n UAuthHub Resource API\n auth.example.com api.example.com\n | |\n v v\n Authentication Application Data\n Sessions Business Operations\n Identity Authorization\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client can configure both destinations 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://auth.example.com/auth\u0026quot;;\n\n options.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n\n options.Resource.Credentials = UAuthResourceCredentialsMode.Auto;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAuthentication operations use the configured authentication endpoints.\u003C/p\u003E\n\u003Cp\u003EResource operations use the configured Resource API 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\u003Evar profile = await UAuthClient.Users.GetMeAsync();\n\nvar products = await UAuthClient.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EBoth operations are accessed through \u003Ccode\u003EIUAuthClient\u003C/code\u003E, but they serve different purposes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-does-not-automatically-protect-an-api\u0022\u003EAuthentication Does Not Automatically Protect an API\u003C/h3\u003E\n\u003Cp\u003EConfiguring a Resource API address does not automatically enable authentication or authorization on that API.\u003C/p\u003E\n\u003Cp\u003EThe Resource API must independently validate incoming requests and enforce its access rules.\u003C/p\u003E\n\u003Cp\u003EFor separate deployments, the Resource API must also be configured to accept and validate the authentication material associated with the selected UltimateAuth authentication mode.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client simplifies communication.\u003C/p\u003E\n\u003Cp\u003EIt does not replace the receiving server\u0027s security responsibilities.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-mode-compatibility\u0022\u003EAuthentication Mode Compatibility\u003C/h3\u003E\n\u003Cp\u003EUAuthHub and Resource APIs are configured independently.\u003C/p\u003E\n\u003Cp\u003EUAuthHub determines which authentication credentials are issued to a client. A Resource API determines which credentials it accepts and how they are validated.\u003C/p\u003E\n\u003Cp\u003EUsing the same UltimateAuth infrastructure does not automatically make all authentication modes interchangeable.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EClient Credential\u003C/th\u003E\n\u003Cth\u003EResource API Validation\u003C/th\u003E\n\u003Cth\u003ECurrent Support\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureOpaque session\u003C/td\u003E\n\u003Ctd\u003ERemote session validation\u003C/td\u003E\n\u003Ctd\u003ESupported\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt access token\u003C/td\u003E\n\u003Ctd\u003ELocal JWT validation\u003C/td\u003E\n\u003Ctd\u003ESupported\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid session credential\u003C/td\u003E\n\u003Ctd\u003ERemote session validation\u003C/td\u003E\n\u003Ctd\u003ESupported when correctly configured\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid JWT access token\u003C/td\u003E\n\u003Ctd\u003EHybrid-aware JWT validation\u003C/td\u003E\n\u003Ctd\u003ENot yet implemented\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureOpaque session\u003C/td\u003E\n\u003Ctd\u003EPureJwt-only validation\u003C/td\u003E\n\u003Ctd\u003ENot supported\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EA PureJwt Resource API cannot authenticate an opaque session credential as a JWT.\u003C/p\u003E\n\u003Cp\u003ELikewise, configuring a Resource API URL in the client SDK does not automatically exchange session credentials for JWT access tokens.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-delivery\u0022\u003ECredential Delivery\u003C/h3\u003E\n\u003Cp\u003EThe client and Resource API must agree on the credential used for authentication and its transport.\u003C/p\u003E\n\u003Ch4 id=\u0022session-based-resource-apis\u0022\u003ESession-based Resource APIs\u003C/h4\u003E\n\u003Cp\u003EPureOpaque and Hybrid Resource APIs use opaque session credentials.\u003C/p\u003E\n\u003Cp\u003ECookie delivery is the default for incoming session credentials.\u003C/p\u003E\n\u003Cp\u003EThe Resource API validates the selected session through UAuthHub using the configured Hub address.\u003C/p\u003E\n\u003Cp\u003EThe browser must be able to send the session cookie to the Resource API.\u003C/p\u003E\n\u003Ch4 id=\u0022jwt-based-resource-apis\u0022\u003EJWT-based Resource APIs\u003C/h4\u003E\n\u003Cp\u003EPureJwt Resource APIs use JWT access tokens.\u003C/p\u003E\n\u003Cp\u003EThe default Blazor Resource Client attaches the current access token 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\u003EHTTP\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-http\u0022\u003EAuthorization: Bearer \u0026lt;access-token\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor a Resource API that exclusively uses header-based JWT authentication, browser cookies can be omitted:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.Credentials = UAuthResourceCredentialsMode.Omit;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EOmitting browser cookies does not prevent the client from attaching its access-token authorization header.\u003C/p\u003E\n\u003Cp\u003EThis option affects Resource API requests, not authentication or refresh requests sent to UAuthHub.\u003C/p\u003E\n\u003Ch4 id=\u0022credential-compatibility\u0022\u003ECredential compatibility\u003C/h4\u003E\n\u003Cp\u003EA JWT issued in Hybrid mode is not interchangeable with a PureJwt access token.\u003C/p\u003E\n\u003Cp\u003EHybrid-aware JWT validation in separate Resource APIs is not currently implemented.\u003C/p\u003E\n\u003Cp\u003EAuthentication mode selection and credential compatibility remain explicit configuration responsibilities.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-and-uauthhub-connectivity\u0022\u003EPureJwt and UAuthHub Connectivity\u003C/h3\u003E\n\u003Cp\u003EA PureJwt Resource API does not need to contact UAuthHub to validate each JWT.\u003C/p\u003E\n\u003Cp\u003EHowever, clients still use UAuthHub for login, refresh, and logout operations.\u003C/p\u003E\n\u003Cp\u003EThis separation allows protected APIs to validate access tokens independently while the authentication authority manages refresh-token state.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-and-application-profile-metadata\u0022\u003E8. Device and Application Profile Metadata\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth maintains a distinction between user identity, device identity, and client environment.\u003C/p\u003E\n\u003Cp\u003EFor browser resource requests, the transport can propagate UltimateAuth metadata, 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\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\u003EX-UDID\nX-UAuth-ApplicationProfile\nX-Requested-With\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis keeps resource requests consistent with the UltimateAuth application environment without requiring every application component to construct these headers manually.\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\u003Eawait UAuthClient.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Edoes not require the developer to manually retrieve and attach the device identifier.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022metadata-is-not-proof-of-identity\u0022\u003EMetadata Is Not Proof of Identity\u003C/h3\u003E\n\u003Cp\u003EDevice identifiers and application profile values describe request context.\u003C/p\u003E\n\u003Cp\u003EThey are not independent authentication credentials.\u003C/p\u003E\n\u003Cp\u003EA receiving API must not grant access solely because a request declares a particular device identifier or application profile.\u003C/p\u003E\n\u003Cp\u003EThe server remains responsible for validating the user\u0027s authentication state and permissions.\u003C/p\u003E\n\u003Cp\u003EFor more information, see \u003Ca href=\u0022/docs/fundamentals/application-profiles\u0022\u003EApplication Profiles\u003C/a\u003E.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022browser-transport-and-security\u0022\u003E9. Browser Transport and Security\u003C/h2\u003E\n\u003Cp\u003EThe Blazor Resource Client uses UltimateAuth\u0027s browser transport.\u003C/p\u003E\n\u003Cp\u003EThis allows UltimateAuth to apply consistent request behavior without requiring developers to write a separate JavaScript module for their application.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022origin-validation\u0022\u003EOrigin Validation\u003C/h3\u003E\n\u003Cp\u003EResource requests are constrained by the configured Resource API origin.\u003C/p\u003E\n\u003Cp\u003EThe transport validates request destinations rather than allowing arbitrary URLs to bypass the configured resource boundary.\u003C/p\u003E\n\u003Cp\u003EThis helps prevent application code from unintentionally sending credentials or UltimateAuth request metadata to unrelated destinations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022redirect-protection\u0022\u003ERedirect Protection\u003C/h3\u003E\n\u003Cp\u003EResource requests use redirect protection.\u003C/p\u003E\n\u003Cp\u003EA request should not silently follow a redirect to an unexpected destination while carrying authentication-related context.\u003C/p\u003E\n\u003Cp\u003EApplications should handle unexpected redirects as transport failures rather than assuming the request succeeded.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022request-cancellation\u0022\u003ERequest Cancellation\u003C/h3\u003E\n\u003Cp\u003EResource operations support \u003Ccode\u003ECancellationToken\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\u003Eusing var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));\n\nvar result = await UAuthClient.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;, cts.Token);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Blazor transport coordinates cancellation with the underlying browser request.\u003C/p\u003E\n\u003Cp\u003ECancellation is particularly useful when a user navigates away from a page or starts another operation before the previous request completes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022browser-security-still-applies\u0022\u003EBrowser Security Still Applies\u003C/h3\u003E\n\u003Cp\u003EThe Resource Client does not disable browser security mechanisms.\u003C/p\u003E\n\u003Cp\u003ECross-origin requests remain subject to CORS and browser credential policies.\u003C/p\u003E\n\u003Cp\u003ELikewise, origin validation and redirect protection do not replace:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication validation.\u003C/li\u003E\n\u003Cli\u003EAuthorization policies.\u003C/li\u003E\n\u003Cli\u003ECSRF protection where applicable.\u003C/li\u003E\n\u003Cli\u003EInput validation.\u003C/li\u003E\n\u003Cli\u003EServer-side resource ownership checks.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese responsibilities remain part of the receiving API\u0027s security model.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server-vs.blazor-webassembly\u0022\u003E10. Blazor Server vs. Blazor WebAssembly\u003C/h2\u003E\n\u003Cp\u003EOne of UltimateAuth\u0027s design goals is to provide a consistent client API across supported application environments.\u003C/p\u003E\n\u003Cp\u003EHowever, different hosting models have different execution characteristics.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-webassembly\u0022\u003EBlazor WebAssembly\u003C/h3\u003E\n\u003Cp\u003EBlazor WebAssembly executes application code in the browser.\u003C/p\u003E\n\u003Cp\u003EIt cannot directly invoke server-side application services or access a server database.\u003C/p\u003E\n\u003Cp\u003EA typical application architecture 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\u003EBlazor WebAssembly\n |\n v\nIUAuthClient.Resource\n |\n v\nResource API\n |\n v\nApplication Services\n |\n v\nDatabase\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource Client provides a natural way to access protected application data from this environment.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server\u0022\u003EBlazor Server\u003C/h3\u003E\n\u003Cp\u003EBlazor Server executes component logic on the server.\u003C/p\u003E\n\u003Cp\u003EWhen the application service is available in the same process, a direct service call is often more appropriate.\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 Server Component\n |\n v\nApplication Service\n |\n v\nDatabase\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\u003Evar products = await productService.GetAllAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThere is no requirement to introduce an HTTP request simply to use the Resource Client.\u003C/p\u003E\n\u003Cp\u003EHowever, when a Blazor Server application needs to communicate with a separate protected Resource API, it can 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 result = await UAuthClient.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E The current Blazor Resource Client uses browser-based transport, including in Blazor Server applications.\u003C/p\u003E\n\u003Cp\u003EThe HTTP request is initiated by the user\u0027s browser, not by a server-side \u003Ccode\u003EHttpClient\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor server-to-server communication, use an appropriate server-side HTTP integration and authentication mechanism.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-same-client-api-different-application-architectures\u0022\u003EThe Same Client API, Different Application Architectures\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth aims to make client integration consistent without forcing every application into the same deployment model.\u003C/p\u003E\n\u003Cp\u003EThe goal is not to replace direct application service calls.\u003C/p\u003E\n\u003Cp\u003EThe goal is to remove unnecessary integration work whenever an HTTP resource request is actually needed.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-renewal-and-unauthorized-responses\u0022\u003E11. Authentication Renewal and Unauthorized Responses\u003C/h2\u003E\n\u003Cp\u003EThe Resource Client participates in UltimateAuth\u0027s coordinated authentication renewal infrastructure.\u003C/p\u003E\n\u003Cp\u003EWith proactive refresh enabled, an eligible request can renew authentication before being sent to the Resource API.\u003C/p\u003E\n\u003Cp\u003EWith reactive refresh enabled, a supported authentication challenge can trigger credential renewal and a single request replay.\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\u003Evar result = await UAuthClient.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\nif (result.IsSuccess)\n{\n products = result.Value;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe application does not need to manually inspect token expiration or implement its own authentication retry loop.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/client-sdk/automatic-refresh\u0022\u003EAutomatic Refresh\u003C/a\u003E\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022organizing-application-resource-services\u0022\u003E12. Organizing Application Resource Services\u003C/h2\u003E\n\u003Cp\u003EAlthough Resource Client operations can be called directly from components, larger applications often benefit from small, domain-specific services.\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\u003Eusing CodeBeam.UltimateAuth.Client;\nusing CodeBeam.UltimateAuth.Core.Contracts;\n\npublic sealed class ProductApiService(IUAuthClient client)\n{\n public Task\u0026lt;UAuthResult\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;\u0026gt; GetAllAsync()\n =\u0026gt; client.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\n public Task\u0026lt;UAuthResult\u0026lt;Product\u0026gt;\u0026gt; GetAsync(int id)\n =\u0026gt; client.Resource.GetAsync\u0026lt;Product\u0026gt;($\u0026quot;/api/products/{id}\u0026quot;);\n\n public Task\u0026lt;UAuthResult\u0026lt;Product\u0026gt;\u0026gt; CreateAsync(Product product)\n =\u0026gt; client.Resource.PostAsync\u0026lt;Product\u0026gt;(\u0026quot;/api/products\u0026quot;, product);\n\n public Task\u0026lt;UAuthResult\u0026lt;Product\u0026gt;\u0026gt; UpdateAsync(int id, Product product)\n =\u0026gt; client.Resource.PutAsync\u0026lt;Product\u0026gt;($\u0026quot;/api/products/{id}\u0026quot;, product);\n\n public Task\u0026lt;UAuthResult\u0026gt; DeleteAsync(int id)\n =\u0026gt; client.Resource.DeleteAsync($\u0026quot;/api/products/{id}\u0026quot;);\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis approach keeps application-specific endpoints and operations in one place.\u003C/p\u003E\n\u003Cp\u003EThe service does not need to implement:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EA custom HTTP transport.\u003C/li\u003E\n\u003Cli\u003EBrowser credential handling.\u003C/li\u003E\n\u003Cli\u003EDevice metadata propagation.\u003C/li\u003E\n\u003Cli\u003EJSON response deserialization.\u003C/li\u003E\n\u003Cli\u003EA separate response wrapper.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThose responsibilities remain with UltimateAuth.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022keep-the-standard-result\u0022\u003EKeep the Standard Result\u003C/h3\u003E\n\u003Cp\u003ENotice that \u003Ccode\u003EProductApiService\u003C/code\u003E returns \u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E directly.\u003C/p\u003E\n\u003Cp\u003EThere is no need to create another response type merely to wrap the same status, value, and problem information.\u003C/p\u003E\n\u003Cp\u003EThis keeps the application aligned with the UltimateAuth SDK.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-services-still-own-business-logic\u0022\u003EApplication Services Still Own Business Logic\u003C/h3\u003E\n\u003Cp\u003EThe Resource Client does not attempt to understand application-specific business rules.\u003C/p\u003E\n\u003Cp\u003EA \u003Ccode\u003EProductApiService\u003C/code\u003E can organize product-related operations, but the Resource API remains responsible for validating product data, enforcing ownership, and authorizing changes.\u003C/p\u003E\n\u003Cp\u003EThis separation keeps UltimateAuth focused on the infrastructure it can provide consistently.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022design-philosophy\u0022\u003E13. Design Philosophy\u003C/h2\u003E\n\u003Cp\u003EThe Resource Client follows the same principle as the rest of UltimateAuth:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EComplexity should be handled by the framework when it is common, predictable, and independent of application business logic.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EDevelopers should not need to repeatedly solve browser transport, credential configuration, device metadata, and response handling simply because their application has its own API.\u003C/p\u003E\n\u003Cp\u003EAt the same time, a framework should not hide important security boundaries or take ownership of application-specific decisions.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth therefore provides:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EA unified client entry point.\u003C/li\u003E\n\u003Cli\u003EFamiliar HTTP operations.\u003C/li\u003E\n\u003Cli\u003EConsistent result contracts.\u003C/li\u003E\n\u003Cli\u003EConfigurable resource origins and credential policies.\u003C/li\u003E\n\u003Cli\u003EBrowser-aware transport behavior.\u003C/li\u003E\n\u003Cli\u003EExplicit server-side security responsibilities.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe result is a simpler developer experience without requiring applications to abandon their existing architecture.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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// Authentication\nawait UAuthClient.Flows.RefreshAsync();\n\n// Identity\nvar user = await UAuthClient.Users.GetMeAsync();\n\n// Sessions\nvar sessions = await UAuthClient.Sessions.GetMyChainsAsync(\n new PageRequest\n {\n PageNumber = 1,\n PageSize = 10\n });\n\n// Application resources\nvar products = await UAuthClient.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDifferent responsibilities. One consistent client model.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUltimateAuth does not stop at authentication. It helps applications use authentication without rebuilding the integration layer around it.\u003C/strong\u003E\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022related-documentation\u0022\u003ERelated Documentation\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client-sdk/overview\u0022\u003EClient SDK Overview\u003C/a\u003E \u2014 Understand the unified client architecture.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E \u2014 Configure application profiles, authentication endpoints, and resource options.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client-sdk/authentication\u0022\u003EAuthentication\u003C/a\u003E \u2014 Work with authentication flows and session renewal.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/application-profiles\u0022\u003EApplication Profiles\u003C/a\u003E \u2014 Understand runtime-specific authentication behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/getting-started/real-world-setup\u0022\u003EReal-World Setup\u003C/a\u003E \u2014 Configure Blazor applications, UAuthHub, and separate Resource APIs.\u003C/li\u003E\n\u003C/ul\u003E\n", + "Html": "\n\u003Cp\u003E\u003Cstrong\u003EAuthenticate once. Access your application resources through the same unified client.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EAuthentication is only the beginning of an application.\u003C/p\u003E\n\u003Cp\u003EOnce a user signs in, the application still needs to retrieve data, create records, update resources, and communicate with protected APIs.\u003C/p\u003E\n\u003Cp\u003ETraditionally, this introduces another layer of integration work.\u003C/p\u003E\n\u003Cp\u003EDevelopers configure authentication through one library, then build a separate HTTP client to access their application APIs. They must handle credentials, browser restrictions, response parsing, errors, and differences between hosting environments.\u003C/p\u003E\n\u003Cp\u003EThe result is often two separate programming models: one for authentication and another for everything that comes after it.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUltimateAuth brings these operations together through \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EInstead of introducing another client abstraction, applications can use the same UltimateAuth entry point for authentication, identity management, and protected resource requests.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource\n .GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ENo custom JavaScript wrapper. No application-specific response type. No separate HTTP client configuration for ordinary authenticated resource requests.\u003C/p\u003E\n\u003Cp\u003EThe goal is straightforward: \u003Cstrong\u003Emake accessing protected application resources feel like a natural continuation of authentication.\u003C/strong\u003E\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-problem-authentication-ends-integration-work-begins\u0022\u003E1. The Problem: Authentication Ends, Integration Work Begins\u003C/h2\u003E\n\u003Cp\u003EConsider a typical application with three components:\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 Application\n |\n \u002B----\u0026gt; UAuthHub\n | Authentication\n | Sessions\n | Identity\n |\n \u002B----\u0026gt; Resource API\n Products\n Orders\n Application Data\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUltimateAuth handles authentication and identity operations.\u003C/p\u003E\n\u003Cp\u003EBut the application also needs to communicate with its Resource API.\u003C/p\u003E\n\u003Cp\u003EWithout a unified resource client, developers typically need to:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EConfigure an additional HTTP client.\u003C/li\u003E\n\u003Cli\u003EDetermine how authentication credentials should accompany requests.\u003C/li\u003E\n\u003Cli\u003EHandle browser credential policies and cross-origin restrictions.\u003C/li\u003E\n\u003Cli\u003EMaintain device and application profile metadata where applicable.\u003C/li\u003E\n\u003Cli\u003EDeserialize successful responses.\u003C/li\u003E\n\u003Cli\u003ETranslate unsuccessful HTTP responses into application-friendly results.\u003C/li\u003E\n\u003Cli\u003EImplement similar request handling across multiple components.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThese responsibilities are not necessarily complicated individually.\u003C/p\u003E\n\u003Cp\u003EThe problem is their repetition.\u003C/p\u003E\n\u003Cp\u003EA framework that simplifies authentication should not require developers to rebuild the surrounding integration layer every time they need application data.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-unified-client-model\u0022\u003EA Unified Client Model\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth already exposes specialized operations through \u003Ccode\u003EIUAuthClient\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\u003EUAuthClient.Flows\nUAuthClient.Users\nUAuthClient.Sessions\nUAuthClient.Credentials\nUAuthClient.Authorization\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EResource requests follow the same 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\u003EUAuthClient.Resource\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis preserves a consistent entry point without mixing application-specific business operations into UltimateAuth\u0027s authentication services.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth does not need to know what a \u003Ccode\u003EProduct\u003C/code\u003E, \u003Ccode\u003EOrder\u003C/code\u003E, or \u003Ccode\u003EInvoice\u003C/code\u003E represents.\u003C/p\u003E\n\u003Cp\u003EIt only needs to provide a predictable way to communicate with the API that owns those resources.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022getting-started\u0022\u003E2. Getting Started\u003C/h2\u003E\n\u003Cp\u003EThe Resource API client is available through the UltimateAuth Client SDK.\u003C/p\u003E\n\u003Cp\u003EFor Blazor applications, register the Blazor client integration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe registration includes the shared client services and the browser-specific resource transport.\u003C/p\u003E\n\u003Cp\u003EYou do not need to register a separate Resource Client.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022inject-iuauthclient\u0022\u003EInject IUAuthClient\u003C/h3\u003E\n\u003Cp\u003EIn a Blazor component:\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@using CodeBeam.UltimateAuth.Client\n@inject IUAuthClient UAuthClient\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThen call a protected application endpoint:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\nif (result.IsSuccess \u0026amp;\u0026amp; result.Value is not null)\n{\n products = result.Value;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe response uses the same structured result model found throughout UltimateAuth.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-happens-behind-the-call\u0022\u003EWhat Happens Behind the Call?\u003C/h3\u003E\n\u003Cp\u003EFor the Blazor integration, the request follows this path:\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 Component\n |\n v\nIUAuthClient.Resource\n |\n v\nResource Client\n |\n v\nUltimateAuth Browser Transport\n |\n v\nProtected Resource API\n |\n v\nUAuthResult\u0026lt;T\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe browser transport handles request construction and browser-specific behavior.\u003C/p\u003E\n\u003Cp\u003EThe Resource API remains responsible for validating authentication and enforcing authorization.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA successful client request does not bypass server-side security.\u003C/strong\u003E\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022supported-http-operations\u0022\u003E3. Supported HTTP Operations\u003C/h2\u003E\n\u003Cp\u003EThe Resource Client provides five standard HTTP operations.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EMethod\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003Cth\u003EReturn type\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EGetAsync\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERetrieve a resource\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPostAsync\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECreate or submit a resource\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPutAsync\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReplace or update a resource\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPatchAsync\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPartially update a resource\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDeleteAsync\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDelete a resource\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthResult\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EAll methods accept a relative endpoint and support cancellation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022get\u0022\u003EGET\u003C/h3\u003E\n\u003Cp\u003ERetrieve application data:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\nif (result.IsSuccess \u0026amp;\u0026amp; result.Value is not null)\n{\n products = result.Value;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERetrieve a single resource:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;Product\u0026gt;($\u0026quot;/api/products/{productId}\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022post\u0022\u003EPOST\u003C/h3\u003E\n\u003Cp\u003ESubmit a new resource:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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 product = new Product\n{\n Name = \u0026quot;Example Product\u0026quot;,\n Price = 29.99m\n};\n\nvar result = await UAuthClient.Resource.PostAsync\u0026lt;Product\u0026gt;(\u0026quot;/api/products\u0026quot;, product);\n\nif (result.IsSuccess)\n{\n // Product created successfully.\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe request payload is serialized for transport.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022put\u0022\u003EPUT\u003C/h3\u003E\n\u003Cp\u003EUpdate a resource:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource\n .PutAsync\u0026lt;Product\u0026gt;($\u0026quot;/api/products/{product.Id}\u0026quot;, product);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022patch\u0022\u003EPATCH\u003C/h3\u003E\n\u003Cp\u003ESubmit a partial update:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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 changes = new\n{\n Price = 24.99m\n};\n\nvar result = await UAuthClient.Resource\n .PatchAsync\u0026lt;Product\u0026gt;($\u0026quot;/api/products/{productId}\u0026quot;, changes);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource Client sends the request payload.\u003C/p\u003E\n\u003Cp\u003EThe receiving API determines which partial-update formats and operations it supports.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022delete\u0022\u003EDELETE\u003C/h3\u003E\n\u003Cp\u003EDelete a resource:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.DeleteAsync($\u0026quot;/api/products/{productId}\u0026quot;);\n\nif (result.IsSuccess)\n{\n // Resource deleted successfully.\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUnlike the other methods, \u003Ccode\u003EDeleteAsync\u003C/code\u003E returns the non-generic \u003Ccode\u003EUAuthResult\u003C/code\u003E because the operation does not require a response value.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022consistent-results-with-uauthresult\u0022\u003E4. Consistent Results with UAuthResult\u003C/h2\u003E\n\u003Cp\u003EA common source of unnecessary complexity is response handling.\u003C/p\u003E\n\u003Cp\u003EOne API client returns \u003Ccode\u003EHttpResponseMessage\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EAnother returns a custom response wrapper.\u003C/p\u003E\n\u003Cp\u003EA third throws exceptions for ordinary HTTP failures.\u003C/p\u003E\n\u003Cp\u003EApplications then need different handling logic for operations that are conceptually similar.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth uses \u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E to provide a consistent response contract.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;Product\u0026gt;(\u0026quot;/api/products/42\u0026quot;);\n\nif (result.IsSuccess)\n{\n var product = result.Value;\n}\nelse\n{\n var status = result.Status;\n var problem = result.Problem;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022result-properties\u0022\u003EResult 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\u003EDescription\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIsSuccess\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIndicates whether the HTTP operation succeeded\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EStatus\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EHTTP response status code\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EValue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDeserialized response value for successful generic operations\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EProblem\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EStructured problem information when available\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EA failed HTTP response does not automatically mean a transport exception.\u003C/p\u003E\n\u003Cp\u003EFor example, an API may return:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003E400 Bad Request\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003E401 Unauthorized\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003E403 Forbidden\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003E404 Not Found\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003E409 Conflict\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese responses can be represented through \u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe application can inspect the status and decide how to respond.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022structured-problems\u0022\u003EStructured Problems\u003C/h3\u003E\n\u003Cp\u003EWhen an unsuccessful response contains a compatible UltimateAuth problem payload, the Resource Client attempts to deserialize it into \u003Ccode\u003EUAuthProblem\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\u003Eif (!result.IsSuccess)\n{\n if (result.Problem is not null)\n {\n // Handle the structured API problem.\n }\n else\n {\n // Handle the HTTP status without a structured problem.\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ENot every API returns a compatible problem body.\u003C/p\u003E\n\u003Cp\u003ETherefore, \u003Ccode\u003EProblem\u003C/code\u003E may be \u003Ccode\u003Enull\u003C/code\u003E even when the request failed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022transport-failures-are-different\u0022\u003ETransport Failures Are Different\u003C/h3\u003E\n\u003Cp\u003ENetwork failures, protocol errors, and request cancellation are different from ordinary unsuccessful HTTP responses.\u003C/p\u003E\n\u003Cp\u003EFor example, an unreachable API does not necessarily produce an HTTP status code.\u003C/p\u003E\n\u003Cp\u003EApplications should distinguish transport exceptions from valid HTTP responses indicating failure.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E standardizes HTTP response handling; it does not guarantee that every network or runtime failure becomes a result object.\u003C/strong\u003E\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-configuration\u0022\u003E5. Resource API Configuration\u003C/h2\u003E\n\u003Cp\u003EResource API configuration is part of \u003Ccode\u003EUAuthClientOptions\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n options.Resource.Credentials = UAuthResourceCredentialsMode.Auto;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe \u003Ccode\u003EResource\u003C/code\u003E options are separate from the authentication endpoint configuration.\u003C/p\u003E\n\u003Cp\u003EThis distinction allows applications to authenticate against one server while accessing resources hosted elsewhere.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022baseaddress\u0022\u003EBaseAddress\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EBaseAddress\u003C/code\u003E identifies the Resource API 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.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIf \u003Ccode\u003EBaseAddress\u003C/code\u003E is not configured, requests use the application\u0027s current 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\u003Ebuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA call 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Ethen targets the application\u0027s origin.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022baseaddress-validation\u0022\u003EBaseAddress Validation\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth validates the configured Resource API address.\u003C/p\u003E\n\u003Cp\u003EThe address must:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EBe an absolute HTTP or HTTPS URL.\u003C/li\u003E\n\u003Cli\u003EUse HTTPS, except for loopback development addresses.\u003C/li\u003E\n\u003Cli\u003ERepresent an origin without an additional path.\u003C/li\u003E\n\u003Cli\u003EExclude embedded credentials, query strings, and fragments.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EValid examples:\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\u003Ehttps://api.example.com\nhttps://localhost:7001\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EInvalid examples:\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\u003Ehttps://api.example.com/api\nhttps://api.example.com?version=1\nhttp://api.example.com\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EKeep endpoint paths in individual Resource Client calls:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis separates deployment configuration from application resource paths.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022browser-credential-handling\u0022\u003E6. Browser Credential Handling\u003C/h2\u003E\n\u003Cp\u003EBrowser-based applications do not have unrestricted control over authentication credentials.\u003C/p\u003E\n\u003Cp\u003ECookies, origins, cross-origin requests, and browser security policies all influence how requests are sent.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth exposes credential handling through \u003Ccode\u003EUAuthResourceCredentialsMode\u003C/code\u003E.\u003C/p\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\u003EBehavior\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuto\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELet UltimateAuth select the appropriate browser credential policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESameOrigin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESend browser credentials only for same-origin requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EInclude\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EInclude browser credentials for the configured Resource API origin\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOmit\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDo not send browser credentials\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\u003Eoptions.Resource.Credentials = UAuthResourceCredentialsMode.Auto;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022same-origin-resource-api\u0022\u003ESame-Origin Resource API\u003C/h3\u003E\n\u003Cp\u003EWhen the application and Resource API share an 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\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\u003Ehttps://app.example.com\nhttps://app.example.com/api/products\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Eyou can 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.Resource.Credentials = UAuthResourceCredentialsMode.SameOrigin;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is appropriate when the Resource API relies on browser credentials available to the application origin.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022separate-resource-api\u0022\u003ESeparate Resource API\u003C/h3\u003E\n\u003Cp\u003EConsider:\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\u003EApplication: https://app.example.com\nResource API: https://api.example.com\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor a cross-origin API that requires browser cookies, 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\u003Ebuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n options.Resource.Credentials = UAuthResourceCredentialsMode.Include;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe receiving API must also support the relevant browser security requirements.\u003C/p\u003E\n\u003Cp\u003EFor credentialed cross-origin requests, this typically includes:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EExplicitly permitted origins.\u003C/li\u003E\n\u003Cli\u003EAppropriate CORS configuration.\u003C/li\u003E\n\u003Cli\u003ECompatible cookie attributes and browser policies.\u003C/li\u003E\n\u003Cli\u003EServer-side authentication and authorization.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EConfiguring \u003Ccode\u003EInclude\u003C/code\u003E does not override browser restrictions or guarantee that a cookie is available for the destination.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022when-to-use-omit\u0022\u003EWhen to Use Omit\u003C/h3\u003E\n\u003Cp\u003ESome resource endpoints do not require browser cookies.\u003C/p\u003E\n\u003Cp\u003EFor those cases:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.Credentials = UAuthResourceCredentialsMode.Omit;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis prevents browser credentials from being included in the resource request.\u003C/p\u003E\n\u003Cp\u003EThe API must still enforce whichever authentication mechanism it requires.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ECredential transmission is not the same as authorization.\u003C/strong\u003E\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022separate-uauthhub-and-resource-api\u0022\u003E7. Separate UAuthHub and Resource API\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports architectures where authentication and application resources are hosted independently.\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\u003E Blazor Application\n |\n \u002B------------\u002B------------\u002B\n | |\n v v\n UAuthHub Resource API\n auth.example.com api.example.com\n | |\n v v\n Authentication Application Data\n Sessions Business Operations\n Identity Authorization\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client can configure both destinations 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://auth.example.com/auth\u0026quot;;\n\n options.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n\n options.Resource.Credentials = UAuthResourceCredentialsMode.Auto;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAuthentication operations use the configured authentication endpoints.\u003C/p\u003E\n\u003Cp\u003EResource operations use the configured Resource API 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\u003Evar profile = await UAuthClient.Users.GetMeAsync();\n\nvar products = await UAuthClient.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EBoth operations are accessed through \u003Ccode\u003EIUAuthClient\u003C/code\u003E, but they serve different purposes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-does-not-automatically-protect-an-api\u0022\u003EAuthentication Does Not Automatically Protect an API\u003C/h3\u003E\n\u003Cp\u003EConfiguring a Resource API address does not automatically enable authentication or authorization on that API.\u003C/p\u003E\n\u003Cp\u003EThe Resource API must independently validate incoming requests and enforce its access rules.\u003C/p\u003E\n\u003Cp\u003EFor separate deployments, the Resource API must also be configured to accept and validate the authentication material associated with the selected UltimateAuth authentication mode.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client simplifies communication.\u003C/p\u003E\n\u003Cp\u003EIt does not replace the receiving server\u0027s security responsibilities.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-mode-compatibility\u0022\u003EAuthentication Mode Compatibility\u003C/h3\u003E\n\u003Cp\u003EUAuthHub and Resource APIs are configured independently.\u003C/p\u003E\n\u003Cp\u003EUAuthHub determines which authentication credentials are issued. A Resource API determines which credentials it accepts and how they are validated.\u003C/p\u003E\n\u003Cp\u003EAll four authentication modes are supported by the UltimateAuth Resource API integration.\u003C/p\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\u003EPrimary credential\u003C/th\u003E\n\u003Cth\u003EResource API validation\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\u003Ctd\u003ERemote authoritative validation\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\u003Ctd\u003ERemote authoritative validation\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\u003Ctd\u003ELocal JWT validation with optional remote authoritative validation\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\u003Ctd\u003ELocal JWT validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe configured Resource API mode must be compatible with the credentials issued by UAuthHub.\u003C/p\u003E\n\u003Cp\u003EChanging the authentication mode does not require rewriting Resource Client calls made through the shared UltimateAuth Client SDK.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-delivery\u0022\u003ECredential Delivery\u003C/h3\u003E\n\u003Cp\u003EThe client and Resource API must agree on the authentication credential and its transport.\u003C/p\u003E\n\u003Ch4 id=\u0022session-based-resource-apis\u0022\u003ESession-based Resource APIs\u003C/h4\u003E\n\u003Cp\u003EPureOpaque and Hybrid Resource APIs authenticate requests using opaque session credentials.\u003C/p\u003E\n\u003Cp\u003ECookie delivery is the default for incoming session credentials. Other supported transports can be configured when required.\u003C/p\u003E\n\u003Cp\u003EThe Resource API validates the presented session through UAuthHub.\u003C/p\u003E\n\u003Cp\u003EWhen cookie delivery is used, the browser must be able to send the session cookie to the Resource API.\u003C/p\u003E\n\u003Ch4 id=\u0022jwt-based-resource-apis\u0022\u003EJWT-based Resource APIs\u003C/h4\u003E\n\u003Cp\u003ESemiHybrid and PureJwt Resource APIs authenticate requests using JWT access tokens.\u003C/p\u003E\n\u003Cp\u003EThe default header-based access-token transport 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\u003EHTTP\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-http\u0022\u003EAuthorization: Bearer \u0026lt;access-token\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe UltimateAuth Resource Client automatically attaches the current access token when configured to use header-based authentication.\u003C/p\u003E\n\u003Cp\u003EFor Resource APIs that do not require browser cookies:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.Credentials = UAuthResourceCredentialsMode.Omit;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis option affects Resource API requests, not authentication or refresh requests sent to UAuthHub.\u003C/p\u003E\n\u003Ch4 id=\u0022credential-compatibility\u0022\u003ECredential compatibility\u003C/h4\u003E\n\u003Cp\u003EJWT access tokens issued for different authentication modes are not necessarily interchangeable.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid requires an access token associated with server-managed session lineage.\u003C/p\u003E\n\u003Cp\u003EPureJwt requires a session-independent access token.\u003C/p\u003E\n\u003Cp\u003EA SemiHybrid session identifier is metadata and must never be accepted as an opaque authentication credential.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-validation-requirements\u0022\u003EResource API validation requirements\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid Resource APIs support both Standard and HubValidated authentication.\u003C/p\u003E\n\u003Cp\u003EStandard validation establishes the authenticated identity locally without contacting UAuthHub.\u003C/p\u003E\n\u003Cp\u003EHubValidated additionally requires authoritative validation of the associated session lineage.\u003C/p\u003E\n\u003Cp\u003ETo require authoritative validation for a particular endpoint:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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\u003ETo require authoritative validation by default:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.SemiHybrid;\n\n options.Auth.Validation.Default = UAuthValidationRequirement.HubValidated;\n\n // Configure Hub connectivity and JWT validation.\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client does not need to select a validation requirement or make a separate validation request.\u003C/p\u003E\n\u003Cp\u003EThe requirement is enforced by the Resource API.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022uauthhub-connectivity\u0022\u003EUAuthHub connectivity\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\u003EUAuthHub connectivity for protected requests\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\u003ERequired\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003ERequired\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003ERequired for HubValidated operations\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ENot required for ordinary JWT validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003ESemiHybrid Resource APIs require a configured Hub address, even when their default validation requirement is Standard.\u003C/p\u003E\n\u003Cp\u003EClients continue to use UAuthHub for authentication flows such as login, refresh, and logout.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/request-lifecycle\u0022\u003ERequest Lifecycle\u003C/a\u003E for validation requirements and\n\u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E for mode-specific guarantees.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-and-application-profile-metadata\u0022\u003E8. Device and Application Profile Metadata\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth maintains a distinction between user identity, device identity, and client environment.\u003C/p\u003E\n\u003Cp\u003EFor browser resource requests, the transport can propagate UltimateAuth metadata, 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\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\u003EX-UDID\nX-UAuth-ApplicationProfile\nX-Requested-With\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis keeps resource requests consistent with the UltimateAuth application environment without requiring every application component to construct these headers manually.\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\u003Eawait UAuthClient.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Edoes not require the developer to manually retrieve and attach the device identifier.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022metadata-is-not-proof-of-identity\u0022\u003EMetadata Is Not Proof of Identity\u003C/h3\u003E\n\u003Cp\u003EDevice identifiers and application profile values describe request context.\u003C/p\u003E\n\u003Cp\u003EThey are not independent authentication credentials.\u003C/p\u003E\n\u003Cp\u003EA receiving API must not grant access solely because a request declares a particular device identifier or application profile.\u003C/p\u003E\n\u003Cp\u003EThe server remains responsible for validating the user\u0027s authentication state and permissions.\u003C/p\u003E\n\u003Cp\u003EFor more information, see \u003Ca href=\u0022/docs/fundamentals/application-profiles\u0022\u003EApplication Profiles\u003C/a\u003E.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022browser-transport-and-security\u0022\u003E9. Browser Transport and Security\u003C/h2\u003E\n\u003Cp\u003EThe Blazor Resource Client uses UltimateAuth\u0027s browser transport.\u003C/p\u003E\n\u003Cp\u003EThis allows UltimateAuth to apply consistent request behavior without requiring developers to write a separate JavaScript module for their application.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022origin-validation\u0022\u003EOrigin Validation\u003C/h3\u003E\n\u003Cp\u003EResource requests are constrained by the configured Resource API origin.\u003C/p\u003E\n\u003Cp\u003EThe transport validates request destinations rather than allowing arbitrary URLs to bypass the configured resource boundary.\u003C/p\u003E\n\u003Cp\u003EThis helps prevent application code from unintentionally sending credentials or UltimateAuth request metadata to unrelated destinations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022redirect-protection\u0022\u003ERedirect Protection\u003C/h3\u003E\n\u003Cp\u003EResource requests use redirect protection.\u003C/p\u003E\n\u003Cp\u003EA request should not silently follow a redirect to an unexpected destination while carrying authentication-related context.\u003C/p\u003E\n\u003Cp\u003EApplications should handle unexpected redirects as transport failures rather than assuming the request succeeded.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022request-cancellation\u0022\u003ERequest Cancellation\u003C/h3\u003E\n\u003Cp\u003EResource operations support \u003Ccode\u003ECancellationToken\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\u003Eusing var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));\n\nvar result = await UAuthClient.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;, cts.Token);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Blazor transport coordinates cancellation with the underlying browser request.\u003C/p\u003E\n\u003Cp\u003ECancellation is particularly useful when a user navigates away from a page or starts another operation before the previous request completes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022browser-security-still-applies\u0022\u003EBrowser Security Still Applies\u003C/h3\u003E\n\u003Cp\u003EThe Resource Client does not disable browser security mechanisms.\u003C/p\u003E\n\u003Cp\u003ECross-origin requests remain subject to CORS and browser credential policies.\u003C/p\u003E\n\u003Cp\u003ELikewise, origin validation and redirect protection do not replace:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication validation.\u003C/li\u003E\n\u003Cli\u003EAuthorization policies.\u003C/li\u003E\n\u003Cli\u003ECSRF protection where applicable.\u003C/li\u003E\n\u003Cli\u003EInput validation.\u003C/li\u003E\n\u003Cli\u003EServer-side resource ownership checks.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese responsibilities remain part of the receiving API\u0027s security model.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server-vs.blazor-webassembly\u0022\u003E10. Blazor Server vs. Blazor WebAssembly\u003C/h2\u003E\n\u003Cp\u003EOne of UltimateAuth\u0027s design goals is to provide a consistent client API across supported application environments.\u003C/p\u003E\n\u003Cp\u003EHowever, different hosting models have different execution characteristics.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-webassembly\u0022\u003EBlazor WebAssembly\u003C/h3\u003E\n\u003Cp\u003EBlazor WebAssembly executes application code in the browser.\u003C/p\u003E\n\u003Cp\u003EIt cannot directly invoke server-side application services or access a server database.\u003C/p\u003E\n\u003Cp\u003EA typical application architecture 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\u003EBlazor WebAssembly\n |\n v\nIUAuthClient.Resource\n |\n v\nResource API\n |\n v\nApplication Services\n |\n v\nDatabase\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource Client provides a natural way to access protected application data from this environment.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server\u0022\u003EBlazor Server\u003C/h3\u003E\n\u003Cp\u003EBlazor Server executes component logic on the server.\u003C/p\u003E\n\u003Cp\u003EWhen the application service is available in the same process, a direct service call is often more appropriate.\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 Server Component\n |\n v\nApplication Service\n |\n v\nDatabase\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\u003Evar products = await productService.GetAllAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThere is no requirement to introduce an HTTP request simply to use the Resource Client.\u003C/p\u003E\n\u003Cp\u003EHowever, when a Blazor Server application needs to communicate with a separate protected Resource API, it can 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 result = await UAuthClient.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E The current Blazor Resource Client uses browser-based transport, including in Blazor Server applications.\u003C/p\u003E\n\u003Cp\u003EThe HTTP request is initiated by the user\u0027s browser, not by a server-side \u003Ccode\u003EHttpClient\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor server-to-server communication, use an appropriate server-side HTTP integration and authentication mechanism.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-same-client-api-different-application-architectures\u0022\u003EThe Same Client API, Different Application Architectures\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth aims to make client integration consistent without forcing every application into the same deployment model.\u003C/p\u003E\n\u003Cp\u003EThe goal is not to replace direct application service calls.\u003C/p\u003E\n\u003Cp\u003EThe goal is to remove unnecessary integration work whenever an HTTP resource request is actually needed.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-renewal-and-unauthorized-responses\u0022\u003E11. Authentication Renewal and Unauthorized Responses\u003C/h2\u003E\n\u003Cp\u003EThe Resource Client participates in UltimateAuth\u0027s coordinated authentication renewal infrastructure.\u003C/p\u003E\n\u003Cp\u003EWith proactive refresh enabled, an eligible request can renew authentication before being sent to the Resource API.\u003C/p\u003E\n\u003Cp\u003EWith reactive refresh enabled, a supported authentication challenge can trigger credential renewal and a single request replay.\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\u003Evar result = await UAuthClient.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\nif (result.IsSuccess)\n{\n products = result.Value;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe application does not need to manually inspect token expiration or implement its own authentication retry loop.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/client-sdk/automatic-refresh\u0022\u003EAutomatic Refresh\u003C/a\u003E\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022organizing-application-resource-services\u0022\u003E12. Organizing Application Resource Services\u003C/h2\u003E\n\u003Cp\u003EAlthough Resource Client operations can be called directly from components, larger applications often benefit from small, domain-specific services.\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\u003Eusing CodeBeam.UltimateAuth.Client;\nusing CodeBeam.UltimateAuth.Core.Contracts;\n\npublic sealed class ProductApiService(IUAuthClient client)\n{\n public Task\u0026lt;UAuthResult\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;\u0026gt; GetAllAsync()\n =\u0026gt; client.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\n public Task\u0026lt;UAuthResult\u0026lt;Product\u0026gt;\u0026gt; GetAsync(int id)\n =\u0026gt; client.Resource.GetAsync\u0026lt;Product\u0026gt;($\u0026quot;/api/products/{id}\u0026quot;);\n\n public Task\u0026lt;UAuthResult\u0026lt;Product\u0026gt;\u0026gt; CreateAsync(Product product)\n =\u0026gt; client.Resource.PostAsync\u0026lt;Product\u0026gt;(\u0026quot;/api/products\u0026quot;, product);\n\n public Task\u0026lt;UAuthResult\u0026lt;Product\u0026gt;\u0026gt; UpdateAsync(int id, Product product)\n =\u0026gt; client.Resource.PutAsync\u0026lt;Product\u0026gt;($\u0026quot;/api/products/{id}\u0026quot;, product);\n\n public Task\u0026lt;UAuthResult\u0026gt; DeleteAsync(int id)\n =\u0026gt; client.Resource.DeleteAsync($\u0026quot;/api/products/{id}\u0026quot;);\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis approach keeps application-specific endpoints and operations in one place.\u003C/p\u003E\n\u003Cp\u003EThe service does not need to implement:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EA custom HTTP transport.\u003C/li\u003E\n\u003Cli\u003EBrowser credential handling.\u003C/li\u003E\n\u003Cli\u003EDevice metadata propagation.\u003C/li\u003E\n\u003Cli\u003EJSON response deserialization.\u003C/li\u003E\n\u003Cli\u003EA separate response wrapper.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThose responsibilities remain with UltimateAuth.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022keep-the-standard-result\u0022\u003EKeep the Standard Result\u003C/h3\u003E\n\u003Cp\u003ENotice that \u003Ccode\u003EProductApiService\u003C/code\u003E returns \u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E directly.\u003C/p\u003E\n\u003Cp\u003EThere is no need to create another response type merely to wrap the same status, value, and problem information.\u003C/p\u003E\n\u003Cp\u003EThis keeps the application aligned with the UltimateAuth SDK.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-services-still-own-business-logic\u0022\u003EApplication Services Still Own Business Logic\u003C/h3\u003E\n\u003Cp\u003EThe Resource Client does not attempt to understand application-specific business rules.\u003C/p\u003E\n\u003Cp\u003EA \u003Ccode\u003EProductApiService\u003C/code\u003E can organize product-related operations, but the Resource API remains responsible for validating product data, enforcing ownership, and authorizing changes.\u003C/p\u003E\n\u003Cp\u003EThis separation keeps UltimateAuth focused on the infrastructure it can provide consistently.\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022design-philosophy\u0022\u003E13. Design Philosophy\u003C/h2\u003E\n\u003Cp\u003EThe Resource Client follows the same principle as the rest of UltimateAuth:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EComplexity should be handled by the framework when it is common, predictable, and independent of application business logic.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EDevelopers should not need to repeatedly solve browser transport, credential configuration, device metadata, and response handling simply because their application has its own API.\u003C/p\u003E\n\u003Cp\u003EAt the same time, a framework should not hide important security boundaries or take ownership of application-specific decisions.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth therefore provides:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EA unified client entry point.\u003C/li\u003E\n\u003Cli\u003EFamiliar HTTP operations.\u003C/li\u003E\n\u003Cli\u003EConsistent result contracts.\u003C/li\u003E\n\u003Cli\u003EConfigurable resource origins and credential policies.\u003C/li\u003E\n\u003Cli\u003EBrowser-aware transport behavior.\u003C/li\u003E\n\u003Cli\u003EExplicit server-side security responsibilities.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe result is a simpler developer experience without requiring applications to abandon their existing architecture.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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// Authentication\nawait UAuthClient.Flows.RefreshAsync();\n\n// Identity\nvar user = await UAuthClient.Users.GetMeAsync();\n\n// Sessions\nvar sessions = await UAuthClient.Sessions.GetMyChainsAsync(\n new PageRequest\n {\n PageNumber = 1,\n PageSize = 10\n });\n\n// Application resources\nvar products = await UAuthClient.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDifferent responsibilities. One consistent client model.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUltimateAuth does not stop at authentication. It helps applications use authentication without rebuilding the integration layer around it.\u003C/strong\u003E\u003C/p\u003E\n\u003Chr\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022related-documentation\u0022\u003ERelated Documentation\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client-sdk/overview\u0022\u003EClient SDK Overview\u003C/a\u003E \u2014 Understand the unified client architecture.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E \u2014 Configure application profiles, authentication endpoints, and resource options.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client-sdk/authentication\u0022\u003EAuthentication\u003C/a\u003E \u2014 Work with authentication flows and session renewal.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/application-profiles\u0022\u003EApplication Profiles\u003C/a\u003E \u2014 Understand runtime-specific authentication behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/getting-started/real-world-setup\u0022\u003EReal-World Setup\u003C/a\u003E \u2014 Configure Blazor applications, UAuthHub, and separate Resource APIs.\u003C/li\u003E\n\u003C/ul\u003E\n", "Headings": [ { "Id": "the-problem-authentication-ends-integration-work-begins", @@ -134,8 +134,13 @@ "Level": 1 }, { - "Id": "purejwt-and-uauthhub-connectivity", - "Text": "PureJwt and UAuthHub Connectivity", + "Id": "resource-api-validation-requirements", + "Text": "Resource API validation requirements", + "Level": 1 + }, + { + "Id": "uauthhub-connectivity", + "Text": "UAuthHub connectivity", "Level": 1 }, { @@ -224,6 +229,6 @@ "Level": 0 } ], - "SourceHash": "163613683B6C3AA5D48C2BB71792C02EF06EFFCDF432947C8C786058AB9FF71A", + "SourceHash": "8419F2857D152D326191AD7078953DE9838D6DEC649FA97DD50A0465BD58D914", "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 c7b32f04..8b2bc6d4 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.Session.Lifetime = 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.Session.Lifetime = 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 provides mode-specific defaults for authentication behavior.\u003C/p\u003E\n\u003Cp\u003EThe current implementation includes templates for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ESemiHybrid\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EPureJwt\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese templates configure relevant token, session, cookie, and response behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022pureopaque\u0022\u003EPureOpaque\u003C/h3\u003E\n\u003Cp\u003EThe \u003Ccode\u003EPureOpaque\u003C/code\u003E defaults 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\u003EToken.IssueJwt = false;\nToken.IssueOpaque = false;\nToken.IssueRefresh = false;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIn this mode, the session identifier is the primary opaque authentication credential.\u003C/p\u003E\n\u003Cp\u003EThe defaults also configure a longer idle timeout and session touch interval where no explicit values were supplied.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022hybrid\u0022\u003EHybrid\u003C/h3\u003E\n\u003Cp\u003EThe \u003Ccode\u003EHybrid\u003C/code\u003E defaults 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\u003EToken.IssueJwt = true;\nToken.IssueOpaque = true;\nToken.AccessTokenLifetime = TimeSpan.FromMinutes(10);\nToken.RefreshTokenLifetime = TimeSpan.FromDays(7);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EHybrid also configures refresh-token delivery through a cookie.\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=\u0022enabling-an-unsupported-mode\u0022\u003EEnabling an Unsupported Mode\u003C/h3\u003E\n\u003Cp\u003EAn enum value or default template does not establish that a mode is ready for production.\u003C/p\u003E\n\u003Cp\u003EUse only modes supported by the current implementation.\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.Session.Lifetime = 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.Session.Lifetime = 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", "Headings": [ { "Id": "configuration-versus-extensibility", @@ -69,13 +69,23 @@ "Level": 0 }, { - "Id": "pureopaque", - "Text": "PureOpaque", + "Id": "mode-defined-credential-behavior", + "Text": "Mode-defined credential behavior", "Level": 1 }, { - "Id": "hybrid", - "Text": "Hybrid", + "Id": "mode-specific-configuration-behavior", + "Text": "Mode-specific configuration behavior", + "Level": 1 + }, + { + "Id": "global-values-and-mode-overrides", + "Text": "Global values and mode overrides", + "Level": 1 + }, + { + "Id": "validation-requirements-are-independent-of-mode-selection", + "Text": "Validation requirements are independent of mode selection", "Level": 1 }, { @@ -324,8 +334,8 @@ "Level": 1 }, { - "Id": "enabling-an-unsupported-mode", - "Text": "Enabling an Unsupported Mode", + "Id": "configuring-incompatible-authentication-components", + "Text": "Configuring incompatible authentication components", "Level": 1 }, { @@ -369,6 +379,6 @@ "Level": 0 } ], - "SourceHash": "7255AB8639ABABF63647A5C3B280F4A3A4C3EED278441D012C4F420BDD710D81", + "SourceHash": "13D63D99FEAFC86BBDD3BFC585DB829F863E7064D91A964216D46C0186C014F3", "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 462bb857..b22c86d9 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\u003EUAuthSessionOptions\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.Session.Lifetime = TimeSpan.FromHours(8);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server consumes \u003Ccode\u003Eoptions.Session\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\n options.Session.Lifetime = TimeSpan.FromHours(8);\n\n options.Token.AccessTokenLifetime =\n 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\u003ESession.Lifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession 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=\u0022core-options-are-composed-into-server-options\u0022\u003E3. Core Options Are Composed into Server Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthServerOptions\u003C/code\u003E includes the following Core-defined option 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\u003Epublic UAuthLoginOptions Login { get; set; } = new();\n\npublic UAuthSessionOptions Session { get; set; } = new();\n\npublic UAuthTokenOptions Token { get; set; } = new();\n\npublic UAuthPkceOptions Pkce { get; set; } = new();\n\npublic UAuthMultiTenantOptions MultiTenant { get; set; } = new();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is composition, not duplication.\u003C/p\u003E\n\u003Cp\u003EThe Core package owns the shared option definitions, while the Server package uses those definitions as part of its effective server configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended\u0022\u003ERecommended\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.Session.Lifetime = TimeSpan.FromHours(8);\n options.Pkce.Enabled = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022not-recommended-for-server-configuration\u0022\u003ENot Recommended for Server 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.AddUltimateAuth(options =\u0026gt;\n{\n options.Session.Lifetime = TimeSpan.FromHours(8);\n});\n\nbuilder.Services.AddUltimateAuthServer();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe second example configures \u003Ccode\u003EUAuthOptions\u003C/code\u003E, not the \u003Ccode\u003EUAuthServerOptions\u003C/code\u003E instance consumed by the server\u0027s authentication runtime.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EWhen using UltimateAuth Server, configure Core-defined behavior through \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E or the \u003Ccode\u003EUltimateAuth:Server\u003C/code\u003E configuration section.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EDirect Core configuration is intended for scenarios that explicitly consume \u003Ccode\u003EUAuthOptions\u003C/code\u003E rather than the server configuration model.\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.Session.Lifetime = 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.Session.Lifetime = 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;Session\u0026quot;: {\n \u0026quot;Lifetime\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.Session.Lifetime = 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 currently implements PureOpaque, Hybrid, and PureJwt.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid remains unavailable.\u003C/p\u003E\n\u003Cp\u003EThe effective authentication mode is resolved from server-controlled configuration and application profile defaults.\u003C/p\u003E\n\u003Cp\u003EResource API mode resolution is independent from UAuthHub mode resolution. A Resource API does not automatically discover or adopt the mode selected for a particular client by UAuthHub.\u003C/p\u003E\n\u003Cp\u003EFor supported modes and their behavior, 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=\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.Session.Lifetime = 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.Session.Lifetime = 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 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\u003EUAuthSessionOptions\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.Session.Lifetime = TimeSpan.FromHours(8);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server consumes \u003Ccode\u003Eoptions.Session\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\n options.Session.Lifetime = TimeSpan.FromHours(8);\n\n options.Token.AccessTokenLifetime =\n 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\u003ESession.Lifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession 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.Session.Lifetime = 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.Session.Lifetime = 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;Session\u0026quot;: {\n \u0026quot;Lifetime\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.Session.Lifetime = 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.Session.Lifetime = 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.Session.Lifetime = 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", @@ -19,20 +19,10 @@ "Level": 1 }, { - "Id": "core-options-are-composed-into-server-options", - "Text": "3. Core Options Are Composed into Server Options", + "Id": "configuration-ownership", + "Text": "3. Configuration Ownership", "Level": 0 }, - { - "Id": "recommended", - "Text": "Recommended", - "Level": 1 - }, - { - "Id": "not-recommended-for-server-configuration", - "Text": "Not Recommended for Server Configuration", - "Level": 1 - }, { "Id": "server-configuration-groups", "Text": "4. Server Configuration Groups", @@ -219,6 +209,6 @@ "Level": 0 } ], - "SourceHash": "883FED0F4CB86E1D29516B4FA8860589031443596924A19064F4763A3988BD83", + "SourceHash": "6855B63F33EF64E980DE08EC5194B37ECE4AC0B05C1C82898E13058F7DB9814E", "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 1816499e..ab89c94b 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.Session.Lifetime = 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;Session\u0026quot;: {\n \u0026quot;Lifetime\u0026quot;: \u0026quot;7.00:00:00\u0026quot;\n },\n \u0026quot;Token\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 contains two categories of configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022core-defined-options\u0022\u003ECore-defined options\u003C/h3\u003E\n\u003Cp\u003EThese types are defined in UltimateAuth Core and composed into the server options:\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\u003EType\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\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthLoginOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin attempts and lockout behavior\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\u003EUAuthSessionOptions\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\u003E\u003Ccode\u003EUAuthTokenOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAccess and refresh token behavior\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\u003EUAuthPkceOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE authorization code lifetime\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthMultiTenantOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant identification and resolution\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPagination\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthPaginationOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPagination defaults and limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthEvents\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\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-specific-options\u0022\u003EServer-specific options\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\u003EPurpose\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\u003ERestrict 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\u003EDescribe the relationship between UAuthHub and the application\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 and flow settings\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ECookie\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECookie names, security attributes, and lifetime 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 incoming credential resolution\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEndpoint groups and disabled actions\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\u003EResetCredential\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential recovery code and token settings\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, normalization, and uniqueness\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIdentifierValidation\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EUsername, email, and phone validation\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 allowed 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 capabilities\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENavigation\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication navigation behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDiagnostics\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EOptional diagnostic response details\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EAdvanced configuration hooks are also available, including \u003Ccode\u003EConfigureMode()\u003C/code\u003E and \u003Ccode\u003EOnConfigureEndpoints\u003C/code\u003E.\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 lifetime, 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.Lifetime = TimeSpan.FromDays(7);\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\u003ELifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E7 days\u003C/td\u003E\n\u003Ctd\u003EStandard session lifetime\u003C/td\u003E\n\u003C/tr\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\u003ELifetime\u003C/code\u003E determines the standard lifetime assigned to a session.\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\u003EMaxChainsPerUser\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E0\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReserved user-level chain limit\u003C/td\u003E\n\u003C/tr\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\u003EMaxChainsPerPlatform\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReserved platform-specific chain limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPlatformCategories\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReserved platform group definitions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaxChainsPerCategory\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReserved category-specific chain limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnableIpBinding\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReserved IP binding setting\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEnableUserAgentBinding\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReserved User-Agent binding setting\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\u003EReserved device mismatch behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003ECurrent implementation limitation:\u003C/strong\u003E The source identifies several device limits and binding settings as reserved for future enforcement. Setting these properties must not be treated as proof that the corresponding protection is active.\u003C/p\u003E\n\u003Cp\u003EFor example, do not rely on:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Session.MaxChainsPerUser = 1;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Eas a production guarantee that only one device chain can exist unless the current runtime implementation has been verified to enforce that restriction.\u003C/p\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\u003E\u003Ccode\u003EHybrid\u003C/code\u003E explicitly sets \u003Ccode\u003ETouchInterval\u003C/code\u003E to \u003Ccode\u003Enull\u003C/code\u003E.\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 access and refresh token 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\u003Ebuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Token.Issuer = \u0026quot;MyApplication\u0026quot;;\n options.Token.Audience = \u0026quot;MyApplicationApi\u0026quot;;\n options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10);\n options.Token.RefreshTokenLifetime = TimeSpan.FromDays(7);\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\u003EIssueJwt\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnable JWT issuance where supported by the effective mode\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIssueOpaque\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnable opaque token issuance where supported\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EIssueRefresh\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\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\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 token 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\u003EAddJwtIdClaim\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EInclude a JWT identifier claim\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=\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 controls how the server distinguishes a closely timed duplicate refresh request from a confirmed replay.\u003C/p\u003E\n\u003Cp\u003EA duplicate refresh request is still rejected.\u003C/p\u003E\n\u003Cp\u003EThe window affects the replay-response classification, including whether the token family should be revoked.\u003C/p\u003E\n\u003Cp\u003EIt does \u003Cstrong\u003Enot\u003C/strong\u003E allow the same consumed refresh token to be used successfully more than once.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-defaults-may-override-token-values\u0022\u003EMode Defaults May Override Token Values\u003C/h3\u003E\n\u003Cp\u003EThe effective \u003Ccode\u003EHybrid\u003C/code\u003E configuration explicitly sets:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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);\nToken.RefreshTokenLifetime = TimeSpan.FromDays(7);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ETherefore, a different value configured globally may be replaced when the effective mode is resolved.\u003C/p\u003E\n\u003Cp\u003ETo customize the lifetime for \u003Ccode\u003EHybrid\u003C/code\u003E, 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(5);\n });\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis distinction is essential when configuring token lifetimes.\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=\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=\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.Session.Lifetime = 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.Session.Lifetime = 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=\u0022unsupported-modes\u0022\u003EUnsupported 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.PureJwt\n ];\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe current validator rejects explicitly enabling \u003Ccode\u003EPureJwt\u003C/code\u003E because that mode is not yet implemented as a supported server mode.\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.Session.Lifetime = 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=\u0022enabling-unsupported-modes\u0022\u003EEnabling Unsupported Modes\u003C/h3\u003E\n\u003Cp\u003EAn authentication mode appearing in an enum does not guarantee runtime support.\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.Session.Lifetime = 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;Session\u0026quot;: {\n \u0026quot;Lifetime\u0026quot;: \u0026quot;7.00:00:00\u0026quot;\n },\n \u0026quot;Token\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\u003EReserved device 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[ApplicationProfile.BlazorServer] = UAuthMode.PureOpaque;\n options.ApplicationProfileModes[ApplicationProfile.BlazorWasm] = UAuthMode.SemiHybrid;\n options.ApplicationProfileModes[ApplicationProfile.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.Session.Lifetime = 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.Session.Lifetime = 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=\u0022enabling-unsupported-modes\u0022\u003EEnabling Unsupported Modes\u003C/h3\u003E\n\u003Cp\u003EAn authentication mode appearing in an enum does not guarantee runtime support.\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", @@ -18,16 +18,6 @@ "Text": "2. Server Options Architecture", "Level": 0 }, - { - "Id": "core-defined-options", - "Text": "Core-defined options", - "Level": 1 - }, - { - "Id": "server-specific-options", - "Text": "Server-specific options", - "Level": 1 - }, { "Id": "login-options", "Text": "3. Login Options", @@ -83,14 +73,24 @@ "Text": "Available Properties", "Level": 1 }, + { + "Id": "mode-specific-applicability", + "Text": "Mode-specific applicability", + "Level": 1 + }, + { + "Id": "session-identifiers-and-credentials", + "Text": "Session identifiers and credentials", + "Level": 1 + }, { "Id": "refresh-token-concurrency-window", "Text": "Refresh Token Concurrency Window", "Level": 1 }, { - "Id": "mode-defaults-may-override-token-values", - "Text": "Mode Defaults May Override Token Values", + "Id": "mode-specific-token-configuration", + "Text": "Mode-specific token configuration", "Level": 1 }, { @@ -113,6 +113,11 @@ "Text": "Default Mode Resolution", "Level": 1 }, + { + "Id": "application-profile-specific-modes", + "Text": "Application-profile-specific modes", + "Level": 1 + }, { "Id": "explicit-purejwt-configuration", "Text": "Explicit PureJwt Configuration", @@ -123,6 +128,31 @@ "Text": "Configure Mode-Specific Behavior", "Level": 1 }, + { + "Id": "a.validation-options", + "Text": "7/A. Validation Options", + "Level": 0 + }, + { + "Id": "default-validation-requirement", + "Text": "Default validation requirement", + "Level": 1 + }, + { + "Id": "endpoint-specific-validation", + "Text": "Endpoint-specific validation", + "Level": 1 + }, + { + "Id": "application-defined-endpoints", + "Text": "Application-defined endpoints", + "Level": 1 + }, + { + "Id": "resource-api-validation", + "Text": "Resource API validation", + "Level": 1 + }, { "Id": "endpoint-options", "Text": "8. Endpoint Options", @@ -498,11 +528,6 @@ "Text": "Example: Invalid Base Path", "Level": 1 }, - { - "Id": "unsupported-modes", - "Text": "Unsupported Modes", - "Level": 1 - }, { "Id": "validation-limitations", "Text": "Validation Limitations", @@ -574,6 +599,6 @@ "Level": 0 } ], - "SourceHash": "990F063FDBD7E1963C970F6AE0B60F2752BB3DE15ECF450456DB439ACE23A6AF", + "SourceHash": "BA65959E40A59F01C10769CC3934ACAB4F3764C1C7FD03731576C7FE50B81417", "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 6a6820ee..634d5734 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 @@ -1,194 +1,129 @@ { "Slug": "fundamentals/auth-modes", "Title": "Authentication Modes", - "Html": "\n\u003Cp\u003EUltimateAuth provides four authentication modes: \u003Cstrong\u003EPureOpaque\u003C/strong\u003E, \u003Cstrong\u003EHybrid\u003C/strong\u003E, \u003Cstrong\u003ESemiHybrid\u003C/strong\u003E, and \u003Cstrong\u003EPureJwt\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EEach mode defines how authentication credentials are issued, validated, renewed, and revoked. The modes share the same authentication and authorization architecture, but differ in their reliance on server-side sessions, credential formats, and lifecycle guarantees.\u003C/p\u003E\n\u003Cp\u003EThe choice of authentication mode affects more than performance. It determines where authentication state is maintained, whether a server-side session must be consulted during an authenticated request, and how quickly previously issued credentials can be invalidated.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailability\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EPureOpaque, Hybrid, and PureJwt are implemented authentication modes.\nSemiHybrid remains reserved for a future implementation and should not be used in production.\u003C/p\u003E\n\u003Cp\u003EPureJwt supports locally validated JWT access tokens and stateful refresh-token rotation without requiring server-side authentication sessions.\u003C/p\u003E\n\u003Cp\u003EResource API authentication is configured independently from the issuing UAuthHub. Matching authentication mode names alone do not guarantee credential compatibility.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022auth-credentials\u0022\u003EAuth credentials\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth distinguishes three credential concepts.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESession credential\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EA session credential identifies an authenticated session maintained by the server. In PureOpaque, it is the credential presented by the client to authenticate requests.\u003C/p\u003E\n\u003Cp\u003EA session credential may be represented by an opaque, randomly generated value. It does not need to expose the internal database identifier of the session.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAccess token\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EAn access token is a credential used to authenticate requests to protected resources.\u003C/p\u003E\n\u003Cp\u003EDepending on the mode, it may be:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAn opaque token resolved and validated by the server.\u003C/li\u003E\n\u003Cli\u003EA JWT validated cryptographically without a session lookup.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EAn access token is not a session identifier. In Hybrid, the JWT access token is a separate credential issued alongside a server-side session. The session remains authoritative for session-backed authentication and lifecycle management.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ERefresh token\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EA refresh token allows an existing authentication context to continue by obtaining replacement credentials without requiring the user to authenticate again.\u003C/p\u003E\n\u003Cp\u003ERefresh tokens have their own validation, expiration, rotation, and replay-protection requirements.\u003C/p\u003E\n\u003Cp\u003ENot every authentication mode requires all three credential types.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-comparison\u0022\u003EMode comparison\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ECharacteristic\u003C/th\u003E\n\u003Cth\u003EPureOpaque\u003C/th\u003E\n\u003Cth\u003EHybrid\u003C/th\u003E\n\u003Cth\u003ESemiHybrid\u003C/th\u003E\n\u003Cth\u003EPureJwt\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession credential\u003C/td\u003E\n\u003Ctd\u003EOpaque\u003C/td\u003E\n\u003Ctd\u003EOpaque\u003C/td\u003E\n\u003Ctd\u003ESession-backed\u003C/td\u003E\n\u003Ctd\u003ENone\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess token\u003C/td\u003E\n\u003Ctd\u003ENone\u003C/td\u003E\n\u003Ctd\u003EJWT\u003C/td\u003E\n\u003Ctd\u003EJWT\u003C/td\u003E\n\u003Ctd\u003EJWT\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh token\u003C/td\u003E\n\u003Ctd\u003ENone\u003C/td\u003E\n\u003Ctd\u003EStateful\u003C/td\u003E\n\u003Ctd\u003EStateful\u003C/td\u003E\n\u003Ctd\u003EStateful\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServer-side session\u003C/td\u003E\n\u003Ctd\u003ERequired\u003C/td\u003E\n\u003Ctd\u003ERequired\u003C/td\u003E\n\u003Ctd\u003ERequired\u003C/td\u003E\n\u003Ctd\u003ENot required\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess validation\u003C/td\u003E\n\u003Ctd\u003ESession validation\u003C/td\u003E\n\u003Ctd\u003EMode-specific session authority\u003C/td\u003E\n\u003Ctd\u003EJWT validation\u003C/td\u003E\n\u003Ctd\u003ELocal JWT validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh continuity\u003C/td\u003E\n\u003Ctd\u003ESession touch\u003C/td\u003E\n\u003Ctd\u003ESession and refresh lifecycle\u003C/td\u003E\n\u003Ctd\u003ESession and refresh lifecycle\u003C/td\u003E\n\u003Ctd\u003ERefresh chain rotation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EImmediate session revocation\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003ESession-backed operations\u003C/td\u003E\n\u003Ctd\u003ESession-backed operations\u003C/td\u003E\n\u003Ctd\u003ENot applicable\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EImmediate JWT revocation\u003C/td\u003E\n\u003Ctd\u003ENot applicable\u003C/td\u003E\n\u003Ctd\u003EDepends on validation strategy\u003C/td\u003E\n\u003Ctd\u003EAdditional enforcement required\u003C/td\u003E\n\u003Ctd\u003ENot supported by local validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDevice binding\u003C/td\u003E\n\u003Ctd\u003ESession-based\u003C/td\u003E\n\u003Ctd\u003ESession/token-based\u003C/td\u003E\n\u003Ctd\u003EPlanned\u003C/td\u003E\n\u003Ctd\u003EJWT and refresh-token binding\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResource API support\u003C/td\u003E\n\u003Ctd\u003EOpaque session validation\u003C/td\u003E\n\u003Ctd\u003ESession validation path; JWT integration incomplete\u003C/td\u003E\n\u003Ctd\u003ENot implemented\u003C/td\u003E\n\u003Ctd\u003ELocal JWT validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMain advantage\u003C/td\u003E\n\u003Ctd\u003ESimple, centrally controlled sessions\u003C/td\u003E\n\u003Ctd\u003ESeparate token lifecycle with session authority\u003C/td\u003E\n\u003Ctd\u003EStateless access validation with session management\u003C/td\u003E\n\u003Ctd\u003EMinimal authentication-state dependencies\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMain trade-off\u003C/td\u003E\n\u003Ctd\u003ESession lookup on each authenticated request\u003C/td\u003E\n\u003Ctd\u003EMore credentials and lifecycle complexity\u003C/td\u003E\n\u003Ctd\u003EExisting JWTs can remain valid after session revocation\u003C/td\u003E\n\u003Ctd\u003ENo immediate server-side session revocation\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe comparison describes authentication behavior, not guaranteed throughput rankings. Actual performance depends on token validation costs, storage infrastructure, caching, network latency, request volume, and application architecture.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022pureopaque\u0022\u003EPureOpaque\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022fully-session-based-authentication\u0022\u003EFully session-based authentication\u003C/h3\u003E\n\u003Cp\u003EPureOpaque is UltimateAuth\u0027s simplest stateful authentication mode.\u003C/p\u003E\n\u003Cp\u003EAuthentication is represented by a server-side session. The client receives an opaque session credential and presents it on subsequent authenticated requests.\u003C/p\u003E\n\u003Cp\u003EThe server resolves the credential, validates the session and its applicable security policies, and establishes the authenticated identity.\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 | Session Credential\n v\nSession Resolution\n |\n v\nSession Validation\n |\n v\nAuthenticated Identity\n |\n v\nAccessContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EPureOpaque does not issue a separate access token or refresh token.\u003C/p\u003E\n\u003Cp\u003EThe session credential itself is sufficient to identify the authentication context, provided the server determines that the session remains valid.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-continuation\u0022\u003ESession continuation\u003C/h3\u003E\n\u003Cp\u003EPureOpaque does not use refresh-token rotation.\u003C/p\u003E\n\u003Cp\u003EInstead, an existing session may continue through session touch operations, subject to the configured session policies.\u003C/p\u003E\n\u003Cp\u003EDepending on the configuration, these policies may include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESession lifetime.\u003C/li\u003E\n\u003Cli\u003ESliding expiration.\u003C/li\u003E\n\u003Cli\u003EIdle timeout.\u003C/li\u003E\n\u003Cli\u003ETouch interval.\u003C/li\u003E\n\u003Cli\u003EAbsolute expiration limits.\u003C/li\u003E\n\u003Cli\u003ESession revocation.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA touch operation does not necessarily extend the session lifetime. It updates session state only when the applicable policy requires it.\u003C/p\u003E\n\u003Cp\u003EAn expired or revoked session cannot be restored merely by touching it.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022advantages\u0022\u003EAdvantages\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003EMinimal credential complexity\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThere is no separate access-token lifecycle, refresh-token storage, or refresh-token rotation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImmediate session revocation\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EWhen a session is revoked, subsequent authentication evaluations that validate that session reject the credential.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ECentralized authentication control\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe server remains authoritative for session validity and can enforce current session policies.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ENatural integration with server-rendered applications\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EApplications already maintaining server-side authentication state can use a single session credential without introducing additional token-management mechanisms.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022limitations\u0022\u003ELimitations\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ESession validation is required\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EEvery authenticated request must validate the server-side session. Depending on the deployment, this can involve a database or distributed cache lookup.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAvailability depends on session infrastructure\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EA distributed deployment needs reliable access to shared session state or an equivalent session-validation mechanism.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EThe session credential is sensitive\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EPossession of a valid session credential may be sufficient to authenticate as the session owner. It must be protected against disclosure, replay, and session fixation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ELong-lived connections require special handling\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EIn environments such as Blazor Server, an established SignalR circuit may outlive the authentication state initially used to establish it. Appropriate revalidation and authorization checks remain necessary.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-applications\u0022\u003ERecommended applications\u003C/h3\u003E\n\u003Cp\u003EPureOpaque is generally a strong default for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EBlazor Server applications.\u003C/li\u003E\n\u003Cli\u003EASP.NET Core MVC and Razor Pages applications.\u003C/li\u003E\n\u003Cli\u003EInternal applications using centrally managed sessions.\u003C/li\u003E\n\u003Cli\u003EBrowser applications using secure, HttpOnly session cookies.\u003C/li\u003E\n\u003Cli\u003ESystems that prioritize simple session lifecycle management and immediate server-side revocation.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EPureOpaque is not restricted to server-to-server communication. It can also be used safely with browser and mobile clients when credentials are stored, transported, and validated appropriately.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022hybrid\u0022\u003EHybrid\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-backed-authentication-with-separate-tokens\u0022\u003ESession-backed authentication with separate tokens\u003C/h3\u003E\n\u003Cp\u003EHybrid combines server-authoritative authentication sessions with JWT access tokens and opaque refresh tokens.\u003C/p\u003E\n\u003Cp\u003EA successful login establishes a server-side session and issues separate access and refresh credentials.\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\u003EAuthentication\n |\n \u002B----\u0026gt; Opaque Session Credential\n | |\n | Session Validation\n | |\n | Root / Chain / Session\n |\n \u002B----\u0026gt; JWT Access Token\n |\n \u002B----\u0026gt; Opaque Refresh Token\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe session identifier, access token, and refresh token represent different credentials with different responsibilities.\u003C/p\u003E\n\u003Cp\u003EThe server-side session remains authoritative for session-backed authentication. Issuing a JWT does not automatically make Hybrid authentication stateless.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022current-resource-api-support\u0022\u003ECurrent Resource API support\u003C/h3\u003E\n\u003Cp\u003EIn the current implementation, Hybrid Resource APIs authenticate requests using the opaque session credential and validate the session remotely through UAuthHub.\u003C/p\u003E\n\u003Cp\u003EHybrid-aware JWT access-token validation in separate Resource APIs is not yet implemented.\u003C/p\u003E\n\u003Cp\u003EApplications requiring independent JWT validation should explicitly select PureJwt and configure compatible signing and verification keys.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-and-session-lifecycle\u0022\u003ERefresh and session lifecycle\u003C/h3\u003E\n\u003Cp\u003EHybrid uses refresh tokens to continue authentication without requiring the user to authenticate again.\u003C/p\u003E\n\u003Cp\u003EA successful refresh validates the relevant session and refresh-token state, applies the configured session policies, and issues replacement credentials.\u003C/p\u003E\n\u003Cp\u003ESession lifetime, access-token lifetime, and refresh-token lifetime are separate concerns.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022advantages-1\u0022\u003EAdvantages\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003EServer-authoritative authentication\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003ESession-backed requests remain subject to server-side session validation and lifecycle policies.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ECentralized session management\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EApplications retain access to device-associated sessions, session chains, revocation, and other session-management capabilities.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESeparate credential lifetimes\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EAccess and refresh credentials can have lifetimes appropriate to their individual responsibilities.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUnified application integration\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EHybrid provides a common authentication model for browser applications, native clients, and centralized authentication deployments.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022limitations-1\u0022\u003ELimitations\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003EServer-side state\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EHybrid requires session infrastructure and refresh-token lifecycle management.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ERemote validation dependency\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003ESeparate Resource APIs using session validation depend on the availability of the authentication server.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EJWT integration boundaries\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EHybrid JWT access tokens must not be treated as interchangeable with PureJwt access tokens. The current Resource API implementation does not support Hybrid-aware JWT validation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ECredential confidentiality\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EJWT payloads are readable by their holders. Signing protects integrity and authenticity, not confidentiality.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-applications-1\u0022\u003ERecommended applications\u003C/h3\u003E\n\u003Cp\u003EHybrid is particularly useful for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EBlazor WebAssembly applications.\u003C/li\u003E\n\u003Cli\u003ENative and mobile applications.\u003C/li\u003E\n\u003Cli\u003EApplications using centralized authentication through UAuthHub.\u003C/li\u003E\n\u003Cli\u003EApplications requiring token-based credential delivery while retaining server-authoritative session management.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EHybrid is the default authentication mode for application profiles other than BlazorServer under the built-in mode resolver.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022semihybrid\u0022\u003ESemiHybrid\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022stateless-jwt-validation-with-server-side-session-lifecycle\u0022\u003EStateless JWT validation with server-side session lifecycle\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid combines JWT access tokens with server-side session management.\u003C/p\u003E\n\u003Cp\u003EIts defining characteristic is the separation between \u003Cstrong\u003Eaccess-token validation\u003C/strong\u003E and \u003Cstrong\u003Esession lifecycle operations\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EFor normal authenticated requests, the server validates the JWT cryptographically. A session lookup is not required by default.\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\nJWT Validation\n |\n v\nAuthenticated Identity\n |\n v\nAccessContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server-side session is not consulted during this normal authentication path.\u003C/p\u003E\n\u003Cp\u003EHowever, the session remains relevant when the authentication lifecycle must be managed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-session-metadata-is-used-for\u0022\u003EWhat session metadata is used for\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid maintains server-side session state for operations such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ERefresh-token validation and rotation.\u003C/li\u003E\n\u003Cli\u003ELogout and session termination.\u003C/li\u003E\n\u003Cli\u003ERevoking an individual session.\u003C/li\u003E\n\u003Cli\u003ERevoking all sessions belonging to a user.\u003C/li\u003E\n\u003Cli\u003EListing active sessions or devices.\u003C/li\u003E\n\u003Cli\u003EEnforcing session expiration and continuation policies.\u003C/li\u003E\n\u003Cli\u003ERecording session lifecycle information.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThis state is a \u003Cstrong\u003Elifecycle control mechanism\u003C/strong\u003E, not a mandatory source of identity validation on every API request.\u003C/p\u003E\n\u003Cp\u003EFor example, when a user logs out, the server can revoke the session and prevent subsequent refresh operations from continuing it.\u003C/p\u003E\n\u003Cp\u003EHowever, a previously issued JWT may remain valid until its expiration because normal JWT validation does not consult that session.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022revocation-semantics\u0022\u003ERevocation semantics\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid must distinguish two separate guarantees.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESession revocation\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003ERevoking the session prevents authentication continuation through that session, including refresh operations that require it.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAccess-token revocation\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003ERevoking the session does not automatically invalidate an already issued JWT.\u003C/p\u003E\n\u003Cp\u003EImmediate rejection of an issued JWT requires an additional mechanism, such as a revocation lookup against a distributed cache.\u003C/p\u003E\n\u003Cp\u003ESuch a mechanism can be supported as an explicit policy, but it introduces an additional request-time dependency and validation cost.\u003C/p\u003E\n\u003Cp\u003EWithout that policy, JWT expiration remains the boundary for an already issued access token.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022advantages-2\u0022\u003EAdvantages\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003EStateless normal request validation\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EProtected API requests can authenticate JWTs without consulting the session store.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ECentralized lifecycle management\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EApplications retain the ability to manage sessions, devices, refresh operations, and future authentication continuity.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EReduced request-time storage dependencies\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003ESession infrastructure is not part of the default JWT validation path.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EConfigurable revocation trade-offs\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EApplications can choose whether to introduce additional request-time revocation enforcement when stronger invalidation guarantees are required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022limitations-2\u0022\u003ELimitations\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ESession revocation does not automatically revoke issued JWTs\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EAn access token can remain valid after logout until its expiration unless an additional revocation mechanism is enforced.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ELifecycle state is still required\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003ESemiHybrid is not a session-free mode. Refresh and session management depend on server-side state.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EMore complex expiration semantics\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EJWT expiration, refresh-token expiration, session expiration, and session activity policies must be coordinated.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EOptional revocation checks reduce statelessness\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EIf immediate access-token revocation is enabled, the request pipeline may need an additional cache or store lookup.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-applications-2\u0022\u003ERecommended applications\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid is intended for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EHigh-throughput APIs that still require centralized session management.\u003C/li\u003E\n\u003Cli\u003EDistributed applications using short-lived JWT access tokens.\u003C/li\u003E\n\u003Cli\u003EApplications offering device and active-session management.\u003C/li\u003E\n\u003Cli\u003ESystems that need JWT validation performance without giving up refresh and session lifecycle control.\u003C/li\u003E\n\u003Cli\u003EArchitectures where access-token expiration is an acceptable default revocation boundary.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003ESemiHybrid should not be described as providing immediate JWT revocation unless an additional enforcement mechanism is enabled.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt\u0022\u003EPureJwt\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-independent-authentication-with-stateful-refresh\u0022\u003ESession-independent authentication with stateful refresh\u003C/h3\u003E\n\u003Cp\u003EPureJwt authenticates protected requests using cryptographically signed JWT access tokens without requiring Root, Chain, or Session records.\u003C/p\u003E\n\u003Cp\u003EUnlike a fully stateless authentication system, UltimateAuth\u0027s PureJwt implementation maintains server-side state for refresh-token lifecycle management.\u003C/p\u003E\n\u003Cp\u003EThis distinction is intentional:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAccess-token validation is stateless.\u003C/li\u003E\n\u003Cli\u003ERefresh-token validation and rotation are stateful.\u003C/li\u003E\n\u003Cli\u003ERefresh tokens are associated with a refresh chain and device context.\u003C/li\u003E\n\u003Cli\u003ELogout can revoke the corresponding refresh chain.\u003C/li\u003E\n\u003Cli\u003EPreviously issued JWT access tokens remain independently valid until expiration unless another validation condition invalidates them.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication\u0022\u003EAuthentication\u003C/h3\u003E\n\u003Cp\u003EAfter successful authentication, UltimateAuth issues a JWT access token and a refresh token.\u003C/p\u003E\n\u003Cp\u003EThe JWT includes the authenticated subject, tenant, device identifier, and applicable identity claims.\u003C/p\u003E\n\u003Cp\u003EA PureJwt access token does not contain a framework session identity.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022access-token-validation\u0022\u003EAccess-token validation\u003C/h3\u003E\n\u003Cp\u003EA Resource API validates JWT access tokens locally using:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ETrusted verification keys selected by key ID (\u003Ccode\u003Ekid\u003C/code\u003E).\u003C/li\u003E\n\u003Cli\u003EAn explicitly allowed signing algorithm.\u003C/li\u003E\n\u003Cli\u003EExpected issuer and audience.\u003C/li\u003E\n\u003Cli\u003EToken signature and lifetime.\u003C/li\u003E\n\u003Cli\u003EThe UltimateAuth access-token type (\u003Ccode\u003Euauth-access\u002Bjwt\u003C/code\u003E).\u003C/li\u003E\n\u003Cli\u003ETenant and subject claims.\u003C/li\u003E\n\u003Cli\u003EDevice binding according to the configured device policy.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EPureJwt Resource APIs do not require \u003Ccode\u003EHub.BaseUrl\u003C/code\u003E for normal access-token validation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-token-lifecycle\u0022\u003ERefresh-token lifecycle\u003C/h3\u003E\n\u003Cp\u003ERefresh tokens are persisted and rotated through a dedicated refresh chain.\u003C/p\u003E\n\u003Cp\u003EA successful refresh consumes the previous refresh token and issues replacement access and refresh credentials.\u003C/p\u003E\n\u003Cp\u003ERefresh rotation preserves the authenticated user, tenant, device, and refresh-chain relationships without creating a server-side authentication session.\u003C/p\u003E\n\u003Cp\u003ERefresh-token reuse outside the configured concurrent-request window can trigger refresh-chain revocation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout\u0022\u003ELogout\u003C/h3\u003E\n\u003Cp\u003EPureJwt logout can revoke the refresh chain associated with a validated refresh token.\u003C/p\u003E\n\u003Cp\u003ERevocation prevents subsequent refresh operations using that chain.\u003C/p\u003E\n\u003Cp\u003ELogout does not retroactively invalidate JWT access tokens already issued to the client.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-considerations\u0022\u003ESecurity considerations\u003C/h3\u003E\n\u003Cp\u003EPureJwt provides independent access-token validation, but it does not provide immediate access-token revocation through session state.\u003C/p\u003E\n\u003Cp\u003EChanges to user status, permissions, or account existence do not automatically invalidate an existing JWT when the Resource API performs only local token validation.\u003C/p\u003E\n\u003Cp\u003EApplications should use appropriately short access-token lifetimes and avoid placing sensitive information in JWT payloads.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-a-mode\u0022\u003EChoosing a mode\u003C/h2\u003E\n\u003Cp\u003EThe most useful selection criterion is not the client technology alone, but the authentication guarantees the application requires.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication or requirement\u003C/th\u003E\n\u003Cth\u003ERecommended mode\u003C/th\u003E\n\u003Cth\u003EReason\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server\u003C/td\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003Ctd\u003EServer-controlled sessions without a separate access/refresh token lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EASP.NET Core MVC or Razor Pages\u003C/td\u003E\n\u003Ctd\u003EPureOpaque\u003C/td\u003E\n\u003Ctd\u003ESimple cookie-based session authentication\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EInternal administrative application\u003C/td\u003E\n\u003Ctd\u003EPureOpaque or Hybrid\u003C/td\u003E\n\u003Ctd\u003ECentralized session control and immediate revocation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor WebAssembly with a separate API\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003EAccess/refresh tokens with authoritative session validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMobile or desktop client\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003EIndependent token lifetimes with centralized session control\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EWeb application with separate frontend and API\u003C/td\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003EToken-based access without losing server-side revocation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHigh-throughput API with session management\u003C/td\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003EStateless JWT validation alongside managed session lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMulti-device application with session controls\u003C/td\u003E\n\u003Ctd\u003ESemiHybrid or Hybrid\u003C/td\u003E\n\u003Ctd\u003ECentralized device/session management; different access-validation costs\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDistributed resource APIs\u003C/td\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003EIndependent JWT validation without mandatory session lookup\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EExternal service integration\u003C/td\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003EStateless token validation across service boundaries\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EImmediate access revocation is essential\u003C/td\u003E\n\u003Ctd\u003EPureOpaque or Hybrid\u003C/td\u003E\n\u003Ctd\u003EEvery authentication evaluation enforces server-side session validity\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ENo session infrastructure is desired\u003C/td\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003EAuthentication does not require session persistence\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese are recommendations, not restrictions.\u003C/p\u003E\n\u003Cp\u003EFor example, Blazor WebAssembly can use PureOpaque through a secure cookie-based backend-for-frontend architecture. Similarly, a server-rendered application can use JWT authentication when its broader system requirements justify it.\u003C/p\u003E\n\u003Cp\u003EThe runtime does not inherently determine the security model.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-profiles-and-authentication-modes\u0022\u003EApplication Profiles and authentication modes\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports different client environments through Application Profiles.\u003C/p\u003E\n\u003Cp\u003EAn Application Profile can provide suitable defaults for a runtime, including credential delivery and authentication-mode selection.\u003C/p\u003E\n\u003Cp\u003EHowever, an Application Profile and an authentication mode represent different concerns.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EApplication Profile\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EDescribes how the application interacts with the authentication system, including runtime characteristics and credential transport.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAuthentication Mode\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EDefines the authentication credential model, session dependencies, validation strategy, and lifecycle guarantees.\u003C/p\u003E\n\u003Cp\u003EA Blazor Server profile may default to PureOpaque, while a Blazor WebAssembly profile may default to Hybrid.\u003C/p\u003E\n\u003Cp\u003EThese defaults do not mean the modes are exclusive to those environments.\u003C/p\u003E\n\u003Cp\u003EApplications can override the effective mode through supported configuration and context-resolution mechanisms.\u003C/p\u003E\n\u003Cp\u003EWhen different clients share the same UAuthHub, the server must resolve the effective mode through trusted configuration and framework-controlled context. An untrusted client must not be allowed to select a weaker authentication policy arbitrarily.\u003C/p\u003E\n\u003Cp\u003EThe effective mode must remain stable throughout a single authentication operation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-considerations-1\u0022\u003ESecurity considerations\u003C/h2\u003E\n\u003Cp\u003EAll four modes can support secure applications when implemented and configured correctly. None should be described as universally more secure than the others.\u003C/p\u003E\n\u003Cp\u003ETheir security guarantees differ.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-confidentiality\u0022\u003ECredential confidentiality\u003C/h3\u003E\n\u003Cp\u003EOpaque credentials do not expose readable claims, but possession of a valid bearer credential may still permit authentication.\u003C/p\u003E\n\u003Cp\u003EJWT signatures protect integrity and authenticity; they do not conceal the payload.\u003C/p\u003E\n\u003Cp\u003EAll credentials require appropriate transport and storage protections.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022revocation-guarantees\u0022\u003ERevocation guarantees\u003C/h3\u003E\n\u003Cp\u003EPureOpaque and Hybrid enforce server-side session validity during authenticated requests.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid enforces session validity during lifecycle operations but does not require it during normal JWT validation.\u003C/p\u003E\n\u003Cp\u003EPureJwt does not depend on sessions and does not provide session-based revocation.\u003C/p\u003E\n\u003Cp\u003EThese differences must be considered when selecting token lifetimes and logout behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022browser-security\u0022\u003EBrowser security\u003C/h3\u003E\n\u003Cp\u003EWhen authentication credentials are delivered through cookies, appropriate \u003Ccode\u003EHttpOnly\u003C/code\u003E, \u003Ccode\u003ESecure\u003C/code\u003E, and \u003Ccode\u003ESameSite\u003C/code\u003E settings should be applied.\u003C/p\u003E\n\u003Cp\u003ECookie-based authentication also requires appropriate CSRF protections.\u003C/p\u003E\n\u003Cp\u003EWhen tokens are accessible to browser application code, XSS and token-exfiltration risks require particular attention.\u003C/p\u003E\n\u003Cp\u003EThe authentication mode does not eliminate these browser security requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-remains-separate\u0022\u003EAuthorization remains separate\u003C/h3\u003E\n\u003Cp\u003EAuthentication establishes the identity of the current actor.\u003C/p\u003E\n\u003Cp\u003EAuthorization determines what that actor is permitted to do.\u003C/p\u003E\n\u003Cp\u003EAll modes must produce trusted authentication state before authorization policies are evaluated.\u003C/p\u003E\n\u003Cp\u003EChoosing a stateless mode does not remove the need for authorization checks or appropriate handling of stale authorization claims.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022summary\u0022\u003ESummary\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth\u0027s four authentication modes represent four distinct strategies:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EPureOpaque\u003C/strong\u003E uses a server-side session as the authentication authority and avoids a separate access/refresh token lifecycle.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EHybrid\u003C/strong\u003E combines server-authoritative sessions with JWT access tokens and opaque refresh tokens. The current Resource API implementation authenticates Hybrid requests through remote session validation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESemiHybrid\u003C/strong\u003E uses JWT access tokens for stateless request authentication while retaining server-side sessions for refresh, logout, revocation, and device management.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EPureJwt\u003C/strong\u003E uses JWT access tokens without requiring server-side session infrastructure.\u003C/p\u003E\n\u003Cp\u003EThe correct mode is the one whose validation, lifecycle, revocation, and operational guarantees match the application\u0027s requirements.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth preserves a consistent authentication and authorization architecture while allowing these underlying strategies to differ.\u003C/p\u003E\n", + "Html": "\n\u003Cp\u003EUltimateAuth introduces four authentication modes: \u003Cstrong\u003EPureOpaque\u003C/strong\u003E, \u003Cstrong\u003EHybrid\u003C/strong\u003E, \u003Cstrong\u003ESemiHybrid\u003C/strong\u003E, and \u003Cstrong\u003EPureJwt\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThey use the same authentication flows, application profiles, authorization model, and client abstractions. What changes is \u003Cstrong\u003Ehow an authenticated request proves identity, which server-side state must be checked, and when revocation becomes effective\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThere is no universally best mode. Choose the validation and lifecycle guarantees your application needs, then choose how to deliver credentials to each client.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022the-four-modes-at-a-glance\u0022\u003EThe four modes at a glance\u003C/h2\u003E\n\u003Cp\u003EAll four authentication modes provide the same unified developer experience. When using UltimateAuth\u0027s shared APIs, choosing a mode does not make authentication easier or harder to implement.\u003C/p\u003E\n\u003Cp\u003EThe difference lies in the underlying authentication strategy, not in how you write your application code.\u003C/p\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\u003EPhilosophy\u003C/th\u003E\n\u003Cth\u003EWhy choose it?\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EPureOpaque\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EMinimalist authentication\u003C/td\u003E\n\u003Ctd\u003EYou want a streamlined authentication model without unnecessary complexity.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EHybrid\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EGeneral-purpose default\u003C/td\u003E\n\u003Ctd\u003EYou want a balanced, comprehensive solution that grows with your application.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESemiHybrid\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EPerformance tuning\u003C/td\u003E\n\u003Ctd\u003EYou want fine-grained control over the balance between performance and centralized security.\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EPureJwt\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EConventional JWT authentication\u003C/td\u003E\n\u003Ctd\u003EYou prefer session-independent JWT authentication and do not require UltimateAuth\u0027s session-based capabilities.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003ENot sure which mode to choose? \u003Cstrong\u003EStart with Hybrid.\u003C/strong\u003E You can always change your authentication strategy later without rewriting your UltimateAuth integration.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003E\u003C/th\u003E\n\u003Cth\u003EPureOpaque\u003C/th\u003E\n\u003Cth\u003EHybrid\u003C/th\u003E\n\u003Cth\u003ESemiHybrid\u003C/th\u003E\n\u003Cth\u003EPureJwt\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPrimary authentication for protected requests\u003C/td\u003E\n\u003Ctd\u003EOpaque session\u003C/td\u003E\n\u003Ctd\u003EOpaque session\u003C/td\u003E\n\u003Ctd\u003EJWT access token\u003C/td\u003E\n\u003Ctd\u003EJWT access token\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServer-side Root / Chain / Session\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003EYes, metadata and lifecycle\u003C/td\u003E\n\u003Ctd\u003ENo\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession record is an authentication credential\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003E\u003Cstrong\u003ENo\u003C/strong\u003E (\u003Ccode\u003Esid\u003C/code\u003E is metadata)\u003C/td\u003E\n\u003Ctd\u003ENo session ID\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServer-side session validation for ordinary access\u003C/td\u003E\n\u003Ctd\u003ERequired\u003C/td\u003E\n\u003Ctd\u003ERequired\u003C/td\u003E\n\u003Ctd\u003E\u003Cstrong\u003EOptional\u003C/strong\u003E, per validation requirement\u003C/td\u003E\n\u003Ctd\u003ENot applicable\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EJWT validation for ordinary access\u003C/td\u003E\n\u003Ctd\u003ENo\u003C/td\u003E\n\u003Ctd\u003ENot the supported Resource API path\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh token\u003C/td\u003E\n\u003Ctd\u003ENo\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh mechanism\u003C/td\u003E\n\u003Ctd\u003ESession touch\u003C/td\u003E\n\u003Ctd\u003EStateful refresh rotation\u003C/td\u003E\n\u003Ctd\u003EStateful refresh rotation \u002B lineage check\u003C/td\u003E\n\u003Ctd\u003EStateful refresh rotation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECan invalidate a session-backed request promptly\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003Ctd\u003EOnly where \u003Ccode\u003EHubValidated\u003C/code\u003E is enforced\u003C/td\u003E\n\u003Ctd\u003ENo session-based mechanism\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAlready issued JWT survives session logout\u003C/td\u003E\n\u003Ctd\u003ENot applicable\u003C/td\u003E\n\u003Ctd\u003EJWT is not the primary Resource API authentication path\u003C/td\u003E\n\u003Ctd\u003EOn \u003Ccode\u003EStandard\u003C/code\u003E requests, until expiry\u003C/td\u003E\n\u003Ctd\u003EUntil expiry\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESeparate Resource API\u003C/td\u003E\n\u003Ctd\u003ERemote session validation\u003C/td\u003E\n\u003Ctd\u003ERemote session validation\u003C/td\u003E\n\u003Ctd\u003ELocal JWT or remote Hub validation\u003C/td\u003E\n\u003Ctd\u003ELocal JWT validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMain cost\u003C/td\u003E\n\u003Ctd\u003ESession infrastructure on each authenticated request\u003C/td\u003E\n\u003Ctd\u003ESession infrastructure plus token lifecycle\u003C/td\u003E\n\u003Ctd\u003EChoosing appropriate validation for each operation\u003C/td\u003E\n\u003Ctd\u003EStale JWT identity until expiration\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E An opaque session credential is not the same as a JWT containing a session identifier. In SemiHybrid, the JWT\u0027s \u003Ccode\u003Esid\u003C/code\u003E claim identifies server-side lineage for applicable checks; it must never be accepted as an opaque session credential.\u003C/p\u003E\n\u003Cp\u003EThe table describes current framework authentication paths, not benchmark results. Cryptographic validation, session stores, network latency, and infrastructure design all affect real-world performance.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022one-decision-matters-most-when-must-the-server-be-consulted\u0022\u003EOne decision matters most: when must the server be consulted?\u003C/h2\u003E\n\u003Cp\u003EThink about what should happen after a user signs out, an administrator terminates a session, or a device is revoked.\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EEvery protected request must observe session termination:\u003C/strong\u003E use \u003Cstrong\u003EPureOpaque\u003C/strong\u003E or \u003Cstrong\u003EHybrid\u003C/strong\u003E. Their supported protected-resource authentication paths validate server-side session state.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EMost reads can use a JWT, but important operations must observe session termination:\u003C/strong\u003E use \u003Cstrong\u003ESemiHybrid\u003C/strong\u003E. Mark important operations \u003Ccode\u003EHubValidated\u003C/code\u003E and allow eligible requests to use \u003Ccode\u003EStandard\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EProtected resource APIs should not depend on a session service:\u003C/strong\u003E use \u003Cstrong\u003EPureJwt\u003C/strong\u003E. Use short-lived JWTs, because server-side session revocation is not part of JWT authentication.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA JWT\u0027s signature proves that a trusted issuer signed it. It does \u003Cstrong\u003Enot\u003C/strong\u003E prove that the user is still active, the session still exists, or permissions have not changed since issuance.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022pureopaque-one-credential-server-authoritative-sessions\u0022\u003EPureOpaque \u2014 one credential, server-authoritative sessions\u003C/h2\u003E\n\u003Cp\u003EPureOpaque uses a randomly generated opaque session credential. The server resolves the session and validates its current state before accepting the 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\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 -- opaque session --\u0026gt; Server\n |\n v\n Session / Chain / Root\n |\n v\n Authenticated\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EChoose PureOpaque when:\u003C/strong\u003E you prefer a small credential surface, predictable server-side revocation, and a simple session lifecycle. It is especially convenient for Blazor Server, MVC, Razor Pages, internal tools, and browser applications with secure session cookies.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EWhat to expect:\u003C/strong\u003E\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ENo separate JWT access token or rotating refresh-token lifecycle.\u003C/li\u003E\n\u003Cli\u003ESession continuation uses session touch and the configured expiration policies.\u003C/li\u003E\n\u003Cli\u003EA revoked or expired session is rejected when the server next validates it.\u003C/li\u003E\n\u003Cli\u003EEach authenticated request depends on the availability and performance of the session-validation infrastructure.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003E\u003Cstrong\u003EPractical tip:\u003C/strong\u003E If you deploy multiple application instances, configure a shared session store. A fast local process cache is not a substitute for shared authoritative state unless your invalidation design makes that safe.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022pureopaque-is-not-limited-to-server-side-applications\u0022\u003EPureOpaque is not limited to server-side applications\u003C/h3\u003E\n\u003Cp\u003EPureOpaque is often associated with server-rendered applications, but it is equally a valid authentication model for client-side and distributed applications.\u003C/p\u003E\n\u003Cp\u003EBlazor WebAssembly, JavaScript SPAs, .NET MAUI, desktop applications, and separate Resource APIs can all use opaque session credentials when credential delivery and server-side validation are configured appropriately.\u003C/p\u003E\n\u003Cp\u003EA client-side application does not inherently need JWTs. An opaque credential can be transported through a cookie or an HTTP header without exposing identity claims to the client.\u003C/p\u003E\n\u003Cp\u003EThe main consideration is whether the protected resource can consult the authentication authority when validating requests.\u003C/p\u003E\n\u003Cp\u003EFor many applications, including distributed ones, PureOpaque may be the simplest sufficient authentication mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022hybrid-authoritative-sessions-with-a-separate-token-lifecycle\u0022\u003EHybrid \u2014 authoritative sessions with a separate token lifecycle\u003C/h2\u003E\n\u003Cp\u003EHybrid retains the server-side Root / Chain / Session model while supporting separate token issuance and stateful refresh-token rotation.\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 -- opaque session --\u0026gt; Resource API / Server\n |\n v\n Session validation\n |\n v\n Root / Chain / Session\n\n Refresh token --\u0026gt; Refresh rotation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EChoose Hybrid when:\u003C/strong\u003E you need centrally managed devices and sessions, immediate rejection when authoritative session validation runs, and a separate refresh-token lifecycle. It is a useful general-purpose choice for applications that communicate with a central UAuthHub.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA common misunderstanding:\u003C/strong\u003E Hybrid having JWT-related token capabilities does \u003Cstrong\u003Enot\u003C/strong\u003E make its supported Resource API authentication path stateless. The current separate Resource API path authenticates Hybrid through the opaque session credential and session validation. Do not configure the Resource API as PureJwt simply because the issuing system can produce a JWT; mode-specific binding and validation rules differ.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EWhat to expect:\u003C/strong\u003E\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESession validity remains authoritative for the supported request authentication path.\u003C/li\u003E\n\u003Cli\u003ERefresh-token rotation and session lifetime are distinct controls.\u003C/li\u003E\n\u003Cli\u003EA separate Resource API using session validation depends on UAuthHub availability.\u003C/li\u003E\n\u003Cli\u003EMore credential and lifecycle concepts must be configured than in PureOpaque.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003E\u003Cstrong\u003EPractical tip:\u003C/strong\u003E Choose Hybrid for its \u003Cem\u003Eauthority and lifecycle model\u003C/em\u003E, not as an assumed JWT performance optimization. If local JWT validation is the requirement, evaluate SemiHybrid or PureJwt instead.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022semihybrid-jwt-access-with-selective-authoritative-validation\u0022\u003ESemiHybrid \u2014 JWT access with selective authoritative validation\u003C/h2\u003E\n\u003Cp\u003ESemiHybrid uses signed JWT access tokens, \u003Cstrong\u003Eand\u003C/strong\u003E maintains Root / Chain / Session records for authentication lifecycle and selected authoritative operations.\u003C/p\u003E\n\u003Cp\u003EIts defining feature is that \u003Cstrong\u003EJWT validation and authoritative session validation are separate decisions\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EA SemiHybrid JWT includes a \u003Ccode\u003Esid\u003C/code\u003E claim, but the session identifier is \u003Cstrong\u003Emetadata\u003C/strong\u003E, not a bearer session credential. A valid JWT can establish identity without a session lookup when the operation requires only \u003Ccode\u003EStandard\u003C/code\u003E validation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022two-validation-levels\u0022\u003ETwo validation levels\u003C/h3\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\u003EWhat is checked\u003C/th\u003E\n\u003Cth\u003EWhat it does not guarantee\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\u003EJWT signature, lifetime, issuer/audience, identity, and applicable device policy\u003C/td\u003E\n\u003Ctd\u003ECurrent server-side session or chain state\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHubValidated\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EJWT validation \u003Cstrong\u003Eplus\u003C/strong\u003E authoritative session lineage validation\u003C/td\u003E\n\u003Ctd\u003EAutomatic reload of every application role, permission, or business policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\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 SemiHybrid JWT\n |\n v\n Local JWT validation\n |\n Required validation?\n / \\\n Standard HubValidated\n | |\n | Session / Chain / Root\n | |\n \u002B---------\u002B---------\u002B\n |\n v\n Authorization / API\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u003Ccode\u003EHubValidated\u003C/code\u003E is a request-time check, not a permanent upgrade to the JWT.\u003C/strong\u003E A previous successful Hub validation does not make subsequent \u003Ccode\u003EStandard\u003C/code\u003E requests session-aware. UltimateAuth avoids a cross-request authoritative-validation cache by default; same-request reuse is a different optimization.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-happens-after-revocation\u0022\u003EWhat happens after revocation?\u003C/h3\u003E\n\u003Cp\u003ESuppose an administrator terminates the session while its JWT is still within its lifetime:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ENext operation\u003C/th\u003E\n\u003Cth\u003EOutcome\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 endpoint\u003C/td\u003E\n\u003Ctd\u003EThe JWT may still authenticate until expiry\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHubValidated\u003C/code\u003E endpoint\u003C/td\u003E\n\u003Ctd\u003EThe revoked or invalid lineage is rejected\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh\u003C/td\u003E\n\u003Ctd\u003ESession lineage is checked; invalid lineage prevents continuation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ENew login\u003C/td\u003E\n\u003Ctd\u003ERequires the normal authentication flow and applicable admission policies\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThis makes SemiHybrid useful when \u003Cstrong\u003Ethe cost of querying session state on every request is unnecessary, but selected operations need current lifecycle authority\u003C/strong\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-which-operations-need-hubvalidated\u0022\u003EChoosing which operations need HubValidated\u003C/h3\u003E\n\u003Cp\u003EA sensible starting policy is:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EOperation\u003C/th\u003E\n\u003Cth\u003ESuggested requirement\u003C/th\u003E\n\u003Cth\u003EWhy\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ELow-risk catalog reads or user-neutral queries\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EStandard\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EA short-lived JWT is often sufficient\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProfile display, when eventual consistency is acceptable\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EStandard\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAvoids an additional session validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPayment, high-impact changes, or sensitive administrative actions\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHubValidated\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECheck that the session lineage remains active\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESession and device management\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHubValidated\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EThese operations rely on authoritative session state\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ELogin and refresh\u003C/td\u003E\n\u003Ctd\u003ETheir own authentication proof/flow\u003C/td\u003E\n\u003Ctd\u003EDo not treat them as ordinary protected GET requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese are \u003Cstrong\u003Eapplication design recommendations\u003C/strong\u003E, not a promise that every listed example has that default classification. UltimateAuth classifies built-in endpoints separately and imposes minimum requirements on specific session-management operations. Custom endpoints require an explicit protection decision.\u003C/p\u003E\n\u003Cp\u003EFor an application endpoint, use the supported endpoint 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\u003Eapp.MapPost(\u0026quot;/api/account/sensitive-action\u0026quot;, HandleSensitiveAction)\n .RequireUAuthHubValidation();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003ERequireUAuthHubValidation()\u003C/code\u003E adds both Hub-validation metadata and an ASP.NET Core authorization requirement. Simply placing \u003Ccode\u003E[UAuthHubValidated]\u003C/code\u003E on an endpoint is not a replacement for requiring authorization.\u003C/p\u003E\n\u003Cp\u003EFor an entire Resource API, you can require Hub validation 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.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.Auth.Mode = UAuthMode.SemiHybrid;\n options.Auth.Validation.Default = UAuthValidationRequirement.HubValidated;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThat configuration prioritizes authoritative checking over the normal stateless performance advantage. Use it deliberately.\u003C/p\u003E\n\u003Cp\u003EOn UltimateAuth Server, \u003Ccode\u003Eoptions.Validation.Default\u003C/code\u003E and per-built-in-endpoint entries control the applicable minimum validation requirement. Request metadata and framework-imposed minimums can raise a requirement; they are not intended to let a request weaken it.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022integrated-server-versus-separate-resource-api\u0022\u003EIntegrated server versus separate Resource API\u003C/h3\u003E\n\u003Cp\u003EThe \u003Cem\u003Evalidation requirement\u003C/em\u003E is the same, but the authority can be reached differently:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EIntegrated server:\u003C/strong\u003E \u003Ccode\u003EHubValidated\u003C/code\u003E checks session lineage through local server services.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESeparate Resource API:\u003C/strong\u003E \u003Ccode\u003EHubValidated\u003C/code\u003E performs a remote validation call to UAuthHub. The Resource API first validates the JWT, and the Hub must explicitly confirm the higher validation level.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe remote request carries the access credential and requests \u003Ccode\u003EHubValidated\u003C/code\u003E. A successful ordinary (\u003Ccode\u003EStandard\u003C/code\u003E) JWT response is insufficient; the Resource API fails closed if the Hub does not confirm authoritative validation.\u003C/p\u003E\n\u003Cp\u003EIn a distributed deployment, a \u003Ccode\u003EStandard\u003C/code\u003E endpoint can avoid a Hub round trip. A \u003Ccode\u003EHubValidated\u003C/code\u003E endpoint pays that cost and depends on the Hub being available. This is the central SemiHybrid trade-off.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-semihybrid-does-not-do-automatically\u0022\u003EWhat SemiHybrid does not do automatically\u003C/h3\u003E\n\u003Cul\u003E\n\u003Cli\u003EIt does not make every JWT request immediately revocable.\u003C/li\u003E\n\u003Cli\u003EIt does not transform the JWT \u003Ccode\u003Esid\u003C/code\u003E into a session credential.\u003C/li\u003E\n\u003Cli\u003EIt does not guarantee that the JWT\u0027s roles or permissions reflect recent account changes.\u003C/li\u003E\n\u003Cli\u003EIt does not replace action-level authorization policies or a fresh-authentication requirement for highly sensitive operations.\u003C/li\u003E\n\u003Cli\u003EIt does not make refresh or logout fully stateless; they still depend on persisted state and proof validation.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003E\u003Cstrong\u003EChoose SemiHybrid when:\u003C/strong\u003E you own multiple APIs, have meaningful session/device-management requirements, and can deliberately separate operations that tolerate JWT staleness from those requiring current session authority.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EPractical tip:\u003C/strong\u003E Keep JWT access-token lifetimes reasonably short even when you use \u003Ccode\u003EHubValidated\u003C/code\u003E. The token\u0027s lifetime determines the exposure window for endpoints that remain \u003Ccode\u003EStandard\u003C/code\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt-locally-validated-access-no-session-lineage\u0022\u003EPureJwt \u2014 locally validated access, no session lineage\u003C/h2\u003E\n\u003Cp\u003EPureJwt signs JWT access tokens without creating UltimateAuth Root / Chain / Session records for authentication.\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 -- JWT --\u0026gt; Resource API\n |\n v\n Local JWT validation\n |\n v\n Authorization\n\nRefresh token --\u0026gt; Persisted refresh chain / rotation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EChoose PureJwt when:\u003C/strong\u003E independent API validation and minimal request-time dependencies matter more than server-side session management. It is a natural fit for distributed resource services and integrations where short JWT validity windows are acceptable.\u003C/p\u003E\n\u003Cp\u003EPureJwt is \u003Cstrong\u003Estateless for access-token validation\u003C/strong\u003E, but it is not entirely persistence-free when refresh tokens are enabled. The refresh-token chain is stored, rotated, and revocable. A successfully revoked refresh chain prevents further refresh, but it cannot retroactively invalidate an access token that a Resource API validates locally.\u003C/p\u003E\n\u003Cp\u003EA PureJwt access token does not include an UltimateAuth \u003Ccode\u003Esid\u003C/code\u003E claim. \u003Ccode\u003EHubValidated\u003C/code\u003E is not supported because there is no server-side session lineage to check.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EPractical tips:\u003C/strong\u003E\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EPrefer short JWT lifetimes and explicit issuer, audience, signing-algorithm, and key validation.\u003C/li\u003E\n\u003Cli\u003ETreat JWT claims as a snapshot taken at issuance, not a live user directory.\u003C/li\u003E\n\u003Cli\u003EUse separate application authorization mechanisms when account changes must become effective immediately.\u003C/li\u003E\n\u003Cli\u003EDo not confuse revoking refresh capability with revoking an already issued access token.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022selecting-a-mode-for-your-application\u0022\u003ESelecting a mode for your application\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022not-sure-which-mode-to-choose-start-with-hybrid\u0022\u003ENot sure which mode to choose? Start with Hybrid.\u003C/h3\u003E\n\u003Cp\u003EIf you are unsure which authentication mode best fits your application, \u003Cstrong\u003EHybrid is the recommended general-purpose starting point.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EIt combines server-authoritative session control with a separate token lifecycle, providing a balanced foundation for security, flexibility, and application growth.\u003C/p\u003E\n\u003Cp\u003EHybrid is also the default authentication mode for most UltimateAuth Application Profiles.\u003C/p\u003E\n\u003Cp\u003EIt is suitable for both new and growing applications, including those that may later introduce additional clients, separate Resource APIs, or distributed infrastructure.\u003C/p\u003E\n\u003Cp\u003EYou do not need to anticipate every future requirement. If your needs change, you can switch to another authentication mode without rewriting your UltimateAuth integration.\u003C/p\u003E\n\u003Cp\u003EStart with the required security behavior, not the UI framework. These are useful starting points rather than hard restrictions:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EYour priority\u003C/th\u003E\n\u003Cth\u003EStart with\u003C/th\u003E\n\u003Cth\u003EConsider instead when...\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESimple server-rendered app with cookies\u003C/td\u003E\n\u003Ctd\u003E\u003Cstrong\u003EPureOpaque\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EYou need a separate token lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EClient-side or native application with simple, centrally validated authentication\u003C/td\u003E\n\u003Ctd\u003E\u003Cstrong\u003EPureOpaque\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EYou need independent access and refresh token lifecycles or local JWT validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EInternal/admin system requiring session authority on each request\u003C/td\u003E\n\u003Ctd\u003E\u003Cstrong\u003EPureOpaque\u003C/strong\u003E or \u003Cstrong\u003EHybrid\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ESome operations can tolerate a short JWT validity window\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECentral UAuthHub, managed devices, and rotating refresh tokens\u003C/td\u003E\n\u003Ctd\u003E\u003Cstrong\u003EHybrid\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ESeparate APIs should authenticate JWTs locally\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDistributed APIs, but selected operations require session revocation checks\u003C/td\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESemiHybrid\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ENo server-side session management is needed\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAPIs where most reads should avoid Hub calls\u003C/td\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESemiHybrid\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ENo operation needs authoritative lineage; then choose PureJwt\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EStandalone JWT resource validation\u003C/td\u003E\n\u003Ctd\u003E\u003Cstrong\u003EPureJwt\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EUsers need managed session/device lifecycles\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EStrong current session guarantees for sensitive operations\u003C/td\u003E\n\u003Ctd\u003E\u003Cstrong\u003EHybrid\u003C/strong\u003E or \u003Cstrong\u003ESemiHybrid\u003C/strong\u003E with \u003Ccode\u003EHubValidated\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEvery request must be authoritative; prefer a fully session-backed 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=\u0022decision-examples\u0022\u003EDecision examples\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003EBlazor Server dashboard:\u003C/strong\u003E PureOpaque is often simplest. The server already handles interaction state, and a short opaque credential lifecycle is easy to reason about. Long-lived SignalR circuits still need appropriate revalidation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EMobile app with device management:\u003C/strong\u003E Hybrid works well when server-authoritative sessions are a hard requirement. SemiHybrid is an alternative if the app consumes separate JWT APIs and only selected actions need authoritative checks.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EPublic product API with account management:\u003C/strong\u003E SemiHybrid can authenticate product reads with \u003Ccode\u003EStandard\u003C/code\u003E JWTs and require \u003Ccode\u003EHubValidated\u003C/code\u003E for account or high-impact operations. This must be an explicit endpoint protection design, not a reliance on default routing alone.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EIndependent service-to-service resource API:\u003C/strong\u003E PureJwt is usually simpler if the service only needs locally verifiable access tokens. For immediate authorization changes, add an independent enforcement design rather than assuming JWT revocation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-boundaries-do-not-mix-them-up\u0022\u003EConfiguration boundaries: do not mix them up\u003C/h2\u003E\n\u003Cp\u003EFour different choices are involved:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConcern\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\u003EAuthentication mode\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EWhat validates identity and which session state exists?\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 type of application is communicating and which defaults are appropriate?\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ECredential delivery\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EIs the credential transported in a cookie or header?\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EDeployment topology\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EIs UAuthHub integrated into the application or hosted separately?\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EFor example, Blazor WebAssembly does not inherently require Hybrid, and a separate Resource API does not inherently require PureJwt. Those are configurable design choices.\u003C/p\u003E\n\u003Cp\u003EThe built-in mode resolver currently selects \u003Cstrong\u003EPureOpaque for \u003Ccode\u003EBlazorServer\u003C/code\u003E\u003C/strong\u003E and \u003Cstrong\u003EHybrid for other application profiles\u003C/strong\u003E. These defaults do not automatically select SemiHybrid for a JWT-enabled application.\u003C/p\u003E\n\u003Cp\u003ETo choose a mode explicitly on UltimateAuth 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.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AuthMode = UAuthMode.SemiHybrid;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ETo choose the mode for a separate Resource 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.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.Auth.Mode = UAuthMode.SemiHybrid;\n options.Hub.BaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese snippets show \u003Cstrong\u003Emode selection\u003C/strong\u003E, not complete production setup. For JWT modes, configure compatible issuer, audience, algorithms, verification keys, and device policy. For Remote Hub validation, configure the authoritative Hub address. A matching mode name alone does not establish cryptographic or credential compatibility.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedModes\u003C/code\u003E restricts which modes a server permits; it does \u003Cstrong\u003Enot\u003C/strong\u003E select a mode. For profile-specific selection use \u003Ccode\u003EApplicationProfileModes\u003C/code\u003E, or choose \u003Ccode\u003EAuthMode\u003C/code\u003E when the server should enforce one mode for all profiles. The two explicit selection mechanisms are mutually exclusive.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/application-profiles\u0022\u003EApplication Profiles\u003C/a\u003E, \u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E, and \u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E for the full configuration rules.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022can-i-change-the-authentication-mode-later-and-safely\u0022\u003ECan i change the authentication mode later and safely?\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EYes. Changing the authentication mode is primarily a configuration change, not an application rewrite.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EAll four authentication modes share the same UltimateAuth APIs, authentication flows, client abstractions, user management, credential management, and authorization architecture.\u003C/p\u003E\n\u003Cp\u003EWhen using UltimateAuth\u0027s unified APIs, switching modes does not require changes to your application-level authentication code.\u003C/p\u003E\n\u003Cp\u003EYour login forms, authentication services, client integration, user accounts, credentials, roles, and permissions remain unchanged. No database schema migration is required solely because of a mode change.\u003C/p\u003E\n\u003Cp\u003ETo switch modes:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EChange the authentication mode in your configuration.\u003C/li\u003E\n\u003Cli\u003EAlign the relevant server and Resource API settings, including cryptographic configuration where required.\u003C/li\u003E\n\u003Cli\u003ERetire incompatible authentication credentials and require users to sign in again as necessary.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EExisting sessions and tokens are not automatically converted between authentication modes. Treat the transition as a controlled configuration change, similar to replacing a signing key.\u003C/p\u003E\n\u003Cp\u003EApplication code that explicitly depends on mode-specific features, such as session identifiers or JWT-specific claims, may require adjustments.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022start-simple-evolve-when-needed\u0022\u003EStart simple, evolve when needed\u003C/h3\u003E\n\u003Cp\u003EYou do not need to anticipate every future authentication requirement.\u003C/p\u003E\n\u003Cp\u003EStart with PureOpaque if simple session-based authentication meets your needs. Switch to Hybrid, SemiHybrid, or PureJwt when your requirements change \u2014 or move back to a simpler mode whenever appropriate.\u003C/p\u003E\n\u003Cp\u003EAuthentication modes are not permanent architectural commitments, nor are they stages of application maturity.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EChange your authentication strategy, not your application architecture.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-rules-that-apply-to-every-mode\u0022\u003ESecurity rules that apply to every mode\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-mismatch-is-a-policy-not-an-authentication-mode\u0022\u003EDevice mismatch is a policy, not an authentication mode\u003C/h3\u003E\n\u003Cp\u003EThe device mismatch policy is configured independently of the authentication mode. \u003Ccode\u003EReject\u003C/code\u003E enforces the configured device match; \u003Ccode\u003EAllow\u003C/code\u003E permits the request-device mismatch where supported. Allowing a different request device \u003Cstrong\u003Edoes not rewrite the credential\u0027s original device binding\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EFor JWT modes, automatic device rebinding (\u003Ccode\u003EAllowAndRebind\u003C/code\u003E) is not supported by the current built-in Resource API validation implementation. Do not treat \u003Ccode\u003EAllow\u003C/code\u003E as implicit rebinding.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-validity-and-current-authorization-are-different\u0022\u003EJWT validity and current authorization are different\u003C/h3\u003E\n\u003Cp\u003EJWTs carry claims issued at a point in time. A valid JWT can contain stale role or permission data. \u003Ccode\u003EHubValidated\u003C/code\u003E checks current session lineage; it should not be read as an automatic guarantee that every authorization claim was reloaded. Define application authorization and user-status requirements explicitly.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-revocation-and-token-revocation-are-different\u0022\u003ESession revocation and token revocation are different\u003C/h3\u003E\n\u003Cp\u003ESession-backed requests reject a revoked session when session validation runs. JWT-only requests can remain valid until their expiry. Refresh-token revocation stops future rotation; it does not erase access tokens already held by clients.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cookie-and-header-security-still-matter\u0022\u003ECookie and header security still matter\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EHttpOnly\u003C/code\u003E, \u003Ccode\u003ESecure\u003C/code\u003E, \u003Ccode\u003ESameSite\u003C/code\u003E, CSRF protection, token confidentiality, and XSS defenses depend on credential transport and application architecture, not just authentication mode. JWT signatures do not encrypt claims.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022where-to-go-next\u0022\u003EWhere to go next\u003C/h2\u003E\n\u003Cp\u003EThis page helps you \u003Cstrong\u003Echoose an authentication mode\u003C/strong\u003E. Keep detailed configuration, endpoint contracts, and lifecycle internals in their dedicated guides:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/auth-model\u0022\u003EAuthentication Model\u003C/a\u003E \u2014 Identity, server authority, and lineage concepts.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/runtime-architecture\u0022\u003ERuntime Architecture\u003C/a\u003E \u2014 Integrated Hub, distributed Hub, and Resource API boundaries.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/request-lifecycle\u0022\u003ERequest Lifecycle\u003C/a\u003E \u2014 How authentication and authorization are applied to requests.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Effective modes, token lifetimes, and validation settings.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/auth-flows/refresh-flow\u0022\u003ERefresh Flow\u003C/a\u003E and \u003Ca href=\u0022/docs/auth-flows/logout-flow\u0022\u003ELogout Flow\u003C/a\u003E \u2014 Credential continuation and termination.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003E\u003Cstrong\u003ERule of thumb:\u003C/strong\u003E Prefer the simplest mode that meets your \u003Cem\u003Erevocation and authorization freshness requirements\u003C/em\u003E. Use SemiHybrid when the distinction between \u003Ccode\u003EStandard\u003C/code\u003E and \u003Ccode\u003EHubValidated\u003C/code\u003E is a deliberate part of your API design\u2014not simply because JWTs appear faster.\u003C/p\u003E\n", "Headings": [ { - "Id": "auth-credentials", - "Text": "Auth credentials", + "Id": "the-four-modes-at-a-glance", + "Text": "The four modes at a glance", "Level": 0 }, { - "Id": "mode-comparison", - "Text": "Mode comparison", + "Id": "one-decision-matters-most-when-must-the-server-be-consulted", + "Text": "One decision matters most: when must the server be consulted?", "Level": 0 }, { - "Id": "pureopaque", - "Text": "PureOpaque", + "Id": "pureopaque-one-credential-server-authoritative-sessions", + "Text": "PureOpaque \u2014 one credential, server-authoritative sessions", "Level": 0 }, { - "Id": "fully-session-based-authentication", - "Text": "Fully session-based authentication", + "Id": "pureopaque-is-not-limited-to-server-side-applications", + "Text": "PureOpaque is not limited to server-side applications", "Level": 1 }, { - "Id": "session-continuation", - "Text": "Session continuation", - "Level": 1 - }, - { - "Id": "advantages", - "Text": "Advantages", - "Level": 1 - }, - { - "Id": "limitations", - "Text": "Limitations", - "Level": 1 - }, - { - "Id": "recommended-applications", - "Text": "Recommended applications", - "Level": 1 - }, - { - "Id": "hybrid", - "Text": "Hybrid", + "Id": "hybrid-authoritative-sessions-with-a-separate-token-lifecycle", + "Text": "Hybrid \u2014 authoritative sessions with a separate token lifecycle", "Level": 0 }, { - "Id": "session-backed-authentication-with-separate-tokens", - "Text": "Session-backed authentication with separate tokens", - "Level": 1 - }, - { - "Id": "current-resource-api-support", - "Text": "Current Resource API support", - "Level": 1 - }, - { - "Id": "refresh-and-session-lifecycle", - "Text": "Refresh and session lifecycle", - "Level": 1 - }, - { - "Id": "advantages-1", - "Text": "Advantages", - "Level": 1 - }, - { - "Id": "limitations-1", - "Text": "Limitations", - "Level": 1 - }, - { - "Id": "recommended-applications-1", - "Text": "Recommended applications", - "Level": 1 - }, - { - "Id": "semihybrid", - "Text": "SemiHybrid", + "Id": "semihybrid-jwt-access-with-selective-authoritative-validation", + "Text": "SemiHybrid \u2014 JWT access with selective authoritative validation", "Level": 0 }, { - "Id": "stateless-jwt-validation-with-server-side-session-lifecycle", - "Text": "Stateless JWT validation with server-side session lifecycle", + "Id": "two-validation-levels", + "Text": "Two validation levels", "Level": 1 }, { - "Id": "what-session-metadata-is-used-for", - "Text": "What session metadata is used for", + "Id": "what-happens-after-revocation", + "Text": "What happens after revocation?", "Level": 1 }, { - "Id": "revocation-semantics", - "Text": "Revocation semantics", + "Id": "choosing-which-operations-need-hubvalidated", + "Text": "Choosing which operations need HubValidated", "Level": 1 }, { - "Id": "advantages-2", - "Text": "Advantages", + "Id": "integrated-server-versus-separate-resource-api", + "Text": "Integrated server versus separate Resource API", "Level": 1 }, { - "Id": "limitations-2", - "Text": "Limitations", + "Id": "what-semihybrid-does-not-do-automatically", + "Text": "What SemiHybrid does not do automatically", "Level": 1 }, { - "Id": "recommended-applications-2", - "Text": "Recommended applications", - "Level": 1 - }, - { - "Id": "purejwt", - "Text": "PureJwt", + "Id": "purejwt-locally-validated-access-no-session-lineage", + "Text": "PureJwt \u2014 locally validated access, no session lineage", "Level": 0 }, { - "Id": "session-independent-authentication-with-stateful-refresh", - "Text": "Session-independent authentication with stateful refresh", - "Level": 1 - }, - { - "Id": "authentication", - "Text": "Authentication", - "Level": 1 - }, - { - "Id": "access-token-validation", - "Text": "Access-token validation", - "Level": 1 + "Id": "selecting-a-mode-for-your-application", + "Text": "Selecting a mode for your application", + "Level": 0 }, { - "Id": "refresh-token-lifecycle", - "Text": "Refresh-token lifecycle", + "Id": "not-sure-which-mode-to-choose-start-with-hybrid", + "Text": "Not sure which mode to choose? Start with Hybrid.", "Level": 1 }, { - "Id": "logout", - "Text": "Logout", + "Id": "decision-examples", + "Text": "Decision examples", "Level": 1 }, { - "Id": "security-considerations", - "Text": "Security considerations", - "Level": 1 + "Id": "configuration-boundaries-do-not-mix-them-up", + "Text": "Configuration boundaries: do not mix them up", + "Level": 0 }, { - "Id": "choosing-a-mode", - "Text": "Choosing a mode", + "Id": "can-i-change-the-authentication-mode-later-and-safely", + "Text": "Can i change the authentication mode later and safely?", "Level": 0 }, { - "Id": "application-profiles-and-authentication-modes", - "Text": "Application Profiles and authentication modes", - "Level": 0 + "Id": "start-simple-evolve-when-needed", + "Text": "Start simple, evolve when needed", + "Level": 1 }, { - "Id": "security-considerations-1", - "Text": "Security considerations", + "Id": "security-rules-that-apply-to-every-mode", + "Text": "Security rules that apply to every mode", "Level": 0 }, { - "Id": "credential-confidentiality", - "Text": "Credential confidentiality", + "Id": "device-mismatch-is-a-policy-not-an-authentication-mode", + "Text": "Device mismatch is a policy, not an authentication mode", "Level": 1 }, { - "Id": "revocation-guarantees", - "Text": "Revocation guarantees", + "Id": "jwt-validity-and-current-authorization-are-different", + "Text": "JWT validity and current authorization are different", "Level": 1 }, { - "Id": "browser-security", - "Text": "Browser security", + "Id": "session-revocation-and-token-revocation-are-different", + "Text": "Session revocation and token revocation are different", "Level": 1 }, { - "Id": "authorization-remains-separate", - "Text": "Authorization remains separate", + "Id": "cookie-and-header-security-still-matter", + "Text": "Cookie and header security still matter", "Level": 1 }, { - "Id": "summary", - "Text": "Summary", + "Id": "where-to-go-next", + "Text": "Where to go next", "Level": 0 } ], - "SourceHash": "26106ACEBA42452DDDDB6CC4D34476242082FE9BD0E1E0AADA3CAC4C12867F6A", + "SourceHash": "21F585C4326CCE9EEE80AC39DBE4D657C9B196419228134893C75789A2B43541", "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/overview.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/overview.json index a047774b..64168195 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/overview.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/overview.json @@ -1,8 +1,19 @@ { "Slug": "fundamentals/overview", "Title": "Fundamentals Overview", - "Html": "\n\u003Cp\u003EThis section explains how UltimateAuth works internally.\u003C/p\u003E\n\u003Ch1 id=\u0022section-order\u0022\u003ESection Order\u003C/h1\u003E\n\u003Cp\u003EIf you are new, follow this order:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication Model\u003C/li\u003E\n\u003Cli\u003EFlow-Based Authentication\u003C/li\u003E\n\u003Cli\u003EAuthentication Modes\u003C/li\u003E\n\u003Cli\u003EApplication Profiles\u003C/li\u003E\n\u003Cli\u003ERuntime Architecture\u003C/li\u003E\n\u003Cli\u003ERequest Lifecycle\u003C/li\u003E\n\u003C/ul\u003E\n", - "Headings": [], - "SourceHash": "14B09E14A6B7C37ADA287B6F5BB51709F35B983604AF72C4A425A4314AF908CD", + "Html": "\n\u003Cp\u003EThis section explains how UltimateAuth works internally.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022one-programming-model-multiple-authentication-strategies\u0022\u003EOne programming model, multiple authentication strategies\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates how applications implement authentication from how authentication works internally.\u003C/p\u003E\n\u003Cp\u003EApplications use a consistent set of APIs for authentication flows, identity management, credential management, and authorization.\u003C/p\u003E\n\u003Cp\u003EThe underlying authentication strategy can be selected through configuration.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth supports four authentication modes:\u003C/p\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\u003EPhilosophy\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\u003EMinimalist authentication\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003EGeneral-purpose default\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003EPerformance tuning\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003EConventional JWT authentication\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EApplication profiles adapt the integration to the runtime environment.\u003C/p\u003E\n\u003Cp\u003EAuthentication modes adapt the underlying authentication architecture.\u003C/p\u003E\n\u003Cp\u003EFlow-based authentication provides a consistent execution model across both.\u003C/p\u003E\n\u003Cp\u003ETogether, these abstractions allow authentication architecture to evolve with the application without requiring a different 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/application-profiles\u0022\u003EApplication Profiles\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022section-order\u0022\u003ESection Order\u003C/h2\u003E\n\u003Cp\u003EIf you are new, follow this order:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication Model\u003C/li\u003E\n\u003Cli\u003EFlow-Based Authentication\u003C/li\u003E\n\u003Cli\u003EAuthentication Modes\u003C/li\u003E\n\u003Cli\u003EApplication Profiles\u003C/li\u003E\n\u003Cli\u003ERuntime Architecture\u003C/li\u003E\n\u003Cli\u003ERequest Lifecycle\u003C/li\u003E\n\u003C/ul\u003E\n", + "Headings": [ + { + "Id": "one-programming-model-multiple-authentication-strategies", + "Text": "One programming model, multiple authentication strategies", + "Level": 0 + }, + { + "Id": "section-order", + "Text": "Section Order", + "Level": 0 + } + ], + "SourceHash": "5FA03443F340733C169DE1F4C1F7E833733C5592C88972693F782528741DEA5B", "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 6ba2c7b9..828e8d96 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 @@ -1,7 +1,7 @@ { "Slug": "fundamentals/request-lifecycle", "Title": "Request Lifecycle", - "Html": "\n\u003Cp\u003EUltimateAuth distinguishes between establishing authentication, validating an existing identity, and authorizing access to protected operations.\u003C/p\u003E\n\u003Cp\u003EThese responsibilities are related, but they do not necessarily execute through the same pipeline.\u003C/p\u003E\n\u003Cp\u003EA login request may establish a new authentication context. A protected API request may only need to validate an existing credential. A server-side application operation may execute without making an additional HTTP request.\u003C/p\u003E\n\u003Cp\u003EUnderstanding these differences is essential when integrating UltimateAuth into real applications.\u003C/p\u003E\n\u003Cp\u003EThis page focuses on \u003Cstrong\u003Ehow authentication is evaluated during application requests and where the security boundaries are enforced\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EFor authentication flow orchestration, 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=\u0022two-request-categories\u0022\u003ETwo request categories\u003C/h2\u003E\n\u003Cp\u003EAt a conceptual level, requests interacting with UltimateAuth fall into two categories.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ECategory\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003Cth\u003ETypical examples\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAuthentication operations\u003C/td\u003E\n\u003Ctd\u003EEstablish, continue, or terminate authentication\u003C/td\u003E\n\u003Ctd\u003ELogin, refresh, logout\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProtected resource operations\u003C/td\u003E\n\u003Ctd\u003EAccess application functionality using an existing identity\u003C/td\u003E\n\u003Ctd\u003EAPI calls, protected pages, application commands\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe distinction matters because an authentication operation may change authentication state, while a protected resource operation generally consumes an existing authentication context.\u003C/p\u003E\n\u003Cp\u003EBoth require appropriate security checks, but they do not need to execute identical flows.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-operations\u0022\u003EAuthentication operations\u003C/h2\u003E\n\u003Cp\u003EAuthentication operations are explicitly initiated through supported authentication endpoints or application integrations.\u003C/p\u003E\n\u003Cp\u003EExamples include login, refresh, and logout.\u003C/p\u003E\n\u003Cp\u003EFor HTTP authentication endpoints, UltimateAuth uses its flow infrastructure to resolve the effective authentication context and execute the requested operation.\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\u003EAuthentication Request\n |\n v\nAuthentication Flow Boundary\n |\n v\nEffective AuthFlowContext\n |\n v\nOperation-Specific Validation\n |\n v\nAuthentication Operation\n |\n v\nAuthentication Result\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe operation may create or update sessions, issue credentials, rotate refresh tokens, revoke authentication state, or produce a result without persistent changes.\u003C/p\u003E\n\u003Cp\u003EThese details depend on the flow and authentication mode.\u003C/p\u003E\n\u003Cp\u003EThe internal execution pipeline is described in \u003Ca href=\u0022/docs/auth-flows/overview\u0022\u003EAuth Flows\u003C/a\u003E, while individual operations are documented in their respective flow guides.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022protected-resource-operations\u0022\u003EProtected resource operations\u003C/h2\u003E\n\u003Cp\u003EMost application requests do not initiate a login, refresh, or logout flow.\u003C/p\u003E\n\u003Cp\u003EInstead, they attempt to access a protected resource using an existing authentication credential or established server-side authentication context.\u003C/p\u003E\n\u003Cp\u003EA typical protected HTTP request follows this conceptual lifecycle:\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 Request\n |\n v\nResolve Applicable Authentication Scheme\n |\n v\nExtract Authentication Credential\n |\n v\nValidate Credential and Required State\n |\n v\nEstablish Trusted Identity\n |\n v\nEvaluate Authorization\n |\n \u002B---- Denied\n |\n v\nExecute Protected Operation\n |\n v\nReturn Response\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe exact framework components and ordering depend on the application integration.\u003C/p\u003E\n\u003Cp\u003EHowever, the security distinction remains the same:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAuthentication establishes identity. Authorization determines whether that identity may perform the requested operation.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EA successfully authenticated request is not automatically authorized.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-validation\u0022\u003ECredential validation\u003C/h2\u003E\n\u003Cp\u003EThe most important mode-dependent difference in the request lifecycle is how authentication credentials are validated.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth supports different authentication strategies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022pureopaque\u0022\u003EPureOpaque\u003C/h3\u003E\n\u003Cp\u003EThe client presents an opaque session credential.\u003C/p\u003E\n\u003Cp\u003EThe server resolves the associated session and evaluates the applicable session, chain, and security requirements.\u003C/p\u003E\n\u003Cp\u003EThe session remains authoritative for authentication.\u003C/p\u003E\n\u003Cp\u003EA revoked or expired session must not continue to authenticate subsequent requests.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022hybrid\u0022\u003EHybrid\u003C/h3\u003E\n\u003Cp\u003EThe client presents an opaque access token.\u003C/p\u003E\n\u003Cp\u003EThe server resolves the token and validates its relationship to the authoritative server-side session.\u003C/p\u003E\n\u003Cp\u003EThe access token and session are separate concepts.\u003C/p\u003E\n\u003Cp\u003EAuthentication requires both a valid access credential and the applicable session validation requirements to succeed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022semihybrid\u0022\u003ESemiHybrid\u003C/h3\u003E\n\u003Cp\u003EThe client presents a JWT access token.\u003C/p\u003E\n\u003Cp\u003ENormal resource authentication validates the JWT cryptographically and applies the relevant token-validation rules.\u003C/p\u003E\n\u003Cp\u003EA server-side session remains relevant for lifecycle operations such as refresh and session management, but normal JWT validation does not require a session lookup.\u003C/p\u003E\n\u003Cp\u003ERevoking a session therefore does not automatically invalidate an already issued JWT.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt\u0022\u003EPureJwt\u003C/h3\u003E\n\u003Cp\u003EThe client presents a JWT access token.\u003C/p\u003E\n\u003Cp\u003EThe resource validates the token cryptographically and applies the configured issuer, audience, lifetime, and other relevant validation requirements.\u003C/p\u003E\n\u003Cp\u003EAuthentication does not require a server-side session.\u003C/p\u003E\n\u003Cp\u003EPreviously issued JWTs may remain valid until expiration unless an additional invalidation mechanism is explicitly configured.\u003C/p\u003E\n\u003Cp\u003EFor the complete guarantees and tradeoffs, 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=\u0022when-identity-becomes-trusted\u0022\u003EWhen identity becomes trusted\u003C/h2\u003E\n\u003Cp\u003EAn incoming request may contain user identifiers, claims, tokens, cookies, device information, or tenant-related metadata.\u003C/p\u003E\n\u003Cp\u003EThese values must not automatically be treated as a trusted identity.\u003C/p\u003E\n\u003Cp\u003EThe relevant authentication mechanism must validate the presented evidence before the application relies on it.\u003C/p\u003E\n\u003Cp\u003EIn session-authoritative modes, this includes the required server-side session checks.\u003C/p\u003E\n\u003Cp\u003EIn JWT-based modes, it includes the applicable cryptographic and token-validation checks.\u003C/p\u003E\n\u003Cp\u003EOnly after successful authentication should the application treat the resulting identity as authenticated.\u003C/p\u003E\n\u003Cp\u003EA failed authentication attempt must not leave behind an identity that appears successfully authenticated to downstream application code.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022anonymous-requests\u0022\u003EAnonymous requests\u003C/h3\u003E\n\u003Cp\u003ENot every application request requires authentication.\u003C/p\u003E\n\u003Cp\u003EPublic endpoints may allow anonymous access.\u003C/p\u003E\n\u003Cp\u003EA request without valid authentication credentials can remain anonymous when the endpoint permits it.\u003C/p\u003E\n\u003Cp\u003EFor protected endpoints, missing or invalid authentication must prevent access according to the applicable authentication and authorization configuration.\u003C/p\u003E\n\u003Cp\u003EAn anonymous request is not necessarily an error. It becomes an access problem when the requested operation requires an authenticated identity.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-context-and-accesscontext\u0022\u003EAuthentication context and AccessContext\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates authentication-flow execution from authorization context.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthFlowContext\u003C/code\u003E is associated with authentication operations and describes the effective environment in which those operations execute.\u003C/p\u003E\n\u003Cp\u003EIt includes the applicable mode, application profile, tenant, and other flow-related information.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAccessContext\u003C/code\u003E represents the trusted actor and contextual information used for access and authorization decisions.\u003C/p\u003E\n\u003Cp\u003EThese contexts serve different purposes.\u003C/p\u003E\n\u003Cp\u003EAn application request does not need to execute a login flow merely to establish an identity from an already valid authentication credential.\u003C/p\u003E\n\u003Cp\u003ELikewise, the existence of an \u003Ccode\u003EAuthFlowContext\u003C/code\u003E does not mean the operation has already been authorized.\u003C/p\u003E\n\u003Cp\u003EThe authentication model and these trust boundaries are introduced in \u003Ca href=\u0022/docs/fundamentals/auth-model\u0022\u003EAuthentication Model\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-boundary\u0022\u003EAuthorization boundary\u003C/h2\u003E\n\u003Cp\u003EAfter authentication establishes the caller\u0027s identity, the application must determine whether the requested operation is permitted.\u003C/p\u003E\n\u003Cp\u003EAuthorization may depend on:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe authenticated actor.\u003C/li\u003E\n\u003Cli\u003EThe requested resource or operation.\u003C/li\u003E\n\u003Cli\u003ETenant boundaries.\u003C/li\u003E\n\u003Cli\u003ERoles and permissions.\u003C/li\u003E\n\u003Cli\u003EApplicable application policies.\u003C/li\u003E\n\u003Cli\u003EResource ownership or other domain-specific requirements.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EUltimateAuth integrates with the relevant server-side authorization mechanisms, but authentication and authorization remain separate responsibilities.\u003C/p\u003E\n\u003Cp\u003EFor ASP.NET Core applications, endpoint and policy-based authorization can protect HTTP resources.\u003C/p\u003E\n\u003Cp\u003EHowever, an authorization attribute applied to an HTTP endpoint does not automatically protect arbitrary direct calls to the underlying application service.\u003C/p\u003E\n\u003Cp\u003ESecurity requirements must be enforced at the boundary through which the operation is actually accessible.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022http-requests-and-in-process-operations\u0022\u003EHTTP requests and in-process operations\u003C/h2\u003E\n\u003Cp\u003ENot every protected application operation crosses an HTTP boundary.\u003C/p\u003E\n\u003Cp\u003EThis distinction is especially important for server-hosted applications.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022http-resource-requests\u0022\u003EHTTP resource requests\u003C/h3\u003E\n\u003Cp\u003EA remote client sends an HTTP request to a protected application or resource API.\u003C/p\u003E\n\u003Cp\u003EThe receiving application must authenticate the request and enforce authorization before performing the protected operation.\u003C/p\u003E\n\u003Cp\u003EClient-side authentication state alone is insufficient.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022in-process-application-operations\u0022\u003EIn-process application operations\u003C/h3\u003E\n\u003Cp\u003EA server-hosted application may invoke application services directly without making an HTTP request.\u003C/p\u003E\n\u003Cp\u003EFor example, a Blazor Server component may call a registered service within the same process.\u003C/p\u003E\n\u003Cp\u003EIn this case, the application must not assume that HTTP middleware or endpoint authorization filters execute automatically.\u003C/p\u003E\n\u003Cp\u003EThe service invocation must operate with an appropriately established identity and enforce the relevant authorization requirements.\u003C/p\u003E\n\u003Cp\u003EThis is an architectural distinction, not a separate authentication mode.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/runtime-architecture\u0022\u003ERuntime Architecture\u003C/a\u003E for integrated and distributed deployment models.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022long-lived-connections\u0022\u003ELong-lived connections\u003C/h2\u003E\n\u003Cp\u003ESome application environments maintain connections or execution contexts that outlive individual HTTP requests.\u003C/p\u003E\n\u003Cp\u003EBlazor Server is an important example.\u003C/p\u003E\n\u003Cp\u003EAn interactive circuit may remain active after its initial authentication state was established.\u003C/p\u003E\n\u003Cp\u003EDuring that time, the underlying authentication state may change.\u003C/p\u003E\n\u003Cp\u003EA session may expire, be revoked, or become invalid because of a security-sensitive operation.\u003C/p\u003E\n\u003Cp\u003EConsequently, applications must account for authentication-state revalidation and authorization during long-lived interactions.\u003C/p\u003E\n\u003Cp\u003EAn initially authenticated connection must not be treated as permanent proof that every later operation remains authorized.\u003C/p\u003E\n\u003Cp\u003EThe appropriate mechanism depends on the runtime integration and authentication mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-failures-and-authorization-failures\u0022\u003EAuthentication failures and authorization failures\u003C/h2\u003E\n\u003Cp\u003EAuthentication and authorization failures represent different conditions.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ECondition\u003C/th\u003E\n\u003Cth\u003EMeaning\u003C/th\u003E\n\u003Cth\u003ETypical HTTP outcome\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMissing required authentication\u003C/td\u003E\n\u003Ctd\u003ENo acceptable authenticated identity was established\u003C/td\u003E\n\u003Ctd\u003E401 Unauthorized\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EInvalid or expired credential\u003C/td\u003E\n\u003Ctd\u003EPresented evidence failed authentication\u003C/td\u003E\n\u003Ctd\u003E401 Unauthorized\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAuthenticated but insufficient permission\u003C/td\u003E\n\u003Ctd\u003EIdentity is valid, but access is denied\u003C/td\u003E\n\u003Ctd\u003E403 Forbidden\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPublic endpoint accessed anonymously\u003C/td\u003E\n\u003Ctd\u003EAuthentication is not required\u003C/td\u003E\n\u003Ctd\u003ERequest proceeds\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese are typical HTTP semantics, not guarantees that every integration returns identical status codes.\u003C/p\u003E\n\u003Cp\u003EBrowser applications may use redirects or other configured challenge behavior.\u003C/p\u003E\n\u003Cp\u003EApplication services operating outside HTTP may express failures through typed results or exceptions rather than HTTP responses.\u003C/p\u003E\n\u003Cp\u003EThe essential distinction is that authentication failure and authorization denial must not be confused.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022request-isolation\u0022\u003ERequest isolation\u003C/h2\u003E\n\u003Cp\u003EAuthentication state must be associated with the correct execution context.\u003C/p\u003E\n\u003Cp\u003EA request must not inherit another request\u0027s authenticated identity, tenant context, or authorization state.\u003C/p\u003E\n\u003Cp\u003EThis matters in multi-tenant systems, applications with concurrent requests, and server-side environments where services may have different lifetimes.\u003C/p\u003E\n\u003Cp\u003ERequest-specific context must be resolved and propagated through the appropriate framework boundaries.\u003C/p\u003E\n\u003Cp\u003ELong-lived or singleton services must not accidentally retain request-specific authentication information.\u003C/p\u003E\n\u003Cp\u003EThe same principle applies to direct application service calls and background operations.\u003C/p\u003E\n\u003Cp\u003EA background operation without an authenticated HTTP request must establish its execution and authorization context through an explicitly supported mechanism rather than assuming a user identity exists.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-the-request-lifecycle-does-not-guarantee\u0022\u003EWhat the request lifecycle does not guarantee\u003C/h2\u003E\n\u003Cp\u003EThe request lifecycle should not be interpreted as a promise that every UltimateAuth operation:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECreates an \u003Ccode\u003EAuthFlowContext\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EResolves a server-side session.\u003C/li\u003E\n\u003Cli\u003EQueries authentication persistence.\u003C/li\u003E\n\u003Cli\u003ERotates or issues tokens.\u003C/li\u003E\n\u003Cli\u003EExecutes the same orchestrator or authority method.\u003C/li\u003E\n\u003Cli\u003EPasses through an HTTP endpoint.\u003C/li\u003E\n\u003Cli\u003EUses identical authorization mechanisms.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThose requirements depend on the operation, authentication mode, and runtime integration.\u003C/p\u003E\n\u003Cp\u003EThe shared guarantee is architectural: authentication evidence must be validated according to the applicable security model, and protected operations must enforce their authorization requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022summary\u0022\u003ESummary\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth distinguishes between authentication operations and requests that consume an existing authenticated identity.\u003C/p\u003E\n\u003Cp\u003EAuthentication operations establish, continue, or terminate authentication through controlled flows.\u003C/p\u003E\n\u003Cp\u003EProtected resource operations validate existing authentication evidence, establish trusted identity, and enforce authorization before allowing access.\u003C/p\u003E\n\u003Cp\u003EThe validation strategy depends on the authentication mode.\u003C/p\u003E\n\u003Cp\u003EThe execution boundary depends on the runtime and deployment architecture.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA request is not trusted because it contains a credential. It becomes authenticated only when the required validation succeeds, and it becomes authorized only when the applicable access rules permit the operation.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003ENext step\u003C/h2\u003E\n\u003Cp\u003EYou have completed the Fundamentals section.\u003C/p\u003E\n\u003Cp\u003EContinue to \u003Ca href=\u0022/docs/auth-flows/overview\u0022\u003EAuth Flows\u003C/a\u003E to explore the technical authentication pipeline and the individual login, refresh, and logout operations.\u003C/p\u003E\n", + "Html": "\n\u003Cp\u003EUltimateAuth distinguishes between establishing authentication, validating an existing identity, and authorizing access to protected operations.\u003C/p\u003E\n\u003Cp\u003EThese responsibilities are related, but they do not necessarily execute through the same pipeline.\u003C/p\u003E\n\u003Cp\u003EA login request may establish a new authentication context. A protected API request may only need to validate an existing credential. A server-side application operation may execute without making an additional HTTP request.\u003C/p\u003E\n\u003Cp\u003EUnderstanding these differences is essential when integrating UltimateAuth into real applications.\u003C/p\u003E\n\u003Cp\u003EThis page focuses on \u003Cstrong\u003Ehow authentication is evaluated during application requests and where the security boundaries are enforced\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EFor authentication flow orchestration, 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=\u0022two-request-categories\u0022\u003ETwo request categories\u003C/h2\u003E\n\u003Cp\u003EAt a conceptual level, requests interacting with UltimateAuth fall into two categories.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ECategory\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003Cth\u003ETypical examples\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAuthentication operations\u003C/td\u003E\n\u003Ctd\u003EEstablish, continue, or terminate authentication\u003C/td\u003E\n\u003Ctd\u003ELogin, refresh, logout\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProtected resource operations\u003C/td\u003E\n\u003Ctd\u003EAccess application functionality using an existing identity\u003C/td\u003E\n\u003Ctd\u003EAPI calls, protected pages, application commands\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe distinction matters because an authentication operation may change authentication state, while a protected resource operation generally consumes an existing authentication context.\u003C/p\u003E\n\u003Cp\u003EBoth require appropriate security checks, but they do not need to execute identical flows.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-operations\u0022\u003EAuthentication operations\u003C/h2\u003E\n\u003Cp\u003EAuthentication operations are explicitly initiated through supported authentication endpoints or application integrations.\u003C/p\u003E\n\u003Cp\u003EExamples include login, refresh, and logout.\u003C/p\u003E\n\u003Cp\u003EFor HTTP authentication endpoints, UltimateAuth uses its flow infrastructure to resolve the effective authentication context and execute the requested operation.\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\u003EAuthentication Request\n |\n v\nAuthentication Flow Boundary\n |\n v\nEffective AuthFlowContext\n |\n v\nOperation-Specific Validation\n |\n v\nAuthentication Operation\n |\n v\nAuthentication Result\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe operation may create or update sessions, issue credentials, rotate refresh tokens, revoke authentication state, or produce a result without persistent changes.\u003C/p\u003E\n\u003Cp\u003EThese details depend on the flow and authentication mode.\u003C/p\u003E\n\u003Cp\u003EThe internal execution pipeline is described in \u003Ca href=\u0022/docs/auth-flows/overview\u0022\u003EAuth Flows\u003C/a\u003E, while individual operations are documented in their respective flow guides.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022protected-resource-operations\u0022\u003EProtected resource operations\u003C/h2\u003E\n\u003Cp\u003EMost application requests do not initiate a login, refresh, or logout flow.\u003C/p\u003E\n\u003Cp\u003EInstead, they attempt to access a protected resource using an existing authentication credential or established server-side authentication context.\u003C/p\u003E\n\u003Cp\u003EA typical protected HTTP request follows this conceptual lifecycle:\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 Request\n |\n v\nResolve Applicable Authentication Scheme\n |\n v\nExtract Authentication Credential\n |\n v\nValidate Credential and Required State\n |\n v\nEstablish Trusted Identity\n |\n v\nEvaluate Authorization\n |\n \u002B---- Denied\n |\n v\nExecute Protected Operation\n |\n v\nReturn Response\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe exact framework components and ordering depend on the application integration.\u003C/p\u003E\n\u003Cp\u003EHowever, the security distinction remains the same:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAuthentication establishes identity. Authorization determines whether that identity may perform the requested operation.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EA successfully authenticated request is not automatically authorized.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-validation\u0022\u003ECredential validation\u003C/h2\u003E\n\u003Cp\u003EThe effective authentication mode determines how the presented credential establishes an authenticated identity.\u003C/p\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\u003EPrimary credential\u003C/th\u003E\n\u003Cth\u003EAuthentication validation\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\u003Ctd\u003EServer-authoritative session validation\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\u003Ctd\u003EServer-authoritative session validation\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\u003Ctd\u003ELocal JWT validation with optional authoritative session validation\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\u003Ctd\u003ELocal JWT validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe authentication mode determines the validation strategy, not the credential transport or application runtime.\u003C/p\u003E\n\u003Cp\u003EFor a complete comparison, see\n\u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-requirements\u0022\u003EValidation requirements\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates the authentication mode from the validation requirement of a protected operation.\u003C/p\u003E\n\u003Cp\u003ETwo validation requirements are available:\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\u003EMeaning\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\u003EApply the normal 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\u003ERequire authoritative validation of the associated server-side session.\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EStandard\u003C/code\u003E does not mean stateless authentication.\u003C/p\u003E\n\u003Cp\u003EIn PureOpaque and Hybrid, standard authentication already requires authoritative session validation.\u003C/p\u003E\n\u003Cp\u003EIn SemiHybrid, the distinction allows applications to use local JWT validation for ordinary operations and require authoritative validation for operations that need stronger session guarantees.\u003C/p\u003E\n\u003Cp\u003EPureJwt does not have an associated authentication session and cannot satisfy a HubValidated requirement.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022standard-request-validation\u0022\u003EStandard request validation\u003C/h3\u003E\n\u003Cp\u003EFor a SemiHybrid Resource API, a standard protected request can be authenticated without contacting 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\u003EIncoming request\n |\n v\nResolve authentication credential\n |\n v\nValidate JWT and applicable security requirements\n |\n v\nEstablish authenticated identity\n |\n v\nEvaluate authorization requirements\n |\n v\nExecute protected operation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe JWT establishes an authenticated identity according to its signature, lifetime, claims, and configured validation requirements.\u003C/p\u003E\n\u003Cp\u003EThis does not establish that the associated session is still active.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authoritative-request-validation\u0022\u003EAuthoritative request validation\u003C/h3\u003E\n\u003Cp\u003EWhen a SemiHybrid operation requires HubValidated authentication, successful JWT validation alone is insufficient.\u003C/p\u003E\n\u003Cp\u003EThe associated session lineage must also satisfy the current authoritative security requirements.\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 request\n |\n v\nValidate JWT\n |\n v\nEstablish authenticated identity\n |\n v\nRequired access checks\n |\n \u002B-- Authorization requirements\n |\n \u002B-- Authoritative session validation\n |\n v\nExecute protected operation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAuthoritative validation can execute locally in an integrated deployment or remotely through UAuthHub in a distributed deployment.\u003C/p\u003E\n\u003Cp\u003EThe protected operation must not execute unless all required access checks succeed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022require-authoritative-validation\u0022\u003ERequire authoritative validation\u003C/h3\u003E\n\u003Cp\u003EAn ASP.NET Core endpoint can explicitly require authoritative session 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 declare the same requirement:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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[UAuthHubValidated]\npublic IActionResult UpdateSecuritySettings()\n{\n // Protected operation.\n return Ok();\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe requirement is particularly useful in SemiHybrid applications where ordinary resource authentication does not require a session lookup.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-flows-have-their-own-requirements\u0022\u003EAuthentication flows have their own requirements\u003C/h3\u003E\n\u003Cp\u003ELogin, refresh, PKCE completion, credential recovery and other authentication flows validate the evidence required by their respective operations.\u003C/p\u003E\n\u003Cp\u003EThey do not become stateless or bypass their security requirements merely because the application uses JWT access tokens.\u003C/p\u003E\n\u003Cp\u003EFor example, SemiHybrid refresh requires authoritative validation of the associated session lineage, even when ordinary resource requests use Standard validation.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-is-not-authorization\u0022\u003EValidation is not authorization\u003C/h3\u003E\n\u003Cp\u003EHubValidated authentication establishes that the associated authentication session remains valid.\u003C/p\u003E\n\u003Cp\u003EIt does not automatically:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EReload every role or permission.\u003C/li\u003E\n\u003Cli\u003ERequire a new login or recent authentication.\u003C/li\u003E\n\u003Cli\u003EEstablish multi-factor authentication.\u003C/li\u003E\n\u003Cli\u003EGrant access to a protected resource.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EAuthorization remains a separate responsibility.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022when-identity-becomes-trusted\u0022\u003EWhen identity becomes trusted\u003C/h2\u003E\n\u003Cp\u003EAn incoming request may contain user identifiers, claims, tokens, cookies, device information, or tenant-related metadata.\u003C/p\u003E\n\u003Cp\u003EThese values must not automatically be treated as a trusted identity.\u003C/p\u003E\n\u003Cp\u003EThe relevant authentication mechanism must validate the presented evidence before the application relies on it.\u003C/p\u003E\n\u003Cp\u003EIn session-authoritative modes, this includes the required server-side session checks.\u003C/p\u003E\n\u003Cp\u003EIn JWT-based modes, it includes the applicable cryptographic and token-validation checks.\u003C/p\u003E\n\u003Cp\u003EOnly after successful authentication should the application treat the resulting identity as authenticated.\u003C/p\u003E\n\u003Cp\u003EA failed authentication attempt must not leave behind an identity that appears successfully authenticated to downstream application code.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022anonymous-requests\u0022\u003EAnonymous requests\u003C/h3\u003E\n\u003Cp\u003ENot every application request requires authentication.\u003C/p\u003E\n\u003Cp\u003EPublic endpoints may allow anonymous access.\u003C/p\u003E\n\u003Cp\u003EA request without valid authentication credentials can remain anonymous when the endpoint permits it.\u003C/p\u003E\n\u003Cp\u003EFor protected endpoints, missing or invalid authentication must prevent access according to the applicable authentication and authorization configuration.\u003C/p\u003E\n\u003Cp\u003EAn anonymous request is not necessarily an error. It becomes an access problem when the requested operation requires an authenticated identity.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-context-and-accesscontext\u0022\u003EAuthentication context and AccessContext\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates authentication-flow execution from authorization context.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthFlowContext\u003C/code\u003E is associated with authentication operations and describes the effective environment in which those operations execute.\u003C/p\u003E\n\u003Cp\u003EIt includes the applicable mode, application profile, tenant, and other flow-related information.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAccessContext\u003C/code\u003E represents the trusted actor and contextual information used for access and authorization decisions.\u003C/p\u003E\n\u003Cp\u003EThese contexts serve different purposes.\u003C/p\u003E\n\u003Cp\u003EAn application request does not need to execute a login flow merely to establish an identity from an already valid authentication credential.\u003C/p\u003E\n\u003Cp\u003ELikewise, the existence of an \u003Ccode\u003EAuthFlowContext\u003C/code\u003E does not mean the operation has already been authorized.\u003C/p\u003E\n\u003Cp\u003EThe authentication model and these trust boundaries are introduced in \u003Ca href=\u0022/docs/fundamentals/auth-model\u0022\u003EAuthentication Model\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-boundary\u0022\u003EAuthorization boundary\u003C/h2\u003E\n\u003Cp\u003EAfter authentication establishes the caller\u0027s identity, the application must determine whether the requested operation is permitted.\u003C/p\u003E\n\u003Cp\u003EAuthorization may depend on:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe authenticated actor.\u003C/li\u003E\n\u003Cli\u003EThe requested resource or operation.\u003C/li\u003E\n\u003Cli\u003ETenant boundaries.\u003C/li\u003E\n\u003Cli\u003ERoles and permissions.\u003C/li\u003E\n\u003Cli\u003EApplicable application policies.\u003C/li\u003E\n\u003Cli\u003EResource ownership or other domain-specific requirements.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EUltimateAuth integrates with the relevant server-side authorization mechanisms, but authentication and authorization remain separate responsibilities.\u003C/p\u003E\n\u003Cp\u003EFor ASP.NET Core applications, endpoint and policy-based authorization can protect HTTP resources.\u003C/p\u003E\n\u003Cp\u003EHowever, an authorization attribute applied to an HTTP endpoint does not automatically protect arbitrary direct calls to the underlying application service.\u003C/p\u003E\n\u003Cp\u003ESecurity requirements must be enforced at the boundary through which the operation is actually accessible.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022http-requests-and-in-process-operations\u0022\u003EHTTP requests and in-process operations\u003C/h2\u003E\n\u003Cp\u003ENot every protected application operation crosses an HTTP boundary.\u003C/p\u003E\n\u003Cp\u003EThis distinction is especially important for server-hosted applications.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022http-resource-requests\u0022\u003EHTTP resource requests\u003C/h3\u003E\n\u003Cp\u003EA remote client sends an HTTP request to a protected application or resource API.\u003C/p\u003E\n\u003Cp\u003EThe receiving application must authenticate the request and enforce authorization before performing the protected operation.\u003C/p\u003E\n\u003Cp\u003EClient-side authentication state alone is insufficient.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022in-process-application-operations\u0022\u003EIn-process application operations\u003C/h3\u003E\n\u003Cp\u003EA server-hosted application may invoke application services directly without making an HTTP request.\u003C/p\u003E\n\u003Cp\u003EFor example, a Blazor Server component may call a registered service within the same process.\u003C/p\u003E\n\u003Cp\u003EIn this case, the application must not assume that HTTP middleware or endpoint authorization filters execute automatically.\u003C/p\u003E\n\u003Cp\u003EThe service invocation must operate with an appropriately established identity and enforce the relevant authorization requirements.\u003C/p\u003E\n\u003Cp\u003EThis is an architectural distinction, not a separate authentication mode.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/fundamentals/runtime-architecture\u0022\u003ERuntime Architecture\u003C/a\u003E for integrated and distributed deployment models.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022long-lived-connections\u0022\u003ELong-lived connections\u003C/h2\u003E\n\u003Cp\u003ESome application environments maintain connections or execution contexts that outlive individual HTTP requests.\u003C/p\u003E\n\u003Cp\u003EBlazor Server is an important example.\u003C/p\u003E\n\u003Cp\u003EAn interactive circuit may remain active after its initial authentication state was established.\u003C/p\u003E\n\u003Cp\u003EDuring that time, the underlying authentication state may change.\u003C/p\u003E\n\u003Cp\u003EA session may expire, be revoked, or become invalid because of a security-sensitive operation.\u003C/p\u003E\n\u003Cp\u003EConsequently, applications must account for authentication-state revalidation and authorization during long-lived interactions.\u003C/p\u003E\n\u003Cp\u003EAn initially authenticated connection must not be treated as permanent proof that every later operation remains authorized.\u003C/p\u003E\n\u003Cp\u003EThe appropriate mechanism depends on the runtime integration and authentication mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-failures-and-authorization-failures\u0022\u003EAuthentication failures and authorization failures\u003C/h2\u003E\n\u003Cp\u003EAuthentication and authorization failures represent different conditions.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ECondition\u003C/th\u003E\n\u003Cth\u003EMeaning\u003C/th\u003E\n\u003Cth\u003ETypical HTTP outcome\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMissing required authentication\u003C/td\u003E\n\u003Ctd\u003ENo acceptable authenticated identity was established\u003C/td\u003E\n\u003Ctd\u003E401 Unauthorized\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EInvalid or expired credential\u003C/td\u003E\n\u003Ctd\u003EPresented evidence failed authentication\u003C/td\u003E\n\u003Ctd\u003E401 Unauthorized\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAuthenticated but insufficient permission\u003C/td\u003E\n\u003Ctd\u003EIdentity is valid, but access is denied\u003C/td\u003E\n\u003Ctd\u003E403 Forbidden\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPublic endpoint accessed anonymously\u003C/td\u003E\n\u003Ctd\u003EAuthentication is not required\u003C/td\u003E\n\u003Ctd\u003ERequest proceeds\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese are typical HTTP semantics, not guarantees that every integration returns identical status codes.\u003C/p\u003E\n\u003Cp\u003EBrowser applications may use redirects or other configured challenge behavior.\u003C/p\u003E\n\u003Cp\u003EApplication services operating outside HTTP may express failures through typed results or exceptions rather than HTTP responses.\u003C/p\u003E\n\u003Cp\u003EThe essential distinction is that authentication failure and authorization denial must not be confused.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022request-isolation\u0022\u003ERequest isolation\u003C/h2\u003E\n\u003Cp\u003EAuthentication state must be associated with the correct execution context.\u003C/p\u003E\n\u003Cp\u003EA request must not inherit another request\u0027s authenticated identity, tenant context, or authorization state.\u003C/p\u003E\n\u003Cp\u003EThis matters in multi-tenant systems, applications with concurrent requests, and server-side environments where services may have different lifetimes.\u003C/p\u003E\n\u003Cp\u003ERequest-specific context must be resolved and propagated through the appropriate framework boundaries.\u003C/p\u003E\n\u003Cp\u003ELong-lived or singleton services must not accidentally retain request-specific authentication information.\u003C/p\u003E\n\u003Cp\u003EThe same principle applies to direct application service calls and background operations.\u003C/p\u003E\n\u003Cp\u003EA background operation without an authenticated HTTP request must establish its execution and authorization context through an explicitly supported mechanism rather than assuming a user identity exists.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-the-request-lifecycle-does-not-guarantee\u0022\u003EWhat the request lifecycle does not guarantee\u003C/h2\u003E\n\u003Cp\u003EThe request lifecycle should not be interpreted as a promise that every UltimateAuth operation:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECreates an \u003Ccode\u003EAuthFlowContext\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EResolves a server-side session.\u003C/li\u003E\n\u003Cli\u003EQueries authentication persistence.\u003C/li\u003E\n\u003Cli\u003ERotates or issues tokens.\u003C/li\u003E\n\u003Cli\u003EExecutes the same orchestrator or authority method.\u003C/li\u003E\n\u003Cli\u003EPasses through an HTTP endpoint.\u003C/li\u003E\n\u003Cli\u003EUses identical authorization mechanisms.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThose requirements depend on the operation, authentication mode, and runtime integration.\u003C/p\u003E\n\u003Cp\u003EThe shared guarantee is architectural: authentication evidence must be validated according to the applicable security model, and protected operations must enforce their authorization requirements.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022summary\u0022\u003ESummary\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth distinguishes between authentication operations and requests that consume an existing authenticated identity.\u003C/p\u003E\n\u003Cp\u003EAuthentication operations establish, continue, or terminate authentication through controlled flows.\u003C/p\u003E\n\u003Cp\u003EProtected resource operations validate existing authentication evidence, establish trusted identity, and enforce authorization before allowing access.\u003C/p\u003E\n\u003Cp\u003EThe validation strategy depends on the authentication mode.\u003C/p\u003E\n\u003Cp\u003EThe execution boundary depends on the runtime and deployment architecture.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA request is not trusted because it contains a credential. It becomes authenticated only when the required validation succeeds, and it becomes authorized only when the applicable access rules permit the operation.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003ENext step\u003C/h2\u003E\n\u003Cp\u003EYou have completed the Fundamentals section.\u003C/p\u003E\n\u003Cp\u003EContinue to \u003Ca href=\u0022/docs/auth-flows/overview\u0022\u003EAuth Flows\u003C/a\u003E to explore the technical authentication pipeline and the individual login, refresh, and logout operations.\u003C/p\u003E\n", "Headings": [ { "Id": "two-request-categories", @@ -24,23 +24,33 @@ "Level": 0 }, { - "Id": "pureopaque", - "Text": "PureOpaque", + "Id": "validation-requirements", + "Text": "Validation requirements", + "Level": 0 + }, + { + "Id": "standard-request-validation", + "Text": "Standard request validation", + "Level": 1 + }, + { + "Id": "authoritative-request-validation", + "Text": "Authoritative request validation", "Level": 1 }, { - "Id": "hybrid", - "Text": "Hybrid", + "Id": "require-authoritative-validation", + "Text": "Require authoritative validation", "Level": 1 }, { - "Id": "semihybrid", - "Text": "SemiHybrid", + "Id": "authentication-flows-have-their-own-requirements", + "Text": "Authentication flows have their own requirements", "Level": 1 }, { - "Id": "purejwt", - "Text": "PureJwt", + "Id": "validation-is-not-authorization", + "Text": "Validation is not authorization", "Level": 1 }, { @@ -109,6 +119,6 @@ "Level": 0 } ], - "SourceHash": "FB837A5765EBD563B44A42A71F1CF0BFF957E7A7EE964F7B81BA0B25DA2E47FF", + "SourceHash": "1EE5BF2FBB50B9DB67310AE106084A2AF88AFC8038318BBAE8CCDC5A1EEA7B7A", "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 f5317dfa..8cb01b7b 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\u003EThe authentication mode determines how a resource application establishes the caller\u0027s authenticated identity.\u003C/p\u003E\n\u003Cp\u003EIn PureOpaque and Hybrid, the current Resource API implementation relies on remote session validation through 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 | Session credential\n v\nResource API\n |\n | Remote session validation\n v\nUAuthHub\n |\n v\nSession infrastructure\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIn PureJwt, the Resource API validates JWT access tokens locally 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\u003EUAuthHub remains responsible for authentication flows, credential issuance, and refresh-token lifecycle management.\u003C/p\u003E\n\u003Cp\u003EA PureJwt Resource API does not need to contact UAuthHub for ordinary access-token validation.\u003C/p\u003E\n\u003Cp\u003EHybrid-aware JWT validation in separate Resource APIs is not yet implemented.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid remains a planned authentication mode.\u003C/p\u003E\n\u003Cp\u003EAuthentication mode selection therefore determines the resource application\u0027s infrastructure dependencies, revocation semantics, and authorization freshness guarantees.\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 lifecycle management but not for normal JWT validation.\u003C/p\u003E\n\u003Cp\u003EPureJwt does not require server-side session infrastructure. Optional refresh-token functionality may introduce independent renewal-state requirements.\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 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", "Headings": [ { "Id": "architectural-overview", @@ -48,6 +48,16 @@ "Text": "Authentication validation depends on the mode", "Level": 1 }, + { + "Id": "uauthhub-is-a-logical-authentication-authority", + "Text": "UAuthHub is a logical authentication authority", + "Level": 1 + }, + { + "Id": "authentication-architecture-can-evolve", + "Text": "Authentication architecture can evolve", + "Level": 1 + }, { "Id": "authorization-remains-local-to-the-protected-operation", "Text": "Authorization remains local to the protected operation", @@ -164,6 +174,6 @@ "Level": 0 } ], - "SourceHash": "6AE4FE8C07C29812F05664F335FBA7EAC2214D594C9ED806DCEC916EF71F5103", + "SourceHash": "5432ED76D9CADC49324BE3809E2D79157C027C68E9AB7BD385B3AD7CA394FB73", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/security/token-security.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/security/token-security.json index bda0a30a..61215795 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/security/token-security.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/security/token-security.json @@ -1,7 +1,7 @@ { "Slug": "security/token-security", "Title": "Token Security", - "Html": "\n\u003Cp\u003EAuthentication tokens allow clients to present authentication state to protected applications and services.\u003C/p\u003E\n\u003Cp\u003EHowever, not all tokens provide the same security guarantees.\u003C/p\u003E\n\u003Cp\u003EAn opaque credential requires authoritative server-side validation. A JSON Web Token (JWT) can be verified locally using its signature and claims. A refresh credential enables authentication to continue without repeating the original login process.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth supports these different mechanisms through its authentication modes.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EToken security depends on the credential\u0027s purpose, how it is validated, how long it remains valid, and which security state is consulted during validation.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThis page explains the security characteristics of access and refresh credentials, including issuance, expiration, rotation, replay risks, and revocation boundaries.\u003C/p\u003E\n\u003Cp\u003EFor the overall authentication architecture, 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=\u0022authentication-state-and-credentials\u0022\u003EAuthentication State and Credentials\u003C/h2\u003E\n\u003Cp\u003EA token is authentication material presented by a client.\u003C/p\u003E\n\u003Cp\u003EIt is not the user identity itself.\u003C/p\u003E\n\u003Cp\u003EDepending on the authentication mode, the token may reference server-managed authentication state or contain signed claims that can be validated without retrieving a session.\u003C/p\u003E\n\u003Cp\u003EThese approaches establish different trust boundaries.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-authoritative-authentication\u0022\u003EServer-Authoritative Authentication\u003C/h3\u003E\n\u003Cp\u003EIn server-authoritative modes, a presented opaque credential is validated against server-managed authentication state.\u003C/p\u003E\n\u003Cp\u003EThe server can evaluate the current validity of the corresponding session and applicable security conditions.\u003C/p\u003E\n\u003Cp\u003EThis allows revocation and other authoritative state changes to affect subsequent protected requests.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022locally-validated-authentication\u0022\u003ELocally Validated Authentication\u003C/h3\u003E\n\u003Cp\u003EIn JWT-based modes, a protected resource can validate a token using its signature, issuer, audience, expiration, and other applicable token requirements.\u003C/p\u003E\n\u003Cp\u003EThe resource may not need to consult the issuing server or a session store for every request.\u003C/p\u003E\n\u003Cp\u003EThis reduces the dependency on server-side session lookups but changes how quickly revocation and authorization changes can be enforced.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ENeither model makes the token an identity record. The token is a credential whose validity is determined by the selected authentication mechanism.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-types\u0022\u003EToken Types\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses two principal access credential formats: opaque credentials and JWTs.\u003C/p\u003E\n\u003Cp\u003ERefresh credentials serve a separate purpose.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ECredential\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003Cth\u003EValidation model\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EOpaque access credential\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthenticate protected requests\u003C/td\u003E\n\u003Ctd\u003EAuthoritative server-side validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EJWT access token\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthenticate protected requests\u003C/td\u003E\n\u003Ctd\u003ECryptographic and claims validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EOpaque refresh credential\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EContinue authentication and obtain renewed credentials\u003C/td\u003E\n\u003Ctd\u003ERefresh-specific validation and state checks\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe distinction between access and refresh credentials is important.\u003C/p\u003E\n\u003Cp\u003EAccess credentials are presented to protected resources.\u003C/p\u003E\n\u003Cp\u003ERefresh credentials are presented to the authentication system for a continuation operation. They should not be accepted as ordinary access credentials.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022opaque-access-credentials\u0022\u003EOpaque Access Credentials\u003C/h2\u003E\n\u003Cp\u003EAn opaque credential is a value whose contents do not expose the authenticated identity or authorization claims to the client.\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\u003EAccess credential:\nq8Vn2...random-opaque-value...M7x\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client presents the credential, but cannot determine its authorization meaning by decoding it.\u003C/p\u003E\n\u003Cp\u003EThe server resolves and validates the associated authentication state.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-properties\u0022\u003ESecurity Properties\u003C/h3\u003E\n\u003Cp\u003EOpaque access credentials provide several useful characteristics:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ETheir meaning is determined by authoritative server-side state.\u003C/li\u003E\n\u003Cli\u003EThey do not need to expose identity claims in a client-readable payload.\u003C/li\u003E\n\u003Cli\u003ETheir validity can be affected by session expiration or revocation.\u003C/li\u003E\n\u003Cli\u003EThey can participate in account-level and chain-level security enforcement.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EHowever, opaque credentials are still bearer credentials unless an additional proof mechanism is enforced.\u003C/p\u003E\n\u003Cp\u003EAn attacker who obtains a usable opaque credential may be able to present it.\u003C/p\u003E\n\u003Cp\u003EOpacity alone does not prevent credential theft or replay.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-side-validation\u0022\u003EServer-Side Validation\u003C/h3\u003E\n\u003Cp\u003EIn a session-authoritative mode, validation can enforce the applicable session hierarchy requirements, including expiration, revocation, ownership, and security state consistency.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/session-security\u0022\u003ESession Security Model\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-access-tokens\u0022\u003EJWT Access Tokens\u003C/h2\u003E\n\u003Cp\u003EA JWT is a structured token containing signed claims.\u003C/p\u003E\n\u003Cp\u003EA typical JWT contains three encoded sections:\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\u003Eheader.payload.signature\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIts payload may describe the authenticated subject, tenant, authorization information, token lifetime, and other relevant context.\u003C/p\u003E\n\u003Cp\u003EA JWT is not encrypted merely because it is encoded and signed.\u003C/p\u003E\n\u003Cp\u003EApplications should not place secrets or unnecessarily sensitive information in a JWT payload.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cryptographic-validation\u0022\u003ECryptographic Validation\u003C/h3\u003E\n\u003Cp\u003EA protected resource must validate the JWT according to the configured token requirements.\u003C/p\u003E\n\u003Cp\u003ERelevant checks include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESignature validity.\u003C/li\u003E\n\u003Cli\u003EAccepted signing algorithm and key.\u003C/li\u003E\n\u003Cli\u003EExpected issuer.\u003C/li\u003E\n\u003Cli\u003EIntended audience.\u003C/li\u003E\n\u003Cli\u003EExpiration and other applicable time constraints.\u003C/li\u003E\n\u003Cli\u003ERequired token claims and application-specific restrictions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA successfully decoded JWT is not necessarily a valid JWT.\u003C/p\u003E\n\u003Cp\u003ELikewise, a correctly signed JWT is not automatically acceptable to every resource.\u003C/p\u003E\n\u003Cp\u003EThe resource must verify that the token was issued for its intended security context.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022local-validation\u0022\u003ELocal Validation\u003C/h3\u003E\n\u003Cp\u003EJWTs can be validated without loading current server-side session state.\u003C/p\u003E\n\u003Cp\u003EThis is useful for distributed APIs and services that need to authenticate requests efficiently.\u003C/p\u003E\n\u003Cp\u003EHowever, local validation introduces an important limitation:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA token can remain cryptographically valid after the underlying account or authorization state has changed.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EWhether such changes immediately affect access depends on additional validation and revocation mechanisms.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-mode-behavior\u0022\u003EAuthentication Mode Behavior\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth selects credential behavior according to the configured authentication mode.\u003C/p\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\u003EAccess mechanism\u003C/th\u003E\n\u003Cth\u003EContinuation mechanism\u003C/th\u003E\n\u003Cth\u003EProtected request authority\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EPureOpaque\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EOpaque session credential\u003C/td\u003E\n\u003Ctd\u003ESession lifecycle\u003C/td\u003E\n\u003Ctd\u003EServer-managed session state\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EHybrid\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EOpaque session credential and JWT access token\u003C/td\u003E\n\u003Ctd\u003EOpaque refresh credential\u003C/td\u003E\n\u003Ctd\u003EServer-managed session state for the current session-backed path\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESemiHybrid\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EJWT access token\u003C/td\u003E\n\u003Ctd\u003EServer-managed refresh flow\u003C/td\u003E\n\u003Ctd\u003ELocally validated JWT\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EPureJwt\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EJWT access token\u003C/td\u003E\n\u003Ctd\u003EStateful refresh-token rotation\u003C/td\u003E\n\u003Ctd\u003ELocally validated JWT\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=\u0022pureopaque\u0022\u003EPureOpaque\u003C/h3\u003E\n\u003Cp\u003EPureOpaque uses an opaque session credential.\u003C/p\u003E\n\u003Cp\u003EIt does not require a separate access-token and refresh-token pair.\u003C/p\u003E\n\u003Cp\u003EThe credential is validated through the authoritative session mechanism.\u003C/p\u003E\n\u003Cp\u003ESession lifecycle operations govern the continuation and validity of authentication state.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022hybrid\u0022\u003EHybrid\u003C/h3\u003E\n\u003Cp\u003EHybrid establishes server-side sessions and issues JWT access tokens together with opaque refresh credentials.\u003C/p\u003E\n\u003Cp\u003EThe current session-backed authentication path relies on authoritative server-managed session state.\u003C/p\u003E\n\u003Cp\u003ERefresh operations validate the relevant session and refresh credential before issuing replacement credentials.\u003C/p\u003E\n\u003Cp\u003EHybrid-aware JWT validation in separate Resource APIs is not yet implemented.\u003C/p\u003E\n\u003Cp\u003EJWT payloads are readable by their holders. The use of signed JWTs does not provide payload confidentiality.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022semihybrid\u0022\u003ESemiHybrid\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid issues JWT access tokens while maintaining server-side session state for relevant lifecycle operations.\u003C/p\u003E\n\u003Cp\u003EProtected requests can validate JWT access tokens locally.\u003C/p\u003E\n\u003Cp\u003ERefresh and logout interact with the server-managed authentication lifecycle.\u003C/p\u003E\n\u003Cp\u003EThis means that server-side revocation does not necessarily invalidate an already-issued JWT immediately.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022purejwt\u0022\u003EPureJwt\u003C/h3\u003E\n\u003Cp\u003EPureJwt uses JWT access tokens without requiring the Root \u2192 Chain \u2192 Session hierarchy for ordinary protected request validation.\u003C/p\u003E\n\u003Cp\u003EAn optional refresh mechanism may maintain refresh-specific state.\u003C/p\u003E\n\u003Cp\u003EThe existence of a refresh store does not make JWT access validation session-authoritative.\u003C/p\u003E\n\u003Cp\u003EFor more detail, 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=\u0022purejwt-validation-requirements\u0022\u003EPureJwt Validation Requirements\u003C/h2\u003E\n\u003Cp\u003EPureJwt Resource APIs validate JWT access tokens locally using trusted verification keys and explicit validation policies.\u003C/p\u003E\n\u003Cp\u003EA valid signature alone is insufficient.\u003C/p\u003E\n\u003Cp\u003EThe current validation pipeline enforces the expected token type, issuer, audience, lifetime, allowed algorithm, key ID, tenant, subject, and device binding requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022trusted-verification-keys\u0022\u003ETrusted verification keys\u003C/h3\u003E\n\u003Cp\u003EVerification keys must come from trusted application configuration or an explicitly registered verification-key provider.\u003C/p\u003E\n\u003Cp\u003EThe Resource API does not accept signing keys supplied by an untrusted JWT header or automatically retrieve keys from token-provided URLs.\u003C/p\u003E\n\u003Cp\u003EThe built-in configured verification-key provider supports Base64-encoded symmetric keys.\u003C/p\u003E\n\u003Cp\u003EFor the built-in HS256 signing implementation, use at least 32 bytes of cryptographically secure random key material.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-binding\u0022\u003EDevice binding\u003C/h3\u003E\n\u003Cp\u003EPureJwt access tokens contain a device identifier.\u003C/p\u003E\n\u003Cp\u003EBy default, Resource API validation rejects requests when the required device identifier is missing or does not match the token.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EDeviceMismatchBehavior.Allow\u003C/code\u003E permits a mismatch when explicitly configured, but weakens device-binding enforcement.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowAndRebind\u003C/code\u003E is not supported in PureJwt.\u003C/p\u003E\n\u003Cp\u003EA matching device identifier is an additional binding check, not cryptographic proof that the requesting device has exclusive possession of the token.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022stateless-authorization-freshness\u0022\u003EStateless authorization freshness\u003C/h3\u003E\n\u003Cp\u003EPureJwt Resource APIs do not require a live user-state lookup during normal JWT validation.\u003C/p\u003E\n\u003Cp\u003EAs a result, an otherwise valid JWT can remain accepted after account deletion, suspension, permission changes, or refresh-chain revocation.\u003C/p\u003E\n\u003Cp\u003EApplications requiring immediate enforcement of such changes must implement an additional authoritative validation mechanism or use an appropriate session-backed authentication strategy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022access-token-lifetime\u0022\u003EAccess Token Lifetime\u003C/h2\u003E\n\u003Cp\u003EAccess credentials should have lifetimes appropriate to their authentication mode and security requirements.\u003C/p\u003E\n\u003Cp\u003EShort-lived JWT access tokens are particularly important because a token may remain usable until expiration even after server-side authorization state changes.\u003C/p\u003E\n\u003Cp\u003EFor example, an application might choose a JWT access lifetime of several minutes.\u003C/p\u003E\n\u003Cp\u003EHowever, \u003Cstrong\u003Ea lifetime such as 5\u201315 minutes is an example of an application security choice, not a universal UltimateAuth default or requirement\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe appropriate value depends on factors such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESensitivity of protected resources.\u003C/li\u003E\n\u003Cli\u003EExpected frequency of authorization changes.\u003C/li\u003E\n\u003Cli\u003EAcceptable revocation delay.\u003C/li\u003E\n\u003Cli\u003EAvailability and security of the refresh mechanism.\u003C/li\u003E\n\u003Cli\u003EClient behavior and network conditions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022lifetime-versus-revocation\u0022\u003ELifetime Versus Revocation\u003C/h3\u003E\n\u003Cp\u003EExpiration limits how long a credential can be accepted.\u003C/p\u003E\n\u003Cp\u003ERevocation invalidates authentication state before its ordinary expiration.\u003C/p\u003E\n\u003Cp\u003EThese mechanisms are related but not interchangeable.\u003C/p\u003E\n\u003Cp\u003EIn server-authoritative modes, current revocation state can be checked during protected requests.\u003C/p\u003E\n\u003Cp\u003EIn locally validated JWT modes, expiration may remain the primary limit on an already-issued access token unless an additional revocation check is implemented.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-credentials\u0022\u003ERefresh Credentials\u003C/h2\u003E\n\u003Cp\u003ERefresh credentials allow clients to continue authentication without repeating the original authentication ceremony.\u003C/p\u003E\n\u003Cp\u003EThey are intended for the authentication system\u0027s refresh operation, not for general API access.\u003C/p\u003E\n\u003Cp\u003EIn UltimateAuth, refresh behavior is mode-dependent.\u003C/p\u003E\n\u003Cp\u003EPureOpaque does not issue a separate access-token and refresh-token pair.\u003C/p\u003E\n\u003Cp\u003EHybrid uses refresh-token rotation together with session validation.\u003C/p\u003E\n\u003Cp\u003EPureJwt uses stateful refresh-token rotation without requiring an authentication session.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid is intended to combine JWT authentication with server-managed session lifecycle operations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-security-requirements\u0022\u003ERefresh Security Requirements\u003C/h3\u003E\n\u003Cp\u003EA secure refresh operation must establish that the presented credential is eligible for continued authentication.\u003C/p\u003E\n\u003Cp\u003EDepending on the mode and configured strategy, this may involve checking:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECredential existence and validity.\u003C/li\u003E\n\u003Cli\u003EExpiration.\u003C/li\u003E\n\u003Cli\u003ERevocation or consumption state.\u003C/li\u003E\n\u003Cli\u003EAssociated user or session context.\u003C/li\u003E\n\u003Cli\u003EApplicable client and device context.\u003C/li\u003E\n\u003Cli\u003ERotation and reuse conditions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA valid refresh credential should not automatically bypass account-level or session-level security requirements that apply to the selected mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022access-and-refresh-separation\u0022\u003EAccess and Refresh Separation\u003C/h3\u003E\n\u003Cp\u003EAccess and refresh credentials have different responsibilities.\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\u003EAuthentication\n |\n v\nAccess credential\n |\n | Used for protected requests\n v\nAccess expires\n |\n v\nRefresh operation\n |\n | Validate refresh credential\n | Apply continuation rules\n v\nRenewed access credential\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe refresh operation does not extend the expiration timestamp of an already-issued JWT.\u003C/p\u003E\n\u003Cp\u003EIt issues new authentication material when continuation is permitted.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-rotation\u0022\u003ERefresh Rotation\u003C/h2\u003E\n\u003Cp\u003ERefresh rotation replaces refresh authentication material according to the configured refresh strategy.\u003C/p\u003E\n\u003Cp\u003EA rotating refresh mechanism can invalidate the previously used refresh credential and issue a replacement.\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\u003ERefresh credential A\n |\n | Successful refresh\n v\nRefresh credential A consumed\nRefresh credential B issued\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis reduces the period during which an older refresh credential remains reusable.\u003C/p\u003E\n\u003Cp\u003EHowever, \u003Cstrong\u003Erotation behavior is not identical across every UltimateAuth mode or refresh strategy\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003ESome session continuation operations may update existing server-side state without replacing a separate refresh credential.\u003C/p\u003E\n\u003Cp\u003EThe effective behavior must follow the selected mode and its configured refresh strategy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022rotation-is-not-replay-prevention-by-itself\u0022\u003ERotation Is Not Replay Prevention by Itself\u003C/h3\u003E\n\u003Cp\u003ERotation limits credential reuse only when the server enforces the relevant consumption or replacement state.\u003C/p\u003E\n\u003Cp\u003EA secure rotating refresh mechanism must account for situations such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe same credential being submitted again.\u003C/li\u003E\n\u003Cli\u003EConcurrent refresh requests.\u003C/li\u003E\n\u003Cli\u003EA credential being reused after replacement.\u003C/li\u003E\n\u003Cli\u003EAn interrupted response after a successful rotation.\u003C/li\u003E\n\u003Cli\u003EAn attacker and legitimate client attempting to use the same credential.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe exact outcome depends on the implemented refresh strategy and concurrency guarantees.\u003C/p\u003E\n\u003Cp\u003ERotation should not be described as automatically eliminating every replay risk.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-token-reuse\u0022\u003ERefresh Token Reuse\u003C/h2\u003E\n\u003Cp\u003ERefresh token reuse occurs when a credential is presented after it has already been consumed, replaced, or otherwise invalidated.\u003C/p\u003E\n\u003Cp\u003EFor a single-use rotating refresh credential, this is a security-relevant event.\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\u003EClient refreshes with A\n |\n v\nA replaced by B\n |\n v\nAnother request presents A\n |\n v\nReuse / invalid credential condition\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA reuse attempt may indicate credential theft, but it can also arise from concurrent requests or client synchronization failures.\u003C/p\u003E\n\u003Cp\u003EThe refresh implementation must distinguish these situations according to its supported guarantees and policy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-response\u0022\u003ESecurity Response\u003C/h3\u003E\n\u003Cp\u003EPossible security responses include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ERejecting the invalid refresh attempt.\u003C/li\u003E\n\u003Cli\u003EInvalidating the associated refresh state.\u003C/li\u003E\n\u003Cli\u003ERevoking an affected session.\u003C/li\u003E\n\u003Cli\u003ERevoking a broader session chain where supported and appropriate.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese are distinct actions.\u003C/p\u003E\n\u003Cp\u003EThe presence of a reuse-detection mechanism does not imply that every reuse attempt automatically revokes the entire device-associated chain.\u003C/p\u003E\n\u003Cp\u003ESuch behavior must be explicitly supported by the configured refresh strategy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-credential-storage\u0022\u003ERefresh Credential Storage\u003C/h2\u003E\n\u003Cp\u003ERefresh credentials are generally more sensitive to long-term compromise because they may allow new access credentials to be obtained.\u003C/p\u003E\n\u003Cp\u003ETheir storage therefore deserves stronger protection than ordinary client-visible access metadata.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-side-storage\u0022\u003EServer-Side Storage\u003C/h3\u003E\n\u003Cp\u003EFor persisted opaque refresh credentials, storing a one-way verifier or hash instead of the raw credential can reduce the impact of a storage disclosure.\u003C/p\u003E\n\u003Cp\u003EHowever, the exact persistence model depends on the selected authentication mode and refresh implementation.\u003C/p\u003E\n\u003Cp\u003EIt should not be assumed that every authentication mode uses the same refresh storage structure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-side-storage\u0022\u003EClient-Side Storage\u003C/h3\u003E\n\u003Cp\u003EThe appropriate client storage mechanism depends on the application environment.\u003C/p\u003E\n\u003Cp\u003EFor browser applications, HttpOnly cookies can prevent JavaScript from directly reading refresh credentials, although cookie-based refresh flows still require appropriate CSRF and origin protections.\u003C/p\u003E\n\u003Cp\u003ENative applications may use platform-provided secure storage where suitable.\u003C/p\u003E\n\u003Cp\u003ERefresh credentials should not be exposed through application logs, diagnostic output, URLs, or unrelated API responses.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022transport-security\u0022\u003ETransport Security\u003C/h3\u003E\n\u003Cp\u003EAuthentication credentials must be protected in transit.\u003C/p\u003E\n\u003Cp\u003EProduction authentication and refresh endpoints should use HTTPS.\u003C/p\u003E\n\u003Cp\u003EApplications should also avoid sending refresh credentials to services that do not need to receive them.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022claims-and-authorization-freshness\u0022\u003EClaims and Authorization Freshness\u003C/h2\u003E\n\u003Cp\u003EJWT claims represent information established when the token was issued.\u003C/p\u003E\n\u003Cp\u003EThey may include standard or application-specific information 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\u003Esub Subject identifier\niss Issuer\naud Audience\nexp Expiration\niat Issued-at time\njti Token identifier\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDepending on the application, a JWT may also include tenant information, roles, permissions, or session references.\u003C/p\u003E\n\u003Cp\u003EThese claims are not automatically updated when the underlying account changes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-permission-removal\u0022\u003EExample: Permission Removal\u003C/h3\u003E\n\u003Cp\u003EConsider the following sequence:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EA JWT is issued containing an administrative permission.\u003C/li\u003E\n\u003Cli\u003EAn administrator removes that permission from the user.\u003C/li\u003E\n\u003Cli\u003EThe client continues presenting the previously issued JWT.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EIf the protected resource relies only on the signed claims in that JWT, the removed permission may remain effective until the token expires.\u003C/p\u003E\n\u003Cp\u003EThe signature remains valid because the token has not been modified.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-strategies\u0022\u003EAuthorization Strategies\u003C/h3\u003E\n\u003Cp\u003EApplications can address this limitation through their security architecture, including:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EShorter JWT lifetimes.\u003C/li\u003E\n\u003Cli\u003EReissuing claims during refresh.\u003C/li\u003E\n\u003Cli\u003EConsulting authoritative authorization state for sensitive operations.\u003C/li\u003E\n\u003Cli\u003EUsing server-authoritative authentication modes where immediate state enforcement is required.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe appropriate approach depends on the security requirements of the application.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/plugin-domains/authorization\u0022\u003EAuthorization\u003C/a\u003E and \u003Ca href=\u0022/docs/plugin-domains/policies\u0022\u003EPolicies \u0026amp; Access Control\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-revocation\u0022\u003EToken Revocation\u003C/h2\u003E\n\u003Cp\u003ERevocation behavior differs fundamentally between opaque credentials and locally validated JWTs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022opaque-credential-revocation\u0022\u003EOpaque Credential Revocation\u003C/h3\u003E\n\u003Cp\u003EAn opaque credential depends on authoritative validation.\u003C/p\u003E\n\u003Cp\u003EIf the corresponding server-managed authentication state is revoked, subsequent validation can reject the credential.\u003C/p\u003E\n\u003Cp\u003EThe precise scope depends on whether the security operation targets a session, chain, or account-level root.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-revocation\u0022\u003EJWT Revocation\u003C/h3\u003E\n\u003Cp\u003EA signed JWT cannot be made cryptographically invalid merely by deleting a server-side session record.\u003C/p\u003E\n\u003Cp\u003EIts signature and expiration remain unchanged.\u003C/p\u003E\n\u003Cp\u003ETo reject an otherwise valid JWT before expiration, the resource must enforce an additional condition, such as an authoritative revocation check or another supported invalidation mechanism.\u003C/p\u003E\n\u003Cp\u003EWithout that additional enforcement, a locally validated JWT may remain acceptable until expiration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-revocation\u0022\u003ERefresh Revocation\u003C/h3\u003E\n\u003Cp\u003ERevoking a refresh credential can prevent further successful refresh operations.\u003C/p\u003E\n\u003Cp\u003EHowever, that does not necessarily invalidate access tokens already issued before the revocation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAccess revocation and refresh revocation are separate security concerns.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-security-and-token-security\u0022\u003ESession Security and Token Security\u003C/h2\u003E\n\u003Cp\u003EToken security and session security are closely related, but they operate at different levels.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConcern\u003C/th\u003E\n\u003Cth\u003EToken Security\u003C/th\u003E\n\u003Cth\u003ESession Security\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECredential format\u003C/td\u003E\n\u003Ctd\u003EOpaque or JWT\u003C/td\u003E\n\u003Ctd\u003ERoot, chain, and session state\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECryptographic validation\u003C/td\u003E\n\u003Ctd\u003EJWT signature and claims\u003C/td\u003E\n\u003Ctd\u003ENot a substitute for token signature validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EExpiration\u003C/td\u003E\n\u003Ctd\u003EToken validity period\u003C/td\u003E\n\u003Ctd\u003ESession and chain lifecycle limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERotation\u003C/td\u003E\n\u003Ctd\u003EReplacement of authentication material\u003C/td\u003E\n\u003Ctd\u003EContinuity and associated state transitions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERevocation\u003C/td\u003E\n\u003Ctd\u003EWhether a presented credential remains acceptable\u003C/td\u003E\n\u003Ctd\u003EWhich authentication state has been invalidated\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDevice context\u003C/td\u003E\n\u003Ctd\u003EMay be associated with token use\u003C/td\u003E\n\u003Ctd\u003EManaged through applicable chain and session context\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EA token may be valid according to its own format but unacceptable under authoritative session security rules.\u003C/p\u003E\n\u003Cp\u003EConversely, server-side session state may remain active while a particular access token has expired.\u003C/p\u003E\n\u003Cp\u003EBoth levels must be understood to reason correctly about the selected authentication mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-security-misconceptions\u0022\u003ECommon Security Misconceptions\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-valid-signature-means-current-authorization\u0022\u003EA Valid Signature Means Current Authorization\u003C/h3\u003E\n\u003Cp\u003EA valid JWT signature proves that the token has not been modified and was signed by an accepted key.\u003C/p\u003E\n\u003Cp\u003EIt does not prove that the user\u0027s permissions or account status have remained unchanged since issuance.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-device-identifier-prevents-token-theft\u0022\u003EA Device Identifier Prevents Token Theft\u003C/h3\u003E\n\u003Cp\u003EA device identifier may support context consistency checks.\u003C/p\u003E\n\u003Cp\u003EIt does not independently prevent a stolen bearer credential from being replayed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-rotation-makes-token-theft-impossible\u0022\u003ERefresh Rotation Makes Token Theft Impossible\u003C/h3\u003E\n\u003Cp\u003ERotation can reduce reuse opportunities and support detection of invalid reuse.\u003C/p\u003E\n\u003Cp\u003EIt does not prevent a stolen credential from being used before the legitimate client or server detects the compromise.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-invalidates-every-jwt-immediately\u0022\u003ELogout Invalidates Every JWT Immediately\u003C/h3\u003E\n\u003Cp\u003ELogout may revoke server-managed session or refresh state.\u003C/p\u003E\n\u003Cp\u003EPreviously issued JWT access tokens can remain valid until expiration unless protected resources enforce an additional invalidation mechanism.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022short-lived-tokens-eliminate-the-need-for-session-security\u0022\u003EShort-Lived Tokens Eliminate the Need for Session Security\u003C/h3\u003E\n\u003Cp\u003EShort lifetimes reduce the exposure window of a compromised token.\u003C/p\u003E\n\u003Cp\u003EThey do not replace account-level security policies, credential recovery protections, or session revocation controls where those capabilities are required.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-design-principles\u0022\u003ESecurity Design Principles\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth\u0027s token model is best understood through a few principles.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUse credentials only for their intended purpose.\u003C/strong\u003E Access and refresh credentials must not be interchangeable.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EValidate according to the selected mode.\u003C/strong\u003E Opaque credentials require authoritative validation; JWTs require correct cryptographic and claims validation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ETreat JWT claims as issuance-time information.\u003C/strong\u003E Current authorization state may differ from what an older token contains.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EKeep access credentials appropriately short-lived.\u003C/strong\u003E Token lifetime should reflect the application\u0027s acceptable exposure window.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EEnforce refresh continuation rules.\u003C/strong\u003E Rotation, expiration, consumption, and reuse behavior must be consistent with the configured strategy.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDistinguish token expiration from session revocation.\u003C/strong\u003E They invalidate authentication through different mechanisms.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDo not promise immediate JWT revocation without enforcement.\u003C/strong\u003E Server-side state changes affect locally validated tokens only when the resource checks the relevant state.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022architectural-perspective\u0022\u003EArchitectural Perspective\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth does not impose a single token model on every application.\u003C/p\u003E\n\u003Cp\u003EPureOpaque and Hybrid emphasize server-authoritative authentication state.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid and PureJwt support locally validated JWT access, with different approaches to authentication continuation.\u003C/p\u003E\n\u003Cp\u003EThese choices affect performance, storage requirements, revocation behavior, and authorization freshness.\u003C/p\u003E\n\u003Cp\u003EThe purpose of the token security model is to make those tradeoffs explicit.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA token establishes access only while its applicable validation requirements remain satisfied. The strength and freshness of those requirements depend on the authentication mode.\u003C/strong\u003E\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/security/session-security\u0022\u003ESession Security\u003C/a\u003E \u2014 Understand authoritative session validation and hierarchical revocation.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E \u2014 Compare credential behavior across modes.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/sessions-devices/session-lifecycle\u0022\u003ESession Model \u0026amp; Lifecycle\u003C/a\u003E \u2014 Explore session creation, continuation, and invalidation.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/plugin-domains/credentials\u0022\u003ECredentials\u003C/a\u003E \u2014 Understand credential management and recovery security.\u003C/li\u003E\n\u003C/ul\u003E\n", + "Html": "\n\u003Cp\u003EAuthentication tokens allow clients to present authentication state to protected applications and services.\u003C/p\u003E\n\u003Cp\u003EHowever, not all tokens provide the same security guarantees.\u003C/p\u003E\n\u003Cp\u003EAn opaque credential requires authoritative server-side validation. A JSON Web Token (JWT) can be verified locally using its signature and claims. A refresh credential enables authentication to continue without repeating the original login process.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth supports these different mechanisms through its authentication modes.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EToken security depends on the credential\u0027s purpose, how it is validated, how long it remains valid, and which security state is consulted during validation.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThis page explains the security characteristics of access and refresh credentials, including issuance, expiration, rotation, replay risks, and revocation boundaries.\u003C/p\u003E\n\u003Cp\u003EFor the overall authentication architecture, 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=\u0022authentication-state-and-credentials\u0022\u003EAuthentication State and Credentials\u003C/h2\u003E\n\u003Cp\u003EA token is authentication material presented by a client.\u003C/p\u003E\n\u003Cp\u003EIt is not the user identity itself.\u003C/p\u003E\n\u003Cp\u003EDepending on the authentication mode, the token may reference server-managed authentication state or contain signed claims that can be validated without retrieving a session.\u003C/p\u003E\n\u003Cp\u003EThese approaches establish different trust boundaries.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-authoritative-authentication\u0022\u003EServer-Authoritative Authentication\u003C/h3\u003E\n\u003Cp\u003EIn server-authoritative modes, a presented opaque credential is validated against server-managed authentication state.\u003C/p\u003E\n\u003Cp\u003EThe server can evaluate the current validity of the corresponding session and applicable security conditions.\u003C/p\u003E\n\u003Cp\u003EThis allows revocation and other authoritative state changes to affect subsequent protected requests.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022locally-validated-authentication\u0022\u003ELocally Validated Authentication\u003C/h3\u003E\n\u003Cp\u003EIn JWT-based modes, a protected resource can validate a token using its signature, issuer, audience, expiration, and other applicable token requirements.\u003C/p\u003E\n\u003Cp\u003EThe resource may not need to consult the issuing server or a session store for every request.\u003C/p\u003E\n\u003Cp\u003EThis reduces the dependency on server-side session lookups but changes how quickly revocation and authorization changes can be enforced.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ENeither model makes the token an identity record. The token is a credential whose validity is determined by the selected authentication mechanism.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-types\u0022\u003EToken Types\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses two principal access credential formats: opaque credentials and JWTs.\u003C/p\u003E\n\u003Cp\u003ERefresh credentials serve a separate purpose.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ECredential\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003Cth\u003EValidation model\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EOpaque access credential\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthenticate protected requests\u003C/td\u003E\n\u003Ctd\u003EAuthoritative server-side validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EJWT access token\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthenticate protected requests\u003C/td\u003E\n\u003Ctd\u003ECryptographic and claims validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EOpaque refresh credential\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EContinue authentication and obtain renewed credentials\u003C/td\u003E\n\u003Ctd\u003ERefresh-specific validation and state checks\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe distinction between access and refresh credentials is important.\u003C/p\u003E\n\u003Cp\u003EAccess credentials are presented to protected resources.\u003C/p\u003E\n\u003Cp\u003ERefresh credentials are presented to the authentication system for a continuation operation. They should not be accepted as ordinary access credentials.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022opaque-access-credentials\u0022\u003EOpaque Access Credentials\u003C/h2\u003E\n\u003Cp\u003EAn opaque credential is a value whose contents do not expose the authenticated identity or authorization claims to the client.\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\u003EAccess credential:\nq8Vn2...random-opaque-value...M7x\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client presents the credential, but cannot determine its authorization meaning by decoding it.\u003C/p\u003E\n\u003Cp\u003EThe server resolves and validates the associated authentication state.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-properties\u0022\u003ESecurity Properties\u003C/h3\u003E\n\u003Cp\u003EOpaque access credentials provide several useful characteristics:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ETheir meaning is determined by authoritative server-side state.\u003C/li\u003E\n\u003Cli\u003EThey do not need to expose identity claims in a client-readable payload.\u003C/li\u003E\n\u003Cli\u003ETheir validity can be affected by session expiration or revocation.\u003C/li\u003E\n\u003Cli\u003EThey can participate in account-level and chain-level security enforcement.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EHowever, opaque credentials are still bearer credentials unless an additional proof mechanism is enforced.\u003C/p\u003E\n\u003Cp\u003EAn attacker who obtains a usable opaque credential may be able to present it.\u003C/p\u003E\n\u003Cp\u003EOpacity alone does not prevent credential theft or replay.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-side-validation\u0022\u003EServer-Side Validation\u003C/h3\u003E\n\u003Cp\u003EIn a session-authoritative mode, validation can enforce the applicable session hierarchy requirements, including expiration, revocation, ownership, and security state consistency.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/session-security\u0022\u003ESession Security Model\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-access-tokens\u0022\u003EJWT Access Tokens\u003C/h2\u003E\n\u003Cp\u003EA JWT is a structured token containing signed claims.\u003C/p\u003E\n\u003Cp\u003EA typical JWT contains three encoded sections:\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\u003Eheader.payload.signature\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIts payload may describe the authenticated subject, tenant, authorization information, token lifetime, and other relevant context.\u003C/p\u003E\n\u003Cp\u003EA JWT is not encrypted merely because it is encoded and signed.\u003C/p\u003E\n\u003Cp\u003EApplications should not place secrets or unnecessarily sensitive information in a JWT payload.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cryptographic-validation\u0022\u003ECryptographic Validation\u003C/h3\u003E\n\u003Cp\u003EA protected resource must validate the JWT according to the configured token requirements.\u003C/p\u003E\n\u003Cp\u003ERelevant checks include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESignature validity.\u003C/li\u003E\n\u003Cli\u003EAccepted signing algorithm and key.\u003C/li\u003E\n\u003Cli\u003EExpected issuer.\u003C/li\u003E\n\u003Cli\u003EIntended audience.\u003C/li\u003E\n\u003Cli\u003EExpiration and other applicable time constraints.\u003C/li\u003E\n\u003Cli\u003ERequired token claims and application-specific restrictions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA successfully decoded JWT is not necessarily a valid JWT.\u003C/p\u003E\n\u003Cp\u003ELikewise, a correctly signed JWT is not automatically acceptable to every resource.\u003C/p\u003E\n\u003Cp\u003EThe resource must verify that the token was issued for its intended security context.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022local-validation\u0022\u003ELocal Validation\u003C/h3\u003E\n\u003Cp\u003EJWTs can be validated without loading current server-side session state.\u003C/p\u003E\n\u003Cp\u003EThis is useful for distributed APIs and services that need to authenticate requests efficiently.\u003C/p\u003E\n\u003Cp\u003EHowever, local validation introduces an important limitation:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA token can remain cryptographically valid after the underlying account or authorization state has changed.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EWhether such changes immediately affect access depends on additional validation and revocation mechanisms.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-mode-behavior\u0022\u003EAuthentication Mode Behavior\u003C/h2\u003E\n\u003Cp\u003EAuthentication modes define how credentials participate in authentication and continuation.\u003C/p\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\u003EPrimary authentication credential\u003C/th\u003E\n\u003Cth\u003EServer-managed continuity\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\u003Ctd\u003ESession lifecycle\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\u003Ctd\u003ESession and refresh-token lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003ESession-associated JWT access token\u003C/td\u003E\n\u003Ctd\u003ESession lineage and refresh-token lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ESession-independent JWT access token\u003C/td\u003E\n\u003Ctd\u003EOptional refresh-token lifecycle\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/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E for the architectural guarantees of each mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-identifiers-are-not-always-credentials\u0022\u003ESession identifiers are not always credentials\u003C/h3\u003E\n\u003Cp\u003EA session identifier can have different security purposes depending on the mode.\u003C/p\u003E\n\u003Cp\u003EIn PureOpaque and Hybrid, the opaque session identifier acts as an authentication credential.\u003C/p\u003E\n\u003Cp\u003EPossession of this value must therefore be treated as possession of sensitive authentication material.\u003C/p\u003E\n\u003Cp\u003EIn SemiHybrid, the session identifier is included in the JWT as lineage metadata.\u003C/p\u003E\n\u003Cp\u003EThe metadata identifies the associated server-managed session but does not independently authenticate the caller.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth distinguishes opaque session credentials from metadata-only session identifiers.\u003C/p\u003E\n\u003Cp\u003EA metadata-only identifier must never be accepted through an opaque session authentication path.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-purpose-isolation\u0022\u003ECredential purpose isolation\u003C/h3\u003E\n\u003Cp\u003EAuthentication credentials must be validated according to their intended purpose.\u003C/p\u003E\n\u003Cp\u003EA session identifier, access token, and refresh token are not interchangeable.\u003C/p\u003E\n\u003Cp\u003EA valid refresh token does not directly authorize access to a protected resource.\u003C/p\u003E\n\u003Cp\u003EA valid JWT does not automatically establish that its associated server-managed session remains active.\u003C/p\u003E\n\u003Cp\u003EA session identifier exposed as JWT metadata does not become an authentication credential.\u003C/p\u003E\n\u003Cp\u003ECredential purpose isolation prevents authentication material from being reused outside its intended security boundary.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-validation-requirements\u0022\u003EJWT Validation Requirements\u003C/h2\u003E\n\u003Cp\u003ESemiHybrid and PureJwt Resource APIs validate JWT access tokens locally using trusted verification keys and explicit validation configuration.\u003C/p\u003E\n\u003Cp\u003ESuccessful validation requires the applicable:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECryptographic signature validation.\u003C/li\u003E\n\u003Cli\u003ETrusted signing or verification key.\u003C/li\u003E\n\u003Cli\u003EIssuer validation.\u003C/li\u003E\n\u003Cli\u003EAudience validation.\u003C/li\u003E\n\u003Cli\u003EToken lifetime validation.\u003C/li\u003E\n\u003Cli\u003ESupported signing algorithm.\u003C/li\u003E\n\u003Cli\u003ERequired identity and device claims.\u003C/li\u003E\n\u003Cli\u003EAuthentication-mode-specific claim requirements.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA valid signature alone is insufficient.\u003C/p\u003E\n\u003Cp\u003EThe token must also satisfy the authentication requirements of the configured mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-specific-session-association\u0022\u003EMode-specific session association\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid requires a valid session identifier claim associated with server-managed lineage.\u003C/p\u003E\n\u003Cp\u003EPureJwt requires a session-independent access token and does not accept a session-bound JWT as a PureJwt authentication credential.\u003C/p\u003E\n\u003Cp\u003EThe presence or absence of session association is part of the authentication mode\u0027s security boundary.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-binding\u0022\u003EDevice binding\u003C/h3\u003E\n\u003Cp\u003EJWT access tokens contain a device identifier.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth applies the configured device mismatch behavior during authentication.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EReject\u003C/code\u003E requires the request device to match the device associated with the token.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllow\u003C/code\u003E permits authentication despite a request-device mismatch.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowAndRebind\u003C/code\u003E is not supported for JWT-based authentication modes.\u003C/p\u003E\n\u003Cp\u003EAllowing a request-device mismatch does not permit inconsistent credential-to-session binding during authoritative validation.\u003C/p\u003E\n\u003Cp\u003EA device identifier is not a substitute for cryptographic proof of possession.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authoritative-jwt-validation\u0022\u003EAuthoritative JWT validation\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid can additionally require authoritative validation of the session associated with the JWT.\u003C/p\u003E\n\u003Cp\u003EThis validates the current session lineage and its relationship to the authenticated identity.\u003C/p\u003E\n\u003Cp\u003EIt does not replace JWT signature validation or automatically establish fresh authorization claims.\u003C/p\u003E\n\u003Cp\u003EPureJwt does not support session-authoritative validation because it has no associated authentication session.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022trusted-verification-keys\u0022\u003ETrusted verification keys\u003C/h3\u003E\n\u003Cp\u003EVerification keys must come from trusted application configuration or an explicitly registered verification-key provider.\u003C/p\u003E\n\u003Cp\u003EThe Resource API does not accept signing keys supplied by an untrusted JWT header or automatically retrieve keys from token-provided URLs.\u003C/p\u003E\n\u003Cp\u003EThe built-in configured verification-key provider supports Base64-encoded symmetric keys.\u003C/p\u003E\n\u003Cp\u003EFor the built-in HS256 signing implementation, use at least 32 bytes of cryptographically secure random key material.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022stateless-authorization-freshness\u0022\u003EStateless authorization freshness\u003C/h3\u003E\n\u003Cp\u003EPureJwt Resource APIs do not require a live user-state lookup during normal JWT validation.\u003C/p\u003E\n\u003Cp\u003EAs a result, an otherwise valid JWT can remain accepted after account deletion, suspension, permission changes, or refresh-chain revocation.\u003C/p\u003E\n\u003Cp\u003EApplications requiring immediate enforcement of such changes must implement an additional authoritative validation mechanism or use an appropriate session-backed authentication strategy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022access-token-lifetime\u0022\u003EAccess Token Lifetime\u003C/h2\u003E\n\u003Cp\u003EAccess credentials should have lifetimes appropriate to their authentication mode and security requirements.\u003C/p\u003E\n\u003Cp\u003EShort-lived JWT access tokens are particularly important because a token may remain usable until expiration even after server-side authorization state changes.\u003C/p\u003E\n\u003Cp\u003EFor example, an application might choose a JWT access lifetime of several minutes.\u003C/p\u003E\n\u003Cp\u003EHowever, \u003Cstrong\u003Ea lifetime such as 5\u201315 minutes is an example of an application security choice, not a universal UltimateAuth default or requirement\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe appropriate value depends on factors such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESensitivity of protected resources.\u003C/li\u003E\n\u003Cli\u003EExpected frequency of authorization changes.\u003C/li\u003E\n\u003Cli\u003EAcceptable revocation delay.\u003C/li\u003E\n\u003Cli\u003EAvailability and security of the refresh mechanism.\u003C/li\u003E\n\u003Cli\u003EClient behavior and network conditions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022lifetime-versus-revocation\u0022\u003ELifetime Versus Revocation\u003C/h3\u003E\n\u003Cp\u003EExpiration limits how long a credential can be accepted.\u003C/p\u003E\n\u003Cp\u003ERevocation invalidates authentication state before its ordinary expiration.\u003C/p\u003E\n\u003Cp\u003EThese mechanisms are related but not interchangeable.\u003C/p\u003E\n\u003Cp\u003EIn server-authoritative modes, current revocation state can be checked during protected requests.\u003C/p\u003E\n\u003Cp\u003EIn locally validated JWT modes, expiration may remain the primary limit on an already-issued access token unless an additional revocation check is implemented.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-credentials\u0022\u003ERefresh Credentials\u003C/h2\u003E\n\u003Cp\u003ERefresh credentials allow clients to continue authentication without repeating the original authentication ceremony.\u003C/p\u003E\n\u003Cp\u003EThey are intended for the authentication system\u0027s refresh operation, not for general API access.\u003C/p\u003E\n\u003Cp\u003EIn UltimateAuth, refresh behavior is mode-dependent.\u003C/p\u003E\n\u003Cp\u003EPureOpaque does not issue a separate access-token and refresh-token pair.\u003C/p\u003E\n\u003Cp\u003EHybrid uses refresh-token rotation together with session validation.\u003C/p\u003E\n\u003Cp\u003EPureJwt uses stateful refresh-token rotation without requiring an authentication session.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid is intended to combine JWT authentication with server-managed session lifecycle operations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-security-requirements\u0022\u003ERefresh Security Requirements\u003C/h3\u003E\n\u003Cp\u003EA secure refresh operation must establish that the presented credential is eligible for continued authentication.\u003C/p\u003E\n\u003Cp\u003EDepending on the mode and configured strategy, this may involve checking:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECredential existence and validity.\u003C/li\u003E\n\u003Cli\u003EExpiration.\u003C/li\u003E\n\u003Cli\u003ERevocation or consumption state.\u003C/li\u003E\n\u003Cli\u003EAssociated user or session context.\u003C/li\u003E\n\u003Cli\u003EApplicable client and device context.\u003C/li\u003E\n\u003Cli\u003ERotation and reuse conditions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA valid refresh credential should not automatically bypass account-level or session-level security requirements that apply to the selected mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022access-and-refresh-separation\u0022\u003EAccess and Refresh Separation\u003C/h3\u003E\n\u003Cp\u003EAccess and refresh credentials have different responsibilities.\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\u003EAuthentication\n |\n v\nAccess credential\n |\n | Used for protected requests\n v\nAccess expires\n |\n v\nRefresh operation\n |\n | Validate refresh credential\n | Apply continuation rules\n v\nRenewed access credential\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe refresh operation does not extend the expiration timestamp of an already-issued JWT.\u003C/p\u003E\n\u003Cp\u003EIt issues new authentication material when continuation is permitted.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-rotation\u0022\u003ERefresh Rotation\u003C/h2\u003E\n\u003Cp\u003ERefresh rotation replaces refresh authentication material according to the configured refresh strategy.\u003C/p\u003E\n\u003Cp\u003EA rotating refresh mechanism can invalidate the previously used refresh credential and issue a replacement.\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\u003ERefresh credential A\n |\n | Successful refresh\n v\nRefresh credential A consumed\nRefresh credential B issued\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis reduces the period during which an older refresh credential remains reusable.\u003C/p\u003E\n\u003Cp\u003EHowever, \u003Cstrong\u003Erotation behavior is not identical across every UltimateAuth mode or refresh strategy\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003ESome session continuation operations may update existing server-side state without replacing a separate refresh credential.\u003C/p\u003E\n\u003Cp\u003EThe effective behavior must follow the selected mode and its configured refresh strategy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022rotation-is-not-replay-prevention-by-itself\u0022\u003ERotation Is Not Replay Prevention by Itself\u003C/h3\u003E\n\u003Cp\u003ERotation limits credential reuse only when the server enforces the relevant consumption or replacement state.\u003C/p\u003E\n\u003Cp\u003EA secure rotating refresh mechanism must account for situations such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe same credential being submitted again.\u003C/li\u003E\n\u003Cli\u003EConcurrent refresh requests.\u003C/li\u003E\n\u003Cli\u003EA credential being reused after replacement.\u003C/li\u003E\n\u003Cli\u003EAn interrupted response after a successful rotation.\u003C/li\u003E\n\u003Cli\u003EAn attacker and legitimate client attempting to use the same credential.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe exact outcome depends on the implemented refresh strategy and concurrency guarantees.\u003C/p\u003E\n\u003Cp\u003ERotation should not be described as automatically eliminating every replay risk.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-token-reuse\u0022\u003ERefresh Token Reuse\u003C/h2\u003E\n\u003Cp\u003ERefresh token reuse occurs when a credential is presented after it has already been consumed, replaced, or otherwise invalidated.\u003C/p\u003E\n\u003Cp\u003EFor a single-use rotating refresh credential, this is a security-relevant event.\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\u003EClient refreshes with A\n |\n v\nA replaced by B\n |\n v\nAnother request presents A\n |\n v\nReuse / invalid credential condition\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA reuse attempt may indicate credential theft, but it can also arise from concurrent requests or client synchronization failures.\u003C/p\u003E\n\u003Cp\u003EThe refresh implementation must distinguish these situations according to its supported guarantees and policy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-response\u0022\u003ESecurity Response\u003C/h3\u003E\n\u003Cp\u003EPossible security responses include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ERejecting the invalid refresh attempt.\u003C/li\u003E\n\u003Cli\u003EInvalidating the associated refresh state.\u003C/li\u003E\n\u003Cli\u003ERevoking an affected session.\u003C/li\u003E\n\u003Cli\u003ERevoking a broader session chain where supported and appropriate.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese are distinct actions.\u003C/p\u003E\n\u003Cp\u003EThe presence of a reuse-detection mechanism does not imply that every reuse attempt automatically revokes the entire device-associated chain.\u003C/p\u003E\n\u003Cp\u003ESuch behavior must be explicitly supported by the configured refresh strategy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-credential-storage\u0022\u003ERefresh Credential Storage\u003C/h2\u003E\n\u003Cp\u003ERefresh credentials are generally more sensitive to long-term compromise because they may allow new access credentials to be obtained.\u003C/p\u003E\n\u003Cp\u003ETheir storage therefore deserves stronger protection than ordinary client-visible access metadata.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-side-storage\u0022\u003EServer-Side Storage\u003C/h3\u003E\n\u003Cp\u003EFor persisted opaque refresh credentials, storing a one-way verifier or hash instead of the raw credential can reduce the impact of a storage disclosure.\u003C/p\u003E\n\u003Cp\u003EHowever, the exact persistence model depends on the selected authentication mode and refresh implementation.\u003C/p\u003E\n\u003Cp\u003EIt should not be assumed that every authentication mode uses the same refresh storage structure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-side-storage\u0022\u003EClient-Side Storage\u003C/h3\u003E\n\u003Cp\u003EThe appropriate client storage mechanism depends on the application environment.\u003C/p\u003E\n\u003Cp\u003EFor browser applications, HttpOnly cookies can prevent JavaScript from directly reading refresh credentials, although cookie-based refresh flows still require appropriate CSRF and origin protections.\u003C/p\u003E\n\u003Cp\u003ENative applications may use platform-provided secure storage where suitable.\u003C/p\u003E\n\u003Cp\u003ERefresh credentials should not be exposed through application logs, diagnostic output, URLs, or unrelated API responses.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022transport-security\u0022\u003ETransport Security\u003C/h3\u003E\n\u003Cp\u003EAuthentication credentials must be protected in transit.\u003C/p\u003E\n\u003Cp\u003EProduction authentication and refresh endpoints should use HTTPS.\u003C/p\u003E\n\u003Cp\u003EApplications should also avoid sending refresh credentials to services that do not need to receive them.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022claims-and-authorization-freshness\u0022\u003EClaims and Authorization Freshness\u003C/h2\u003E\n\u003Cp\u003EJWT claims represent information established when the token was issued.\u003C/p\u003E\n\u003Cp\u003EThey may include standard or application-specific information 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\u003Esub Subject identifier\niss Issuer\naud Audience\nexp Expiration\niat Issued-at time\njti Token identifier\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDepending on the application, a JWT may also include tenant information, roles, permissions, or session references.\u003C/p\u003E\n\u003Cp\u003EThese claims are not automatically updated when the underlying account changes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-permission-removal\u0022\u003EExample: Permission Removal\u003C/h3\u003E\n\u003Cp\u003EConsider the following sequence:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EA JWT is issued containing an administrative permission.\u003C/li\u003E\n\u003Cli\u003EAn administrator removes that permission from the user.\u003C/li\u003E\n\u003Cli\u003EThe client continues presenting the previously issued JWT.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EIf the protected resource relies only on the signed claims in that JWT, the removed permission may remain effective until the token expires.\u003C/p\u003E\n\u003Cp\u003EThe signature remains valid because the token has not been modified.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-strategies\u0022\u003EAuthorization Strategies\u003C/h3\u003E\n\u003Cp\u003EApplications can address this limitation through their security architecture, including:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EShorter JWT lifetimes.\u003C/li\u003E\n\u003Cli\u003EReissuing claims during refresh.\u003C/li\u003E\n\u003Cli\u003EConsulting authoritative authorization state for sensitive operations.\u003C/li\u003E\n\u003Cli\u003EUsing server-authoritative authentication modes where immediate state enforcement is required.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe appropriate approach depends on the security requirements of the application.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/plugin-domains/authorization\u0022\u003EAuthorization\u003C/a\u003E and \u003Ca href=\u0022/docs/plugin-domains/policies\u0022\u003EPolicies \u0026amp; Access Control\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-revocation\u0022\u003EToken Revocation\u003C/h2\u003E\n\u003Cp\u003ERevocation behavior differs fundamentally between opaque credentials and locally validated JWTs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022opaque-credential-revocation\u0022\u003EOpaque Credential Revocation\u003C/h3\u003E\n\u003Cp\u003EAn opaque credential depends on authoritative validation.\u003C/p\u003E\n\u003Cp\u003EIf the corresponding server-managed authentication state is revoked, subsequent validation can reject the credential.\u003C/p\u003E\n\u003Cp\u003EThe precise scope depends on whether the security operation targets a session, chain, or account-level root.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-revocation\u0022\u003EJWT Revocation\u003C/h3\u003E\n\u003Cp\u003EA signed JWT cannot be made cryptographically invalid merely by deleting a server-side session record.\u003C/p\u003E\n\u003Cp\u003EIts signature and expiration remain unchanged.\u003C/p\u003E\n\u003Cp\u003ETo reject an otherwise valid JWT before expiration, the resource must enforce an additional condition, such as an authoritative revocation check or another supported invalidation mechanism.\u003C/p\u003E\n\u003Cp\u003EWithout that additional enforcement, a locally validated JWT may remain acceptable until expiration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-revocation\u0022\u003ERefresh Revocation\u003C/h3\u003E\n\u003Cp\u003ERevoking a refresh credential can prevent further successful refresh operations.\u003C/p\u003E\n\u003Cp\u003EHowever, that does not necessarily invalidate access tokens already issued before the revocation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAccess revocation and refresh revocation are separate security concerns.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-security-and-token-security\u0022\u003ESession Security and Token Security\u003C/h2\u003E\n\u003Cp\u003EToken security and session security are closely related, but they operate at different levels.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConcern\u003C/th\u003E\n\u003Cth\u003EToken Security\u003C/th\u003E\n\u003Cth\u003ESession Security\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECredential format\u003C/td\u003E\n\u003Ctd\u003EOpaque or JWT\u003C/td\u003E\n\u003Ctd\u003ERoot, chain, and session state\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECryptographic validation\u003C/td\u003E\n\u003Ctd\u003EJWT signature and claims\u003C/td\u003E\n\u003Ctd\u003ENot a substitute for token signature validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EExpiration\u003C/td\u003E\n\u003Ctd\u003EToken validity period\u003C/td\u003E\n\u003Ctd\u003ESession and chain lifecycle limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERotation\u003C/td\u003E\n\u003Ctd\u003EReplacement of authentication material\u003C/td\u003E\n\u003Ctd\u003EContinuity and associated state transitions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERevocation\u003C/td\u003E\n\u003Ctd\u003EWhether a presented credential remains acceptable\u003C/td\u003E\n\u003Ctd\u003EWhich authentication state has been invalidated\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDevice context\u003C/td\u003E\n\u003Ctd\u003EMay be associated with token use\u003C/td\u003E\n\u003Ctd\u003EManaged through applicable chain and session context\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EA token may be valid according to its own format but unacceptable under authoritative session security rules.\u003C/p\u003E\n\u003Cp\u003EConversely, server-side session state may remain active while a particular access token has expired.\u003C/p\u003E\n\u003Cp\u003EBoth levels must be understood to reason correctly about the selected authentication mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-security-misconceptions\u0022\u003ECommon Security Misconceptions\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-valid-signature-means-current-authorization\u0022\u003EA Valid Signature Means Current Authorization\u003C/h3\u003E\n\u003Cp\u003EA valid JWT signature proves that the token has not been modified and was signed by an accepted key.\u003C/p\u003E\n\u003Cp\u003EIt does not prove that the user\u0027s permissions or account status have remained unchanged since issuance.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-device-identifier-prevents-token-theft\u0022\u003EA Device Identifier Prevents Token Theft\u003C/h3\u003E\n\u003Cp\u003EA device identifier may support context consistency checks.\u003C/p\u003E\n\u003Cp\u003EIt does not independently prevent a stolen bearer credential from being replayed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-rotation-makes-token-theft-impossible\u0022\u003ERefresh Rotation Makes Token Theft Impossible\u003C/h3\u003E\n\u003Cp\u003ERotation can reduce reuse opportunities and support detection of invalid reuse.\u003C/p\u003E\n\u003Cp\u003EIt does not prevent a stolen credential from being used before the legitimate client or server detects the compromise.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-invalidates-every-jwt-immediately\u0022\u003ELogout Invalidates Every JWT Immediately\u003C/h3\u003E\n\u003Cp\u003ELogout may revoke server-managed session or refresh state.\u003C/p\u003E\n\u003Cp\u003EPreviously issued JWT access tokens can remain valid until expiration unless protected resources enforce an additional invalidation mechanism.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022short-lived-tokens-eliminate-the-need-for-session-security\u0022\u003EShort-Lived Tokens Eliminate the Need for Session Security\u003C/h3\u003E\n\u003Cp\u003EShort lifetimes reduce the exposure window of a compromised token.\u003C/p\u003E\n\u003Cp\u003EThey do not replace account-level security policies, credential recovery protections, or session revocation controls where those capabilities are required.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-design-principles\u0022\u003ESecurity Design Principles\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth\u0027s token model is best understood through a few principles.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUse credentials only for their intended purpose.\u003C/strong\u003E Access and refresh credentials must not be interchangeable.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EValidate according to the selected mode.\u003C/strong\u003E Opaque credentials require authoritative validation; JWTs require correct cryptographic and claims validation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ETreat JWT claims as issuance-time information.\u003C/strong\u003E Current authorization state may differ from what an older token contains.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EKeep access credentials appropriately short-lived.\u003C/strong\u003E Token lifetime should reflect the application\u0027s acceptable exposure window.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EEnforce refresh continuation rules.\u003C/strong\u003E Rotation, expiration, consumption, and reuse behavior must be consistent with the configured strategy.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDistinguish token expiration from session revocation.\u003C/strong\u003E They invalidate authentication through different mechanisms.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDo not promise immediate JWT revocation without enforcement.\u003C/strong\u003E Server-side state changes affect locally validated tokens only when the resource checks the relevant state.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022architectural-perspective\u0022\u003EArchitectural Perspective\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth does not impose a single token model on every application.\u003C/p\u003E\n\u003Cp\u003EPureOpaque and Hybrid emphasize server-authoritative authentication state.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid and PureJwt support locally validated JWT access, with different approaches to authentication continuation.\u003C/p\u003E\n\u003Cp\u003EThese choices affect performance, storage requirements, revocation behavior, and authorization freshness.\u003C/p\u003E\n\u003Cp\u003EThe purpose of the token security model is to make those tradeoffs explicit.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA token establishes access only while its applicable validation requirements remain satisfied. The strength and freshness of those requirements depend on the authentication mode.\u003C/strong\u003E\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/security/session-security\u0022\u003ESession Security\u003C/a\u003E \u2014 Understand authoritative session validation and hierarchical revocation.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E \u2014 Compare credential behavior across modes.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/sessions-devices/session-lifecycle\u0022\u003ESession Model \u0026amp; Lifecycle\u003C/a\u003E \u2014 Explore session creation, continuation, and invalidation.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/plugin-domains/credentials\u0022\u003ECredentials\u003C/a\u003E \u2014 Understand credential management and recovery security.\u003C/li\u003E\n\u003C/ul\u003E\n", "Headings": [ { "Id": "authentication-state-and-credentials", @@ -59,38 +59,38 @@ "Level": 0 }, { - "Id": "pureopaque", - "Text": "PureOpaque", + "Id": "session-identifiers-are-not-always-credentials", + "Text": "Session identifiers are not always credentials", "Level": 1 }, { - "Id": "hybrid", - "Text": "Hybrid", + "Id": "credential-purpose-isolation", + "Text": "Credential purpose isolation", "Level": 1 }, { - "Id": "semihybrid", - "Text": "SemiHybrid", - "Level": 1 + "Id": "jwt-validation-requirements", + "Text": "JWT Validation Requirements", + "Level": 0 }, { - "Id": "purejwt", - "Text": "PureJwt", + "Id": "mode-specific-session-association", + "Text": "Mode-specific session association", "Level": 1 }, { - "Id": "purejwt-validation-requirements", - "Text": "PureJwt Validation Requirements", - "Level": 0 + "Id": "device-binding", + "Text": "Device binding", + "Level": 1 }, { - "Id": "trusted-verification-keys", - "Text": "Trusted verification keys", + "Id": "authoritative-jwt-validation", + "Text": "Authoritative JWT validation", "Level": 1 }, { - "Id": "device-binding", - "Text": "Device binding", + "Id": "trusted-verification-keys", + "Text": "Trusted verification keys", "Level": 1 }, { @@ -249,6 +249,6 @@ "Level": 0 } ], - "SourceHash": "1343160C1FB25288766B429B71863855D87AD4C8FDCBEA2772138A7678559954", + "SourceHash": "911C8D044E81A644B33C2C9C8BBD12AB2157C210B59B198489B9C28847B66400", "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 4be78e08..ab929b0f 100644 --- a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Program.cs +++ b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Program.cs @@ -38,7 +38,7 @@ o.Diagnostics.EnableRefreshDetails = true; //o.Session.MaxLifetime = TimeSpan.FromSeconds(32); - //o.Session.Lifetime = TimeSpan.FromSeconds(32); + //o.Token.SessionIdLifetime = TimeSpan.FromSeconds(32); //o.Session.TouchInterval = TimeSpan.FromSeconds(9); //o.Session.IdleTimeout = TimeSpan.FromSeconds(15); //o.Token.AccessTokenLifetime = TimeSpan.FromSeconds(30); diff --git a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/Program.cs b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/Program.cs index 9937f649..11c08c32 100644 --- a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/Program.cs +++ b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/Program.cs @@ -44,7 +44,7 @@ o.DeviceLimits.TypeLimits["web"] = 2; //o.Session.MaxLifetime = TimeSpan.FromSeconds(32); - //o.Session.Lifetime = TimeSpan.FromSeconds(32); + //o.Token.SessionIdLifetime = TimeSpan.FromSeconds(32); //o.Session.TouchInterval = TimeSpan.FromSeconds(9); //o.Session.IdleTimeout = TimeSpan.FromSeconds(15); //o.Token.AccessTokenLifetime = TimeSpan.FromSeconds(30); diff --git a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Program.cs b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Program.cs index 0ffe1ff8..97845505 100644 --- a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Program.cs +++ b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Program.cs @@ -46,7 +46,7 @@ { o.Diagnostics.EnableRefreshDetails = true; //o.Session.MaxLifetime = TimeSpan.FromSeconds(32); - //o.Session.Lifetime = TimeSpan.FromSeconds(32); + //o.Token.SessionIdLifetime = TimeSpan.FromSeconds(32); //o.Session.TouchInterval = TimeSpan.FromSeconds(9); //o.Session.IdleTimeout = TimeSpan.FromSeconds(15); //o.Token.AccessTokenLifetime = TimeSpan.FromSeconds(30); diff --git a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/Program.cs b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/Program.cs index 6d126d3b..93e29c2e 100644 --- a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/Program.cs +++ b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/Program.cs @@ -64,7 +64,7 @@ // No-op and touch with max lifetime example //o.Session.MaxLifetime = TimeSpan.FromSeconds(32); - //o.Session.Lifetime = TimeSpan.FromSeconds(32); + //o.Token.SessionIdLifetime = TimeSpan.FromSeconds(32); //o.Session.TouchInterval = TimeSpan.FromSeconds(9); //o.Session.IdleTimeout = TimeSpan.FromSeconds(15); //o.Token.AccessTokenLifetime = TimeSpan.FromSeconds(30); @@ -72,7 +72,7 @@ // Infinite sliding expiration example //o.Session.MaxLifetime = null; - //o.Session.Lifetime = TimeSpan.FromSeconds(20); + //o.Token.SessionIdLifetime = TimeSpan.FromSeconds(20); //o.Session.TouchInterval = TimeSpan.FromSeconds(9); //o.Session.IdleTimeout = TimeSpan.FromSeconds(10); }) From 5eb04b87b5b7e900574e982cc00c7c42e22570fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Thu, 3 Dec 2026 11:40:07 +0300 Subject: [PATCH 11/14] Add Tests & Fix Docs --- docs/content/client-sdk/automatic-refresh.md | 6 +- .../configuration/advanced-configuration.md | 4 +- docs/content/configuration/client-options.md | 4 +- docs/content/configuration/overview.md | 29 +- docs/content/configuration/server-options.md | 16 +- docs/content/fundamentals/auth-model.md | 2 +- docs/content/getting-started/index.md | 2 +- .../getting-started/real-world-setup.md | 26 +- docs/content/security/token-security.md | 2 +- .../docs/client-sdk/automatic-refresh.json | 4 +- .../configuration/advanced-configuration.json | 4 +- .../docs/configuration/client-options.json | 4 +- .../wwwroot/docs/configuration/overview.json | 4 +- .../docs/configuration/server-options.json | 9 +- .../wwwroot/docs/fundamentals/auth-model.json | 4 +- .../wwwroot/docs/getting-started/index.json | 4 +- .../getting-started/real-world-setup.json | 4 +- .../wwwroot/docs/security/token-security.json | 4 +- .../Server/JwtLogoutServiceTests.cs | 667 ++++++++++++++++++ ...thEndpointValidationClassificationTests.cs | 61 ++ .../UAuthValidationOptionsValidatorTests.cs | 166 +++++ ...UAuthValidationRequirementResolverTests.cs | 357 ++++++++++ .../Server/ValidateEndpointHandlerTests.cs | 586 ++++++++++++++- 23 files changed, 1879 insertions(+), 90 deletions(-) create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/JwtLogoutServiceTests.cs create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthEndpointValidationClassificationTests.cs create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthValidationOptionsValidatorTests.cs create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthValidationRequirementResolverTests.cs diff --git a/docs/content/client-sdk/automatic-refresh.md b/docs/content/client-sdk/automatic-refresh.md index 75ceed90..1a06149a 100644 --- a/docs/content/client-sdk/automatic-refresh.md +++ b/docs/content/client-sdk/automatic-refresh.md @@ -274,8 +274,6 @@ Hybrid combines server-authoritative session state with additional credential li PureJwt uses session-independent JWT authentication with a stateful refresh-token lifecycle. -SemiHybrid describes the JWT-based session-backed model. Its complete runtime support is still evolving; applications should not assume that every SemiHybrid scenario is currently available. - ### Cookie-Only Authentication Automatic refresh does not require the application to possess a readable access token. @@ -473,7 +471,7 @@ Consider the following server configuration: ```csharp builder.Services.AddUltimateAuthServer(options => { - options.Session.Lifetime = TimeSpan.FromDays(7); + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); options.Session.SlidingExpiration = true; options.Session.TouchInterval = TimeSpan.FromMinutes(5); options.Session.IdleTimeout = TimeSpan.FromDays(4); @@ -499,7 +497,7 @@ Each option serves a different purpose. | `Session.TouchInterval` | Minimum interval for ordinary server-side session touches | | `Session.SlidingExpiration` | Whether a successful touch can extend session expiration | | `Session.IdleTimeout` | Maximum permitted time without recorded session activity | -| `Session.Lifetime` | Session expiration policy | +| `Token.SessionIdLifetime` | Session expiration policy | | `Session.MaxLifetime` | Maximum chain lifetime when configured | ### Refresh Does Not Always Touch a Session diff --git a/docs/content/configuration/advanced-configuration.md b/docs/content/configuration/advanced-configuration.md index 73dc4573..e3051792 100644 --- a/docs/content/configuration/advanced-configuration.md +++ b/docs/content/configuration/advanced-configuration.md @@ -30,7 +30,7 @@ For example, changing a session lifetime is configuration: ```csharp builder.Services.AddUltimateAuthServer(options => { - options.Session.Lifetime = TimeSpan.FromHours(8); + options.Token.SessionIdLifetime = TimeSpan.FromHours(8); }); ``` @@ -81,7 +81,7 @@ For example: ```csharp builder.Services.AddUltimateAuthServer(options => { - options.Session.Lifetime = TimeSpan.FromHours(8); + options.Token.SessionIdLifetime = TimeSpan.FromHours(8); options.Token.Issuer = "MyApplication"; }); ``` diff --git a/docs/content/configuration/client-options.md b/docs/content/configuration/client-options.md index c0d7d646..85ebb02d 100644 --- a/docs/content/configuration/client-options.md +++ b/docs/content/configuration/client-options.md @@ -70,7 +70,7 @@ A Blazor Server application can register both UltimateAuth Server and the Blazor ```csharp builder.Services.AddUltimateAuthServer(options => { - options.Session.Lifetime = TimeSpan.FromDays(7); + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); }); builder.Services.AddUltimateAuthClientBlazor(options => @@ -1085,7 +1085,7 @@ builder.Services.AddUltimateAuthServer(options => UAuthMode.Hybrid ]; - options.Session.Lifetime = TimeSpan.FromDays(7); + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); options.Login.MaxFailedAttempts = 5; }); diff --git a/docs/content/configuration/overview.md b/docs/content/configuration/overview.md index c34ad96e..bd4c824c 100644 --- a/docs/content/configuration/overview.md +++ b/docs/content/configuration/overview.md @@ -56,16 +56,16 @@ UltimateAuth The important distinction is between **where an option type is defined** and **where its value is consumed**. -For example, `UAuthSessionOptions` is defined in Core, but a normal UltimateAuth Server application configures it through: +For example, `UAuthTokenOptions` is defined in Core, but a normal UltimateAuth Server application configures it through: ```csharp builder.Services.AddUltimateAuthServer(options => { - options.Session.Lifetime = TimeSpan.FromHours(8); + options.Token.SessionIdLifetime = TimeSpan.FromHours(8); }); ``` -The server consumes `options.Session` from `UAuthServerOptions`. +The server consumes `options.Token` from `UAuthServerOptions`. There is no need to configure a separate Core options instance for this setting. @@ -96,11 +96,8 @@ It also supports a separate optional delegate for registering access policies. builder.Services.AddUltimateAuthServer(options => { options.Login.MaxFailedAttempts = 5; - - options.Session.Lifetime = TimeSpan.FromHours(8); - - options.Token.AccessTokenLifetime = - TimeSpan.FromMinutes(15); + options.Token.SessionIdLifetime = TimeSpan.FromHours(8); + options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(15); }); ``` @@ -109,7 +106,7 @@ These settings control different parts of the authentication lifecycle: | Option | Purpose | |---|---| | `Login.MaxFailedAttempts` | Maximum failed login attempts under the configured login policy | -| `Session.Lifetime` | Session lifetime | +| `Token.SessionIdLifetime` | Session identifier lifetime | | `Token.AccessTokenLifetime` | Access token lifetime | The server applies its validation rules to the resulting configuration. @@ -241,7 +238,7 @@ For example: ```csharp builder.Services.AddUltimateAuthServer(options => { - options.Session.Lifetime = TimeSpan.FromHours(8); + options.Token.SessionIdLifetime = TimeSpan.FromHours(8); }); builder.Services.AddUltimateAuthClient(options => @@ -280,7 +277,7 @@ Use `Program.cs` for explicit configuration. builder.Services.AddUltimateAuthServer(options => { options.Login.MaxFailedAttempts = 5; - options.Session.Lifetime = TimeSpan.FromHours(8); + options.Token.SessionIdLifetime = TimeSpan.FromHours(8); }); ``` @@ -303,8 +300,8 @@ For example, in `appsettings.json`: "Login": { "MaxFailedAttempts": 5 }, - "Session": { - "Lifetime": "08:00:00" + "Token": { + "SessionIdLifetime": "08:00:00" } } } @@ -343,7 +340,7 @@ You can combine code-based and configuration-based settings: builder.Services.AddUltimateAuthServer(options => { options.Login.MaxFailedAttempts = 5; - options.Session.Lifetime = TimeSpan.FromHours(8); + options.Token.SessionIdLifetime = TimeSpan.FromHours(8); }); ``` @@ -705,7 +702,7 @@ For example, the server validates that: ```csharp builder.Services.AddUltimateAuthServer(options => { - options.Session.Lifetime = TimeSpan.Zero; + options.Token.SessionIdLifetime = TimeSpan.Zero; }); ``` @@ -769,7 +766,7 @@ Not every internal service is intended to be replaced, and custom implementation Use configuration when you want to adjust a supported behavior: ```csharp -options.Session.Lifetime = TimeSpan.FromHours(8); +options.Token.SessionIdLifetime = TimeSpan.FromHours(8); ``` Use an extension point when your application needs to provide its own implementation: diff --git a/docs/content/configuration/server-options.md b/docs/content/configuration/server-options.md index 6ab2645c..e4d32a44 100644 --- a/docs/content/configuration/server-options.md +++ b/docs/content/configuration/server-options.md @@ -26,7 +26,7 @@ Configure the server through `AddUltimateAuthServer()`: builder.Services.AddUltimateAuthServer(options => { options.Login.MaxFailedAttempts = 5; - options.Session.Lifetime = TimeSpan.FromDays(7); + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); options.Token.AccessTokenLifetime = TimeSpan.FromMinutes(10); }); ``` @@ -71,10 +71,8 @@ For example: "MaxFailedAttempts": 5, "LockoutDuration": "00:15:00" }, - "Session": { - "Lifetime": "7.00:00:00" - }, "Token": { + "SessionIdLifetime": "7.00:00:00", "AccessTokenLifetime": "00:10:00" } } @@ -197,7 +195,7 @@ These settings have different purposes. | Property | Default | Description | |---|---|---| | `MaxSessionsPerChain` | `100` | Session-chain rotation limit | -| `DeviceMismatchBehavior` | `Reject` | Reserved device mismatch behavior | +| `DeviceMismatchBehavior` | `Reject` | Device mismatch behavior | ### Enforced Device Limits @@ -1480,7 +1478,7 @@ This means that the effective settings used for a `Hybrid` client can differ fro ```csharp builder.Services.AddUltimateAuthServer(options => { - options.Session.Lifetime = TimeSpan.FromDays(7); + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); options.ConfigureMode(UAuthMode.Hybrid, mode => { @@ -1520,7 +1518,7 @@ These validators cover areas including: ```csharp builder.Services.AddUltimateAuthServer(options => { - options.Session.Lifetime = TimeSpan.Zero; + options.Token.SessionIdLifetime = TimeSpan.Zero; }); ``` @@ -1637,10 +1635,6 @@ Mode-specific defaults can replace globally configured values. Use `ConfigureMode()` for explicit mode-specific behavior. -### Enabling Unsupported Modes - -An authentication mode appearing in an enum does not guarantee runtime support. - ### Treating Reserved Session Options as Enforced Security Features Some device and session-chain options are reserved for future enforcement. diff --git a/docs/content/fundamentals/auth-model.md b/docs/content/fundamentals/auth-model.md index 7dfb4953..388536c8 100644 --- a/docs/content/fundamentals/auth-model.md +++ b/docs/content/fundamentals/auth-model.md @@ -43,7 +43,7 @@ Server authority does not require every request to access a server-side session For example: - In PureOpaque, the server validates the session represented by the client's opaque session credential. -- In Hybrid, the server resolves an opaque access token and validates its associated session. +- In Hybrid, the supported resource authentication path validates an opaque session credential against authoritative server-side session state. A separate access and refresh token lifecycle is also maintained. - In SemiHybrid, normal requests authenticate through JWT validation, while server-side sessions govern authentication continuation and lifecycle operations. - In PureJwt, authentication can be established through JWT validation without requiring session persistence or lookup. diff --git a/docs/content/getting-started/index.md b/docs/content/getting-started/index.md index af697330..1b975d33 100644 --- a/docs/content/getting-started/index.md +++ b/docs/content/getting-started/index.md @@ -307,7 +307,7 @@ A server application begins by registering UltimateAuth and configuring the secu builder.Services.AddUltimateAuthServer(options => { options.Login.MaxFailedAttempts = 5; - options.Session.Lifetime = TimeSpan.FromDays(7); + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); options.CredentialSessionPolicy.OnRecovery = CredentialSessionBehavior.RevokeAll; }); ``` diff --git a/docs/content/getting-started/real-world-setup.md b/docs/content/getting-started/real-world-setup.md index 94f258b9..5dfb05ed 100644 --- a/docs/content/getting-started/real-world-setup.md +++ b/docs/content/getting-started/real-world-setup.md @@ -76,11 +76,11 @@ builder.Services.AddUltimateAuthServer(options => { options.Cryptography.TokenHashingKey = builder.Configuration["UltimateAuth:Cryptography:TokenHashingKey"] - ?? throw new InvalidOperationException("UltimateAuth token hashing key is missing."); + ?? o.Cryptography.TokenHashingKey; options.Cryptography.JwtSigningKey = builder.Configuration["UltimateAuth:Cryptography:JwtSigningKey"] - ?? throw new InvalidOperationException("UltimateAuth JWT signing key is missing."); + ?? o.Cryptography.JwtSigningKey; }); ``` @@ -129,11 +129,11 @@ builder.Services.AddUltimateAuthServer(options => { options.Cryptography.TokenHashingKey = builder.Configuration["UltimateAuth:Cryptography:TokenHashingKey"] - ?? throw new InvalidOperationException("Token hashing key is missing."); + ?? o.Cryptography.TokenHashingKey; options.Cryptography.JwtSigningKey = builder.Configuration["UltimateAuth:Cryptography:JwtSigningKey"] - ?? throw new InvalidOperationException("JWT signing key is missing."); + ?? o.Cryptography.JwtSigningKey; }) .AddUltimateAuthEntityFrameworkCore(db => { @@ -343,7 +343,7 @@ builder.Services.AddUltimateAuthServer(options => { options.Login.MaxFailedAttempts = 5; options.Login.LockoutDuration = TimeSpan.FromMinutes(15); - options.Session.Lifetime = TimeSpan.FromDays(7); + options.Token.SessionIdLifetime = TimeSpan.FromDays(7); options.Identifiers.Behavior.AllowMultipleUsernames = true; options.Password.Level = PasswordPolicyLevel.Strict; }); @@ -410,11 +410,11 @@ builder.Services.AddUltimateAuthServer(options => { options.Cryptography.TokenHashingKey = builder.Configuration["UltimateAuth:Cryptography:TokenHashingKey"] - ?? throw new InvalidOperationException("Token hashing key is missing."); + ?? o.Cryptography.TokenHashingKey; options.Cryptography.JwtSigningKey = builder.Configuration["UltimateAuth:Cryptography:JwtSigningKey"] - ?? throw new InvalidOperationException("JWT signing key is missing."); + ?? o.Cryptography.JwtSigningKey; }) .AddUltimateAuthInMemory() .AddUAuthHub(options => @@ -439,11 +439,11 @@ builder.Services.AddUltimateAuthServer(options => { options.Cryptography.TokenHashingKey = builder.Configuration["UltimateAuth:Cryptography:TokenHashingKey"] - ?? throw new InvalidOperationException("Token hashing key is missing."); + ?? o.Cryptography.TokenHashingKey; options.Cryptography.JwtSigningKey = builder.Configuration["UltimateAuth:Cryptography:JwtSigningKey"] - ?? throw new InvalidOperationException("JWT signing key is missing."); + ?? o.Cryptography.JwtSigningKey; }) .AddUltimateAuthEntityFrameworkCore(db => { @@ -1120,13 +1120,13 @@ The default resolver maps application profiles to authentication modes. | Blazor WASM | `Hybrid` | | Web Server | `Hybrid` | | MAUI | `Hybrid` | -| API | `PureJwt` | +| API | `Hybrid` | +| Resource API | `Hybrid` | +| UAuthHub | `Hybrid` | This mapping describes the resolver's behavior, not a guarantee that every mode is currently fully supported by the server. -PureOpaque, Hybrid, and PureJwt are implemented authentication modes. - -SemiHybrid remains reserved for future implementation. +PureOpaque, Hybrid, SemiHybrd and PureJwt are implemented authentication modes. Hybrid Resource APIs currently support session-based authentication. PureJwt Resource APIs support independent JWT validation. diff --git a/docs/content/security/token-security.md b/docs/content/security/token-security.md index cbbe55c1..6db10556 100644 --- a/docs/content/security/token-security.md +++ b/docs/content/security/token-security.md @@ -307,7 +307,7 @@ Hybrid uses refresh-token rotation together with session validation. PureJwt uses stateful refresh-token rotation without requiring an authentication session. -SemiHybrid is intended to combine JWT authentication with server-managed session lifecycle operations. +SemiHybrid combines JWT authentication with server-managed session lifecycle operations. ### Refresh Security Requirements diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/client-sdk/automatic-refresh.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/client-sdk/automatic-refresh.json index 9fabe501..197990c2 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/client-sdk/automatic-refresh.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/client-sdk/automatic-refresh.json @@ -1,7 +1,7 @@ { "Slug": "client-sdk/automatic-refresh", "Title": "Automatic Refresh", - "Html": "\n\u003Cp\u003EAuthentication should not become an application-level scheduling problem.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides a coordinated refresh mechanism that can renew authentication before a protected request, recover from supported authentication challenges, or maintain authentication through background execution.\u003C/p\u003E\n\u003Cp\u003EApplications do not need to implement their own token expiration timers, refresh locks, or authentication retry pipelines when using the supported UltimateAuth client operations.\u003C/p\u003E\n\u003Cp\u003EThe same client architecture supports different authentication modes and credential lifecycles without requiring applications to implement a separate refresh strategy for each mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022getting-started\u0022\u003E1. Getting Started\u003C/h2\u003E\n\u003Cp\u003EAutomatic refresh is available through the UltimateAuth Client SDK and its supported platform integrations.\u003C/p\u003E\n\u003Cp\u003EFor Blazor applications, register the client as usual:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EProactive and reactive refresh are enabled by default. Background refresh is opt-in.\u003C/p\u003E\n\u003Cp\u003EThe following configuration makes the defaults explicit:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoRefresh.Proactive = true;\n options.AutoRefresh.Reactive = true;\n options.AutoRefresh.Background = false;\n\n options.AutoRefresh.Interval = TimeSpan.FromMinutes(5);\n options.AutoRefresh.RefreshBeforeExpiration = TimeSpan.FromMinutes(1);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EOnce authentication is established, supported client operations participate in refresh coordination automatically.\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\u003Evar result = await UAuthClient.Resource\n .GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\nif (result.IsSuccess)\n{\n products = result.Value;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe application does not need to check token expiration or explicitly refresh authentication before every request.\u003C/p\u003E\n\u003Cp\u003EFor client registration and configuration, see \u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022three-automatic-refresh-strategies\u0022\u003E2. Three Automatic Refresh Strategies\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth provides three independently configurable automatic refresh strategies.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EStrategy\u003C/th\u003E\n\u003Cth\u003ETrigger\u003C/th\u003E\n\u003Cth\u003EEnabled by default\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProactive\u003C/td\u003E\n\u003Ctd\u003EBefore an eligible authenticated request\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EReactive\u003C/td\u003E\n\u003Ctd\u003EAfter a supported authentication challenge\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBackground\u003C/td\u003E\n\u003Ctd\u003EWhen the background coordinator reaches its refresh schedule\u003C/td\u003E\n\u003Ctd\u003ENo\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese strategies complement each other. They share the same refresh coordination and credential management infrastructure.\u003C/p\u003E\n\u003Cp\u003EEnabling multiple strategies does not create independent refresh pipelines.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022proactive-refresh\u0022\u003EProactive Refresh\u003C/h3\u003E\n\u003Cp\u003EProactive refresh checks whether authentication is eligible for renewal before sending a supported authenticated request.\u003C/p\u003E\n\u003Cp\u003EWhen refresh is due, the client attempts to renew authentication first.\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\u003EApplication request\n |\n v\nIs refresh due?\n |\n \u002B-- No --\u0026gt; Send request\n |\n \u002B-- Yes --\u0026gt; Refresh authentication\n |\n v\n Send request\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis avoids unnecessary authentication challenges when the client already knows that renewal is appropriate.\u003C/p\u003E\n\u003Cp\u003EFor example, when a JWT is approaching expiration:\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\u003EPOST /auth/refresh -\u0026gt; 204\nGET /api/products -\u0026gt; 200\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWithout proactive refresh, the application might first encounter an expired-token challenge.\u003C/p\u003E\n\u003Cp\u003EProactive refresh is particularly useful for applications that should renew authentication while being used, without continuously refreshing during inactivity.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003ETip: Keep proactive refresh enabled even when background refresh is disabled. Request-driven renewal provides authentication continuity without requiring a continuously running refresh timer.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022reactive-refresh\u0022\u003EReactive Refresh\u003C/h3\u003E\n\u003Cp\u003EReactive refresh attempts to recover from a supported authentication challenge.\u003C/p\u003E\n\u003Cp\u003EWhen a protected request is rejected before application execution, the client can attempt refresh and replay the original request using a renewed access token.\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\u003EGET /api/products -\u0026gt; 401\nPOST /auth/refresh -\u0026gt; 204\nGET /api/products -\u0026gt; 200\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EReactive refresh is a recovery mechanism rather than the primary refresh schedule.\u003C/p\u003E\n\u003Cp\u003EIt is useful when:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EA token expires between preparation and request execution.\u003C/li\u003E\n\u003Cli\u003EAn application resumes after being suspended.\u003C/li\u003E\n\u003Cli\u003EThe server rejects an access token that the client expected to remain valid.\u003C/li\u003E\n\u003Cli\u003EA concurrent request has already renewed the access token.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe client does not blindly retry every unsuccessful request.\u003C/p\u003E\n\u003Cp\u003ERecovery requires a supported authentication challenge and an appropriate access-token lifecycle.\u003C/p\u003E\n\u003Cp\u003EA request is replayed at most once through this recovery pipeline.\u003C/p\u003E\n\u003Cp\u003EThe following responses do not independently trigger authentication recovery:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003E403 Forbidden\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003E429 Too Many Requests\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003EArbitrary application-generated \u003Ccode\u003E401\u003C/code\u003E responses\u003C/li\u003E\n\u003Cli\u003ENetwork failures\u003C/li\u003E\n\u003Cli\u003EServer errors\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EReactive recovery currently requires a usable access-token context for safe replay. Cookie-only session authentication does not receive the same automatic replay behavior.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003ETip: Proactive refresh reduces the number of expected authentication challenges. Reactive refresh remains useful as a fallback for expiration races and unexpected authentication rejection.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022background-refresh\u0022\u003EBackground Refresh\u003C/h3\u003E\n\u003Cp\u003EBackground refresh allows the client coordinator to initiate renewal without waiting for an application request.\u003C/p\u003E\n\u003Cp\u003EEnable it explicitly:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoRefresh.Background = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EBackground refresh is useful for applications that need to maintain authentication during periods without protected requests.\u003C/p\u003E\n\u003Cp\u003EExamples include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EOperational dashboards.\u003C/li\u003E\n\u003Cli\u003EMonitoring applications.\u003C/li\u003E\n\u003Cli\u003ELong-running interactive workspaces.\u003C/li\u003E\n\u003Cli\u003EApplications where users spend significant time editing local state before submitting it.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EBackground refresh requires an active client coordinator and an execution environment capable of running it.\u003C/p\u003E\n\u003Cp\u003EIt cannot guarantee renewal while a browser tab is suspended, a device is offline, an application has been closed, or its execution environment has stopped.\u003C/p\u003E\n\u003Cp\u003EServer-side expiration, revocation, and refresh policies continue to apply.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003ETip: Enable background refresh because your application needs independent authentication renewal, not simply because it supports long-lived sessions.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022how-refresh-timing-works\u0022\u003E3. How Refresh Timing Works\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses a shared refresh schedule.\u003C/p\u003E\n\u003Cp\u003EThe schedule adapts to the credential available to the client.\u003C/p\u003E\n\u003Cp\u003EThere are two primary scheduling mechanisms:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EInterval-based scheduling.\u003C/li\u003E\n\u003Cli\u003EJWT expiration-based scheduling.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EApplications do not need to run both mechanisms as independent timers.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022interval-based-scheduling\u0022\u003EInterval-Based Scheduling\u003C/h3\u003E\n\u003Cp\u003EWhen the client has an established authentication context without a managed JWT access token, refresh eligibility is determined by \u003Ccode\u003EInterval\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.AutoRefresh.Interval = TimeSpan.FromMinutes(5);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe interval is measured from the establishment of the authenticated schedule or the last successful refresh.\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\u003E12:00 Authentication established\n12:02 Protected request\n12:05 Refresh becomes eligible\n12:08 Protected request triggers proactive refresh\n12:08 Refresh succeeds\n12:13 Refresh becomes eligible again\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWith background refresh disabled, no refresh request is sent at 12:05 simply because the interval has elapsed.\u003C/p\u003E\n\u003Cp\u003EThe next eligible authenticated request initiates renewal.\u003C/p\u003E\n\u003Cp\u003EThis scheduling mechanism is particularly useful for opaque session authentication.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-expiration-based-scheduling\u0022\u003EJWT Expiration-Based Scheduling\u003C/h3\u003E\n\u003Cp\u003EWhen a managed JWT access token is available, the client uses its expiration time.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoRefresh.RefreshBeforeExpiration = TimeSpan.FromMinutes(1);\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\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\u003E12:00 Access token issued\n12:09 Refresh becomes eligible\n12:10 Access token expires\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client becomes eligible for refresh one minute before expiration.\u003C/p\u003E\n\u003Cp\u003EIf the configured threshold is greater than or equal to the remaining token lifetime when its schedule is initialized, UltimateAuth reduces the effective threshold to half of that remaining lifetime.\u003C/p\u003E\n\u003Cp\u003EThis prevents short-lived access tokens from immediately entering a continuous refresh cycle.\u003C/p\u003E\n\u003Cp\u003EFor example, a newly received token with a remaining lifetime of 30 seconds and a configured refresh threshold of one minute becomes eligible after approximately 15 seconds.\u003C/p\u003E\n\u003Cp\u003EThe schedule belongs to the credential itself. Repeated validation or repeated schedule checks do not continuously postpone its refresh time.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022interval-vs.refreshbeforeexpiration\u0022\u003EInterval vs. RefreshBeforeExpiration\u003C/h3\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\u003EUsed when\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication uses an interval-based schedule without a managed JWT\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshBeforeExpiration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EA managed JWT access token provides an expiration time\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese options describe alternative scheduling mechanisms rather than competing refresh timers.\u003C/p\u003E\n\u003Cp\u003EBoth proactive and background refresh use the applicable shared schedule.\u003C/p\u003E\n\u003Cp\u003EReactive refresh responds to authentication challenges independently of scheduled eligibility.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes\u0022\u003E4. Authentication Modes\u003C/h2\u003E\n\u003Cp\u003ERefresh behavior depends on both the authentication mode and the credentials delivered to the client.\u003C/p\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\u003ETypical scheduling\u003C/th\u003E\n\u003Cth\u003ERefresh behavior\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\u003EInterval\u003C/td\u003E\n\u003Ctd\u003EContinue an existing server-side session\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003EInterval or JWT expiration, depending on the managed credential\u003C/td\u003E\n\u003Ctd\u003EValidate session continuity and rotate refresh credentials\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003EJWT expiration\u003C/td\u003E\n\u003Ctd\u003ERotate refresh credentials and obtain a replacement access token\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003EJWT expiration when supported\u003C/td\u003E\n\u003Ctd\u003EJWT renewal with server-managed lifecycle state\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EPureOpaque does not require a separate access-token and refresh-token pair.\u003C/p\u003E\n\u003Cp\u003EIts refresh operation may update recorded session activity and extend session expiration according to server policy.\u003C/p\u003E\n\u003Cp\u003EHybrid combines server-authoritative session state with additional credential lifecycles. The actual client schedule depends on the credential delivered and managed by the client.\u003C/p\u003E\n\u003Cp\u003EPureJwt uses session-independent JWT authentication with a stateful refresh-token lifecycle.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid describes the JWT-based session-backed model. Its complete runtime support is still evolving; applications should not assume that every SemiHybrid scenario is currently available.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cookie-only-authentication\u0022\u003ECookie-Only Authentication\u003C/h3\u003E\n\u003Cp\u003EAutomatic refresh does not require the application to possess a readable access token.\u003C/p\u003E\n\u003Cp\u003EFor example, PureOpaque can use a server-managed session cookie with interval-based proactive or background refresh.\u003C/p\u003E\n\u003Cp\u003EThe client can initiate the refresh operation without reading the session credential from the cookie.\u003C/p\u003E\n\u003Cp\u003EReactive access-token replay has additional requirements and should not be assumed to work identically for cookie-only authentication.\u003C/p\u003E\n\u003Cp\u003EFor a complete comparison, 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=\u0022choose-the-right-strategy\u0022\u003E5. Choose the Right Strategy\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-default\u0022\u003ERecommended Default\u003C/h3\u003E\n\u003Cp\u003EFor most interactive 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoRefresh.Proactive = true;\noptions.AutoRefresh.Reactive = true;\noptions.AutoRefresh.Background = false;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configuration renews authentication when supported application activity requires it and provides reactive recovery where available.\u003C/p\u003E\n\u003Cp\u003EIt avoids continuously sending refresh requests simply because an application remains open.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022continuous-authentication-maintenance\u0022\u003EContinuous Authentication Maintenance\u003C/h3\u003E\n\u003Cp\u003EFor applications that need independent renewal:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoRefresh.Proactive = true;\noptions.AutoRefresh.Reactive = true;\noptions.AutoRefresh.Background = true;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe strategies share refresh coordination, so overlapping refresh triggers do not independently rotate the same credential within the client scope.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022reactive-only-recovery\u0022\u003EReactive-Only Recovery\u003C/h3\u003E\n\u003Cp\u003EFor specialized applications that prefer recovery after authentication challenges:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoRefresh.Proactive = false;\noptions.AutoRefresh.Reactive = true;\noptions.AutoRefresh.Background = false;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configuration is primarily useful with managed, renewable access tokens.\u003C/p\u003E\n\u003Cp\u003EIt may introduce an additional failed request before successful recovery.\u003C/p\u003E\n\u003Cp\u003EIt is not a replacement for session maintenance in cookie-only opaque authentication.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022manual-refresh-only\u0022\u003EManual Refresh Only\u003C/h3\u003E\n\u003Cp\u003EApplications can disable all three automatic strategies:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoRefresh.Proactive = false;\noptions.AutoRefresh.Reactive = false;\noptions.AutoRefresh.Background = false;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EExplicit refresh remains 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\u003Evar result = await UAuthClient.Flows.RefreshAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDisabling automatic refresh strategies does not necessarily disable initial authentication recovery performed by the client state integration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-proactive-refresh-is-efficient\u0022\u003E6. Why Proactive Refresh Is Efficient\u003C/h2\u003E\n\u003Cp\u003EConsider an application that remains open for eight hours but receives authenticated application requests during only two hours.\u003C/p\u003E\n\u003Cp\u003EWith a five-minute refresh interval:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EBackground refresh could attempt renewal throughout the eight-hour period.\u003C/li\u003E\n\u003Cli\u003EProactive refresh attempts renewal only when an eligible authenticated request is made.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EUnder simplified conditions with sufficiently frequent requests:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EStrategy\u003C/th\u003E\n\u003Cth style=\u0022text-align: right;\u0022\u003EIllustrative refresh attempts\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBackground refresh\u003C/td\u003E\n\u003Ctd style=\u0022text-align: right;\u0022\u003E96\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProactive refresh\u003C/td\u003E\n\u003Ctd style=\u0022text-align: right;\u0022\u003EApproximately 24\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThis represents approximately 75% fewer refresh attempts in this example.\u003C/p\u003E\n\u003Cp\u003EActual results depend on the distribution of requests, successful refresh times, authentication validity, rate limiting, and execution environment.\u003C/p\u003E\n\u003Cp\u003EProactive refresh is request-driven, not a direct measurement of human activity.\u003C/p\u003E\n\u003Cp\u003EAn application that continuously polls protected endpoints may continue renewing authentication even when the user is not interacting with its interface.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003ETip: If preserving meaningful idle expiration is important, review automatic application polling as well as background refresh configuration.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022coordinated-refresh-and-concurrent-requests\u0022\u003E7. Coordinated Refresh and Concurrent Requests\u003C/h2\u003E\n\u003Cp\u003EA common authentication problem occurs when multiple requests discover that an access token needs renewal at the same time.\u003C/p\u003E\n\u003Cp\u003EWithout coordination:\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\u003ERequest A -\u0026gt; Refresh\nRequest B -\u0026gt; Refresh\nRequest C -\u0026gt; Refresh\nRequest D -\u0026gt; Refresh\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EConcurrent rotation can introduce unnecessary traffic, conflicting credential updates, or refresh-token reuse.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth coordinates refresh through a shared single-flight mechanism.\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\u003ERequest A --\u002B\nRequest B --\u002B\nRequest C --\u002B--\u0026gt; Shared refresh execution\nRequest D --\u002B |\n v\n Updated authentication\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EConcurrent callers can wait for the same refresh execution rather than independently sending refresh requests.\u003C/p\u003E\n\u003Cp\u003EThe coordination infrastructure is shared by proactive, reactive, background, manual, and initial recovery operations.\u003C/p\u003E\n\u003Cp\u003EThe client also tracks authentication lifecycle and credential changes to prevent stale refresh results from overwriting a newer client authentication context.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EA user logs out while a refresh is in progress.\u003C/li\u003E\n\u003Cli\u003EA different user signs in before an earlier refresh completes.\u003C/li\u003E\n\u003Cli\u003EA delayed authentication challenge arrives after another request has already renewed the access token.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe client can reject stale results or reuse an already renewed credential where appropriate.\u003C/p\u003E\n\u003Cp\u003EThis coordination applies within the current client scope.\u003C/p\u003E\n\u003Cp\u003EIt does not provide distributed locking across browser tabs, independent applications, or multiple devices.\u003C/p\u003E\n\u003Cp\u003EServer-side rotation and replay protection remain essential.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/refresh-rotation\u0022\u003ERefresh Rotation \u0026amp; Replay Protection\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022safe-authentication-recovery-and-request-replay\u0022\u003E8. Safe Authentication Recovery and Request Replay\u003C/h2\u003E\n\u003Cp\u003EAutomatic request replay must distinguish authentication rejection from application execution.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth uses an authentication recovery response marker for supported authentication challenges.\u003C/p\u003E\n\u003Cp\u003EThe client does not interpret every \u003Ccode\u003E401 Unauthorized\u003C/code\u003E response as permission to replay an operation.\u003C/p\u003E\n\u003Cp\u003EThis distinction matters for requests that modify application state:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.PostAsync\u0026lt;Order\u0026gt;(\u0026quot;/api/orders\u0026quot;, request);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ESupported resource operations can participate in authentication recovery regardless of their HTTP method.\u003C/p\u003E\n\u003Cp\u003EHowever, authentication replay is limited to the supported recovery contract and requires an appropriate renewed credential.\u003C/p\u003E\n\u003Cp\u003EIt is not a general-purpose HTTP retry policy.\u003C/p\u003E\n\u003Cp\u003EApplications should not emit the authentication recovery marker from business logic after performing a mutation.\u003C/p\u003E\n\u003Cp\u003EA custom endpoint that performs side effects before returning an authentication challenge can violate the assumptions required for safe replay.\u003C/p\u003E\n\u003Cp\u003EBusiness-level idempotency remains important for operations that must tolerate retries from networks, proxies, or other infrastructure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022which-requests-participate\u0022\u003EWhich Requests Participate?\u003C/h3\u003E\n\u003Cp\u003EAutomatic request preparation and recovery are available through:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESupported authenticated UltimateAuth Client SDK operations.\u003C/li\u003E\n\u003Cli\u003EThe UltimateAuth Resource Client.\u003C/li\u003E\n\u003Cli\u003EOther integrations explicitly connected to the refresh recovery infrastructure.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003ENot every authentication flow or SDK endpoint necessarily participates in automatic request replay.\u003C/p\u003E\n\u003Cp\u003EAn arbitrary \u003Ccode\u003EHttpClient\u003C/code\u003E request, direct JavaScript fetch, or server-side service invocation does not automatically enter this pipeline.\u003C/p\u003E\n\u003Cp\u003EFor protected application API integration, see \u003Ca href=\u0022/docs/client-sdk/resource-api-requests\u0022\u003EResource API Requests\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-touch-sliding-expiration-and-idle-timeout\u0022\u003E9. Session Touch, Sliding Expiration, and Idle Timeout\u003C/h2\u003E\n\u003Cp\u003EClient refresh scheduling and server session policies are separate responsibilities.\u003C/p\u003E\n\u003Cp\u003EConsider the following server 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.Session.Lifetime = TimeSpan.FromDays(7);\n options.Session.SlidingExpiration = true;\n options.Session.TouchInterval = TimeSpan.FromMinutes(5);\n options.Session.IdleTimeout = TimeSpan.FromDays(4);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAnd the following client 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoRefresh.Interval = TimeSpan.FromMinutes(10);\n options.AutoRefresh.Proactive = true;\n options.AutoRefresh.Background = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach option serves a different purpose.\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\u003EResponsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh.Interval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EClient refresh eligibility\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession.TouchInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMinimum interval for ordinary server-side session touches\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession.SlidingExpiration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EWhether a successful touch can extend session expiration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession.IdleTimeout\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMaximum permitted time without recorded session activity\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession.Lifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession expiration policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession.MaxLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMaximum chain lifetime when configured\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=\u0022refresh-does-not-always-touch-a-session\u0022\u003ERefresh Does Not Always Touch a Session\u003C/h3\u003E\n\u003Cp\u003EA refresh request can succeed without changing server-side session state.\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\u003Eoptions.Session.TouchInterval = TimeSpan.FromMinutes(5);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIf the client attempts refresh every 30 seconds, ordinary refresh requests may return \u003Ccode\u003ENoOp\u003C/code\u003E until the server touch interval has elapsed.\u003C/p\u003E\n\u003Cp\u003EThis is valid behavior, but it can produce unnecessary refresh traffic.\u003C/p\u003E\n\u003Cp\u003EFor interval-based opaque authentication, a useful starting point 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\u003ETouchInterval \u0026lt;= AutoRefresh.Interval\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is a configuration recommendation rather than a universal requirement.\u003C/p\u003E\n\u003Cp\u003EJWT expiration and refresh-token rotation may require renewal independently of the server touch interval.\u003C/p\u003E\n\u003Cp\u003EExplicit server-side force-touch behavior may also bypass the ordinary touch interval.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022sliding-expiration\u0022\u003ESliding Expiration\u003C/h3\u003E\n\u003Cp\u003EA successful session touch may extend expiration when sliding expiration is enabled.\u003C/p\u003E\n\u003Cp\u003EBoth proactive and background refresh can participate in this behavior.\u003C/p\u003E\n\u003Cp\u003EThe server remains responsible for applying the session lifetime and any configured maximum lifetime.\u003C/p\u003E\n\u003Cp\u003ERefresh cannot revive a session that has already expired or bypass an applicable absolute lifetime limit.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022idle-timeout\u0022\u003EIdle Timeout\u003C/h3\u003E\n\u003Cp\u003EIdle expiration is based on recorded server-side session activity.\u003C/p\u003E\n\u003Cp\u003EIt is not necessarily reset by every protected request.\u003C/p\u003E\n\u003Cp\u003EWith proactive refresh, ordinary requests that occur before refresh eligibility may not update the server\u0027s recorded activity.\u003C/p\u003E\n\u003Cp\u003EConsequently, the recorded idle duration can differ from the time since the user\u0027s last interaction.\u003C/p\u003E\n\u003Cp\u003EConfigure the refresh interval and touch interval with sufficient margin below the idle timeout.\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\u003ETouchInterval: 1 minute\nAutoRefresh.Interval: 5 minutes\nIdleTimeout: 30 minutes\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configuration provides more scheduling margin than using a refresh interval close to the idle timeout.\u003C/p\u003E\n\u003Cp\u003EIt still does not guarantee that a session will remain valid without a timely eligible request.\u003C/p\u003E\n\u003Cp\u003EBackground refresh can keep recorded activity current even when the user is inactive. This may be desirable for continuous workspaces, but it may also prevent idle expiration from reflecting human inactivity.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003ETip: If the purpose of IdleTimeout is to expire inactive user sessions, prefer request-driven renewal and avoid unnecessary protected polling.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/sessions-devices/session-lifecycle\u0022\u003ESession Model \u0026amp; Lifecycle\u003C/a\u003E and \u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022rate-limiting-and-refresh-backoff\u0022\u003E10. Rate Limiting and Refresh Backoff\u003C/h2\u003E\n\u003Cp\u003ERefresh is an authentication operation and remains subject to server-side rate limiting.\u003C/p\u003E\n\u003Cp\u003EWhen the server returns \u003Ccode\u003E429 Too Many Requests\u003C/code\u003E, the client observes the applicable retry delay instead of immediately starting another refresh attempt.\u003C/p\u003E\n\u003Cp\u003EA rate-limited refresh does not independently mean that the user has been logged out.\u003C/p\u003E\n\u003Cp\u003EThe client can preserve the existing authentication context while renewal is temporarily unavailable.\u003C/p\u003E\n\u003Cp\u003EWhether an application request can continue depends on the available credential and its validity.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth also applies automatic refresh backoff when a successful refresh does not rotate an existing JWT.\u003C/p\u003E\n\u003Cp\u003EThis prevents repeated proactive or background attempts from creating a tight refresh loop.\u003C/p\u003E\n\u003Cp\u003EA successful refresh response does not make an expired access token valid again.\u003C/p\u003E\n\u003Cp\u003EApplications should handle unsuccessful request results normally and must not assume that every refresh attempt produces usable replacement credentials.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/rate-limiting\u0022\u003ERate Limiting\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022manual-refresh-and-authentication-recovery\u0022\u003E11. Manual Refresh and Authentication Recovery\u003C/h2\u003E\n\u003Cp\u003EAutomatic refresh does not remove explicit authentication operations.\u003C/p\u003E\n\u003Cp\u003EApplications can still request refresh directly:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.RefreshAsync();\n\nif (result.IsSuccess)\n{\n // Authentication continuation succeeded.\n}\nelse if (result.Outcome == RefreshOutcome.ReauthRequired)\n{\n // Authentication must be established again.\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EManual refresh participates in the shared coordination infrastructure.\u003C/p\u003E\n\u003Cp\u003EIt does not bypass server expiration, rotation, revocation, or rate-limiting policies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-recovery-after-reload\u0022\u003EAuthentication Recovery After Reload\u003C/h3\u003E\n\u003Cp\u003EA client may start without a managed access token, for example after a full browser reload.\u003C/p\u003E\n\u003Cp\u003EWhen a compatible refresh credential remains available, the client can attempt authentication recovery.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.RecoverAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EInitial recovery differs from reactive request replay.\u003C/p\u003E\n\u003Cp\u003EIts purpose is to restore authentication when the client does not currently have usable access material.\u003C/p\u003E\n\u003Cp\u003ERecovery remains subject to server policy and browser credential availability.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/client-sdk/authentication\u0022\u003EAuthentication\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-outcomes\u0022\u003E12. Refresh Outcomes\u003C/h2\u003E\n\u003Cp\u003ERefresh is not synonymous with token rotation.\u003C/p\u003E\n\u003Cp\u003EThe result depends on the authentication mode and the server\u0027s refresh policy.\u003C/p\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\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\u003EAuthentication continuation succeeded without requiring a session update\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETouched\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERecorded session activity was updated\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERotated\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh credentials were rotated\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESuccess\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EGeneric successful refresh\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauthRequired\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication cannot safely continue through the attempted refresh\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EApplications should inspect \u003Ccode\u003ERefreshResult.IsSuccess\u003C/code\u003E rather than requiring a particular successful outcome.\u003C/p\u003E\n\u003Cp\u003EDetailed refresh outcomes may depend on the server diagnostics 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.Diagnostics.EnableRefreshDetails = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA generic success result does not necessarily mean that a session was touched or that a token was rotated.\u003C/p\u003E\n\u003Cp\u003EFor server-side execution details, see \u003Ca href=\u0022/docs/auth-flows/refresh-flow\u0022\u003ERefresh Flow\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-diagnostics\u0022\u003E13. Client Diagnostics\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth exposes refresh diagnostics through \u003Ccode\u003EUAuthClientDiagnostics\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EA Blazor component can inject the diagnostics service:\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@using CodeBeam.UltimateAuth.Client.Diagnostics\n@inject UAuthClientDiagnostics Diagnostics\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe available counters distinguish refresh operations by their initiating trigger.\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\u003EMeaning\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EProactiveRefreshCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EProactive transport attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReactiveRefreshCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReactive transport attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EBackgroundRefreshCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EBackground transport attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EManualRefreshCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EExplicit manual transport attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERecoveryRefreshCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication recovery transport attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutomaticRefreshCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECombined proactive, reactive, and background attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshAttemptCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETotal transport attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003ECounters represent transport attempts, not individual callers waiting for a shared refresh execution.\u003C/p\u003E\n\u003Cp\u003ELocally deferred operations do not independently increment transport attempt counters.\u003C/p\u003E\n\u003Cp\u003EOutcome counters are also available:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshTouchedCount\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshRotatedCount\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshNoOpCount\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshSuccessCount\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshReauthRequiredCount\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-eligibility-vs.background-scheduling\u0022\u003ERefresh Eligibility vs. Background Scheduling\u003C/h3\u003E\n\u003Cp\u003ETwo diagnostic timestamps describe different aspects of refresh timing.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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 eligibleAt = Diagnostics.NextRefreshEligibleAt;\nvar backgroundAt = Diagnostics.NextAutomaticRefreshAt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003ENextRefreshEligibleAt\u003C/code\u003E describes the initialized refresh schedule for the current authentication context.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ENextAutomaticRefreshAt\u003C/code\u003E describes the next attempt scheduled by the background coordinator.\u003C/p\u003E\n\u003Cp\u003EWith proactive refresh enabled and background refresh disabled, the eligibility timestamp can be available while the background timestamp remains null.\u003C/p\u003E\n\u003Cp\u003EEligibility does not guarantee that a request will be sent at that time.\u003C/p\u003E\n\u003Cp\u003ETemporary backoff, rate limiting, authentication changes, and execution environment constraints can affect actual execution.\u003C/p\u003E\n\u003Cp\u003EReading diagnostics does not initiate a refresh or initialize a new JWT refresh schedule.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022observing-changes-in-blazor\u0022\u003EObserving Changes in Blazor\u003C/h3\u003E\n\u003Cp\u003EComponents can subscribe to diagnostic changes:\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@implements IDisposable\n\n\u0026lt;div\u0026gt;\n Proactive attempts: @Diagnostics.ProactiveRefreshCount\n\u0026lt;/div\u0026gt;\n\n\u0026lt;div\u0026gt;\n Background attempts: @Diagnostics.BackgroundRefreshCount\n\u0026lt;/div\u0026gt;\n\n@code {\n protected override void OnInitialized()\n {\n Diagnostics.Changed \u002B= OnDiagnosticsChanged;\n }\n\n private void OnDiagnosticsChanged()\n {\n _ = InvokeAsync(StateHasChanged);\n }\n\n public void Dispose()\n {\n Diagnostics.Changed -= OnDiagnosticsChanged;\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUse diagnostic notifications to update application displays.\u003C/p\u003E\n\u003Cp\u003EAvoid initiating authentication operations synchronously from diagnostic event handlers.\u003C/p\u003E\n\u003Cp\u003EFor a countdown display, a local UI timer can update the displayed remaining time without sending authentication requests.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-scope\u0022\u003EClient Scope\u003C/h3\u003E\n\u003Cp\u003EDiagnostics describe the current client scope.\u003C/p\u003E\n\u003Cp\u003EThey are not application-wide telemetry, server-wide counters, or persistent per-user audit records.\u003C/p\u003E\n\u003Cp\u003ECounters may accumulate across authentication changes within the same client scope.\u003C/p\u003E\n\u003Cp\u003EApplications that need centralized monitoring should use an appropriate telemetry or logging integration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022troubleshooting\u0022\u003E14. Troubleshooting\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-never-runs-when-the-application-is-idle\u0022\u003ERefresh Never Runs When the Application Is Idle\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E Background refresh is disabled.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E This is expected with proactive refresh. Send a supported authenticated request after refresh eligibility is reached, or enable background refresh if independent renewal is required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-succeeds-but-session-expiration-does-not-change\u0022\u003ERefresh Succeeds but Session Expiration Does Not Change\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E The server may return \u003Ccode\u003ENoOp\u003C/code\u003E, sliding expiration may be disabled, or a maximum lifetime may prevent further extension.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E Review server session policies and detailed refresh outcomes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022too-many-refresh-requests-return-noop\u0022\u003EToo Many Refresh Requests Return NoOp\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E The client refresh interval may be shorter than the server touch interval.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E Align the intervals for opaque session authentication.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-short-lived-jwt-refreshes-earlier-than-expected\u0022\u003EA Short-Lived JWT Refreshes Earlier Than Expected\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E The configured refresh threshold may be greater than the remaining token lifetime.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E UltimateAuth clamps the effective threshold when initializing the schedule. Review the access-token lifetime and refresh threshold together.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-401-response-does-not-trigger-reactive-refresh\u0022\u003EA 401 Response Does Not Trigger Reactive Refresh\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E The response may not represent a supported authentication challenge, the operation may not participate in recovery, or a renewable managed access token may be unavailable.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E Verify the request integration, credential delivery, authentication recovery marker, and reactive configuration.\u003C/p\u003E\n\u003Cp\u003EFor cross-origin browser requests, ensure the required response headers are exposed through CORS.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022background-refresh-is-enabled-but-not-running\u0022\u003EBackground Refresh Is Enabled but Not Running\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E The client coordinator may not be started, authentication may not be established, or the application execution environment may be suspended.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E Review the client integration and coordinator diagnostics.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-expires-despite-automatic-refresh\u0022\u003EAuthentication Expires Despite Automatic Refresh\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E The session, refresh token, or authentication chain may have expired or been revoked. A required credential may also be unavailable.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E Handle reauthentication appropriately. Automatic refresh cannot override server security policy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-reference\u0022\u003E15. Configuration Reference\u003C/h2\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\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EProactive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh before eligible authenticated requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReactive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERecover from supported authentication challenges\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EBackground\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnable independent background refresh\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E5 minutes\u003C/td\u003E\n\u003Ctd\u003EInterval-based refresh eligibility\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshBeforeExpiration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E1 minute\u003C/td\u003E\n\u003Ctd\u003EJWT expiration-based refresh threshold\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe effective interval defaults to five minutes after client option configuration.\u003C/p\u003E\n\u003Cp\u003EThe equivalent configuration can be expressed through appsettings.json:\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;AutoRefresh\u0026quot;: {\n \u0026quot;Proactive\u0026quot;: true,\n \u0026quot;Reactive\u0026quot;: true,\n \u0026quot;Background\u0026quot;: false,\n \u0026quot;Interval\u0026quot;: \u0026quot;00:05:00\u0026quot;,\n \u0026quot;RefreshBeforeExpiration\u0026quot;: \u0026quot;00:01:00\u0026quot;\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022summary\u0022\u003ESummary\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates authentication renewal from application business logic.\u003C/p\u003E\n\u003Cp\u003EProactive refresh provides efficient request-driven renewal.\u003C/p\u003E\n\u003Cp\u003EReactive refresh provides recovery from supported authentication challenges.\u003C/p\u003E\n\u003Cp\u003EBackground refresh provides independent renewal when the application requires it.\u003C/p\u003E\n\u003Cp\u003EAll strategies share refresh coordination and credential lifecycle management within the current client scope.\u003C/p\u003E\n\u003Cp\u003EThe recommended starting point is proactive and reactive refresh with background refresh disabled.\u003C/p\u003E\n\u003Cp\u003EEnable additional behavior according to the application\u0027s continuity requirements rather than implementing independent authentication timers and retry mechanisms.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022related-documentation\u0022\u003ERelated Documentation\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client-sdk/authentication\u0022\u003EAuthentication\u003C/a\u003E \u2014 Login, logout, manual refresh, and authentication recovery.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client-sdk/resource-api-requests\u0022\u003EResource API Requests\u003C/a\u003E \u2014 Protected application requests and supported recovery behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E \u2014 Client configuration reference.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Server authentication and session policies.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E \u2014 Credential and authentication lifecycle differences.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/auth-flows/refresh-flow\u0022\u003ERefresh Flow\u003C/a\u003E \u2014 Server-side refresh execution.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/sessions-devices/session-lifecycle\u0022\u003ESession Model \u0026amp; Lifecycle\u003C/a\u003E \u2014 Session expiration, touch, and sliding expiration.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/security/refresh-rotation\u0022\u003ERefresh Rotation \u0026amp; Replay Protection\u003C/a\u003E \u2014 Refresh-token concurrency and replay protection.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/security/rate-limiting\u0022\u003ERate Limiting\u003C/a\u003E \u2014 Authentication rate limits and server enforcement.\u003C/li\u003E\n\u003C/ul\u003E\n", + "Html": "\n\u003Cp\u003EAuthentication should not become an application-level scheduling problem.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides a coordinated refresh mechanism that can renew authentication before a protected request, recover from supported authentication challenges, or maintain authentication through background execution.\u003C/p\u003E\n\u003Cp\u003EApplications do not need to implement their own token expiration timers, refresh locks, or authentication retry pipelines when using the supported UltimateAuth client operations.\u003C/p\u003E\n\u003Cp\u003EThe same client architecture supports different authentication modes and credential lifecycles without requiring applications to implement a separate refresh strategy for each mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022getting-started\u0022\u003E1. Getting Started\u003C/h2\u003E\n\u003Cp\u003EAutomatic refresh is available through the UltimateAuth Client SDK and its supported platform integrations.\u003C/p\u003E\n\u003Cp\u003EFor Blazor applications, register the client as usual:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EProactive and reactive refresh are enabled by default. Background refresh is opt-in.\u003C/p\u003E\n\u003Cp\u003EThe following configuration makes the defaults explicit:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoRefresh.Proactive = true;\n options.AutoRefresh.Reactive = true;\n options.AutoRefresh.Background = false;\n\n options.AutoRefresh.Interval = TimeSpan.FromMinutes(5);\n options.AutoRefresh.RefreshBeforeExpiration = TimeSpan.FromMinutes(1);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EOnce authentication is established, supported client operations participate in refresh coordination automatically.\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\u003Evar result = await UAuthClient.Resource\n .GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\nif (result.IsSuccess)\n{\n products = result.Value;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe application does not need to check token expiration or explicitly refresh authentication before every request.\u003C/p\u003E\n\u003Cp\u003EFor client registration and configuration, see \u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022three-automatic-refresh-strategies\u0022\u003E2. Three Automatic Refresh Strategies\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth provides three independently configurable automatic refresh strategies.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EStrategy\u003C/th\u003E\n\u003Cth\u003ETrigger\u003C/th\u003E\n\u003Cth\u003EEnabled by default\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProactive\u003C/td\u003E\n\u003Ctd\u003EBefore an eligible authenticated request\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EReactive\u003C/td\u003E\n\u003Ctd\u003EAfter a supported authentication challenge\u003C/td\u003E\n\u003Ctd\u003EYes\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBackground\u003C/td\u003E\n\u003Ctd\u003EWhen the background coordinator reaches its refresh schedule\u003C/td\u003E\n\u003Ctd\u003ENo\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese strategies complement each other. They share the same refresh coordination and credential management infrastructure.\u003C/p\u003E\n\u003Cp\u003EEnabling multiple strategies does not create independent refresh pipelines.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022proactive-refresh\u0022\u003EProactive Refresh\u003C/h3\u003E\n\u003Cp\u003EProactive refresh checks whether authentication is eligible for renewal before sending a supported authenticated request.\u003C/p\u003E\n\u003Cp\u003EWhen refresh is due, the client attempts to renew authentication first.\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\u003EApplication request\n |\n v\nIs refresh due?\n |\n \u002B-- No --\u0026gt; Send request\n |\n \u002B-- Yes --\u0026gt; Refresh authentication\n |\n v\n Send request\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis avoids unnecessary authentication challenges when the client already knows that renewal is appropriate.\u003C/p\u003E\n\u003Cp\u003EFor example, when a JWT is approaching expiration:\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\u003EPOST /auth/refresh -\u0026gt; 204\nGET /api/products -\u0026gt; 200\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWithout proactive refresh, the application might first encounter an expired-token challenge.\u003C/p\u003E\n\u003Cp\u003EProactive refresh is particularly useful for applications that should renew authentication while being used, without continuously refreshing during inactivity.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003ETip: Keep proactive refresh enabled even when background refresh is disabled. Request-driven renewal provides authentication continuity without requiring a continuously running refresh timer.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022reactive-refresh\u0022\u003EReactive Refresh\u003C/h3\u003E\n\u003Cp\u003EReactive refresh attempts to recover from a supported authentication challenge.\u003C/p\u003E\n\u003Cp\u003EWhen a protected request is rejected before application execution, the client can attempt refresh and replay the original request using a renewed access token.\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\u003EGET /api/products -\u0026gt; 401\nPOST /auth/refresh -\u0026gt; 204\nGET /api/products -\u0026gt; 200\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EReactive refresh is a recovery mechanism rather than the primary refresh schedule.\u003C/p\u003E\n\u003Cp\u003EIt is useful when:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EA token expires between preparation and request execution.\u003C/li\u003E\n\u003Cli\u003EAn application resumes after being suspended.\u003C/li\u003E\n\u003Cli\u003EThe server rejects an access token that the client expected to remain valid.\u003C/li\u003E\n\u003Cli\u003EA concurrent request has already renewed the access token.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe client does not blindly retry every unsuccessful request.\u003C/p\u003E\n\u003Cp\u003ERecovery requires a supported authentication challenge and an appropriate access-token lifecycle.\u003C/p\u003E\n\u003Cp\u003EA request is replayed at most once through this recovery pipeline.\u003C/p\u003E\n\u003Cp\u003EThe following responses do not independently trigger authentication recovery:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003E403 Forbidden\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003E429 Too Many Requests\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003EArbitrary application-generated \u003Ccode\u003E401\u003C/code\u003E responses\u003C/li\u003E\n\u003Cli\u003ENetwork failures\u003C/li\u003E\n\u003Cli\u003EServer errors\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EReactive recovery currently requires a usable access-token context for safe replay. Cookie-only session authentication does not receive the same automatic replay behavior.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003ETip: Proactive refresh reduces the number of expected authentication challenges. Reactive refresh remains useful as a fallback for expiration races and unexpected authentication rejection.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022background-refresh\u0022\u003EBackground Refresh\u003C/h3\u003E\n\u003Cp\u003EBackground refresh allows the client coordinator to initiate renewal without waiting for an application request.\u003C/p\u003E\n\u003Cp\u003EEnable it explicitly:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoRefresh.Background = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EBackground refresh is useful for applications that need to maintain authentication during periods without protected requests.\u003C/p\u003E\n\u003Cp\u003EExamples include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EOperational dashboards.\u003C/li\u003E\n\u003Cli\u003EMonitoring applications.\u003C/li\u003E\n\u003Cli\u003ELong-running interactive workspaces.\u003C/li\u003E\n\u003Cli\u003EApplications where users spend significant time editing local state before submitting it.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EBackground refresh requires an active client coordinator and an execution environment capable of running it.\u003C/p\u003E\n\u003Cp\u003EIt cannot guarantee renewal while a browser tab is suspended, a device is offline, an application has been closed, or its execution environment has stopped.\u003C/p\u003E\n\u003Cp\u003EServer-side expiration, revocation, and refresh policies continue to apply.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003ETip: Enable background refresh because your application needs independent authentication renewal, not simply because it supports long-lived sessions.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022how-refresh-timing-works\u0022\u003E3. How Refresh Timing Works\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses a shared refresh schedule.\u003C/p\u003E\n\u003Cp\u003EThe schedule adapts to the credential available to the client.\u003C/p\u003E\n\u003Cp\u003EThere are two primary scheduling mechanisms:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EInterval-based scheduling.\u003C/li\u003E\n\u003Cli\u003EJWT expiration-based scheduling.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EApplications do not need to run both mechanisms as independent timers.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022interval-based-scheduling\u0022\u003EInterval-Based Scheduling\u003C/h3\u003E\n\u003Cp\u003EWhen the client has an established authentication context without a managed JWT access token, refresh eligibility is determined by \u003Ccode\u003EInterval\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.AutoRefresh.Interval = TimeSpan.FromMinutes(5);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe interval is measured from the establishment of the authenticated schedule or the last successful refresh.\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\u003E12:00 Authentication established\n12:02 Protected request\n12:05 Refresh becomes eligible\n12:08 Protected request triggers proactive refresh\n12:08 Refresh succeeds\n12:13 Refresh becomes eligible again\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWith background refresh disabled, no refresh request is sent at 12:05 simply because the interval has elapsed.\u003C/p\u003E\n\u003Cp\u003EThe next eligible authenticated request initiates renewal.\u003C/p\u003E\n\u003Cp\u003EThis scheduling mechanism is particularly useful for opaque session authentication.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-expiration-based-scheduling\u0022\u003EJWT Expiration-Based Scheduling\u003C/h3\u003E\n\u003Cp\u003EWhen a managed JWT access token is available, the client uses its expiration time.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoRefresh.RefreshBeforeExpiration = TimeSpan.FromMinutes(1);\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\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\u003E12:00 Access token issued\n12:09 Refresh becomes eligible\n12:10 Access token expires\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client becomes eligible for refresh one minute before expiration.\u003C/p\u003E\n\u003Cp\u003EIf the configured threshold is greater than or equal to the remaining token lifetime when its schedule is initialized, UltimateAuth reduces the effective threshold to half of that remaining lifetime.\u003C/p\u003E\n\u003Cp\u003EThis prevents short-lived access tokens from immediately entering a continuous refresh cycle.\u003C/p\u003E\n\u003Cp\u003EFor example, a newly received token with a remaining lifetime of 30 seconds and a configured refresh threshold of one minute becomes eligible after approximately 15 seconds.\u003C/p\u003E\n\u003Cp\u003EThe schedule belongs to the credential itself. Repeated validation or repeated schedule checks do not continuously postpone its refresh time.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022interval-vs.refreshbeforeexpiration\u0022\u003EInterval vs. RefreshBeforeExpiration\u003C/h3\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\u003EUsed when\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication uses an interval-based schedule without a managed JWT\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshBeforeExpiration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EA managed JWT access token provides an expiration time\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese options describe alternative scheduling mechanisms rather than competing refresh timers.\u003C/p\u003E\n\u003Cp\u003EBoth proactive and background refresh use the applicable shared schedule.\u003C/p\u003E\n\u003Cp\u003EReactive refresh responds to authentication challenges independently of scheduled eligibility.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes\u0022\u003E4. Authentication Modes\u003C/h2\u003E\n\u003Cp\u003ERefresh behavior depends on both the authentication mode and the credentials delivered to the client.\u003C/p\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\u003ETypical scheduling\u003C/th\u003E\n\u003Cth\u003ERefresh behavior\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\u003EInterval\u003C/td\u003E\n\u003Ctd\u003EContinue an existing server-side session\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003EInterval or JWT expiration, depending on the managed credential\u003C/td\u003E\n\u003Ctd\u003EValidate session continuity and rotate refresh credentials\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003EJWT expiration\u003C/td\u003E\n\u003Ctd\u003ERotate refresh credentials and obtain a replacement access token\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003EJWT expiration when supported\u003C/td\u003E\n\u003Ctd\u003EJWT renewal with server-managed lifecycle state\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EPureOpaque does not require a separate access-token and refresh-token pair.\u003C/p\u003E\n\u003Cp\u003EIts refresh operation may update recorded session activity and extend session expiration according to server policy.\u003C/p\u003E\n\u003Cp\u003EHybrid combines server-authoritative session state with additional credential lifecycles. The actual client schedule depends on the credential delivered and managed by the client.\u003C/p\u003E\n\u003Cp\u003EPureJwt uses session-independent JWT authentication with a stateful refresh-token lifecycle.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cookie-only-authentication\u0022\u003ECookie-Only Authentication\u003C/h3\u003E\n\u003Cp\u003EAutomatic refresh does not require the application to possess a readable access token.\u003C/p\u003E\n\u003Cp\u003EFor example, PureOpaque can use a server-managed session cookie with interval-based proactive or background refresh.\u003C/p\u003E\n\u003Cp\u003EThe client can initiate the refresh operation without reading the session credential from the cookie.\u003C/p\u003E\n\u003Cp\u003EReactive access-token replay has additional requirements and should not be assumed to work identically for cookie-only authentication.\u003C/p\u003E\n\u003Cp\u003EFor a complete comparison, 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=\u0022choose-the-right-strategy\u0022\u003E5. Choose the Right Strategy\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-default\u0022\u003ERecommended Default\u003C/h3\u003E\n\u003Cp\u003EFor most interactive 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoRefresh.Proactive = true;\noptions.AutoRefresh.Reactive = true;\noptions.AutoRefresh.Background = false;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configuration renews authentication when supported application activity requires it and provides reactive recovery where available.\u003C/p\u003E\n\u003Cp\u003EIt avoids continuously sending refresh requests simply because an application remains open.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022continuous-authentication-maintenance\u0022\u003EContinuous Authentication Maintenance\u003C/h3\u003E\n\u003Cp\u003EFor applications that need independent renewal:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoRefresh.Proactive = true;\noptions.AutoRefresh.Reactive = true;\noptions.AutoRefresh.Background = true;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe strategies share refresh coordination, so overlapping refresh triggers do not independently rotate the same credential within the client scope.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022reactive-only-recovery\u0022\u003EReactive-Only Recovery\u003C/h3\u003E\n\u003Cp\u003EFor specialized applications that prefer recovery after authentication challenges:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoRefresh.Proactive = false;\noptions.AutoRefresh.Reactive = true;\noptions.AutoRefresh.Background = false;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configuration is primarily useful with managed, renewable access tokens.\u003C/p\u003E\n\u003Cp\u003EIt may introduce an additional failed request before successful recovery.\u003C/p\u003E\n\u003Cp\u003EIt is not a replacement for session maintenance in cookie-only opaque authentication.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022manual-refresh-only\u0022\u003EManual Refresh Only\u003C/h3\u003E\n\u003Cp\u003EApplications can disable all three automatic strategies:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoRefresh.Proactive = false;\noptions.AutoRefresh.Reactive = false;\noptions.AutoRefresh.Background = false;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EExplicit refresh remains 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\u003Evar result = await UAuthClient.Flows.RefreshAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDisabling automatic refresh strategies does not necessarily disable initial authentication recovery performed by the client state integration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-proactive-refresh-is-efficient\u0022\u003E6. Why Proactive Refresh Is Efficient\u003C/h2\u003E\n\u003Cp\u003EConsider an application that remains open for eight hours but receives authenticated application requests during only two hours.\u003C/p\u003E\n\u003Cp\u003EWith a five-minute refresh interval:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EBackground refresh could attempt renewal throughout the eight-hour period.\u003C/li\u003E\n\u003Cli\u003EProactive refresh attempts renewal only when an eligible authenticated request is made.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EUnder simplified conditions with sufficiently frequent requests:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EStrategy\u003C/th\u003E\n\u003Cth style=\u0022text-align: right;\u0022\u003EIllustrative refresh attempts\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBackground refresh\u003C/td\u003E\n\u003Ctd style=\u0022text-align: right;\u0022\u003E96\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProactive refresh\u003C/td\u003E\n\u003Ctd style=\u0022text-align: right;\u0022\u003EApproximately 24\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThis represents approximately 75% fewer refresh attempts in this example.\u003C/p\u003E\n\u003Cp\u003EActual results depend on the distribution of requests, successful refresh times, authentication validity, rate limiting, and execution environment.\u003C/p\u003E\n\u003Cp\u003EProactive refresh is request-driven, not a direct measurement of human activity.\u003C/p\u003E\n\u003Cp\u003EAn application that continuously polls protected endpoints may continue renewing authentication even when the user is not interacting with its interface.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003ETip: If preserving meaningful idle expiration is important, review automatic application polling as well as background refresh configuration.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022coordinated-refresh-and-concurrent-requests\u0022\u003E7. Coordinated Refresh and Concurrent Requests\u003C/h2\u003E\n\u003Cp\u003EA common authentication problem occurs when multiple requests discover that an access token needs renewal at the same time.\u003C/p\u003E\n\u003Cp\u003EWithout coordination:\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\u003ERequest A -\u0026gt; Refresh\nRequest B -\u0026gt; Refresh\nRequest C -\u0026gt; Refresh\nRequest D -\u0026gt; Refresh\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EConcurrent rotation can introduce unnecessary traffic, conflicting credential updates, or refresh-token reuse.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth coordinates refresh through a shared single-flight mechanism.\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\u003ERequest A --\u002B\nRequest B --\u002B\nRequest C --\u002B--\u0026gt; Shared refresh execution\nRequest D --\u002B |\n v\n Updated authentication\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EConcurrent callers can wait for the same refresh execution rather than independently sending refresh requests.\u003C/p\u003E\n\u003Cp\u003EThe coordination infrastructure is shared by proactive, reactive, background, manual, and initial recovery operations.\u003C/p\u003E\n\u003Cp\u003EThe client also tracks authentication lifecycle and credential changes to prevent stale refresh results from overwriting a newer client authentication context.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EA user logs out while a refresh is in progress.\u003C/li\u003E\n\u003Cli\u003EA different user signs in before an earlier refresh completes.\u003C/li\u003E\n\u003Cli\u003EA delayed authentication challenge arrives after another request has already renewed the access token.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe client can reject stale results or reuse an already renewed credential where appropriate.\u003C/p\u003E\n\u003Cp\u003EThis coordination applies within the current client scope.\u003C/p\u003E\n\u003Cp\u003EIt does not provide distributed locking across browser tabs, independent applications, or multiple devices.\u003C/p\u003E\n\u003Cp\u003EServer-side rotation and replay protection remain essential.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/refresh-rotation\u0022\u003ERefresh Rotation \u0026amp; Replay Protection\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022safe-authentication-recovery-and-request-replay\u0022\u003E8. Safe Authentication Recovery and Request Replay\u003C/h2\u003E\n\u003Cp\u003EAutomatic request replay must distinguish authentication rejection from application execution.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth uses an authentication recovery response marker for supported authentication challenges.\u003C/p\u003E\n\u003Cp\u003EThe client does not interpret every \u003Ccode\u003E401 Unauthorized\u003C/code\u003E response as permission to replay an operation.\u003C/p\u003E\n\u003Cp\u003EThis distinction matters for requests that modify application state:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.PostAsync\u0026lt;Order\u0026gt;(\u0026quot;/api/orders\u0026quot;, request);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ESupported resource operations can participate in authentication recovery regardless of their HTTP method.\u003C/p\u003E\n\u003Cp\u003EHowever, authentication replay is limited to the supported recovery contract and requires an appropriate renewed credential.\u003C/p\u003E\n\u003Cp\u003EIt is not a general-purpose HTTP retry policy.\u003C/p\u003E\n\u003Cp\u003EApplications should not emit the authentication recovery marker from business logic after performing a mutation.\u003C/p\u003E\n\u003Cp\u003EA custom endpoint that performs side effects before returning an authentication challenge can violate the assumptions required for safe replay.\u003C/p\u003E\n\u003Cp\u003EBusiness-level idempotency remains important for operations that must tolerate retries from networks, proxies, or other infrastructure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022which-requests-participate\u0022\u003EWhich Requests Participate?\u003C/h3\u003E\n\u003Cp\u003EAutomatic request preparation and recovery are available through:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESupported authenticated UltimateAuth Client SDK operations.\u003C/li\u003E\n\u003Cli\u003EThe UltimateAuth Resource Client.\u003C/li\u003E\n\u003Cli\u003EOther integrations explicitly connected to the refresh recovery infrastructure.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003ENot every authentication flow or SDK endpoint necessarily participates in automatic request replay.\u003C/p\u003E\n\u003Cp\u003EAn arbitrary \u003Ccode\u003EHttpClient\u003C/code\u003E request, direct JavaScript fetch, or server-side service invocation does not automatically enter this pipeline.\u003C/p\u003E\n\u003Cp\u003EFor protected application API integration, see \u003Ca href=\u0022/docs/client-sdk/resource-api-requests\u0022\u003EResource API Requests\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-touch-sliding-expiration-and-idle-timeout\u0022\u003E9. Session Touch, Sliding Expiration, and Idle Timeout\u003C/h2\u003E\n\u003Cp\u003EClient refresh scheduling and server session policies are separate responsibilities.\u003C/p\u003E\n\u003Cp\u003EConsider the following server 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.FromDays(7);\n options.Session.SlidingExpiration = true;\n options.Session.TouchInterval = TimeSpan.FromMinutes(5);\n options.Session.IdleTimeout = TimeSpan.FromDays(4);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAnd the following client 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoRefresh.Interval = TimeSpan.FromMinutes(10);\n options.AutoRefresh.Proactive = true;\n options.AutoRefresh.Background = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach option serves a different purpose.\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\u003EResponsibility\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh.Interval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EClient refresh eligibility\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession.TouchInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMinimum interval for ordinary server-side session touches\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession.SlidingExpiration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EWhether a successful touch can extend session expiration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession.IdleTimeout\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMaximum permitted time without recorded session activity\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 expiration policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESession.MaxLifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EMaximum chain lifetime when configured\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=\u0022refresh-does-not-always-touch-a-session\u0022\u003ERefresh Does Not Always Touch a Session\u003C/h3\u003E\n\u003Cp\u003EA refresh request can succeed without changing server-side session state.\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\u003Eoptions.Session.TouchInterval = TimeSpan.FromMinutes(5);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIf the client attempts refresh every 30 seconds, ordinary refresh requests may return \u003Ccode\u003ENoOp\u003C/code\u003E until the server touch interval has elapsed.\u003C/p\u003E\n\u003Cp\u003EThis is valid behavior, but it can produce unnecessary refresh traffic.\u003C/p\u003E\n\u003Cp\u003EFor interval-based opaque authentication, a useful starting point 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\u003ETouchInterval \u0026lt;= AutoRefresh.Interval\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is a configuration recommendation rather than a universal requirement.\u003C/p\u003E\n\u003Cp\u003EJWT expiration and refresh-token rotation may require renewal independently of the server touch interval.\u003C/p\u003E\n\u003Cp\u003EExplicit server-side force-touch behavior may also bypass the ordinary touch interval.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022sliding-expiration\u0022\u003ESliding Expiration\u003C/h3\u003E\n\u003Cp\u003EA successful session touch may extend expiration when sliding expiration is enabled.\u003C/p\u003E\n\u003Cp\u003EBoth proactive and background refresh can participate in this behavior.\u003C/p\u003E\n\u003Cp\u003EThe server remains responsible for applying the session lifetime and any configured maximum lifetime.\u003C/p\u003E\n\u003Cp\u003ERefresh cannot revive a session that has already expired or bypass an applicable absolute lifetime limit.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022idle-timeout\u0022\u003EIdle Timeout\u003C/h3\u003E\n\u003Cp\u003EIdle expiration is based on recorded server-side session activity.\u003C/p\u003E\n\u003Cp\u003EIt is not necessarily reset by every protected request.\u003C/p\u003E\n\u003Cp\u003EWith proactive refresh, ordinary requests that occur before refresh eligibility may not update the server\u0027s recorded activity.\u003C/p\u003E\n\u003Cp\u003EConsequently, the recorded idle duration can differ from the time since the user\u0027s last interaction.\u003C/p\u003E\n\u003Cp\u003EConfigure the refresh interval and touch interval with sufficient margin below the idle timeout.\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\u003ETouchInterval: 1 minute\nAutoRefresh.Interval: 5 minutes\nIdleTimeout: 30 minutes\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis configuration provides more scheduling margin than using a refresh interval close to the idle timeout.\u003C/p\u003E\n\u003Cp\u003EIt still does not guarantee that a session will remain valid without a timely eligible request.\u003C/p\u003E\n\u003Cp\u003EBackground refresh can keep recorded activity current even when the user is inactive. This may be desirable for continuous workspaces, but it may also prevent idle expiration from reflecting human inactivity.\u003C/p\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003ETip: If the purpose of IdleTimeout is to expire inactive user sessions, prefer request-driven renewal and avoid unnecessary protected polling.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/sessions-devices/session-lifecycle\u0022\u003ESession Model \u0026amp; Lifecycle\u003C/a\u003E and \u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022rate-limiting-and-refresh-backoff\u0022\u003E10. Rate Limiting and Refresh Backoff\u003C/h2\u003E\n\u003Cp\u003ERefresh is an authentication operation and remains subject to server-side rate limiting.\u003C/p\u003E\n\u003Cp\u003EWhen the server returns \u003Ccode\u003E429 Too Many Requests\u003C/code\u003E, the client observes the applicable retry delay instead of immediately starting another refresh attempt.\u003C/p\u003E\n\u003Cp\u003EA rate-limited refresh does not independently mean that the user has been logged out.\u003C/p\u003E\n\u003Cp\u003EThe client can preserve the existing authentication context while renewal is temporarily unavailable.\u003C/p\u003E\n\u003Cp\u003EWhether an application request can continue depends on the available credential and its validity.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth also applies automatic refresh backoff when a successful refresh does not rotate an existing JWT.\u003C/p\u003E\n\u003Cp\u003EThis prevents repeated proactive or background attempts from creating a tight refresh loop.\u003C/p\u003E\n\u003Cp\u003EA successful refresh response does not make an expired access token valid again.\u003C/p\u003E\n\u003Cp\u003EApplications should handle unsuccessful request results normally and must not assume that every refresh attempt produces usable replacement credentials.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/rate-limiting\u0022\u003ERate Limiting\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022manual-refresh-and-authentication-recovery\u0022\u003E11. Manual Refresh and Authentication Recovery\u003C/h2\u003E\n\u003Cp\u003EAutomatic refresh does not remove explicit authentication operations.\u003C/p\u003E\n\u003Cp\u003EApplications can still request refresh directly:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.RefreshAsync();\n\nif (result.IsSuccess)\n{\n // Authentication continuation succeeded.\n}\nelse if (result.Outcome == RefreshOutcome.ReauthRequired)\n{\n // Authentication must be established again.\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EManual refresh participates in the shared coordination infrastructure.\u003C/p\u003E\n\u003Cp\u003EIt does not bypass server expiration, rotation, revocation, or rate-limiting policies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-recovery-after-reload\u0022\u003EAuthentication Recovery After Reload\u003C/h3\u003E\n\u003Cp\u003EA client may start without a managed access token, for example after a full browser reload.\u003C/p\u003E\n\u003Cp\u003EWhen a compatible refresh credential remains available, the client can attempt authentication recovery.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.RecoverAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EInitial recovery differs from reactive request replay.\u003C/p\u003E\n\u003Cp\u003EIts purpose is to restore authentication when the client does not currently have usable access material.\u003C/p\u003E\n\u003Cp\u003ERecovery remains subject to server policy and browser credential availability.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/client-sdk/authentication\u0022\u003EAuthentication\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-outcomes\u0022\u003E12. Refresh Outcomes\u003C/h2\u003E\n\u003Cp\u003ERefresh is not synonymous with token rotation.\u003C/p\u003E\n\u003Cp\u003EThe result depends on the authentication mode and the server\u0027s refresh policy.\u003C/p\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\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\u003EAuthentication continuation succeeded without requiring a session update\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETouched\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERecorded session activity was updated\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERotated\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh credentials were rotated\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESuccess\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EGeneric successful refresh\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauthRequired\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication cannot safely continue through the attempted refresh\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EApplications should inspect \u003Ccode\u003ERefreshResult.IsSuccess\u003C/code\u003E rather than requiring a particular successful outcome.\u003C/p\u003E\n\u003Cp\u003EDetailed refresh outcomes may depend on the server diagnostics 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.Diagnostics.EnableRefreshDetails = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA generic success result does not necessarily mean that a session was touched or that a token was rotated.\u003C/p\u003E\n\u003Cp\u003EFor server-side execution details, see \u003Ca href=\u0022/docs/auth-flows/refresh-flow\u0022\u003ERefresh Flow\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-diagnostics\u0022\u003E13. Client Diagnostics\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth exposes refresh diagnostics through \u003Ccode\u003EUAuthClientDiagnostics\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EA Blazor component can inject the diagnostics service:\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@using CodeBeam.UltimateAuth.Client.Diagnostics\n@inject UAuthClientDiagnostics Diagnostics\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe available counters distinguish refresh operations by their initiating trigger.\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\u003EMeaning\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EProactiveRefreshCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EProactive transport attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReactiveRefreshCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReactive transport attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EBackgroundRefreshCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EBackground transport attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EManualRefreshCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EExplicit manual transport attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERecoveryRefreshCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication recovery transport attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutomaticRefreshCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECombined proactive, reactive, and background attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshAttemptCount\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETotal transport attempts\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003ECounters represent transport attempts, not individual callers waiting for a shared refresh execution.\u003C/p\u003E\n\u003Cp\u003ELocally deferred operations do not independently increment transport attempt counters.\u003C/p\u003E\n\u003Cp\u003EOutcome counters are also available:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshTouchedCount\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshRotatedCount\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshNoOpCount\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshSuccessCount\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ERefreshReauthRequiredCount\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-eligibility-vs.background-scheduling\u0022\u003ERefresh Eligibility vs. Background Scheduling\u003C/h3\u003E\n\u003Cp\u003ETwo diagnostic timestamps describe different aspects of refresh timing.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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 eligibleAt = Diagnostics.NextRefreshEligibleAt;\nvar backgroundAt = Diagnostics.NextAutomaticRefreshAt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003ENextRefreshEligibleAt\u003C/code\u003E describes the initialized refresh schedule for the current authentication context.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003ENextAutomaticRefreshAt\u003C/code\u003E describes the next attempt scheduled by the background coordinator.\u003C/p\u003E\n\u003Cp\u003EWith proactive refresh enabled and background refresh disabled, the eligibility timestamp can be available while the background timestamp remains null.\u003C/p\u003E\n\u003Cp\u003EEligibility does not guarantee that a request will be sent at that time.\u003C/p\u003E\n\u003Cp\u003ETemporary backoff, rate limiting, authentication changes, and execution environment constraints can affect actual execution.\u003C/p\u003E\n\u003Cp\u003EReading diagnostics does not initiate a refresh or initialize a new JWT refresh schedule.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022observing-changes-in-blazor\u0022\u003EObserving Changes in Blazor\u003C/h3\u003E\n\u003Cp\u003EComponents can subscribe to diagnostic changes:\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@implements IDisposable\n\n\u0026lt;div\u0026gt;\n Proactive attempts: @Diagnostics.ProactiveRefreshCount\n\u0026lt;/div\u0026gt;\n\n\u0026lt;div\u0026gt;\n Background attempts: @Diagnostics.BackgroundRefreshCount\n\u0026lt;/div\u0026gt;\n\n@code {\n protected override void OnInitialized()\n {\n Diagnostics.Changed \u002B= OnDiagnosticsChanged;\n }\n\n private void OnDiagnosticsChanged()\n {\n _ = InvokeAsync(StateHasChanged);\n }\n\n public void Dispose()\n {\n Diagnostics.Changed -= OnDiagnosticsChanged;\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUse diagnostic notifications to update application displays.\u003C/p\u003E\n\u003Cp\u003EAvoid initiating authentication operations synchronously from diagnostic event handlers.\u003C/p\u003E\n\u003Cp\u003EFor a countdown display, a local UI timer can update the displayed remaining time without sending authentication requests.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-scope\u0022\u003EClient Scope\u003C/h3\u003E\n\u003Cp\u003EDiagnostics describe the current client scope.\u003C/p\u003E\n\u003Cp\u003EThey are not application-wide telemetry, server-wide counters, or persistent per-user audit records.\u003C/p\u003E\n\u003Cp\u003ECounters may accumulate across authentication changes within the same client scope.\u003C/p\u003E\n\u003Cp\u003EApplications that need centralized monitoring should use an appropriate telemetry or logging integration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022troubleshooting\u0022\u003E14. Troubleshooting\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-never-runs-when-the-application-is-idle\u0022\u003ERefresh Never Runs When the Application Is Idle\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E Background refresh is disabled.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E This is expected with proactive refresh. Send a supported authenticated request after refresh eligibility is reached, or enable background refresh if independent renewal is required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-succeeds-but-session-expiration-does-not-change\u0022\u003ERefresh Succeeds but Session Expiration Does Not Change\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E The server may return \u003Ccode\u003ENoOp\u003C/code\u003E, sliding expiration may be disabled, or a maximum lifetime may prevent further extension.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E Review server session policies and detailed refresh outcomes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022too-many-refresh-requests-return-noop\u0022\u003EToo Many Refresh Requests Return NoOp\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E The client refresh interval may be shorter than the server touch interval.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E Align the intervals for opaque session authentication.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-short-lived-jwt-refreshes-earlier-than-expected\u0022\u003EA Short-Lived JWT Refreshes Earlier Than Expected\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E The configured refresh threshold may be greater than the remaining token lifetime.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E UltimateAuth clamps the effective threshold when initializing the schedule. Review the access-token lifetime and refresh threshold together.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-401-response-does-not-trigger-reactive-refresh\u0022\u003EA 401 Response Does Not Trigger Reactive Refresh\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E The response may not represent a supported authentication challenge, the operation may not participate in recovery, or a renewable managed access token may be unavailable.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E Verify the request integration, credential delivery, authentication recovery marker, and reactive configuration.\u003C/p\u003E\n\u003Cp\u003EFor cross-origin browser requests, ensure the required response headers are exposed through CORS.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022background-refresh-is-enabled-but-not-running\u0022\u003EBackground Refresh Is Enabled but Not Running\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E The client coordinator may not be started, authentication may not be established, or the application execution environment may be suspended.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E Review the client integration and coordinator diagnostics.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-expires-despite-automatic-refresh\u0022\u003EAuthentication Expires Despite Automatic Refresh\u003C/h3\u003E\n\u003Cp\u003E\u003Cstrong\u003ECause:\u003C/strong\u003E The session, refresh token, or authentication chain may have expired or been revoked. A required credential may also be unavailable.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESolution:\u003C/strong\u003E Handle reauthentication appropriately. Automatic refresh cannot override server security policy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-reference\u0022\u003E15. Configuration Reference\u003C/h2\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\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EProactive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh before eligible authenticated requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReactive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERecover from supported authentication challenges\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EBackground\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnable independent background refresh\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E5 minutes\u003C/td\u003E\n\u003Ctd\u003EInterval-based refresh eligibility\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshBeforeExpiration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E1 minute\u003C/td\u003E\n\u003Ctd\u003EJWT expiration-based refresh threshold\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe effective interval defaults to five minutes after client option configuration.\u003C/p\u003E\n\u003Cp\u003EThe equivalent configuration can be expressed through appsettings.json:\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;AutoRefresh\u0026quot;: {\n \u0026quot;Proactive\u0026quot;: true,\n \u0026quot;Reactive\u0026quot;: true,\n \u0026quot;Background\u0026quot;: false,\n \u0026quot;Interval\u0026quot;: \u0026quot;00:05:00\u0026quot;,\n \u0026quot;RefreshBeforeExpiration\u0026quot;: \u0026quot;00:01:00\u0026quot;\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022summary\u0022\u003ESummary\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates authentication renewal from application business logic.\u003C/p\u003E\n\u003Cp\u003EProactive refresh provides efficient request-driven renewal.\u003C/p\u003E\n\u003Cp\u003EReactive refresh provides recovery from supported authentication challenges.\u003C/p\u003E\n\u003Cp\u003EBackground refresh provides independent renewal when the application requires it.\u003C/p\u003E\n\u003Cp\u003EAll strategies share refresh coordination and credential lifecycle management within the current client scope.\u003C/p\u003E\n\u003Cp\u003EThe recommended starting point is proactive and reactive refresh with background refresh disabled.\u003C/p\u003E\n\u003Cp\u003EEnable additional behavior according to the application\u0027s continuity requirements rather than implementing independent authentication timers and retry mechanisms.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022related-documentation\u0022\u003ERelated Documentation\u003C/h2\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client-sdk/authentication\u0022\u003EAuthentication\u003C/a\u003E \u2014 Login, logout, manual refresh, and authentication recovery.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client-sdk/resource-api-requests\u0022\u003EResource API Requests\u003C/a\u003E \u2014 Protected application requests and supported recovery behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E \u2014 Client configuration reference.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Server authentication and session policies.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E \u2014 Credential and authentication lifecycle differences.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/auth-flows/refresh-flow\u0022\u003ERefresh Flow\u003C/a\u003E \u2014 Server-side refresh execution.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/sessions-devices/session-lifecycle\u0022\u003ESession Model \u0026amp; Lifecycle\u003C/a\u003E \u2014 Session expiration, touch, and sliding expiration.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/security/refresh-rotation\u0022\u003ERefresh Rotation \u0026amp; Replay Protection\u003C/a\u003E \u2014 Refresh-token concurrency and replay protection.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/security/rate-limiting\u0022\u003ERate Limiting\u003C/a\u003E \u2014 Authentication rate limits and server enforcement.\u003C/li\u003E\n\u003C/ul\u003E\n", "Headings": [ { "Id": "getting-started", @@ -219,6 +219,6 @@ "Level": 0 } ], - "SourceHash": "B00D328ECEA190C7A99DB1A3711DA30FE21F8B1B010BFE308873463CA39CD404", + "SourceHash": "3A21E1EBEA569C33B40530951CFF3F9E3FCF49A5A63848C2908FBA00B13999D9", "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 8b2bc6d4..55060769 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.Session.Lifetime = 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.Session.Lifetime = 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-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", "Headings": [ { "Id": "configuration-versus-extensibility", @@ -379,6 +379,6 @@ "Level": 0 } ], - "SourceHash": "13D63D99FEAFC86BBDD3BFC585DB829F863E7064D91A964216D46C0186C014F3", + "SourceHash": "020D03CDE480446C7230437A5322AA251D412BABE4BBDEE6C6564C6D6CE9FCB5", "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/client-options.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/client-options.json index ceaf2fe6..da85842a 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/client-options.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/configuration/client-options.json @@ -1,7 +1,7 @@ { "Slug": "configuration/client-options", "Title": "Client Options", - "Html": "\n\u003Cp\u003E\u003Ccode\u003EUAuthClientOptions\u003C/code\u003E controls how an UltimateAuth client communicates with the authentication server, executes authentication flows, maintains client-side authentication state, and responds when authentication must be renewed.\u003C/p\u003E\n\u003Cp\u003EThe client configuration is intentionally separate from server security configuration.\u003C/p\u003E\n\u003Cp\u003EThe server determines which authentication operations are permitted, how credentials are validated, and when sessions expire. The client determines how those operations are initiated and how the application responds to their outcomes.\u003C/p\u003E\n\u003Cp\u003EThis guide covers the current client configuration API, platform integration, defaults, practical examples, and important security considerations.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022register-the-ultimateauth-client\u0022\u003E1. Register the UltimateAuth Client\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth provides a platform-independent client SDK and platform-specific adapters.\u003C/p\u003E\n\u003Cp\u003EFor Blazor applications, 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.AddUltimateAuthClientBlazor(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\u003E\u003Ccode\u003EAddUltimateAuthClientBlazor()\u003C/code\u003E registers the underlying client services and the Blazor-specific infrastructure, including browser transport, storage, device identification, and authentication state integration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022core-client-registration\u0022\u003ECore Client Registration\u003C/h3\u003E\n\u003Cp\u003EThe platform-independent 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.AddUltimateAuthClient(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis registers the shared client SDK.\u003C/p\u003E\n\u003Cp\u003EHowever, it does not provide every platform-specific implementation needed to run authentication flows.\u003C/p\u003E\n\u003Cp\u003EApplications should use an appropriate platform adapter rather than relying on the core client registration alone.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022do-not-register-both-client-methods\u0022\u003EDo Not Register Both Client Methods\u003C/h3\u003E\n\u003Cp\u003EWhen 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\u003Ebuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Edo not also call:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Blazor registration already includes the core client services.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-and-client-in-one-application\u0022\u003EServer and Client in One Application\u003C/h3\u003E\n\u003Cp\u003EA Blazor Server application can register both UltimateAuth Server and the Blazor client adapter:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Lifetime = TimeSpan.FromDays(7);\n});\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.ApplicationProfile = UAuthApplicationProfile.BlazorServer;\n options.AutoDetectApplicationProfile = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese registrations configure different components.\u003C/p\u003E\n\u003Cp\u003EThe server controls authentication security and lifecycle rules.\u003C/p\u003E\n\u003Cp\u003EThe client controls the application-side integration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-options-architecture\u0022\u003E2. Client Options Architecture\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthClientOptions\u003C/code\u003E contains the following properties:\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\u003EType\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\u003EApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifies the application environment\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoDetectApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ebool\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnables automatic 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\u003E\u003Ccode\u003Estring?\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDefault navigation destination after authentication\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientEndpointOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication endpoint paths\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientLoginFlowOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin flow configuration\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\u003EUAuthClientPkceLoginFlowOptions\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\u003EAutoRefresh\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientAutoRefreshOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EProactive, reactive, and background refresh coordination\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauth\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientReauthOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReauthentication behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientMultiTenantOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant propagation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EStateEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthStateEventOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication state event handling\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResource\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientResourceOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EProtected Resource API origin and browser credential handling\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese options are configured through the same \u003Ccode\u003EUAuthClientOptions\u003C/code\u003E instance.\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.DefaultReturnUrl = \u0026quot;/dashboard\u0026quot;;\n options.Pkce.Enabled = true;\n options.AutoRefresh.Interval = TimeSpan.FromMinutes(5);\n options.StateEvents.HandlingMode = UAuthStateEventHandlingMode.Patch;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-profiles\u0022\u003E3. Application Profiles\u003C/h2\u003E\n\u003Cp\u003EThe application profile identifies the application environment and influences authentication flow behavior.\u003C/p\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\u003Eoptions.ApplicationProfile\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUltimateAuth defines profiles including:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProfile\u003C/th\u003E\n\u003Cth\u003ETypical application\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\u003EInteractive Blazor Server applications\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EBlazorWasm\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EBrowser-hosted Blazor WebAssembly\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaui\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E.NET MAUI applications\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EWebServer\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETraditional ASP.NET Core web applications\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EApi\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAPI-oriented clients\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthHub\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EUltimateAuth Hub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENotSpecified\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EProfile not explicitly selected\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EDifferent application profiles may result in different authentication modes on the server.\u003C/p\u003E\n\u003Cp\u003EFor example, the default server mode resolver maps Blazor Server to \u003Ccode\u003EPureOpaque\u003C/code\u003E and Blazor WebAssembly to \u003Ccode\u003EHybrid\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe application profile does not itself authorize an authentication mode. The server must support and permit the resolved mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022automatic-application-profile-detection\u0022\u003E4. Automatic Application Profile Detection\u003C/h2\u003E\n\u003Cp\u003EAutomatic profile detection is enabled by default:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoDetectApplicationProfile = true;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen enabled, UltimateAuth detects the application environment if \u003Ccode\u003EApplicationProfile\u003C/code\u003E remains \u003Ccode\u003ENotSpecified\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe current detector checks for:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EUAuthHub registration.\u003C/li\u003E\n\u003Cli\u003E.NET MAUI.\u003C/li\u003E\n\u003Cli\u003EBlazor WebAssembly.\u003C/li\u003E\n\u003Cli\u003EBlazor Server.\u003C/li\u003E\n\u003Cli\u003EA fallback to \u003Ccode\u003EWebServer\u003C/code\u003E.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-configuration\u0022\u003EDefault 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ENo explicit profile is required for ordinary supported environments where detection succeeds.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022manual-configuration\u0022\u003EManual Configuration\u003C/h3\u003E\n\u003Cp\u003EFor applications that need predictable behavior independent of assembly-based detection:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = false;\n options.ApplicationProfile = UAuthApplicationProfile.BlazorWasm;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EManual configuration can be useful for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESpecialized hosting environments.\u003C/li\u003E\n\u003Cli\u003EIntegration tests.\u003C/li\u003E\n\u003Cli\u003EApplications with multiple hosting models.\u003C/li\u003E\n\u003Cli\u003ECases where assembly-based detection is ambiguous.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important-validation-rule\u0022\u003EImportant Validation Rule\u003C/h3\u003E\n\u003Cp\u003EThis configuration is invalid:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = false;\n options.ApplicationProfile = UAuthApplicationProfile.NotSpecified;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen automatic detection is disabled, an explicit application profile must be provided.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022explicit-profiles-take-precedence\u0022\u003EExplicit Profiles Take Precedence\u003C/h3\u003E\n\u003Cp\u003EThe post-configuration detector does not replace a profile that has already been explicitly selected.\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.ApplicationProfile = UAuthApplicationProfile.BlazorServer;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe explicit profile is retained even when automatic detection remains enabled.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022detection-limitations\u0022\u003EDetection Limitations\u003C/h3\u003E\n\u003Cp\u003EThe current detector uses service registration and loaded assemblies to identify the environment.\u003C/p\u003E\n\u003Cp\u003EAssembly-based detection may not be completely reliable in every hosting arrangement.\u003C/p\u003E\n\u003Cp\u003EFor complex Blazor Web App hosting scenarios, explicitly configuring the profile can make authentication behavior easier to reason about.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-configuration\u0022\u003E5. Endpoint Configuration\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Endpoints\u003C/code\u003E defines the endpoint paths used by the client SDK.\u003C/p\u003E\n\u003Cp\u003EThe default 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\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-a-remote-authentication-server\u0022\u003EConfigure a Remote Authentication Server\u003C/h3\u003E\n\u003Cp\u003EFor a client communicating with a separately hosted 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://auth.example.com/auth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor an application using same-origin authentication 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;/auth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe base path must match the deployed authentication server\u0027s routing configuration.\u003C/p\u003E\n\u003Cp\u003EChanging a client endpoint does not create or expose the corresponding server endpoint.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-endpoint-paths\u0022\u003EDefault Endpoint Paths\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\u003EBasePath\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/auth\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/login\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETryLogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/try-login\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogout\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/logout\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefresh\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/refresh\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauth\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/reauth\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EValidate\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/validate\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkceAuthorize\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/pkce/authorize\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkceTryComplete\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/pkce/try-complete\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkceComplete\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/pkce/complete\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHubLoginPath\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/uauthhub/entry\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELoginTransport\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/login/transport\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003EThe \u003Ccode\u003ELoginTransport\u003C/code\u003E endpoint exposes the effective login transport capabilities of the authentication server.\u003C/p\u003E\n\u003Cp\u003EThe client uses this information to determine whether navigation-based login is supported and whether the authentication response requires access-token processing.\u003C/p\u003E\n\u003Cp\u003EThis endpoint does not select an authentication mode or negotiate the server\u0027s authentication configuration.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022customize-individual-paths\u0022\u003ECustomize Individual Paths\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;/auth\u0026quot;;\n options.Endpoints.Login = \u0026quot;/login\u0026quot;;\n options.Endpoints.Logout = \u0026quot;/logout\u0026quot;;\n options.Endpoints.Refresh = \u0026quot;/refresh\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese values should reflect the actual routes registered by UltimateAuth Server.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022required-endpoint-validation\u0022\u003ERequired Endpoint Validation\u003C/h3\u003E\n\u003Cp\u003EThe client options validator requires:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EEndpoints.BasePath\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EEndpoints.Login\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EEndpoints.Logout\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EEndpoints.Refresh\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EEndpoints.Validate\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese properties must not be null, empty, or whitespace-only.\u003C/p\u003E\n\u003Cp\u003EThe current validator does not apply the same required-value checks to every optional endpoint path.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022remote-clients-and-browser-security\u0022\u003ERemote Clients and Browser Security\u003C/h3\u003E\n\u003Cp\u003EWhen using a remote authentication server, also consider:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EHTTPS.\u003C/li\u003E\n\u003Cli\u003ECross-origin request configuration.\u003C/li\u003E\n\u003Cli\u003ECookie \u003Ccode\u003ESameSite\u003C/code\u003E and \u003Ccode\u003ESecure\u003C/code\u003E attributes.\u003C/li\u003E\n\u003Cli\u003EAllowed client origins.\u003C/li\u003E\n\u003Cli\u003EPKCE redirects.\u003C/li\u003E\n\u003Cli\u003EBrowser credential policies.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA correct endpoint URL alone does not guarantee that cross-origin authentication will work.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-configuration\u0022\u003EResource API Configuration\u003C/h3\u003E\n\u003Cp\u003EAuthentication endpoints and application resource endpoints serve different purposes.\u003C/p\u003E\n\u003Cp\u003EAn application may authenticate through UAuthHub while retrieving business data from a separately deployed Resource API.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides \u003Ccode\u003Eoptions.Resource\u003C/code\u003E to configure these requests 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\u003Eusing CodeBeam.UltimateAuth.Client;\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://auth.example.com/auth\u0026quot;;\n\n options.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n options.Resource.Credentials = UAuthResourceCredentialsMode.Auto;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource Client is available through \u003Ccode\u003EIUAuthClient.Resource\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\u003Evar result = await UAuthClient.Resource\n .GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch4 id=\u0022resource-options\u0022\u003EResource Options\u003C/h4\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\u003EResource.BaseAddress\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResource API origin; \u003Ccode\u003Enull\u003C/code\u003E uses the application\u0027s origin\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResource.Credentials\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuto\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EBrowser credential transmission policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch4 id=\u0022base-address-validation\u0022\u003EBase Address Validation\u003C/h4\u003E\n\u003Cp\u003EWhen configured, \u003Ccode\u003EResource.BaseAddress\u003C/code\u003E must be an absolute HTTP or HTTPS origin.\u003C/p\u003E\n\u003Cp\u003EHTTPS is required except for loopback development addresses.\u003C/p\u003E\n\u003Cp\u003EThe address must not contain an additional path, query string, fragment, or embedded credentials.\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\u003Eoptions.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIndividual resource paths are supplied when making requests:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch4 id=\u0022credential-modes\u0022\u003ECredential Modes\u003C/h4\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthResourceCredentialsMode\u003C/code\u003E supports four options:\u003C/p\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\u003EAuto\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAutomatically select the appropriate browser credential policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESameOrigin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EInclude browser credentials only for same-origin requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EInclude\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EInclude browser credentials for the configured Resource API origin\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOmit\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDo not include browser credentials\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EFor example, a separate Resource API that requires cross-origin cookies may 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.Resource.Credentials = UAuthResourceCredentialsMode.Include;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource API must permit the relevant browser origin and support the required CORS and cookie configuration.\u003C/p\u003E\n\u003Cp\u003ECredential configuration does not bypass browser security restrictions or replace server-side authentication and authorization.\u003C/p\u003E\n\u003Ch4 id=\u0022resource-requests-and-authentication-lifecycle\u0022\u003EResource Requests and Authentication Lifecycle\u003C/h4\u003E\n\u003Cp\u003EResource requests use the browser transport in the Blazor integration.\u003C/p\u003E\n\u003Cp\u003EThey support request cancellation, origin validation, and redirect protection.\u003C/p\u003E\n\u003Cp\u003EResource requests return \u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E or \u003Ccode\u003EUAuthResult\u003C/code\u003E, depending on the operation.\u003C/p\u003E\n\u003Cp\u003EThe current Resource Client does not automatically refresh authentication and retry a request after receiving a \u003Ccode\u003E401 Unauthorized\u003C/code\u003E response.\u003C/p\u003E\n\u003Cp\u003EFor a complete explanation, see \u003Ca href=\u0022/docs/client-sdk/resource-api-requests\u0022\u003EResource API Requests\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-flow-options\u0022\u003E6. Login Flow Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Login\u003C/code\u003E controls client-side login behavior.\u003C/p\u003E\n\u003Cp\u003EThe available properties are:\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\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin-specific return destination\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAllowCredentialPost\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAllow direct credential posting\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=\u0022configure-login-navigation\u0022\u003EConfigure Login Navigation\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Login.ReturnUrl = \u0026quot;/dashboard\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe login-specific return URL is used when the login flow does not provide a more specific destination.\u003C/p\u003E\n\u003Cp\u003EIf it is not set, UltimateAuth can fall back to \u003Ccode\u003EDefaultReturnUrl\u003C/code\u003E or the current location according to the flow.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022direct-credential-posting\u0022\u003EDirect Credential Posting\u003C/h3\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\u003Eoptions.Login.AllowCredentialPost = false;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is an important security setting.\u003C/p\u003E\n\u003Cp\u003EDirectly posting user credentials is not appropriate for public browser clients such as Blazor WebAssembly applications.\u003C/p\u003E\n\u003Cp\u003EPublic clients should use the supported PKCE-based login flow.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022trusted-server-hosted-clients\u0022\u003ETrusted Server-Hosted Clients\u003C/h3\u003E\n\u003Cp\u003EA trusted server-hosted application may explicitly enable direct credential posting where its authentication architecture requires it:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.ApplicationProfile = UAuthApplicationProfile.BlazorServer;\n options.Login.AllowCredentialPost = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDo not enable this setting for a public client merely to simplify login implementation.\u003C/p\u003E\n\u003Cp\u003EThe server still determines whether the requested authentication operation is permitted.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022pkce-configuration\u0022\u003E7. PKCE Configuration\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Pkce\u003C/code\u003E controls client-side PKCE login behavior.\u003C/p\u003E\n\u003Cp\u003EPKCE allows a public client to complete an authorization flow without relying on a confidential client secret.\u003C/p\u003E\n\u003Cp\u003EThe current options are:\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\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\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnable client PKCE support\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPost-login return destination\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRedirect\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAutomatically navigate after beginning PKCE\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOnAuthorized\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECallback after the authorization response is issued\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=\u0022basic-configuration\u0022\u003EBasic 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Pkce.Enabled = true;\n options.Pkce.ReturnUrl = \u0026quot;/dashboard\u0026quot;;\n options.Pkce.AutoRedirect = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022disable-automatic-redirect\u0022\u003EDisable Automatic 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Pkce.AutoRedirect = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen \u003Ccode\u003EAutoRedirect\u003C/code\u003E is disabled, \u003Ccode\u003EBeginPkceAsync\u003C/code\u003E does not automatically navigate to the next location.\u003C/p\u003E\n\u003Cp\u003EThe application is responsible for handling navigation.\u003C/p\u003E\n\u003Cp\u003EThis can be useful when integrating UltimateAuth into an existing routing or navigation system.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-callback\u0022\u003EAuthorization Callback\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Pkce.OnAuthorized = response =\u0026gt;\n {\n // Inspect or process the authorization response.\n return Task.CompletedTask;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe callback 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\u003EPkceAuthorizeResponse\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIt runs after the authorization response is issued and before the normal Hub navigation.\u003C/p\u003E\n\u003Cp\u003EUse the callback for application-specific integration, not to bypass PKCE verification.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-and-server-pkce-settings-are-different\u0022\u003EClient and Server PKCE Settings Are Different\u003C/h3\u003E\n\u003Cp\u003EClient 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\u003Eoptions.Pkce.AutoRedirect = true;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EServer 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\u003Eoptions.Pkce.AuthorizationCodeLifetimeSeconds = 120;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client controls how the flow is initiated and navigated.\u003C/p\u003E\n\u003Cp\u003EThe server controls the authorization code\u0027s validity and verification.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022return-url-configuration\u0022\u003E8. Return URL Configuration\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports several return URL configuration points.\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\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDefaultReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EGlobal default for interactive authentication\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin.ReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin-specific default\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce.ReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE-specific default\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=\u0022global-default\u0022\u003EGlobal Default\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.DefaultReturnUrl = \u0026quot;/dashboard\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022flow-specific-defaults\u0022\u003EFlow-Specific Defaults\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.DefaultReturnUrl = \u0026quot;/\u0026quot;;\n options.Login.ReturnUrl = \u0026quot;/account\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;/dashboard\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFlow-specific values allow different authentication paths to use different destinations.\u003C/p\u003E\n\u003Cp\u003EAn explicitly supplied return URL for an individual operation may take precedence over these defaults.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-considerations\u0022\u003ESecurity Considerations\u003C/h3\u003E\n\u003Cp\u003EReturn URLs are navigation destinations and must be treated carefully.\u003C/p\u003E\n\u003Cp\u003EDo not redirect users to arbitrary external URLs without appropriate validation.\u003C/p\u003E\n\u003Cp\u003EOpen redirects can be abused for phishing and other attacks.\u003C/p\u003E\n\u003Cp\u003EPrefer local application routes unless cross-origin navigation is an intentional and validated part of the authentication architecture.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022automatic-refresh\u0022\u003E9. Automatic Refresh\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.AutoRefresh\u003C/code\u003E controls client-side authentication renewal.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides three independently configurable automatic refresh strategies.\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\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EProactive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh before eligible authenticated requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReactive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERecover from supported authentication challenges\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EBackground\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh independently of application requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E5 minutes\u003C/td\u003E\n\u003Ctd\u003EInterval-based refresh eligibility\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshBeforeExpiration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E1 minute\u003C/td\u003E\n\u003Ctd\u003EJWT expiration-based refresh threshold\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoRefresh.Proactive = true;\n options.AutoRefresh.Reactive = true;\n options.AutoRefresh.Background = false;\n\n options.AutoRefresh.Interval = TimeSpan.FromMinutes(5);\n options.AutoRefresh.RefreshBeforeExpiration = TimeSpan.FromMinutes(1);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EProactive and reactive refresh are enabled by default.\u003C/p\u003E\n\u003Cp\u003EBackground refresh is opt-in and requires an active client coordinator.\u003C/p\u003E\n\u003Cp\u003EThe client uses interval-based or JWT expiration-based scheduling according to the available managed credential.\u003C/p\u003E\n\u003Cp\u003EAll refresh strategies share coordination infrastructure within the current client scope.\u003C/p\u003E\n\u003Cp\u003EAutomatic refresh does not override server-side expiration, revocation, device binding, or rate-limiting policies.\u003C/p\u003E\n\u003Cp\u003EFor strategy selection, scheduling behavior, session policy alignment, request replay, and diagnostics, see \u003Ca href=\u0022/docs/client-sdk/automatic-refresh\u0022\u003EAutomatic Refresh\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022reauthentication-options\u0022\u003E10. Reauthentication Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Reauth\u003C/code\u003E controls how the Blazor session coordinator responds when refresh reports that reauthentication is required.\u003C/p\u003E\n\u003Cp\u003EThe available properties are:\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\u003EBehavior\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauthBehavior.Redirect\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERedirectPath\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=\u0022available-behaviors\u0022\u003EAvailable Behaviors\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\u003EReauthBehavior.Redirect\nReauthBehavior.None\nReauthBehavior.RaiseEvent\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022redirect\u0022\u003ERedirect\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Reauth.Behavior = ReauthBehavior.Redirect;\n options.Reauth.RedirectPath = \u0026quot;/login\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen the coordinator receives a \u003Ccode\u003EReauthRequired\u003C/code\u003E refresh outcome, it navigates to the configured redirect path.\u003C/p\u003E\n\u003Cp\u003EIf \u003Ccode\u003ERedirectPath\u003C/code\u003E is null, the coordinator falls back to \u003Ccode\u003EEndpoints.Login\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe current Blazor coordinator uses forced navigation for this redirect.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022raise-an-event\u0022\u003ERaise an 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis allows an application to handle reauthentication through the coordinator\u0027s \u003Ccode\u003EReauthRequired\u003C/code\u003E event.\u003C/p\u003E\n\u003Cp\u003EFor example, an application may display a reauthentication dialog rather than immediately navigating.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022no-automatic-action\u0022\u003ENo Automatic Action\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Reauth.Behavior = ReauthBehavior.None;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWith \u003Ccode\u003ENone\u003C/code\u003E, the coordinator does not automatically redirect or raise its reauthentication event.\u003C/p\u003E\n\u003Cp\u003EThe application must still handle unauthenticated states appropriately.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important\u0022\u003EImportant\u003C/h3\u003E\n\u003Cp\u003EReauthentication behavior does not make an expired or revoked session valid.\u003C/p\u003E\n\u003Cp\u003EIt only controls how the client responds when authentication must be reestablished.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022multi-tenant-client-configuration\u0022\u003E11. Multi-Tenant Client Configuration\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.MultiTenant\u003C/code\u003E controls tenant propagation from the client to the authentication server.\u003C/p\u003E\n\u003Cp\u003EThe client does not independently authorize or resolve tenant ownership.\u003C/p\u003E\n\u003Cp\u003EIt carries tenant context using the configured transport.\u003C/p\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\u003EEnabled\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnable tenant propagation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant identifier to propagate\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETransport\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ETenantTransport.None\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant transport mechanism\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=\u0022available-transports\u0022\u003EAvailable Transports\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\u003ETenantTransport.None\nTenantTransport.Header\nTenantTransport.Route\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022header-based-tenant-propagation\u0022\u003EHeader-Based Tenant Propagation\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.MultiTenant.Enabled = true;\n options.MultiTenant.Tenant = \u0026quot;tenant-a\u0026quot;;\n options.MultiTenant.Transport = TenantTransport.Header;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server must be configured to resolve tenant information from the corresponding transport.\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.Enabled = true;\n options.MultiTenant.EnableHeader = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022route-based-tenant-propagation\u0022\u003ERoute-Based Tenant Propagation\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.MultiTenant.Enabled = true;\n options.MultiTenant.Tenant = \u0026quot;tenant-a\u0026quot;;\n options.MultiTenant.Transport = TenantTransport.Route;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server must expose routes compatible with tenant-based routing.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-boundary\u0022\u003ESecurity Boundary\u003C/h3\u003E\n\u003Cp\u003EA client-provided tenant identifier is not proof of tenant membership.\u003C/p\u003E\n\u003Cp\u003EThe server must validate the resolved tenant and enforce tenant isolation.\u003C/p\u003E\n\u003Cp\u003ENever rely on client-side tenant selection as an authorization boundary.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-state-events\u0022\u003E12. Authentication State Events\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.StateEvents\u003C/code\u003E controls how the client processes authentication-related state events.\u003C/p\u003E\n\u003Cp\u003EThe available 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.StateEvents.HandlingMode\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIts 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\u003EUAuthStateEventHandlingMode.Patch\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\u003EBehavior\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPatch\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EApply a local authentication state update\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EValidate\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERevalidate authentication state after the event\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENone\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDo not update authentication state in response to the event\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=\u0022patch\u0022\u003EPatch\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.StateEvents.HandlingMode = UAuthStateEventHandlingMode.Patch;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EPatch\u003C/code\u003E is the default.\u003C/p\u003E\n\u003Cp\u003EIt allows the client to update local state without performing a full authentication validation for every event.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validate\u0022\u003EValidate\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.StateEvents.HandlingMode = UAuthStateEventHandlingMode.Validate;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EValidate\u003C/code\u003E causes the client to revalidate authentication state in response to events.\u003C/p\u003E\n\u003Cp\u003EThis may introduce additional requests but can be appropriate when the application prefers server-confirmed state updates.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022none\u0022\u003ENone\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.StateEvents.HandlingMode = UAuthStateEventHandlingMode.None;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003ENone\u003C/code\u003E disables automatic authentication state updates in response to these events.\u003C/p\u003E\n\u003Cp\u003EApplications using this mode must provide any required state synchronization through other mechanisms.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022local-events-are-not-distributed-notifications\u0022\u003ELocal Events Are Not Distributed Notifications\u003C/h3\u003E\n\u003Cp\u003EClient state events do not automatically notify every browser, device, or application instance.\u003C/p\u003E\n\u003Cp\u003EFor example, an administrator changing a user\u0027s role does not automatically push an event to that user\u0027s open browser.\u003C/p\u003E\n\u003Cp\u003EDistributed synchronization requires additional application infrastructure.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-from-appsettings.json\u0022\u003E13. Configuration from appsettings.json\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth Client 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: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;Endpoints\u0026quot;: {\n \u0026quot;BasePath\u0026quot;: \u0026quot;https://auth.example.com/auth\u0026quot;\n },\n \u0026quot;Pkce\u0026quot;: {\n \u0026quot;Enabled\u0026quot;: true,\n \u0026quot;ReturnUrl\u0026quot;: \u0026quot;/dashboard\u0026quot;,\n \u0026quot;AutoRedirect\u0026quot;: true\n },\n \u0026quot;AutoRefresh\u0026quot;: {\n \u0026quot;Background\u0026quot;: true,\n \u0026quot;Interval\u0026quot;: \u0026quot;00:05:00\u0026quot;\n },\n \u0026quot;Reauth\u0026quot;: {\n \u0026quot;Behavior\u0026quot;: \u0026quot;Redirect\u0026quot;,\n \u0026quot;RedirectPath\u0026quot;: \u0026quot;/login\u0026quot;\n },\n \u0026quot;StateEvents\u0026quot;: {\n \u0026quot;HandlingMode\u0026quot;: \u0026quot;Patch\u0026quot;\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe example uses the standard ASP.NET Core configuration binding conventions.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-precedence\u0022\u003EConfiguration Precedence\u003C/h3\u003E\n\u003Cp\u003EThe registration pipeline applies:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EOption type defaults.\u003C/li\u003E\n\u003Cli\u003EThe configuration delegate.\u003C/li\u003E\n\u003Cli\u003EValues from \u003Ccode\u003EUltimateAuth:Client\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EPost-configuration processing.\u003C/li\u003E\n\u003Cli\u003ERegistered options validation when the options are resolved.\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.DefaultReturnUrl = \u0026quot;/\u0026quot;;\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;Client\u0026quot;: {\n \u0026quot;DefaultReturnUrl\u0026quot;: \u0026quot;/dashboard\u0026quot;\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe configured return URL becomes \u003Ccode\u003E/dashboard\u003C/code\u003E.\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 double underscores for hierarchical configuration keys.\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__Client__Endpoints__BasePath=https://auth.example.com/auth\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:Client:Endpoints:BasePath\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUse environment-specific configuration for deployment-dependent values such as authentication server addresses and application return paths.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-options-validation\u0022\u003E14. Client Options Validation\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth registers validators for:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EUAuthClientOptions\nUAuthClientEndpointOptions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-profile-validation\u0022\u003EApplication Profile Validation\u003C/h3\u003E\n\u003Cp\u003EThe validator rejects a configuration where:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoDetectApplicationProfile = false;\noptions.ApplicationProfile = UAuthApplicationProfile.NotSpecified;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAn explicit profile is required when detection is disabled.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-validation\u0022\u003EEndpoint Validation\u003C/h3\u003E\n\u003Cp\u003EThe following endpoint properties must be present:\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\u003EEndpoints.BasePath\nEndpoints.Login\nEndpoints.Logout\nEndpoints.Refresh\nEndpoints.Validate\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example, this configuration is invalid:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-timing\u0022\u003EValidation Timing\u003C/h3\u003E\n\u003Cp\u003EUnlike the server registration, the current client registration does not explicitly call \u003Ccode\u003EValidateOnStart()\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EValidation therefore occurs through the normal options resolution lifecycle.\u003C/p\u003E\n\u003Cp\u003EApplications that require early validation can arrange for the configured options to be resolved during startup.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-scope\u0022\u003EValidation Scope\u003C/h3\u003E\n\u003Cp\u003EThe current validators check essential application profile and endpoint requirements.\u003C/p\u003E\n\u003Cp\u003EThey do not automatically validate every possible combination of client flow, server deployment, cookie behavior, and authentication mode.\u003C/p\u003E\n\u003Cp\u003EApplications should test their actual authentication flows against the deployed server configuration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022complete-blazor-webassembly-example\u0022\u003E15. Complete Blazor WebAssembly Example\u003C/h2\u003E\n\u003Cp\u003EThe following example configures a Blazor WebAssembly client using a remote authentication 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n // Application profile\n options.AutoDetectApplicationProfile = false;\n options.ApplicationProfile = UAuthApplicationProfile.BlazorWasm;\n\n // Authentication server\n options.Endpoints.BasePath = \u0026quot;https://auth.example.com/auth\u0026quot;;\n\n // Navigation\n options.DefaultReturnUrl = \u0026quot;/\u0026quot;;\n options.Login.ReturnUrl = \u0026quot;/dashboard\u0026quot;;\n\n // Public client security\n options.Login.AllowCredentialPost = false;\n\n // PKCE\n options.Pkce.Enabled = true;\n options.Pkce.ReturnUrl = \u0026quot;/dashboard\u0026quot;;\n options.Pkce.AutoRedirect = true;\n\n // Background refresh\n options.AutoRefresh.Background = false;\n options.AutoRefresh.Proactive = true;\n\n // Reauthentication\n options.Reauth.Behavior = ReauthBehavior.Redirect;\n options.Reauth.RedirectPath = \u0026quot;/login\u0026quot;;\n\n // State updates\n options.StateEvents.HandlingMode = UAuthStateEventHandlingMode.Patch;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis example emphasizes PKCE-based authentication and avoids direct credential posting from a public browser client.\u003C/p\u003E\n\u003Cp\u003EThe remote server must be configured with compatible endpoints, origins, authentication modes, and credential delivery policies.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022complete-blazor-server-example\u0022\u003E16. Complete Blazor Server Example\u003C/h2\u003E\n\u003Cp\u003EThe following example configures a Blazor Server 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n // Application profile\n options.AutoDetectApplicationProfile = false;\n options.ApplicationProfile = UAuthApplicationProfile.BlazorServer;\n\n // Same-origin authentication endpoints\n options.Endpoints.BasePath = \u0026quot;/auth\u0026quot;;\n\n // Navigation\n options.DefaultReturnUrl = \u0026quot;/\u0026quot;;\n options.Login.ReturnUrl = \u0026quot;/dashboard\u0026quot;;\n\n // Background refresh\n options.AutoRefresh.Background = false;\n options.AutoRefresh.Proactive = true;\n options.AutoRefresh.Interval = TimeSpan.FromMinutes(5);\n\n // Reauthentication\n options.Reauth.Behavior = ReauthBehavior.Redirect;\n options.Reauth.RedirectPath = \u0026quot;/login\u0026quot;;\n\n // Authentication state\n options.StateEvents.HandlingMode = UAuthStateEventHandlingMode.Patch;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EBlazor Server applications can use session-oriented authentication and the corresponding server-side security policies.\u003C/p\u003E\n\u003Cp\u003EThe application must still initialize the client and session coordinator through its supported lifecycle.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-and-client-configuration-together\u0022\u003E17. Server and Client Configuration Together\u003C/h2\u003E\n\u003Cp\u003EAn application that hosts both UltimateAuth Server and the Blazor client adapter can configure them 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\u003E// Server: authentication and security policies\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AllowedModes =\n [\n UAuthMode.PureOpaque,\n UAuthMode.Hybrid\n ];\n\n options.Session.Lifetime = TimeSpan.FromDays(7);\n options.Login.MaxFailedAttempts = 5;\n});\n\n// Client: platform integration and flow behavior\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.ApplicationProfile = UAuthApplicationProfile.BlazorServer;\n options.AutoDetectApplicationProfile = false;\n options.Endpoints.BasePath = \u0026quot;/auth\u0026quot;;\n options.AutoRefresh.Proactive = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe two configuration objects have different responsibilities.\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\u003EConfigure on\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\u003EServer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess token lifetime\u003C/td\u003E\n\u003Ctd\u003EServer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh token replay policy\u003C/td\u003E\n\u003Ctd\u003EServer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECredential recovery rules\u003C/td\u003E\n\u003Ctd\u003EServer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAllowed authentication modes\u003C/td\u003E\n\u003Ctd\u003EServer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EApplication profile\u003C/td\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPKCE navigation\u003C/td\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAutomatic proactive refresh\u003C/td\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EReauthentication navigation\u003C/td\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAuthentication state event handling\u003C/td\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ETenant validation\u003C/td\u003E\n\u003Ctd\u003EServer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ETenant propagation\u003C/td\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe client cannot override server-side security decisions.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-configuration-mistakes\u0022\u003E18. Common Configuration Mistakes\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022registering-the-core-client-and-blazor-adapter-separately\u0022\u003ERegistering the Core Client and Blazor Adapter Separately\u003C/h3\u003E\n\u003Cp\u003EUse \u003Ccode\u003EAddUltimateAuthClientBlazor()\u003C/code\u003E for Blazor applications.\u003C/p\u003E\n\u003Cp\u003EIt already registers the underlying client SDK.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022disabling-profile-detection-without-selecting-a-profile\u0022\u003EDisabling Profile Detection Without Selecting a Profile\u003C/h3\u003E\n\u003Cp\u003EWhen \u003Ccode\u003EAutoDetectApplicationProfile\u003C/code\u003E is false, set \u003Ccode\u003EApplicationProfile\u003C/code\u003E explicitly.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022relying-on-automatic-detection-in-an-ambiguous-hosting-environment\u0022\u003ERelying on Automatic Detection in an Ambiguous Hosting Environment\u003C/h3\u003E\n\u003Cp\u003EFor complex hosting arrangements, consider specifying the application profile explicitly.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022enabling-direct-credential-posting-in-a-public-client\u0022\u003EEnabling Direct Credential Posting in a Public Client\u003C/h3\u003E\n\u003Cp\u003EDo not enable \u003Ccode\u003EAllowCredentialPost\u003C/code\u003E for browser-hosted public clients.\u003C/p\u003E\n\u003Cp\u003EUse PKCE.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-client-auto-refresh-extends-server-lifetimes\u0022\u003EAssuming Client Auto-Refresh Extends Server Lifetimes\u003C/h3\u003E\n\u003Cp\u003EAutomatic refresh only initiates refresh operations.\u003C/p\u003E\n\u003Cp\u003EThe server controls whether refresh is permitted.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-auto-refresh-starts-automatically\u0022\u003EAssuming Auto-Refresh Starts Automatically\u003C/h3\u003E\n\u003Cp\u003EThe Blazor session coordinator must be started through the supported application lifecycle.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuring-only-the-client-endpoint\u0022\u003EConfiguring Only the Client Endpoint\u003C/h3\u003E\n\u003Cp\u003EThe server must expose compatible routes and allow the intended cross-origin interaction.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022treating-tenant-propagation-as-authorization\u0022\u003ETreating Tenant Propagation as Authorization\u003C/h3\u003E\n\u003Cp\u003EA tenant identifier supplied by the client does not grant access to that tenant.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022using-state-events-as-distributed-notifications\u0022\u003EUsing State Events as Distributed Notifications\u003C/h3\u003E\n\u003Cp\u003EClient events update local client state; they do not automatically synchronize all connected devices.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-every-client-setting-is-validated-at-startup\u0022\u003EAssuming Every Client Setting Is Validated at Startup\u003C/h3\u003E\n\u003Cp\u003EThe current client registration validates options when they are resolved, rather than explicitly requiring startup validation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-options-quick-reference\u0022\u003E19. Client Options Quick Reference\u003C/h2\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\u003EApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ENotSpecified\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EApplication environment\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoDetectApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAutomatic 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\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EGlobal return URL\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints.BasePath\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/auth\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication endpoint base\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin.ReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin return URL\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin.AllowCredentialPost\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDirect credential posting\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce.Enabled\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE flow support\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce.ReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE return URL\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce.AutoRedirect\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAutomatic PKCE navigation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce.OnAuthorized\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE authorization callback\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh.Proactive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh before eligible authenticated requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh.Reactive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERecover from supported authentication challenges\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh.Background\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIndependent background refresh coordination\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh.Interval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E5 minutes\u003C/td\u003E\n\u003Ctd\u003EInterval-based refresh eligibility\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh.RefreshBeforeExpiration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E1 minute\u003C/td\u003E\n\u003Ctd\u003EJWT expiration-based refresh threshold\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauth.Behavior\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ERedirect\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReauthentication handling\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauth.RedirectPath\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReauthentication redirect\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant.Enabled\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant propagation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant.Tenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant identifier\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant.Transport\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ENone\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant transport\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EStateEvents.HandlingMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EPatch\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EState event handling\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResource.BaseAddress\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResource API origin; defaults to application origin\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResource.Credentials\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuto\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EBrowser credential handling for resource requests\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/overview\u0022\u003EConfiguration Overview\u003C/a\u003E \u2014 Understand the configuration architecture and source precedence.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Configure authentication security, sessions, tokens, and endpoints.\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-sdk/authentication\u0022\u003EAuthentication\u003C/a\u003E \u2014 Implement login, PKCE, refresh, and logout flows.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client-sdk/automatic-refresh\u0022\u003EAutomatic Refresh\u003C/a\u003E \u2014 Configure efficient authentication renewal, automatic recovery, and refresh coordination.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client-sdk/session-management\u0022\u003ESession Management\u003C/a\u003E \u2014 Manage authenticated sessions and revocation.\u003C/li\u003E\n\u003C/ul\u003E\n", + "Html": "\n\u003Cp\u003E\u003Ccode\u003EUAuthClientOptions\u003C/code\u003E controls how an UltimateAuth client communicates with the authentication server, executes authentication flows, maintains client-side authentication state, and responds when authentication must be renewed.\u003C/p\u003E\n\u003Cp\u003EThe client configuration is intentionally separate from server security configuration.\u003C/p\u003E\n\u003Cp\u003EThe server determines which authentication operations are permitted, how credentials are validated, and when sessions expire. The client determines how those operations are initiated and how the application responds to their outcomes.\u003C/p\u003E\n\u003Cp\u003EThis guide covers the current client configuration API, platform integration, defaults, practical examples, and important security considerations.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022register-the-ultimateauth-client\u0022\u003E1. Register the UltimateAuth Client\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth provides a platform-independent client SDK and platform-specific adapters.\u003C/p\u003E\n\u003Cp\u003EFor Blazor applications, 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.AddUltimateAuthClientBlazor(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\u003E\u003Ccode\u003EAddUltimateAuthClientBlazor()\u003C/code\u003E registers the underlying client services and the Blazor-specific infrastructure, including browser transport, storage, device identification, and authentication state integration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022core-client-registration\u0022\u003ECore Client Registration\u003C/h3\u003E\n\u003Cp\u003EThe platform-independent 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.AddUltimateAuthClient(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis registers the shared client SDK.\u003C/p\u003E\n\u003Cp\u003EHowever, it does not provide every platform-specific implementation needed to run authentication flows.\u003C/p\u003E\n\u003Cp\u003EApplications should use an appropriate platform adapter rather than relying on the core client registration alone.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022do-not-register-both-client-methods\u0022\u003EDo Not Register Both Client Methods\u003C/h3\u003E\n\u003Cp\u003EWhen 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\u003Ebuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003Edo not also call:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Blazor registration already includes the core client services.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-and-client-in-one-application\u0022\u003EServer and Client in One Application\u003C/h3\u003E\n\u003Cp\u003EA Blazor Server application can register both UltimateAuth Server and the Blazor client adapter:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.ApplicationProfile = UAuthApplicationProfile.BlazorServer;\n options.AutoDetectApplicationProfile = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese registrations configure different components.\u003C/p\u003E\n\u003Cp\u003EThe server controls authentication security and lifecycle rules.\u003C/p\u003E\n\u003Cp\u003EThe client controls the application-side integration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-options-architecture\u0022\u003E2. Client Options Architecture\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthClientOptions\u003C/code\u003E contains the following properties:\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\u003EType\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\u003EApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIdentifies the application environment\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoDetectApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ebool\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnables automatic 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\u003E\u003Ccode\u003Estring?\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDefault navigation destination after authentication\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientEndpointOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication endpoint paths\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientLoginFlowOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin flow configuration\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\u003EUAuthClientPkceLoginFlowOptions\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\u003EAutoRefresh\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientAutoRefreshOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EProactive, reactive, and background refresh coordination\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauth\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientReauthOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReauthentication behavior\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientMultiTenantOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant propagation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EStateEvents\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthStateEventOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication state event handling\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResource\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthClientResourceOptions\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EProtected Resource API origin and browser credential handling\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese options are configured through the same \u003Ccode\u003EUAuthClientOptions\u003C/code\u003E instance.\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.DefaultReturnUrl = \u0026quot;/dashboard\u0026quot;;\n options.Pkce.Enabled = true;\n options.AutoRefresh.Interval = TimeSpan.FromMinutes(5);\n options.StateEvents.HandlingMode = UAuthStateEventHandlingMode.Patch;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-profiles\u0022\u003E3. Application Profiles\u003C/h2\u003E\n\u003Cp\u003EThe application profile identifies the application environment and influences authentication flow behavior.\u003C/p\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\u003Eoptions.ApplicationProfile\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUltimateAuth defines profiles including:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EProfile\u003C/th\u003E\n\u003Cth\u003ETypical application\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\u003EInteractive Blazor Server applications\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EBlazorWasm\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EBrowser-hosted Blazor WebAssembly\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMaui\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E.NET MAUI applications\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EWebServer\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETraditional ASP.NET Core web applications\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EApi\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAPI-oriented clients\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EUAuthHub\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EUltimateAuth Hub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENotSpecified\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EProfile not explicitly selected\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EDifferent application profiles may result in different authentication modes on the server.\u003C/p\u003E\n\u003Cp\u003EFor example, the default server mode resolver maps Blazor Server to \u003Ccode\u003EPureOpaque\u003C/code\u003E and Blazor WebAssembly to \u003Ccode\u003EHybrid\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe application profile does not itself authorize an authentication mode. The server must support and permit the resolved mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022automatic-application-profile-detection\u0022\u003E4. Automatic Application Profile Detection\u003C/h2\u003E\n\u003Cp\u003EAutomatic profile detection is enabled by default:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoDetectApplicationProfile = true;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen enabled, UltimateAuth detects the application environment if \u003Ccode\u003EApplicationProfile\u003C/code\u003E remains \u003Ccode\u003ENotSpecified\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe current detector checks for:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EUAuthHub registration.\u003C/li\u003E\n\u003Cli\u003E.NET MAUI.\u003C/li\u003E\n\u003Cli\u003EBlazor WebAssembly.\u003C/li\u003E\n\u003Cli\u003EBlazor Server.\u003C/li\u003E\n\u003Cli\u003EA fallback to \u003Ccode\u003EWebServer\u003C/code\u003E.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-configuration\u0022\u003EDefault 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ENo explicit profile is required for ordinary supported environments where detection succeeds.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022manual-configuration\u0022\u003EManual Configuration\u003C/h3\u003E\n\u003Cp\u003EFor applications that need predictable behavior independent of assembly-based detection:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = false;\n options.ApplicationProfile = UAuthApplicationProfile.BlazorWasm;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EManual configuration can be useful for:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESpecialized hosting environments.\u003C/li\u003E\n\u003Cli\u003EIntegration tests.\u003C/li\u003E\n\u003Cli\u003EApplications with multiple hosting models.\u003C/li\u003E\n\u003Cli\u003ECases where assembly-based detection is ambiguous.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important-validation-rule\u0022\u003EImportant Validation Rule\u003C/h3\u003E\n\u003Cp\u003EThis configuration is invalid:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = false;\n options.ApplicationProfile = UAuthApplicationProfile.NotSpecified;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen automatic detection is disabled, an explicit application profile must be provided.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022explicit-profiles-take-precedence\u0022\u003EExplicit Profiles Take Precedence\u003C/h3\u003E\n\u003Cp\u003EThe post-configuration detector does not replace a profile that has already been explicitly selected.\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.ApplicationProfile = UAuthApplicationProfile.BlazorServer;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe explicit profile is retained even when automatic detection remains enabled.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022detection-limitations\u0022\u003EDetection Limitations\u003C/h3\u003E\n\u003Cp\u003EThe current detector uses service registration and loaded assemblies to identify the environment.\u003C/p\u003E\n\u003Cp\u003EAssembly-based detection may not be completely reliable in every hosting arrangement.\u003C/p\u003E\n\u003Cp\u003EFor complex Blazor Web App hosting scenarios, explicitly configuring the profile can make authentication behavior easier to reason about.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-configuration\u0022\u003E5. Endpoint Configuration\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Endpoints\u003C/code\u003E defines the endpoint paths used by the client SDK.\u003C/p\u003E\n\u003Cp\u003EThe default 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\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-a-remote-authentication-server\u0022\u003EConfigure a Remote Authentication Server\u003C/h3\u003E\n\u003Cp\u003EFor a client communicating with a separately hosted 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://auth.example.com/auth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor an application using same-origin authentication 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;/auth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe base path must match the deployed authentication server\u0027s routing configuration.\u003C/p\u003E\n\u003Cp\u003EChanging a client endpoint does not create or expose the corresponding server endpoint.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022default-endpoint-paths\u0022\u003EDefault Endpoint Paths\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\u003EBasePath\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/auth\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/login\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETryLogin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/try-login\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogout\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/logout\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefresh\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/refresh\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauth\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/reauth\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EValidate\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/validate\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkceAuthorize\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/pkce/authorize\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkceTryComplete\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/pkce/try-complete\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkceComplete\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/pkce/complete\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EHubLoginPath\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/uauthhub/entry\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELoginTransport\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/login/transport\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003EThe \u003Ccode\u003ELoginTransport\u003C/code\u003E endpoint exposes the effective login transport capabilities of the authentication server.\u003C/p\u003E\n\u003Cp\u003EThe client uses this information to determine whether navigation-based login is supported and whether the authentication response requires access-token processing.\u003C/p\u003E\n\u003Cp\u003EThis endpoint does not select an authentication mode or negotiate the server\u0027s authentication configuration.\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022customize-individual-paths\u0022\u003ECustomize Individual Paths\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;/auth\u0026quot;;\n options.Endpoints.Login = \u0026quot;/login\u0026quot;;\n options.Endpoints.Logout = \u0026quot;/logout\u0026quot;;\n options.Endpoints.Refresh = \u0026quot;/refresh\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese values should reflect the actual routes registered by UltimateAuth Server.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022required-endpoint-validation\u0022\u003ERequired Endpoint Validation\u003C/h3\u003E\n\u003Cp\u003EThe client options validator requires:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EEndpoints.BasePath\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EEndpoints.Login\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EEndpoints.Logout\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EEndpoints.Refresh\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EEndpoints.Validate\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese properties must not be null, empty, or whitespace-only.\u003C/p\u003E\n\u003Cp\u003EThe current validator does not apply the same required-value checks to every optional endpoint path.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022remote-clients-and-browser-security\u0022\u003ERemote Clients and Browser Security\u003C/h3\u003E\n\u003Cp\u003EWhen using a remote authentication server, also consider:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EHTTPS.\u003C/li\u003E\n\u003Cli\u003ECross-origin request configuration.\u003C/li\u003E\n\u003Cli\u003ECookie \u003Ccode\u003ESameSite\u003C/code\u003E and \u003Ccode\u003ESecure\u003C/code\u003E attributes.\u003C/li\u003E\n\u003Cli\u003EAllowed client origins.\u003C/li\u003E\n\u003Cli\u003EPKCE redirects.\u003C/li\u003E\n\u003Cli\u003EBrowser credential policies.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA correct endpoint URL alone does not guarantee that cross-origin authentication will work.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-configuration\u0022\u003EResource API Configuration\u003C/h3\u003E\n\u003Cp\u003EAuthentication endpoints and application resource endpoints serve different purposes.\u003C/p\u003E\n\u003Cp\u003EAn application may authenticate through UAuthHub while retrieving business data from a separately deployed Resource API.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides \u003Ccode\u003Eoptions.Resource\u003C/code\u003E to configure these requests 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\u003Eusing CodeBeam.UltimateAuth.Client;\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://auth.example.com/auth\u0026quot;;\n\n options.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n options.Resource.Credentials = UAuthResourceCredentialsMode.Auto;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource Client is available through \u003Ccode\u003EIUAuthClient.Resource\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\u003Evar result = await UAuthClient.Resource\n .GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch4 id=\u0022resource-options\u0022\u003EResource Options\u003C/h4\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\u003EResource.BaseAddress\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResource API origin; \u003Ccode\u003Enull\u003C/code\u003E uses the application\u0027s origin\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResource.Credentials\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuto\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EBrowser credential transmission policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Ch4 id=\u0022base-address-validation\u0022\u003EBase Address Validation\u003C/h4\u003E\n\u003Cp\u003EWhen configured, \u003Ccode\u003EResource.BaseAddress\u003C/code\u003E must be an absolute HTTP or HTTPS origin.\u003C/p\u003E\n\u003Cp\u003EHTTPS is required except for loopback development addresses.\u003C/p\u003E\n\u003Cp\u003EThe address must not contain an additional path, query string, fragment, or embedded credentials.\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\u003Eoptions.Resource.BaseAddress = \u0026quot;https://api.example.com\u0026quot;;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIndividual resource paths are supplied when making requests:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch4 id=\u0022credential-modes\u0022\u003ECredential Modes\u003C/h4\u003E\n\u003Cp\u003E\u003Ccode\u003EUAuthResourceCredentialsMode\u003C/code\u003E supports four options:\u003C/p\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\u003EAuto\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAutomatically select the appropriate browser credential policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ESameOrigin\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EInclude browser credentials only for same-origin requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EInclude\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EInclude browser credentials for the configured Resource API origin\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOmit\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDo not include browser credentials\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EFor example, a separate Resource API that requires cross-origin cookies may 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.Resource.Credentials = UAuthResourceCredentialsMode.Include;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource API must permit the relevant browser origin and support the required CORS and cookie configuration.\u003C/p\u003E\n\u003Cp\u003ECredential configuration does not bypass browser security restrictions or replace server-side authentication and authorization.\u003C/p\u003E\n\u003Ch4 id=\u0022resource-requests-and-authentication-lifecycle\u0022\u003EResource Requests and Authentication Lifecycle\u003C/h4\u003E\n\u003Cp\u003EResource requests use the browser transport in the Blazor integration.\u003C/p\u003E\n\u003Cp\u003EThey support request cancellation, origin validation, and redirect protection.\u003C/p\u003E\n\u003Cp\u003EResource requests return \u003Ccode\u003EUAuthResult\u0026lt;T\u0026gt;\u003C/code\u003E or \u003Ccode\u003EUAuthResult\u003C/code\u003E, depending on the operation.\u003C/p\u003E\n\u003Cp\u003EThe current Resource Client does not automatically refresh authentication and retry a request after receiving a \u003Ccode\u003E401 Unauthorized\u003C/code\u003E response.\u003C/p\u003E\n\u003Cp\u003EFor a complete explanation, see \u003Ca href=\u0022/docs/client-sdk/resource-api-requests\u0022\u003EResource API Requests\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022login-flow-options\u0022\u003E6. Login Flow Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Login\u003C/code\u003E controls client-side login behavior.\u003C/p\u003E\n\u003Cp\u003EThe available properties are:\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\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin-specific return destination\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAllowCredentialPost\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAllow direct credential posting\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=\u0022configure-login-navigation\u0022\u003EConfigure Login Navigation\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Login.ReturnUrl = \u0026quot;/dashboard\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe login-specific return URL is used when the login flow does not provide a more specific destination.\u003C/p\u003E\n\u003Cp\u003EIf it is not set, UltimateAuth can fall back to \u003Ccode\u003EDefaultReturnUrl\u003C/code\u003E or the current location according to the flow.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022direct-credential-posting\u0022\u003EDirect Credential Posting\u003C/h3\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\u003Eoptions.Login.AllowCredentialPost = false;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis is an important security setting.\u003C/p\u003E\n\u003Cp\u003EDirectly posting user credentials is not appropriate for public browser clients such as Blazor WebAssembly applications.\u003C/p\u003E\n\u003Cp\u003EPublic clients should use the supported PKCE-based login flow.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022trusted-server-hosted-clients\u0022\u003ETrusted Server-Hosted Clients\u003C/h3\u003E\n\u003Cp\u003EA trusted server-hosted application may explicitly enable direct credential posting where its authentication architecture requires it:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.ApplicationProfile = UAuthApplicationProfile.BlazorServer;\n options.Login.AllowCredentialPost = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDo not enable this setting for a public client merely to simplify login implementation.\u003C/p\u003E\n\u003Cp\u003EThe server still determines whether the requested authentication operation is permitted.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022pkce-configuration\u0022\u003E7. PKCE Configuration\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Pkce\u003C/code\u003E controls client-side PKCE login behavior.\u003C/p\u003E\n\u003Cp\u003EPKCE allows a public client to complete an authorization flow without relying on a confidential client secret.\u003C/p\u003E\n\u003Cp\u003EThe current options are:\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\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\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnable client PKCE support\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPost-login return destination\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRedirect\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAutomatically navigate after beginning PKCE\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EOnAuthorized\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ECallback after the authorization response is issued\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=\u0022basic-configuration\u0022\u003EBasic 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Pkce.Enabled = true;\n options.Pkce.ReturnUrl = \u0026quot;/dashboard\u0026quot;;\n options.Pkce.AutoRedirect = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022disable-automatic-redirect\u0022\u003EDisable Automatic 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Pkce.AutoRedirect = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen \u003Ccode\u003EAutoRedirect\u003C/code\u003E is disabled, \u003Ccode\u003EBeginPkceAsync\u003C/code\u003E does not automatically navigate to the next location.\u003C/p\u003E\n\u003Cp\u003EThe application is responsible for handling navigation.\u003C/p\u003E\n\u003Cp\u003EThis can be useful when integrating UltimateAuth into an existing routing or navigation system.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-callback\u0022\u003EAuthorization Callback\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Pkce.OnAuthorized = response =\u0026gt;\n {\n // Inspect or process the authorization response.\n return Task.CompletedTask;\n };\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe callback 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\u003EPkceAuthorizeResponse\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIt runs after the authorization response is issued and before the normal Hub navigation.\u003C/p\u003E\n\u003Cp\u003EUse the callback for application-specific integration, not to bypass PKCE verification.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-and-server-pkce-settings-are-different\u0022\u003EClient and Server PKCE Settings Are Different\u003C/h3\u003E\n\u003Cp\u003EClient 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\u003Eoptions.Pkce.AutoRedirect = true;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EServer 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\u003Eoptions.Pkce.AuthorizationCodeLifetimeSeconds = 120;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client controls how the flow is initiated and navigated.\u003C/p\u003E\n\u003Cp\u003EThe server controls the authorization code\u0027s validity and verification.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022return-url-configuration\u0022\u003E8. Return URL Configuration\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth supports several return URL configuration points.\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\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EDefaultReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EGlobal default for interactive authentication\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin.ReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin-specific default\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce.ReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE-specific default\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=\u0022global-default\u0022\u003EGlobal Default\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.DefaultReturnUrl = \u0026quot;/dashboard\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022flow-specific-defaults\u0022\u003EFlow-Specific Defaults\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.DefaultReturnUrl = \u0026quot;/\u0026quot;;\n options.Login.ReturnUrl = \u0026quot;/account\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;/dashboard\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFlow-specific values allow different authentication paths to use different destinations.\u003C/p\u003E\n\u003Cp\u003EAn explicitly supplied return URL for an individual operation may take precedence over these defaults.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-considerations\u0022\u003ESecurity Considerations\u003C/h3\u003E\n\u003Cp\u003EReturn URLs are navigation destinations and must be treated carefully.\u003C/p\u003E\n\u003Cp\u003EDo not redirect users to arbitrary external URLs without appropriate validation.\u003C/p\u003E\n\u003Cp\u003EOpen redirects can be abused for phishing and other attacks.\u003C/p\u003E\n\u003Cp\u003EPrefer local application routes unless cross-origin navigation is an intentional and validated part of the authentication architecture.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022automatic-refresh\u0022\u003E9. Automatic Refresh\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.AutoRefresh\u003C/code\u003E controls client-side authentication renewal.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides three independently configurable automatic refresh strategies.\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\u003Cth\u003EPurpose\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EProactive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh before eligible authenticated requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReactive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERecover from supported authentication challenges\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EBackground\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh independently of application requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EInterval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E5 minutes\u003C/td\u003E\n\u003Ctd\u003EInterval-based refresh eligibility\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERefreshBeforeExpiration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E1 minute\u003C/td\u003E\n\u003Ctd\u003EJWT expiration-based refresh threshold\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoRefresh.Proactive = true;\n options.AutoRefresh.Reactive = true;\n options.AutoRefresh.Background = false;\n\n options.AutoRefresh.Interval = TimeSpan.FromMinutes(5);\n options.AutoRefresh.RefreshBeforeExpiration = TimeSpan.FromMinutes(1);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EProactive and reactive refresh are enabled by default.\u003C/p\u003E\n\u003Cp\u003EBackground refresh is opt-in and requires an active client coordinator.\u003C/p\u003E\n\u003Cp\u003EThe client uses interval-based or JWT expiration-based scheduling according to the available managed credential.\u003C/p\u003E\n\u003Cp\u003EAll refresh strategies share coordination infrastructure within the current client scope.\u003C/p\u003E\n\u003Cp\u003EAutomatic refresh does not override server-side expiration, revocation, device binding, or rate-limiting policies.\u003C/p\u003E\n\u003Cp\u003EFor strategy selection, scheduling behavior, session policy alignment, request replay, and diagnostics, see \u003Ca href=\u0022/docs/client-sdk/automatic-refresh\u0022\u003EAutomatic Refresh\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022reauthentication-options\u0022\u003E10. Reauthentication Options\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.Reauth\u003C/code\u003E controls how the Blazor session coordinator responds when refresh reports that reauthentication is required.\u003C/p\u003E\n\u003Cp\u003EThe available properties are:\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\u003EBehavior\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauthBehavior.Redirect\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ERedirectPath\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=\u0022available-behaviors\u0022\u003EAvailable Behaviors\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\u003EReauthBehavior.Redirect\nReauthBehavior.None\nReauthBehavior.RaiseEvent\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022redirect\u0022\u003ERedirect\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Reauth.Behavior = ReauthBehavior.Redirect;\n options.Reauth.RedirectPath = \u0026quot;/login\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWhen the coordinator receives a \u003Ccode\u003EReauthRequired\u003C/code\u003E refresh outcome, it navigates to the configured redirect path.\u003C/p\u003E\n\u003Cp\u003EIf \u003Ccode\u003ERedirectPath\u003C/code\u003E is null, the coordinator falls back to \u003Ccode\u003EEndpoints.Login\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe current Blazor coordinator uses forced navigation for this redirect.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022raise-an-event\u0022\u003ERaise an 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis allows an application to handle reauthentication through the coordinator\u0027s \u003Ccode\u003EReauthRequired\u003C/code\u003E event.\u003C/p\u003E\n\u003Cp\u003EFor example, an application may display a reauthentication dialog rather than immediately navigating.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022no-automatic-action\u0022\u003ENo Automatic Action\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Reauth.Behavior = ReauthBehavior.None;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EWith \u003Ccode\u003ENone\u003C/code\u003E, the coordinator does not automatically redirect or raise its reauthentication event.\u003C/p\u003E\n\u003Cp\u003EThe application must still handle unauthenticated states appropriately.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022important\u0022\u003EImportant\u003C/h3\u003E\n\u003Cp\u003EReauthentication behavior does not make an expired or revoked session valid.\u003C/p\u003E\n\u003Cp\u003EIt only controls how the client responds when authentication must be reestablished.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022multi-tenant-client-configuration\u0022\u003E11. Multi-Tenant Client Configuration\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.MultiTenant\u003C/code\u003E controls tenant propagation from the client to the authentication server.\u003C/p\u003E\n\u003Cp\u003EThe client does not independently authorize or resolve tenant ownership.\u003C/p\u003E\n\u003Cp\u003EIt carries tenant context using the configured transport.\u003C/p\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\u003EEnabled\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EEnable tenant propagation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant identifier to propagate\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ETransport\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ETenantTransport.None\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant transport mechanism\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=\u0022available-transports\u0022\u003EAvailable Transports\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\u003ETenantTransport.None\nTenantTransport.Header\nTenantTransport.Route\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022header-based-tenant-propagation\u0022\u003EHeader-Based Tenant Propagation\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.MultiTenant.Enabled = true;\n options.MultiTenant.Tenant = \u0026quot;tenant-a\u0026quot;;\n options.MultiTenant.Transport = TenantTransport.Header;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server must be configured to resolve tenant information from the corresponding transport.\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.Enabled = true;\n options.MultiTenant.EnableHeader = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022route-based-tenant-propagation\u0022\u003ERoute-Based Tenant Propagation\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.MultiTenant.Enabled = true;\n options.MultiTenant.Tenant = \u0026quot;tenant-a\u0026quot;;\n options.MultiTenant.Transport = TenantTransport.Route;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server must expose routes compatible with tenant-based routing.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-boundary\u0022\u003ESecurity Boundary\u003C/h3\u003E\n\u003Cp\u003EA client-provided tenant identifier is not proof of tenant membership.\u003C/p\u003E\n\u003Cp\u003EThe server must validate the resolved tenant and enforce tenant isolation.\u003C/p\u003E\n\u003Cp\u003ENever rely on client-side tenant selection as an authorization boundary.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-state-events\u0022\u003E12. Authentication State Events\u003C/h2\u003E\n\u003Cp\u003E\u003Ccode\u003Eoptions.StateEvents\u003C/code\u003E controls how the client processes authentication-related state events.\u003C/p\u003E\n\u003Cp\u003EThe available 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.StateEvents.HandlingMode\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIts 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\u003EUAuthStateEventHandlingMode.Patch\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\u003EBehavior\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPatch\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EApply a local authentication state update\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EValidate\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERevalidate authentication state after the event\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ENone\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDo not update authentication state in response to the event\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=\u0022patch\u0022\u003EPatch\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.StateEvents.HandlingMode = UAuthStateEventHandlingMode.Patch;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EPatch\u003C/code\u003E is the default.\u003C/p\u003E\n\u003Cp\u003EIt allows the client to update local state without performing a full authentication validation for every event.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validate\u0022\u003EValidate\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.StateEvents.HandlingMode = UAuthStateEventHandlingMode.Validate;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EValidate\u003C/code\u003E causes the client to revalidate authentication state in response to events.\u003C/p\u003E\n\u003Cp\u003EThis may introduce additional requests but can be appropriate when the application prefers server-confirmed state updates.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022none\u0022\u003ENone\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.StateEvents.HandlingMode = UAuthStateEventHandlingMode.None;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003ENone\u003C/code\u003E disables automatic authentication state updates in response to these events.\u003C/p\u003E\n\u003Cp\u003EApplications using this mode must provide any required state synchronization through other mechanisms.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022local-events-are-not-distributed-notifications\u0022\u003ELocal Events Are Not Distributed Notifications\u003C/h3\u003E\n\u003Cp\u003EClient state events do not automatically notify every browser, device, or application instance.\u003C/p\u003E\n\u003Cp\u003EFor example, an administrator changing a user\u0027s role does not automatically push an event to that user\u0027s open browser.\u003C/p\u003E\n\u003Cp\u003EDistributed synchronization requires additional application infrastructure.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-from-appsettings.json\u0022\u003E13. Configuration from appsettings.json\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth Client 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: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;Endpoints\u0026quot;: {\n \u0026quot;BasePath\u0026quot;: \u0026quot;https://auth.example.com/auth\u0026quot;\n },\n \u0026quot;Pkce\u0026quot;: {\n \u0026quot;Enabled\u0026quot;: true,\n \u0026quot;ReturnUrl\u0026quot;: \u0026quot;/dashboard\u0026quot;,\n \u0026quot;AutoRedirect\u0026quot;: true\n },\n \u0026quot;AutoRefresh\u0026quot;: {\n \u0026quot;Background\u0026quot;: true,\n \u0026quot;Interval\u0026quot;: \u0026quot;00:05:00\u0026quot;\n },\n \u0026quot;Reauth\u0026quot;: {\n \u0026quot;Behavior\u0026quot;: \u0026quot;Redirect\u0026quot;,\n \u0026quot;RedirectPath\u0026quot;: \u0026quot;/login\u0026quot;\n },\n \u0026quot;StateEvents\u0026quot;: {\n \u0026quot;HandlingMode\u0026quot;: \u0026quot;Patch\u0026quot;\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe example uses the standard ASP.NET Core configuration binding conventions.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-precedence\u0022\u003EConfiguration Precedence\u003C/h3\u003E\n\u003Cp\u003EThe registration pipeline applies:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EOption type defaults.\u003C/li\u003E\n\u003Cli\u003EThe configuration delegate.\u003C/li\u003E\n\u003Cli\u003EValues from \u003Ccode\u003EUltimateAuth:Client\u003C/code\u003E.\u003C/li\u003E\n\u003Cli\u003EPost-configuration processing.\u003C/li\u003E\n\u003Cli\u003ERegistered options validation when the options are resolved.\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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.DefaultReturnUrl = \u0026quot;/\u0026quot;;\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;Client\u0026quot;: {\n \u0026quot;DefaultReturnUrl\u0026quot;: \u0026quot;/dashboard\u0026quot;\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe configured return URL becomes \u003Ccode\u003E/dashboard\u003C/code\u003E.\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 double underscores for hierarchical configuration keys.\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__Client__Endpoints__BasePath=https://auth.example.com/auth\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:Client:Endpoints:BasePath\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EUse environment-specific configuration for deployment-dependent values such as authentication server addresses and application return paths.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-options-validation\u0022\u003E14. Client Options Validation\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth registers validators for:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003EUAuthClientOptions\nUAuthClientEndpointOptions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-profile-validation\u0022\u003EApplication Profile Validation\u003C/h3\u003E\n\u003Cp\u003EThe validator rejects a configuration where:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AutoDetectApplicationProfile = false;\noptions.ApplicationProfile = UAuthApplicationProfile.NotSpecified;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAn explicit profile is required when detection is disabled.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022endpoint-validation\u0022\u003EEndpoint Validation\u003C/h3\u003E\n\u003Cp\u003EThe following endpoint properties must be present:\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\u003EEndpoints.BasePath\nEndpoints.Login\nEndpoints.Logout\nEndpoints.Refresh\nEndpoints.Validate\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor example, this configuration is invalid:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-timing\u0022\u003EValidation Timing\u003C/h3\u003E\n\u003Cp\u003EUnlike the server registration, the current client registration does not explicitly call \u003Ccode\u003EValidateOnStart()\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EValidation therefore occurs through the normal options resolution lifecycle.\u003C/p\u003E\n\u003Cp\u003EApplications that require early validation can arrange for the configured options to be resolved during startup.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022validation-scope\u0022\u003EValidation Scope\u003C/h3\u003E\n\u003Cp\u003EThe current validators check essential application profile and endpoint requirements.\u003C/p\u003E\n\u003Cp\u003EThey do not automatically validate every possible combination of client flow, server deployment, cookie behavior, and authentication mode.\u003C/p\u003E\n\u003Cp\u003EApplications should test their actual authentication flows against the deployed server configuration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022complete-blazor-webassembly-example\u0022\u003E15. Complete Blazor WebAssembly Example\u003C/h2\u003E\n\u003Cp\u003EThe following example configures a Blazor WebAssembly client using a remote authentication 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n // Application profile\n options.AutoDetectApplicationProfile = false;\n options.ApplicationProfile = UAuthApplicationProfile.BlazorWasm;\n\n // Authentication server\n options.Endpoints.BasePath = \u0026quot;https://auth.example.com/auth\u0026quot;;\n\n // Navigation\n options.DefaultReturnUrl = \u0026quot;/\u0026quot;;\n options.Login.ReturnUrl = \u0026quot;/dashboard\u0026quot;;\n\n // Public client security\n options.Login.AllowCredentialPost = false;\n\n // PKCE\n options.Pkce.Enabled = true;\n options.Pkce.ReturnUrl = \u0026quot;/dashboard\u0026quot;;\n options.Pkce.AutoRedirect = true;\n\n // Background refresh\n options.AutoRefresh.Background = false;\n options.AutoRefresh.Proactive = true;\n\n // Reauthentication\n options.Reauth.Behavior = ReauthBehavior.Redirect;\n options.Reauth.RedirectPath = \u0026quot;/login\u0026quot;;\n\n // State updates\n options.StateEvents.HandlingMode = UAuthStateEventHandlingMode.Patch;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis example emphasizes PKCE-based authentication and avoids direct credential posting from a public browser client.\u003C/p\u003E\n\u003Cp\u003EThe remote server must be configured with compatible endpoints, origins, authentication modes, and credential delivery policies.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022complete-blazor-server-example\u0022\u003E16. Complete Blazor Server Example\u003C/h2\u003E\n\u003Cp\u003EThe following example configures a Blazor Server 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n // Application profile\n options.AutoDetectApplicationProfile = false;\n options.ApplicationProfile = UAuthApplicationProfile.BlazorServer;\n\n // Same-origin authentication endpoints\n options.Endpoints.BasePath = \u0026quot;/auth\u0026quot;;\n\n // Navigation\n options.DefaultReturnUrl = \u0026quot;/\u0026quot;;\n options.Login.ReturnUrl = \u0026quot;/dashboard\u0026quot;;\n\n // Background refresh\n options.AutoRefresh.Background = false;\n options.AutoRefresh.Proactive = true;\n options.AutoRefresh.Interval = TimeSpan.FromMinutes(5);\n\n // Reauthentication\n options.Reauth.Behavior = ReauthBehavior.Redirect;\n options.Reauth.RedirectPath = \u0026quot;/login\u0026quot;;\n\n // Authentication state\n options.StateEvents.HandlingMode = UAuthStateEventHandlingMode.Patch;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EBlazor Server applications can use session-oriented authentication and the corresponding server-side security policies.\u003C/p\u003E\n\u003Cp\u003EThe application must still initialize the client and session coordinator through its supported lifecycle.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-and-client-configuration-together\u0022\u003E17. Server and Client Configuration Together\u003C/h2\u003E\n\u003Cp\u003EAn application that hosts both UltimateAuth Server and the Blazor client adapter can configure them 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\u003E// Server: authentication and security policies\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.AllowedModes =\n [\n UAuthMode.PureOpaque,\n UAuthMode.Hybrid\n ];\n\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n options.Login.MaxFailedAttempts = 5;\n});\n\n// Client: platform integration and flow behavior\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.ApplicationProfile = UAuthApplicationProfile.BlazorServer;\n options.AutoDetectApplicationProfile = false;\n options.Endpoints.BasePath = \u0026quot;/auth\u0026quot;;\n options.AutoRefresh.Proactive = true;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe two configuration objects have different responsibilities.\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\u003EConfigure on\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\u003EServer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAccess token lifetime\u003C/td\u003E\n\u003Ctd\u003EServer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERefresh token replay policy\u003C/td\u003E\n\u003Ctd\u003EServer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECredential recovery rules\u003C/td\u003E\n\u003Ctd\u003EServer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAllowed authentication modes\u003C/td\u003E\n\u003Ctd\u003EServer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EApplication profile\u003C/td\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPKCE navigation\u003C/td\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAutomatic proactive refresh\u003C/td\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EReauthentication navigation\u003C/td\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAuthentication state event handling\u003C/td\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ETenant validation\u003C/td\u003E\n\u003Ctd\u003EServer\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ETenant propagation\u003C/td\u003E\n\u003Ctd\u003EClient\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe client cannot override server-side security decisions.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-configuration-mistakes\u0022\u003E18. Common Configuration Mistakes\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022registering-the-core-client-and-blazor-adapter-separately\u0022\u003ERegistering the Core Client and Blazor Adapter Separately\u003C/h3\u003E\n\u003Cp\u003EUse \u003Ccode\u003EAddUltimateAuthClientBlazor()\u003C/code\u003E for Blazor applications.\u003C/p\u003E\n\u003Cp\u003EIt already registers the underlying client SDK.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022disabling-profile-detection-without-selecting-a-profile\u0022\u003EDisabling Profile Detection Without Selecting a Profile\u003C/h3\u003E\n\u003Cp\u003EWhen \u003Ccode\u003EAutoDetectApplicationProfile\u003C/code\u003E is false, set \u003Ccode\u003EApplicationProfile\u003C/code\u003E explicitly.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022relying-on-automatic-detection-in-an-ambiguous-hosting-environment\u0022\u003ERelying on Automatic Detection in an Ambiguous Hosting Environment\u003C/h3\u003E\n\u003Cp\u003EFor complex hosting arrangements, consider specifying the application profile explicitly.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022enabling-direct-credential-posting-in-a-public-client\u0022\u003EEnabling Direct Credential Posting in a Public Client\u003C/h3\u003E\n\u003Cp\u003EDo not enable \u003Ccode\u003EAllowCredentialPost\u003C/code\u003E for browser-hosted public clients.\u003C/p\u003E\n\u003Cp\u003EUse PKCE.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-client-auto-refresh-extends-server-lifetimes\u0022\u003EAssuming Client Auto-Refresh Extends Server Lifetimes\u003C/h3\u003E\n\u003Cp\u003EAutomatic refresh only initiates refresh operations.\u003C/p\u003E\n\u003Cp\u003EThe server controls whether refresh is permitted.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-auto-refresh-starts-automatically\u0022\u003EAssuming Auto-Refresh Starts Automatically\u003C/h3\u003E\n\u003Cp\u003EThe Blazor session coordinator must be started through the supported application lifecycle.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuring-only-the-client-endpoint\u0022\u003EConfiguring Only the Client Endpoint\u003C/h3\u003E\n\u003Cp\u003EThe server must expose compatible routes and allow the intended cross-origin interaction.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022treating-tenant-propagation-as-authorization\u0022\u003ETreating Tenant Propagation as Authorization\u003C/h3\u003E\n\u003Cp\u003EA tenant identifier supplied by the client does not grant access to that tenant.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022using-state-events-as-distributed-notifications\u0022\u003EUsing State Events as Distributed Notifications\u003C/h3\u003E\n\u003Cp\u003EClient events update local client state; they do not automatically synchronize all connected devices.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022assuming-every-client-setting-is-validated-at-startup\u0022\u003EAssuming Every Client Setting Is Validated at Startup\u003C/h3\u003E\n\u003Cp\u003EThe current client registration validates options when they are resolved, rather than explicitly requiring startup validation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-options-quick-reference\u0022\u003E19. Client Options Quick Reference\u003C/h2\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\u003EApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ENotSpecified\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EApplication environment\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoDetectApplicationProfile\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAutomatic 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\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EGlobal return URL\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EEndpoints.BasePath\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003E/auth\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication endpoint base\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin.ReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ELogin return URL\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003ELogin.AllowCredentialPost\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EDirect credential posting\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce.Enabled\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE flow support\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce.ReturnUrl\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE return URL\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce.AutoRedirect\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EAutomatic PKCE navigation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EPkce.OnAuthorized\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EPKCE authorization callback\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh.Proactive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERefresh before eligible authenticated requests\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh.Reactive\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Etrue\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ERecover from supported authentication challenges\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh.Background\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EIndependent background refresh coordination\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh.Interval\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E5 minutes\u003C/td\u003E\n\u003Ctd\u003EInterval-based refresh eligibility\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EAutoRefresh.RefreshBeforeExpiration\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E1 minute\u003C/td\u003E\n\u003Ctd\u003EJWT expiration-based refresh threshold\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauth.Behavior\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ERedirect\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReauthentication handling\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EReauth.RedirectPath\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EReauthentication redirect\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant.Enabled\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Efalse\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant propagation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant.Tenant\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant identifier\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EMultiTenant.Transport\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003ENone\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant transport\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EStateEvents.HandlingMode\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EPatch\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EState event handling\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResource.BaseAddress\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Enull\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EResource API origin; defaults to application origin\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Ccode\u003EResource.Credentials\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EAuto\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003EBrowser credential handling for resource requests\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/overview\u0022\u003EConfiguration Overview\u003C/a\u003E \u2014 Understand the configuration architecture and source precedence.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Configure authentication security, sessions, tokens, and endpoints.\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-sdk/authentication\u0022\u003EAuthentication\u003C/a\u003E \u2014 Implement login, PKCE, refresh, and logout flows.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client-sdk/automatic-refresh\u0022\u003EAutomatic Refresh\u003C/a\u003E \u2014 Configure efficient authentication renewal, automatic recovery, and refresh coordination.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/client-sdk/session-management\u0022\u003ESession Management\u003C/a\u003E \u2014 Manage authenticated sessions and revocation.\u003C/li\u003E\n\u003C/ul\u003E\n", "Headings": [ { "Id": "register-the-ultimateauth-client", @@ -379,6 +379,6 @@ "Level": 0 } ], - "SourceHash": "41E44B2415B87DA2D857DA48A4327DFFAF46BD79E1D3ED4FD073913572A440A8", + "SourceHash": "86130EBDB22EC6DD85ADCDC2C6F68D98DFDD1BB7E93F54D997B0F5BE76716045", "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 b22c86d9..59598b0d 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\u003EUAuthSessionOptions\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.Session.Lifetime = TimeSpan.FromHours(8);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server consumes \u003Ccode\u003Eoptions.Session\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\n options.Session.Lifetime = TimeSpan.FromHours(8);\n\n options.Token.AccessTokenLifetime =\n 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\u003ESession.Lifetime\u003C/code\u003E\u003C/td\u003E\n\u003Ctd\u003ESession 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.Session.Lifetime = 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.Session.Lifetime = 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;Session\u0026quot;: {\n \u0026quot;Lifetime\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.Session.Lifetime = 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.Session.Lifetime = 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.Session.Lifetime = 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 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", "Headings": [ { "Id": "configuration-architecture", @@ -209,6 +209,6 @@ "Level": 0 } ], - "SourceHash": "6855B63F33EF64E980DE08EC5194B37ECE4AC0B05C1C82898E13058F7DB9814E", + "SourceHash": "4B811B4B53884F5927AF19271A576844DC4515B1F1A39ABB00BCD180E0DA2EF7", "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 ab89c94b..f4853f30 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.Session.Lifetime = 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;Session\u0026quot;: {\n \u0026quot;Lifetime\u0026quot;: \u0026quot;7.00:00:00\u0026quot;\n },\n \u0026quot;Token\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\u003EReserved device 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[ApplicationProfile.BlazorServer] = UAuthMode.PureOpaque;\n options.ApplicationProfileModes[ApplicationProfile.BlazorWasm] = UAuthMode.SemiHybrid;\n options.ApplicationProfileModes[ApplicationProfile.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.Session.Lifetime = 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.Session.Lifetime = 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=\u0022enabling-unsupported-modes\u0022\u003EEnabling Unsupported Modes\u003C/h3\u003E\n\u003Cp\u003EAn authentication mode appearing in an enum does not guarantee runtime support.\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\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[ApplicationProfile.BlazorServer] = UAuthMode.PureOpaque;\n options.ApplicationProfileModes[ApplicationProfile.BlazorWasm] = UAuthMode.SemiHybrid;\n options.ApplicationProfileModes[ApplicationProfile.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", "Headings": [ { "Id": "register-ultimateauth-server", @@ -558,11 +558,6 @@ "Text": "Ignoring Mode Defaults", "Level": 1 }, - { - "Id": "enabling-unsupported-modes", - "Text": "Enabling Unsupported Modes", - "Level": 1 - }, { "Id": "treating-reserved-session-options-as-enforced-security-features", "Text": "Treating Reserved Session Options as Enforced Security Features", @@ -599,6 +594,6 @@ "Level": 0 } ], - "SourceHash": "BA65959E40A59F01C10769CC3934ACAB4F3764C1C7FD03731576C7FE50B81417", + "SourceHash": "E6F68F88A162B13C585185BEF6B63671DFD879EF75FAB418BE1CFC9D600A2D4F", "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 eb71c661..f26ccf91 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 @@ -1,7 +1,7 @@ { "Slug": "fundamentals/auth-model", "Title": "Authentication Model", - "Html": "\n\u003Cp\u003EUltimateAuth is built around a fundamental principle: \u003Cstrong\u003Eauthentication is a trusted process for establishing identity, not simply the presence of a token, cookie, or session identifier.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EAn authentication credential provides evidence of identity. The server must evaluate that evidence according to the active authentication mode before treating a request as authenticated.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides a common authentication architecture that supports both server-side sessions and cryptographically verifiable tokens.\u003C/p\u003E\n\u003Cp\u003EThe authentication mode determines how identity is established, what state must be validated, and which lifecycle guarantees apply.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-and-identity\u0022\u003EAuthentication and identity\u003C/h2\u003E\n\u003Cp\u003EAuthentication answers a specific question:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EWho is making this request, and what evidence establishes that identity?\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EAn authentication operation may involve credentials such as passwords, existing sessions, access tokens, refresh tokens, or other supported authentication proofs.\u003C/p\u003E\n\u003Cp\u003EThese credentials have different purposes.\u003C/p\u003E\n\u003Cp\u003EA password can establish a new authenticated context. An access token can represent an already established identity. A refresh token can continue an existing authentication context without repeating the original login.\u003C/p\u003E\n\u003Cp\u003ENone of these credentials should be trusted merely because a client presents them.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth evaluates authentication evidence through framework-controlled services and produces a trusted identity context only after the applicable validation succeeds.\u003C/p\u003E\n\u003Cp\u003EAuthorization is a separate responsibility. It determines what an authenticated actor is allowed to do.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-authority\u0022\u003EServer authority\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth is server-authoritative.\u003C/p\u003E\n\u003Cp\u003EThis means the server defines the authentication rules and determines whether the presented evidence satisfies them.\u003C/p\u003E\n\u003Cp\u003EServer authority does not require every request to access a server-side session store.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EIn PureOpaque, the server validates the session represented by the client\u0027s opaque session credential.\u003C/li\u003E\n\u003Cli\u003EIn Hybrid, the server resolves an opaque access token and validates its associated session.\u003C/li\u003E\n\u003Cli\u003EIn SemiHybrid, normal requests authenticate through JWT validation, while server-side sessions govern authentication continuation and lifecycle operations.\u003C/li\u003E\n\u003Cli\u003EIn PureJwt, authentication can be established through JWT validation without requiring session persistence or lookup.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EIn all cases, the effective authentication mode, validation requirements, and security policies remain under trusted server control.\u003C/p\u003E\n\u003Cp\u003EThe client cannot establish its own authenticated identity merely by supplying claims, identifiers, or an arbitrary authentication mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-state\u0022\u003EAuthentication state\u003C/h2\u003E\n\u003Cp\u003EAuthentication state can be represented in different ways.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EServer-side authentication state\u003C/strong\u003E is maintained by the authentication system and evaluated when required. It enables centralized session management and immediate session-based revocation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EToken-based authentication state\u003C/strong\u003E can be represented by cryptographically verifiable credentials. A JWT can carry sufficient information to establish identity without a session lookup, provided its signature and applicable validation rules are satisfied.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ECombined authentication state\u003C/strong\u003E uses both approaches for different purposes. For example, an application can validate JWTs independently while retaining server-side state for refresh and session management.\u003C/p\u003E\n\u003Cp\u003EThese are different authentication strategies, not separate authentication architectures.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth preserves common trust boundaries while allowing the effective mode to determine how authentication state is represented and evaluated.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-lineage\u0022\u003EAuthentication lineage\u003C/h2\u003E\n\u003Cp\u003EFor session-backed authentication, UltimateAuth models authentication state through three related concepts:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ERoot:\u003C/strong\u003E User-level authentication authority within a tenant.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EChain:\u003C/strong\u003E A grouping of related authentication sessions, typically associated with a device or client context.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESession:\u003C/strong\u003E An individual authenticated session.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003ETogether, these form the authentication lineage.\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\u003ERoot\n |\n \u002B-- Chain A\n | |\n | \u002B-- Session 1\n | |\n | \u002B-- Session 2\n |\n \u002B-- Chain B\n |\n \u002B-- Session 3\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe lineage provides a structured way to manage authentication state at different scopes.\u003C/p\u003E\n\u003Cp\u003EIt allows the system to distinguish between terminating one session, terminating sessions associated with a particular chain, and applying a broader user-level security change.\u003C/p\u003E\n\u003Cp\u003EThe lineage is central to session-backed authentication. It must not be interpreted as a mandatory persistence requirement for every authentication mode.\u003C/p\u003E\n\u003Cp\u003EIn particular, PureJwt does not require Root, Chain, or Session records to authenticate requests.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022root-user-level-authentication-authority\u0022\u003ERoot: user-level authentication authority\u003C/h2\u003E\n\u003Cp\u003ERoot represents the user-level authority within a tenant\u0027s session-backed authentication lineage.\u003C/p\u003E\n\u003Cp\u003EIt provides a common security boundary for related chains and sessions.\u003C/p\u003E\n\u003Cp\u003EDepending on the configured policies and supported operations, Root can participate in:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ETracking user-level authentication security state.\u003C/li\u003E\n\u003Cli\u003ECoordinating security changes affecting multiple sessions.\u003C/li\u003E\n\u003Cli\u003EApplying broader session invalidation.\u003C/li\u003E\n\u003Cli\u003EMaintaining a security version or epoch used by session-backed validation.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor example, a security-sensitive credential change may trigger a policy that invalidates existing sessions.\u003C/p\u003E\n\u003Cp\u003ERather than treating each session as unrelated, the lineage provides a common authority through which the affected authentication state can be managed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-versions\u0022\u003ESecurity versions\u003C/h3\u003E\n\u003Cp\u003EA security version, sometimes called a security epoch, can be used to determine whether an existing session still belongs to the current authentication security state.\u003C/p\u003E\n\u003Cp\u003EA session may retain the version associated with its creation. When the relevant authority changes, validation can reject sessions associated with an outdated version.\u003C/p\u003E\n\u003Cp\u003EThis mechanism is meaningful when authentication validation consults the relevant server-side state.\u003C/p\u003E\n\u003Cp\u003EIt does not automatically invalidate a previously issued JWT that is validated without a server-side lookup.\u003C/p\u003E\n\u003Cp\u003EThe exact invalidation behavior depends on the authentication mode and configured security policies.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022chain-related-session-context\u0022\u003EChain: related session context\u003C/h2\u003E\n\u003Cp\u003EChain groups related authentication sessions under a common lifecycle context.\u003C/p\u003E\n\u003Cp\u003EA chain commonly represents a device or client context, but its purpose is broader than storing a device identifier.\u003C/p\u003E\n\u003Cp\u003EIt provides a boundary for managing related authentication activity.\u003C/p\u003E\n\u003Cp\u003EA chain can support:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EGrouping related sessions.\u003C/li\u003E\n\u003Cli\u003EDevice-oriented session management.\u003C/li\u003E\n\u003Cli\u003EChain-level expiration and invalidation.\u003C/li\u003E\n\u003Cli\u003ECoordinating refresh-token lifecycle where applicable.\u003C/li\u003E\n\u003Cli\u003EApplying security policies to related authentication sessions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor example, an application may allow a user to terminate authentication associated with a particular device without terminating every session belonging to the user.\u003C/p\u003E\n\u003Cp\u003EA chain provides a suitable scope for that operation.\u003C/p\u003E\n\u003Cp\u003EA chain is not itself proof of authentication. Its validity and relationship to the relevant session must be evaluated according to the active mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-an-authenticated-instance\u0022\u003ESession: an authenticated instance\u003C/h2\u003E\n\u003Cp\u003ESession represents an individual authenticated instance maintained by the server.\u003C/p\u003E\n\u003Cp\u003EIt can contain or reference the information required to manage that instance, such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe authenticated user and tenant.\u003C/li\u003E\n\u003Cli\u003EIts relationship to a chain.\u003C/li\u003E\n\u003Cli\u003ECreation and expiration information.\u003C/li\u003E\n\u003Cli\u003ERevocation or lifecycle status.\u003C/li\u003E\n\u003Cli\u003EApplicable security-version information.\u003C/li\u003E\n\u003Cli\u003ESession metadata required by supported policies.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe role of Session differs by authentication mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-authoritative-authentication\u0022\u003ESession-authoritative authentication\u003C/h3\u003E\n\u003Cp\u003EIn PureOpaque and Hybrid, session validity is part of the authentication decision.\u003C/p\u003E\n\u003Cp\u003EA request cannot be treated as authenticated merely because it presents a structurally valid credential. The associated session must also satisfy the applicable validation requirements.\u003C/p\u003E\n\u003Cp\u003EIn these modes, session invalidation affects subsequent authentication evaluations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-managed-authentication\u0022\u003ESession-managed authentication\u003C/h3\u003E\n\u003Cp\u003EIn SemiHybrid, sessions support lifecycle operations such as refresh, logout, device management, and session revocation.\u003C/p\u003E\n\u003Cp\u003EHowever, normal JWT authentication does not require session validation.\u003C/p\u003E\n\u003Cp\u003EConsequently, revoking a session can prevent future refresh operations without automatically invalidating an already issued JWT.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-independent-authentication\u0022\u003ESession-independent authentication\u003C/h3\u003E\n\u003Cp\u003EPureJwt does not require a Session record.\u003C/p\u003E\n\u003Cp\u003EAuthentication relies on cryptographic token validation and applicable claims and token-validation policies.\u003C/p\u003E\n\u003Cp\u003EThere is no mandatory session authority or session lookup in its authentication pipeline.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022establishing-a-new-authentication-context\u0022\u003EEstablishing a new authentication context\u003C/h2\u003E\n\u003Cp\u003EAuthentication begins when the system receives evidence sufficient to establish a new authenticated identity.\u003C/p\u003E\n\u003Cp\u003EA typical login operation follows these conceptual steps:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EResolve the effective authentication context and security policies.\u003C/li\u003E\n\u003Cli\u003EValidate the presented authentication proof.\u003C/li\u003E\n\u003Cli\u003EEstablish the authenticated identity.\u003C/li\u003E\n\u003Cli\u003ECreate the authentication state required by the selected mode.\u003C/li\u003E\n\u003Cli\u003EIssue the appropriate authentication credentials.\u003C/li\u003E\n\u003Cli\u003EDeliver those credentials through the configured transport mechanism.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThe fourth and fifth steps are mode-dependent.\u003C/p\u003E\n\u003Cp\u003EFor session-backed modes, establishing authentication can involve creating or resolving the relevant Root, Chain, and Session state.\u003C/p\u003E\n\u003Cp\u003EFor PureJwt, issuing a JWT must not require creating a server-side session.\u003C/p\u003E\n\u003Cp\u003EThe shared authentication pipeline does not imply that every mode performs identical persistence operations.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authenticating-subsequent-requests\u0022\u003EAuthenticating subsequent requests\u003C/h2\u003E\n\u003Cp\u003EAfter login, a client presents the credential appropriate for its authentication mode.\u003C/p\u003E\n\u003Cp\u003EThe request pipeline validates that credential and establishes the trusted authentication state.\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 Request\n |\n v\nEffective Authentication Context\n |\n v\nCredential Resolution\n |\n v\nMode-Specific Authentication Validation\n |\n \u002B-- PureOpaque: Session validation\n |\n \u002B-- Hybrid: Opaque token \u002B session validation\n |\n \u002B-- SemiHybrid: JWT validation\n |\n \u002B-- PureJwt: JWT validation\n |\n v\nAuthenticated Identity\n |\n v\nAccessContext\n |\n v\nAuthorization\n |\n v\nProtected Operation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe authentication mode determines which validation steps are required.\u003C/p\u003E\n\u003Cp\u003EThe resulting identity must satisfy the same framework-level trust requirements regardless of the credential format.\u003C/p\u003E\n\u003Cp\u003EAn application must not construct a trusted identity directly from unvalidated client input.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-context-and-authorization-context\u0022\u003EAuthentication context and authorization context\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth distinguishes the context used to execute an authentication flow from the context used to evaluate authorization.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authflowcontext\u0022\u003EAuthFlowContext\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthFlowContext\u003C/code\u003E represents the effective authentication context for an operation.\u003C/p\u003E\n\u003Cp\u003EIt includes the relevant mode, client characteristics, tenant context, and other applicable runtime information.\u003C/p\u003E\n\u003Cp\u003EThe framework establishes this context through controlled boundaries.\u003C/p\u003E\n\u003Cp\u003EOnce established, the effective context remains stable throughout the operation.\u003C/p\u003E\n\u003Cp\u003EApplication code and individual domain services must not independently replace or reconstruct it to change the security rules.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022accesscontext\u0022\u003EAccessContext\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EAccessContext\u003C/code\u003E represents the trusted actor and authorization context after authentication has been evaluated.\u003C/p\u003E\n\u003Cp\u003EIt provides the identity and contextual information needed for authorization and policy decisions.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAccessContext\u003C/code\u003E does not authenticate credentials.\u003C/p\u003E\n\u003Cp\u003EAuthentication must be resolved before a trusted authorization context is established.\u003C/p\u003E\n\u003Cp\u003EThis separation allows the authentication mechanism to vary without requiring a different authorization architecture for each mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-lifecycle\u0022\u003EAuthentication lifecycle\u003C/h2\u003E\n\u003Cp\u003EAuthentication does not end when credentials are issued.\u003C/p\u003E\n\u003Cp\u003EDepending on the mode, an authenticated context may be continued, renewed, expired, or revoked.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth distinguishes several lifecycle operations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication\u0022\u003EAuthentication\u003C/h3\u003E\n\u003Cp\u003EEstablishes a new authenticated context after the required proof has been validated.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh\u0022\u003ERefresh\u003C/h3\u003E\n\u003Cp\u003EContinues an existing authentication context when its continuation requirements are satisfied.\u003C/p\u003E\n\u003Cp\u003ERefresh is mode-dependent.\u003C/p\u003E\n\u003Cp\u003EPureOpaque uses session continuation and touch semantics rather than refresh-token rotation.\u003C/p\u003E\n\u003Cp\u003EHybrid and SemiHybrid use refresh-token rotation together with the applicable session validation requirements.\u003C/p\u003E\n\u003Cp\u003EPureJwt may support session-independent token renewal when refresh tokens are enabled.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout\u0022\u003ELogout\u003C/h3\u003E\n\u003Cp\u003EEnds or discards the relevant authentication context according to the mode.\u003C/p\u003E\n\u003Cp\u003EIn session-authoritative modes, server-side session revocation can prevent subsequent authentication.\u003C/p\u003E\n\u003Cp\u003EIn JWT-based modes, removing credentials from the client does not by itself invalidate already issued JWTs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022revocation\u0022\u003ERevocation\u003C/h3\u003E\n\u003Cp\u003EInvalidates authentication state or credentials according to the guarantees supported by the selected mode.\u003C/p\u003E\n\u003Cp\u003ESession revocation and JWT revocation are not equivalent operations.\u003C/p\u003E\n\u003Cp\u003EA server-side session can be revoked immediately, but a JWT validated without session lookup can remain valid until expiration.\u003C/p\u003E\n\u003Cp\u003EApplications requiring stronger access-token invalidation guarantees must select a mode and validation strategy that explicitly provides them.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-security-boundaries\u0022\u003EAuthentication security boundaries\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth\u0027s authentication architecture relies on several principles that apply across modes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credentials-are-evidence-not-authority\u0022\u003ECredentials are evidence, not authority\u003C/h3\u003E\n\u003Cp\u003EThe presence of a token, cookie, or session identifier does not automatically establish identity.\u003C/p\u003E\n\u003Cp\u003EThe required validation must succeed first.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes-have-explicit-guarantees\u0022\u003EAuthentication modes have explicit guarantees\u003C/h3\u003E\n\u003Cp\u003EA mode must not silently weaken its validation or revocation guarantees because of client runtime, transport selection, or performance optimization.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-authority-is-mode-dependent\u0022\u003ESession authority is mode-dependent\u003C/h3\u003E\n\u003Cp\u003EServer-side sessions are authoritative where the mode requires them.\u003C/p\u003E\n\u003Cp\u003EStateless authentication does not become session-backed merely because other parts of the framework support session management.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-context-is-not-inherently-trusted\u0022\u003EClient context is not inherently trusted\u003C/h3\u003E\n\u003Cp\u003EDevice identifiers, tenant identifiers, and client-provided runtime information must be handled according to the applicable trust boundaries.\u003C/p\u003E\n\u003Cp\u003EThey must not allow a client to bypass authentication requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-and-authorization-remain-separate\u0022\u003EAuthentication and authorization remain separate\u003C/h3\u003E\n\u003Cp\u003EA valid identity does not automatically imply permission to access a resource.\u003C/p\u003E\n\u003Cp\u003EAuthorization policies must still evaluate the authenticated actor\u0027s access rights.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-protection-remains-essential\u0022\u003ECredential protection remains essential\u003C/h3\u003E\n\u003Cp\u003EOpaque session credentials, opaque access tokens, JWTs, and refresh tokens are all sensitive.\u003C/p\u003E\n\u003Cp\u003ETheir safe use depends on appropriate transport, storage, expiration, and validation policies.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022how-the-model-relates-to-authentication-modes\u0022\u003EHow the model relates to authentication modes\u003C/h2\u003E\n\u003Cp\u003EThe authentication model establishes the shared principles and boundaries.\u003C/p\u003E\n\u003Cp\u003EAuthentication modes determine how those principles are executed.\u003C/p\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\u003EAuthentication authority\u003C/th\u003E\n\u003Cth\u003ERole of session 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\u003EServer-side session\u003C/td\u003E\n\u003Ctd\u003ERequired for authentication and lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003EServer-side session, accessed through an opaque token\u003C/td\u003E\n\u003Ctd\u003ERequired for authentication and lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003ECryptographically validated JWT for normal requests\u003C/td\u003E\n\u003Ctd\u003ERequired for session lifecycle, not default request validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ECryptographically validated JWT\u003C/td\u003E\n\u003Ctd\u003ENot required\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThis distinction is essential to understanding UltimateAuth.\u003C/p\u003E\n\u003Cp\u003ERoot, Chain, and Session provide structured lifecycle control where server-side authentication state is required.\u003C/p\u003E\n\u003Cp\u003EThey are not universal prerequisites for authenticating a request.\u003C/p\u003E\n\u003Cp\u003ELikewise, JWT authentication does not eliminate server authority. The server still defines which tokens are acceptable and which validation rules must be enforced.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022summary\u0022\u003ESummary\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth defines authentication as a controlled process that establishes trusted identity from validated evidence.\u003C/p\u003E\n\u003Cp\u003EIts architecture separates:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication proof and credential validation.\u003C/li\u003E\n\u003Cli\u003EAuthentication state and lifecycle management.\u003C/li\u003E\n\u003Cli\u003EAuthentication context and authorization context.\u003C/li\u003E\n\u003Cli\u003EShared security boundaries and mode-specific execution strategies.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003ERoot, Chain, and Session form the authentication lineage used by session-backed modes.\u003C/p\u003E\n\u003Cp\u003EPureOpaque and Hybrid rely on that lineage as part of their authentication authority.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid retains session lifecycle management while allowing JWT authentication without request-time session lookup.\u003C/p\u003E\n\u003Cp\u003EPureJwt does not require session persistence or validation.\u003C/p\u003E\n\u003Cp\u003EThese distinctions allow UltimateAuth to support different authentication strategies without changing the fundamental trust and authorization model.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003ENext step\u003C/h2\u003E\n\u003Cp\u003EContinue to \u003Cstrong\u003EFlow-Based Authentication\u003C/strong\u003E to understand how UltimateAuth establishes and executes authentication operations through its controlled flow pipeline.\u003C/p\u003E\n", + "Html": "\n\u003Cp\u003EUltimateAuth is built around a fundamental principle: \u003Cstrong\u003Eauthentication is a trusted process for establishing identity, not simply the presence of a token, cookie, or session identifier.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EAn authentication credential provides evidence of identity. The server must evaluate that evidence according to the active authentication mode before treating a request as authenticated.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides a common authentication architecture that supports both server-side sessions and cryptographically verifiable tokens.\u003C/p\u003E\n\u003Cp\u003EThe authentication mode determines how identity is established, what state must be validated, and which lifecycle guarantees apply.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-and-identity\u0022\u003EAuthentication and identity\u003C/h2\u003E\n\u003Cp\u003EAuthentication answers a specific question:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EWho is making this request, and what evidence establishes that identity?\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EAn authentication operation may involve credentials such as passwords, existing sessions, access tokens, refresh tokens, or other supported authentication proofs.\u003C/p\u003E\n\u003Cp\u003EThese credentials have different purposes.\u003C/p\u003E\n\u003Cp\u003EA password can establish a new authenticated context. An access token can represent an already established identity. A refresh token can continue an existing authentication context without repeating the original login.\u003C/p\u003E\n\u003Cp\u003ENone of these credentials should be trusted merely because a client presents them.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth evaluates authentication evidence through framework-controlled services and produces a trusted identity context only after the applicable validation succeeds.\u003C/p\u003E\n\u003Cp\u003EAuthorization is a separate responsibility. It determines what an authenticated actor is allowed to do.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-authority\u0022\u003EServer authority\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth is server-authoritative.\u003C/p\u003E\n\u003Cp\u003EThis means the server defines the authentication rules and determines whether the presented evidence satisfies them.\u003C/p\u003E\n\u003Cp\u003EServer authority does not require every request to access a server-side session store.\u003C/p\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EIn PureOpaque, the server validates the session represented by the client\u0027s opaque session credential.\u003C/li\u003E\n\u003Cli\u003EIn Hybrid, the supported resource authentication path validates an opaque session credential against authoritative server-side session state. A separate access and refresh token lifecycle is also maintained.\u003C/li\u003E\n\u003Cli\u003EIn SemiHybrid, normal requests authenticate through JWT validation, while server-side sessions govern authentication continuation and lifecycle operations.\u003C/li\u003E\n\u003Cli\u003EIn PureJwt, authentication can be established through JWT validation without requiring session persistence or lookup.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EIn all cases, the effective authentication mode, validation requirements, and security policies remain under trusted server control.\u003C/p\u003E\n\u003Cp\u003EThe client cannot establish its own authenticated identity merely by supplying claims, identifiers, or an arbitrary authentication mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-state\u0022\u003EAuthentication state\u003C/h2\u003E\n\u003Cp\u003EAuthentication state can be represented in different ways.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EServer-side authentication state\u003C/strong\u003E is maintained by the authentication system and evaluated when required. It enables centralized session management and immediate session-based revocation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EToken-based authentication state\u003C/strong\u003E can be represented by cryptographically verifiable credentials. A JWT can carry sufficient information to establish identity without a session lookup, provided its signature and applicable validation rules are satisfied.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ECombined authentication state\u003C/strong\u003E uses both approaches for different purposes. For example, an application can validate JWTs independently while retaining server-side state for refresh and session management.\u003C/p\u003E\n\u003Cp\u003EThese are different authentication strategies, not separate authentication architectures.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth preserves common trust boundaries while allowing the effective mode to determine how authentication state is represented and evaluated.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-lineage\u0022\u003EAuthentication lineage\u003C/h2\u003E\n\u003Cp\u003EFor session-backed authentication, UltimateAuth models authentication state through three related concepts:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003ERoot:\u003C/strong\u003E User-level authentication authority within a tenant.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EChain:\u003C/strong\u003E A grouping of related authentication sessions, typically associated with a device or client context.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003ESession:\u003C/strong\u003E An individual authenticated session.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003ETogether, these form the authentication lineage.\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\u003ERoot\n |\n \u002B-- Chain A\n | |\n | \u002B-- Session 1\n | |\n | \u002B-- Session 2\n |\n \u002B-- Chain B\n |\n \u002B-- Session 3\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe lineage provides a structured way to manage authentication state at different scopes.\u003C/p\u003E\n\u003Cp\u003EIt allows the system to distinguish between terminating one session, terminating sessions associated with a particular chain, and applying a broader user-level security change.\u003C/p\u003E\n\u003Cp\u003EThe lineage is central to session-backed authentication. It must not be interpreted as a mandatory persistence requirement for every authentication mode.\u003C/p\u003E\n\u003Cp\u003EIn particular, PureJwt does not require Root, Chain, or Session records to authenticate requests.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022root-user-level-authentication-authority\u0022\u003ERoot: user-level authentication authority\u003C/h2\u003E\n\u003Cp\u003ERoot represents the user-level authority within a tenant\u0027s session-backed authentication lineage.\u003C/p\u003E\n\u003Cp\u003EIt provides a common security boundary for related chains and sessions.\u003C/p\u003E\n\u003Cp\u003EDepending on the configured policies and supported operations, Root can participate in:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ETracking user-level authentication security state.\u003C/li\u003E\n\u003Cli\u003ECoordinating security changes affecting multiple sessions.\u003C/li\u003E\n\u003Cli\u003EApplying broader session invalidation.\u003C/li\u003E\n\u003Cli\u003EMaintaining a security version or epoch used by session-backed validation.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor example, a security-sensitive credential change may trigger a policy that invalidates existing sessions.\u003C/p\u003E\n\u003Cp\u003ERather than treating each session as unrelated, the lineage provides a common authority through which the affected authentication state can be managed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-versions\u0022\u003ESecurity versions\u003C/h3\u003E\n\u003Cp\u003EA security version, sometimes called a security epoch, can be used to determine whether an existing session still belongs to the current authentication security state.\u003C/p\u003E\n\u003Cp\u003EA session may retain the version associated with its creation. When the relevant authority changes, validation can reject sessions associated with an outdated version.\u003C/p\u003E\n\u003Cp\u003EThis mechanism is meaningful when authentication validation consults the relevant server-side state.\u003C/p\u003E\n\u003Cp\u003EIt does not automatically invalidate a previously issued JWT that is validated without a server-side lookup.\u003C/p\u003E\n\u003Cp\u003EThe exact invalidation behavior depends on the authentication mode and configured security policies.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022chain-related-session-context\u0022\u003EChain: related session context\u003C/h2\u003E\n\u003Cp\u003EChain groups related authentication sessions under a common lifecycle context.\u003C/p\u003E\n\u003Cp\u003EA chain commonly represents a device or client context, but its purpose is broader than storing a device identifier.\u003C/p\u003E\n\u003Cp\u003EIt provides a boundary for managing related authentication activity.\u003C/p\u003E\n\u003Cp\u003EA chain can support:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EGrouping related sessions.\u003C/li\u003E\n\u003Cli\u003EDevice-oriented session management.\u003C/li\u003E\n\u003Cli\u003EChain-level expiration and invalidation.\u003C/li\u003E\n\u003Cli\u003ECoordinating refresh-token lifecycle where applicable.\u003C/li\u003E\n\u003Cli\u003EApplying security policies to related authentication sessions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EFor example, an application may allow a user to terminate authentication associated with a particular device without terminating every session belonging to the user.\u003C/p\u003E\n\u003Cp\u003EA chain provides a suitable scope for that operation.\u003C/p\u003E\n\u003Cp\u003EA chain is not itself proof of authentication. Its validity and relationship to the relevant session must be evaluated according to the active mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-an-authenticated-instance\u0022\u003ESession: an authenticated instance\u003C/h2\u003E\n\u003Cp\u003ESession represents an individual authenticated instance maintained by the server.\u003C/p\u003E\n\u003Cp\u003EIt can contain or reference the information required to manage that instance, such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe authenticated user and tenant.\u003C/li\u003E\n\u003Cli\u003EIts relationship to a chain.\u003C/li\u003E\n\u003Cli\u003ECreation and expiration information.\u003C/li\u003E\n\u003Cli\u003ERevocation or lifecycle status.\u003C/li\u003E\n\u003Cli\u003EApplicable security-version information.\u003C/li\u003E\n\u003Cli\u003ESession metadata required by supported policies.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe role of Session differs by authentication mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-authoritative-authentication\u0022\u003ESession-authoritative authentication\u003C/h3\u003E\n\u003Cp\u003EIn PureOpaque and Hybrid, session validity is part of the authentication decision.\u003C/p\u003E\n\u003Cp\u003EA request cannot be treated as authenticated merely because it presents a structurally valid credential. The associated session must also satisfy the applicable validation requirements.\u003C/p\u003E\n\u003Cp\u003EIn these modes, session invalidation affects subsequent authentication evaluations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-managed-authentication\u0022\u003ESession-managed authentication\u003C/h3\u003E\n\u003Cp\u003EIn SemiHybrid, sessions support lifecycle operations such as refresh, logout, device management, and session revocation.\u003C/p\u003E\n\u003Cp\u003EHowever, normal JWT authentication does not require session validation.\u003C/p\u003E\n\u003Cp\u003EConsequently, revoking a session can prevent future refresh operations without automatically invalidating an already issued JWT.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-independent-authentication\u0022\u003ESession-independent authentication\u003C/h3\u003E\n\u003Cp\u003EPureJwt does not require a Session record.\u003C/p\u003E\n\u003Cp\u003EAuthentication relies on cryptographic token validation and applicable claims and token-validation policies.\u003C/p\u003E\n\u003Cp\u003EThere is no mandatory session authority or session lookup in its authentication pipeline.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022establishing-a-new-authentication-context\u0022\u003EEstablishing a new authentication context\u003C/h2\u003E\n\u003Cp\u003EAuthentication begins when the system receives evidence sufficient to establish a new authenticated identity.\u003C/p\u003E\n\u003Cp\u003EA typical login operation follows these conceptual steps:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EResolve the effective authentication context and security policies.\u003C/li\u003E\n\u003Cli\u003EValidate the presented authentication proof.\u003C/li\u003E\n\u003Cli\u003EEstablish the authenticated identity.\u003C/li\u003E\n\u003Cli\u003ECreate the authentication state required by the selected mode.\u003C/li\u003E\n\u003Cli\u003EIssue the appropriate authentication credentials.\u003C/li\u003E\n\u003Cli\u003EDeliver those credentials through the configured transport mechanism.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EThe fourth and fifth steps are mode-dependent.\u003C/p\u003E\n\u003Cp\u003EFor session-backed modes, establishing authentication can involve creating or resolving the relevant Root, Chain, and Session state.\u003C/p\u003E\n\u003Cp\u003EFor PureJwt, issuing a JWT must not require creating a server-side session.\u003C/p\u003E\n\u003Cp\u003EThe shared authentication pipeline does not imply that every mode performs identical persistence operations.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authenticating-subsequent-requests\u0022\u003EAuthenticating subsequent requests\u003C/h2\u003E\n\u003Cp\u003EAfter login, a client presents the credential appropriate for its authentication mode.\u003C/p\u003E\n\u003Cp\u003EThe request pipeline validates that credential and establishes the trusted authentication state.\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 Request\n |\n v\nEffective Authentication Context\n |\n v\nCredential Resolution\n |\n v\nMode-Specific Authentication Validation\n |\n \u002B-- PureOpaque: Session validation\n |\n \u002B-- Hybrid: Opaque token \u002B session validation\n |\n \u002B-- SemiHybrid: JWT validation\n |\n \u002B-- PureJwt: JWT validation\n |\n v\nAuthenticated Identity\n |\n v\nAccessContext\n |\n v\nAuthorization\n |\n v\nProtected Operation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe authentication mode determines which validation steps are required.\u003C/p\u003E\n\u003Cp\u003EThe resulting identity must satisfy the same framework-level trust requirements regardless of the credential format.\u003C/p\u003E\n\u003Cp\u003EAn application must not construct a trusted identity directly from unvalidated client input.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-context-and-authorization-context\u0022\u003EAuthentication context and authorization context\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth distinguishes the context used to execute an authentication flow from the context used to evaluate authorization.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authflowcontext\u0022\u003EAuthFlowContext\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EAuthFlowContext\u003C/code\u003E represents the effective authentication context for an operation.\u003C/p\u003E\n\u003Cp\u003EIt includes the relevant mode, client characteristics, tenant context, and other applicable runtime information.\u003C/p\u003E\n\u003Cp\u003EThe framework establishes this context through controlled boundaries.\u003C/p\u003E\n\u003Cp\u003EOnce established, the effective context remains stable throughout the operation.\u003C/p\u003E\n\u003Cp\u003EApplication code and individual domain services must not independently replace or reconstruct it to change the security rules.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022accesscontext\u0022\u003EAccessContext\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EAccessContext\u003C/code\u003E represents the trusted actor and authorization context after authentication has been evaluated.\u003C/p\u003E\n\u003Cp\u003EIt provides the identity and contextual information needed for authorization and policy decisions.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAccessContext\u003C/code\u003E does not authenticate credentials.\u003C/p\u003E\n\u003Cp\u003EAuthentication must be resolved before a trusted authorization context is established.\u003C/p\u003E\n\u003Cp\u003EThis separation allows the authentication mechanism to vary without requiring a different authorization architecture for each mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-lifecycle\u0022\u003EAuthentication lifecycle\u003C/h2\u003E\n\u003Cp\u003EAuthentication does not end when credentials are issued.\u003C/p\u003E\n\u003Cp\u003EDepending on the mode, an authenticated context may be continued, renewed, expired, or revoked.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth distinguishes several lifecycle operations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication\u0022\u003EAuthentication\u003C/h3\u003E\n\u003Cp\u003EEstablishes a new authenticated context after the required proof has been validated.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh\u0022\u003ERefresh\u003C/h3\u003E\n\u003Cp\u003EContinues an existing authentication context when its continuation requirements are satisfied.\u003C/p\u003E\n\u003Cp\u003ERefresh is mode-dependent.\u003C/p\u003E\n\u003Cp\u003EPureOpaque uses session continuation and touch semantics rather than refresh-token rotation.\u003C/p\u003E\n\u003Cp\u003EHybrid and SemiHybrid use refresh-token rotation together with the applicable session validation requirements.\u003C/p\u003E\n\u003Cp\u003EPureJwt may support session-independent token renewal when refresh tokens are enabled.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout\u0022\u003ELogout\u003C/h3\u003E\n\u003Cp\u003EEnds or discards the relevant authentication context according to the mode.\u003C/p\u003E\n\u003Cp\u003EIn session-authoritative modes, server-side session revocation can prevent subsequent authentication.\u003C/p\u003E\n\u003Cp\u003EIn JWT-based modes, removing credentials from the client does not by itself invalidate already issued JWTs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022revocation\u0022\u003ERevocation\u003C/h3\u003E\n\u003Cp\u003EInvalidates authentication state or credentials according to the guarantees supported by the selected mode.\u003C/p\u003E\n\u003Cp\u003ESession revocation and JWT revocation are not equivalent operations.\u003C/p\u003E\n\u003Cp\u003EA server-side session can be revoked immediately, but a JWT validated without session lookup can remain valid until expiration.\u003C/p\u003E\n\u003Cp\u003EApplications requiring stronger access-token invalidation guarantees must select a mode and validation strategy that explicitly provides them.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-security-boundaries\u0022\u003EAuthentication security boundaries\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth\u0027s authentication architecture relies on several principles that apply across modes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credentials-are-evidence-not-authority\u0022\u003ECredentials are evidence, not authority\u003C/h3\u003E\n\u003Cp\u003EThe presence of a token, cookie, or session identifier does not automatically establish identity.\u003C/p\u003E\n\u003Cp\u003EThe required validation must succeed first.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes-have-explicit-guarantees\u0022\u003EAuthentication modes have explicit guarantees\u003C/h3\u003E\n\u003Cp\u003EA mode must not silently weaken its validation or revocation guarantees because of client runtime, transport selection, or performance optimization.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-authority-is-mode-dependent\u0022\u003ESession authority is mode-dependent\u003C/h3\u003E\n\u003Cp\u003EServer-side sessions are authoritative where the mode requires them.\u003C/p\u003E\n\u003Cp\u003EStateless authentication does not become session-backed merely because other parts of the framework support session management.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-context-is-not-inherently-trusted\u0022\u003EClient context is not inherently trusted\u003C/h3\u003E\n\u003Cp\u003EDevice identifiers, tenant identifiers, and client-provided runtime information must be handled according to the applicable trust boundaries.\u003C/p\u003E\n\u003Cp\u003EThey must not allow a client to bypass authentication requirements.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-and-authorization-remain-separate\u0022\u003EAuthentication and authorization remain separate\u003C/h3\u003E\n\u003Cp\u003EA valid identity does not automatically imply permission to access a resource.\u003C/p\u003E\n\u003Cp\u003EAuthorization policies must still evaluate the authenticated actor\u0027s access rights.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-protection-remains-essential\u0022\u003ECredential protection remains essential\u003C/h3\u003E\n\u003Cp\u003EOpaque session credentials, opaque access tokens, JWTs, and refresh tokens are all sensitive.\u003C/p\u003E\n\u003Cp\u003ETheir safe use depends on appropriate transport, storage, expiration, and validation policies.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022how-the-model-relates-to-authentication-modes\u0022\u003EHow the model relates to authentication modes\u003C/h2\u003E\n\u003Cp\u003EThe authentication model establishes the shared principles and boundaries.\u003C/p\u003E\n\u003Cp\u003EAuthentication modes determine how those principles are executed.\u003C/p\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\u003EAuthentication authority\u003C/th\u003E\n\u003Cth\u003ERole of session 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\u003EServer-side session\u003C/td\u003E\n\u003Ctd\u003ERequired for authentication and lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHybrid\u003C/td\u003E\n\u003Ctd\u003EServer-side session, accessed through an opaque token\u003C/td\u003E\n\u003Ctd\u003ERequired for authentication and lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003ECryptographically validated JWT for normal requests\u003C/td\u003E\n\u003Ctd\u003ERequired for session lifecycle, not default request validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ECryptographically validated JWT\u003C/td\u003E\n\u003Ctd\u003ENot required\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThis distinction is essential to understanding UltimateAuth.\u003C/p\u003E\n\u003Cp\u003ERoot, Chain, and Session provide structured lifecycle control where server-side authentication state is required.\u003C/p\u003E\n\u003Cp\u003EThey are not universal prerequisites for authenticating a request.\u003C/p\u003E\n\u003Cp\u003ELikewise, JWT authentication does not eliminate server authority. The server still defines which tokens are acceptable and which validation rules must be enforced.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022summary\u0022\u003ESummary\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth defines authentication as a controlled process that establishes trusted identity from validated evidence.\u003C/p\u003E\n\u003Cp\u003EIts architecture separates:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication proof and credential validation.\u003C/li\u003E\n\u003Cli\u003EAuthentication state and lifecycle management.\u003C/li\u003E\n\u003Cli\u003EAuthentication context and authorization context.\u003C/li\u003E\n\u003Cli\u003EShared security boundaries and mode-specific execution strategies.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003ERoot, Chain, and Session form the authentication lineage used by session-backed modes.\u003C/p\u003E\n\u003Cp\u003EPureOpaque and Hybrid rely on that lineage as part of their authentication authority.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid retains session lifecycle management while allowing JWT authentication without request-time session lookup.\u003C/p\u003E\n\u003Cp\u003EPureJwt does not require session persistence or validation.\u003C/p\u003E\n\u003Cp\u003EThese distinctions allow UltimateAuth to support different authentication strategies without changing the fundamental trust and authorization model.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022next-step\u0022\u003ENext step\u003C/h2\u003E\n\u003Cp\u003EContinue to \u003Cstrong\u003EFlow-Based Authentication\u003C/strong\u003E to understand how UltimateAuth establishes and executes authentication operations through its controlled flow pipeline.\u003C/p\u003E\n", "Headings": [ { "Id": "authentication-and-identity", @@ -159,6 +159,6 @@ "Level": 0 } ], - "SourceHash": "77930C2897B345BFA0A34AB076BD4F3FD71EDF2974774053A818333FA1606E32", + "SourceHash": "1B21BD5DC9880EB6EB96786B7CEF98F384BFE49AD8F09D3311A896F93796DDB4", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/getting-started/index.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/getting-started/index.json index 7750abce..199dd4ed 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/getting-started/index.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/getting-started/index.json @@ -1,7 +1,7 @@ { "Slug": "getting-started/index", "Title": "Getting Started", - "Html": "\n\u003Cp\u003E\u003Cstrong\u003EModern authentication and authorization for .NET \u2014 built around a unified security lifecycle.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EAuthentication starts with a login. But it doesn\u0027t end there.\u003C/p\u003E\n\u003Cp\u003EAs applications grow, they introduce new challenges: multiple clients, refresh tokens, device sessions, credential recovery, tenant isolation, permissions, and revocation. What begins as a simple login system can gradually become a collection of disconnected security mechanisms.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth takes a different approach.\u003C/p\u003E\n\u003Cp\u003EIt brings authentication, authorization, users, credentials, sessions, and client integration into \u003Cstrong\u003Eone coherent framework\u003C/strong\u003E, with a shared model for how security decisions are made and how authentication state changes over time.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EOne framework. Multiple client environments. A consistent security lifecycle.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ca href=\u0022https://github.com/CodeBeamOrg/UltimateAuth\u0022\u003EExplore the Source\u003C/a\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-ultimateauth\u0022\u003EWhy UltimateAuth?\u003C/h2\u003E\n\u003Cp\u003EMost applications don\u0027t struggle with generating an access token.\u003C/p\u003E\n\u003Cp\u003EThey struggle with everything that comes afterward.\u003C/p\u003E\n\u003Cp\u003EConsider an application that starts with a single web frontend. Eventually, it adds a mobile application, an administration panel, multiple organizations, and external APIs.\u003C/p\u003E\n\u003Cp\u003ESuddenly, authentication raises questions that a basic login implementation doesn\u0027t answer:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EHow should browser sessions and API tokens coexist?\u003C/li\u003E\n\u003Cli\u003ECan users see and revoke sessions associated with their devices?\u003C/li\u003E\n\u003Cli\u003EWhat happens to existing sessions after a password reset?\u003C/li\u003E\n\u003Cli\u003EHow do we prevent refresh token replay?\u003C/li\u003E\n\u003Cli\u003EHow do we enforce tenant boundaries consistently?\u003C/li\u003E\n\u003Cli\u003EHow do we keep authorization decisions separate from authentication?\u003C/li\u003E\n\u003Cli\u003ECan multiple application types use the same backend security model?\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese concerns are related. Implementing each independently makes the system harder to maintain, audit, and extend.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUltimateAuth is designed to manage these concerns as parts of the same security lifecycle.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-different-way-to-think-about-authentication\u0022\u003EA Different Way to Think About Authentication\u003C/h2\u003E\n\u003Cp\u003ETraditional authentication integration is often organized around credentials and their immediate results:\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\u003ECredentials\n \u2193\nValidate\n \u2193\nIssue Token\n \u2193\nAuthenticated\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThat sequence is necessary, but incomplete.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth approaches authentication as a longer-running lifecycle:\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 UltimateAuth\n \u2502\n \u25BC\n Request Context\n Client \u00B7 Tenant \u00B7 Device\n \u2502\n \u25BC\n Authentication\n Validation \u00B7 Decisions\n \u2502\n \u25BC\n Security State\n User \u00B7 Root \u00B7 Chain \u00B7 Session\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC \u25BC\n Refresh Logout Revoke\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 \u25BC\n Controlled State\n Transitions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis model makes it possible to reason about authentication beyond a single request.\u003C/p\u003E\n\u003Cp\u003ELogin establishes authentication. Refresh evaluates whether it may continue. Logout and revocation terminate authentication at the appropriate scope. Credential changes and security policies can affect existing sessions.\u003C/p\u003E\n\u003Cp\u003EThe result is a framework where these operations share a consistent security vocabulary.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-makes-ultimateauth-different\u0022\u003EWhat Makes UltimateAuth Different?\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003E\u003Cescape\u003E\u003C/escape\u003E\u003C/th\u003E\n\u003Cth\u003ECapability\u003C/th\u003E\n\u003Cth\u003EUltimateAuth\u0027s approach\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EUnified architecture\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication, sessions, users, credentials, and authorization share a common foundation\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EClient-aware behavior\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication can adapt to the application profile and effective server configuration\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESession lifecycle\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ERoot, chain, and session concepts support different scopes of session management\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EFlow-driven execution\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication operations use explicit context, validation, decisions, and state transitions\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ECredential lifecycle\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential changes, recovery, and session invalidation are related security operations\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ETenant awareness\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant context participates in authentication and access decisions\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EModularity\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ECore, Server, Client, and domain packages separate responsibilities\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESelf-hosting\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EApplications can operate their own authentication infrastructure\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\n\u003Cp\u003EUltimateAuth does not claim that tokens, sessions, PKCE, or policy-based authorization are new concepts.\u003C/p\u003E\n\u003Cp\u003EIts value is in \u003Cstrong\u003Ebringing established security concepts together under a consistent architecture\u003C/strong\u003E, rather than requiring every application to connect them independently.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022one-security-model-across-different-clients\u0022\u003EOne Security Model Across Different Clients\u003C/h2\u003E\n\u003Cp\u003EA browser application, a server-rendered application, and a native client have different security constraints.\u003C/p\u003E\n\u003Cp\u003EThey should not necessarily use identical credential storage, transport, or authentication flows.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth separates the common authentication model from client-specific integration.\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 Your .NET Applications\n\n Blazor Server Blazor WebAssembly\n \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n UltimateAuth Client\n \u2502\n \u25BC\n UltimateAuth Server\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC \u25BC\n Users Sessions Authorization\n \u2502 \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u25BC\n Shared Security\n Lifecycle\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe architecture also provides foundations for .NET MAUI, traditional ASP.NET Core applications, and API-oriented integrations.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESupport depends on the client adapter and authentication modes available in the installed version.\u003C/strong\u003E A supported architectural profile should not be confused with a fully released platform adapter.\u003C/p\u003E\n\u003Cp\u003EThe goal is to share authentication concepts without pretending that all clients have the same trust boundaries.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022sessions-are-more-than-tokens\u0022\u003ESessions Are More Than Tokens\u003C/h2\u003E\n\u003Cp\u003EOne of UltimateAuth\u0027s central concepts is its stateful session 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 \u2014 Browser A\n \u2502 \u251C\u2500\u2500 Session\n \u2502 \u2514\u2500\u2500 Session\n \u2502\n \u2514\u2500\u2500 Chain \u2014 Device B\n \u251C\u2500\u2500 Session\n \u2514\u2500\u2500 Session\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach level represents a different security scope.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ERoot\u003C/strong\u003E represents a broader authentication security boundary.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EChain\u003C/strong\u003E represents the continuity of authentication associated with a device or client context.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESession\u003C/strong\u003E represents an individual authentication instance within that chain.\u003C/p\u003E\n\u003Cp\u003EThis distinction makes several operations easier to express:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EEnd the current session.\u003C/li\u003E\n\u003Cli\u003ERevoke a particular device-associated chain.\u003C/li\u003E\n\u003Cli\u003ERevoke other active chains while preserving the current one.\u003C/li\u003E\n\u003Cli\u003ERevoke a broader authentication scope after a security-sensitive event.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA token is a credential used to access the system. It is not necessarily the complete record of the user\u0027s authentication lifecycle.\u003C/p\u003E\n\u003Cp\u003EThe hierarchy applies to session-backed authentication modes; different modes can have different persistence and validation characteristics.\u003C/p\u003E\n\u003Cp\u003E\u003Ca href=\u0022https://github.com/CodeBeamOrg/UltimateAuth\u0022\u003EExplore Session Management\u003C/a\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-flows-not-disconnected-endpoints\u0022\u003EAuthentication Flows, Not Disconnected Endpoints\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth organizes security-sensitive operations around explicit flows.\u003C/p\u003E\n\u003Cp\u003EA flow can combine:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003ERequest and tenant context.\u003C/li\u003E\n\u003Cli\u003EUser, credential, and session resolution.\u003C/li\u003E\n\u003Cli\u003EInput and security validation.\u003C/li\u003E\n\u003Cli\u003EAuthorization and authority decisions.\u003C/li\u003E\n\u003Cli\u003EControlled state transitions.\u003C/li\u003E\n\u003Cli\u003EClient-appropriate results and responses.\u003C/li\u003E\n\u003C/ol\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\u003ERequest\n \u2193\nAuthFlowContext\n \u2193\nValidation\n \u2193\nSecurity Decision\n \u2193\nExecution\n \u2193\nState Transition\n \u2193\nResponse\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis approach provides a consistent place for security rules to be evaluated.\u003C/p\u003E\n\u003Cp\u003EIt also makes individual operations easier to test and inspect because the important decisions are part of an explicit execution model.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EThe purpose is not abstraction for its own sake. It is to make authentication behavior understandable and predictable.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-continues-after-login\u0022\u003ESecurity Continues After Login\u003C/h2\u003E\n\u003Cp\u003EA secure authentication system must account for events that happen after a user signs in.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EEvent\u003C/th\u003E\n\u003Cth\u003EUltimateAuth concept\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA user signs in\u003C/td\u003E\n\u003Ctd\u003ELogin flow\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA session needs renewal\u003C/td\u003E\n\u003Ctd\u003ERefresh flow\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA user signs out\u003C/td\u003E\n\u003Ctd\u003ELogout flow\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA device should lose access\u003C/td\u003E\n\u003Ctd\u003EChain revocation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA credential is changed\u003C/td\u003E\n\u003Ctd\u003ECredential lifecycle and session policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAn account is recovered\u003C/td\u003E\n\u003Ctd\u003ERecovery proof and session invalidation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA user requests a protected resource\u003C/td\u003E\n\u003Ctd\u003EAuthorization decision\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA request targets a tenant\u003C/td\u003E\n\u003Ctd\u003ETenant-aware security context\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThis is why UltimateAuth treats session management, credential management, and authorization as connected parts of the system.\u003C/p\u003E\n\u003Cp\u003EFor example, a password reset is not simply a database update. It can also affect the validity of existing authentication sessions according to the configured credential session policy.\u003C/p\u003E\n\u003Cp\u003ESimilarly, logout and revocation are not interchangeable operations. They have different scopes and consequences.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-and-authorization-together\u0022\u003EAuthentication and Authorization Together\u003C/h2\u003E\n\u003Cp\u003EKnowing who a user is does not determine what that user is allowed to do.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth separates authentication from authorization while keeping them within the same overall security architecture.\u003C/p\u003E\n\u003Cp\u003EAuthentication establishes identity and applicable security context.\u003C/p\u003E\n\u003Cp\u003EAuthorization evaluates whether an actor may perform an action on a resource.\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\u003EActor: Authenticated user\nAction: update\nResource: products\nResult: Allowed or Denied\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERoles and permissions can be managed through the authorization domain, while the server remains responsible for enforcing access decisions.\u003C/p\u003E\n\u003Cp\u003EThis separation helps applications avoid spreading authorization logic across UI components, controllers, and unrelated service methods.\u003C/p\u003E\n\u003Cp\u003EClient-side authorization checks can improve the interface, but \u003Cstrong\u003Eserver-side enforcement remains the security boundary\u003C/strong\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022tenant-aware-by-design\u0022\u003ETenant-Aware by Design\u003C/h2\u003E\n\u003Cp\u003EMulti-tenant authentication involves more than adding a tenant identifier to a user record.\u003C/p\u003E\n\u003Cp\u003EA request must be interpreted within the correct tenant context, and security operations must respect that boundary.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides tenant resolution and propagation mechanisms that participate in its request and flow infrastructure.\u003C/p\u003E\n\u003Cp\u003EThis allows applications to build tenant-aware authentication and authorization behavior without treating tenancy as an unrelated afterthought.\u003C/p\u003E\n\u003Cp\u003ETenant context must still be configured correctly, and a client-supplied tenant identifier is never sufficient proof of authorization.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022modular-without-becoming-fragmented\u0022\u003EModular Without Becoming Fragmented\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth is divided into packages with distinct responsibilities.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EPackage or domain\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\u003Cstrong\u003ECore\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EShared contracts, domain concepts, and authentication foundations\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EServer\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication execution, runtime configuration, and server integration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EClient\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EPlatform-independent authentication and domain APIs\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EClient.Blazor\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EBlazor-specific transport, storage, and authentication state integration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EUsers\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EUser lifecycle, profiles, and identifiers\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ECredentials\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential operations, changes, and recovery\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EAuthorization\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ERoles, permissions, and access checks\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EPolicies\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EApplication access policy integration\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThis structure supports both a straightforward integration experience and deeper customization where the application requires it.\u003C/p\u003E\n\u003Cp\u003EDevelopers can begin with the public registration and client APIs without first learning every internal service.\u003C/p\u003E\n\u003Cp\u003EWhen necessary, they can explore the underlying flows, policies, stores, and extension points.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022designed-for-practical.net-development\u0022\u003EDesigned for Practical .NET Development\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth is intended to fit naturally into .NET applications.\u003C/p\u003E\n\u003Cp\u003EA server application begins by registering UltimateAuth and configuring the security behavior it needs:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Session.Lifetime = TimeSpan.FromDays(7);\n options.CredentialSessionPolicy.OnRecovery = CredentialSessionBehavior.RevokeAll;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA Blazor application registers the client adapter:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = true;\n options.Endpoints.BasePath = \u0026quot;/auth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese examples illustrate the configuration entry points rather than a complete application setup.\u003C/p\u003E\n\u003Cp\u003EThe server and client have different responsibilities, and a complete deployment also needs the appropriate hosting, persistence, transport, and authentication integration.\u003C/p\u003E\n\u003Cp\u003EThe important idea is that common behavior is configured through structured options rather than scattered application-specific code.\u003C/p\u003E\n\u003Cp\u003E\u003Ca href=\u0022/docs/getting-started/quickstart\u0022\u003EStart with QuickStart\u003C/a\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022who-is-ultimateauth-for\u0022\u003EWho Is UltimateAuth For?\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth is particularly relevant if you are building:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EA Blazor application\u003C/strong\u003E that needs authentication and authorization integrated with its hosting model.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EA multi-client .NET system\u003C/strong\u003E where different frontends should share the same authentication backend.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EAn application with device-aware sessions\u003C/strong\u003E where users or administrators need control over active authentication.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EA multi-tenant platform\u003C/strong\u003E with explicit tenant resolution and security boundaries.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EA security-sensitive application\u003C/strong\u003E that requires controlled refresh, credential recovery, and revocation behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EA self-hosted system\u003C/strong\u003E where the team wants visibility into and control over its authentication infrastructure.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003E\u003Cstrong\u003EFrom a simple login page to a complex authentication platform, UltimateAuth is designed to make getting started easy without limiting what comes next.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EYou shouldn\u0027t need to understand an entire identity framework just to add authentication to a small .NET application. And you shouldn\u0027t need to replace your authentication system when that application grows.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth is built for both.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022simple-applications.simple-beginnings\u0022\u003ESimple Applications. Simple Beginnings.\u003C/h3\u003E\n\u003Cp\u003EFor a small application, authentication should be straightforward.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth aims to provide a lightweight integration experience with clear configuration, sensible defaults, and ready-to-use authentication flows.\u003C/p\u003E\n\u003Cp\u003EInstead of requiring developers to assemble numerous identity components before they can begin, UltimateAuth provides a cohesive foundation that can be configured through a small number of well-defined entry points.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EStart with what you need. You don\u0027t have to configure everything the framework supports.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022complex-applications.room-to-grow\u0022\u003EComplex Applications. Room to Grow.\u003C/h3\u003E\n\u003Cp\u003EWhen requirements become more demanding, the same framework provides a deeper security architecture.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth is particularly useful for applications requiring multiple client types, device-aware session management, tenant isolation, advanced authorization, credential recovery, controlled refresh, and targeted revocation.\u003C/p\u003E\n\u003Cp\u003EIts modular architecture, explicit authentication flows, configurable policies, and extension points allow developers to introduce additional capabilities without abandoning the original authentication foundation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EThe complexity of your application should not determine how difficult authentication is to begin with.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022one-framework-for-both\u0022\u003EOne Framework for Both\u003C/h3\u003E\n\u003Cp\u003EWhether you\u0027re building a small personal project, a business application, a SaaS platform, or a larger distributed system, UltimateAuth follows the same principle:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EEasy to start. Powerful when needed. Consistent as you grow.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EYou can begin with a straightforward authentication setup and progressively adopt the capabilities your application actually requires.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth can also serve smaller applications, but its architecture becomes especially valuable when authentication requirements extend beyond a basic login form.\u003C/p\u003E\n\u003Cp\u003EIf your application only needs a minimal authentication mechanism, evaluate whether UltimateAuth\u0027s broader lifecycle model provides enough value for your use case.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022current-scope-and-maturity\u0022\u003ECurrent Scope and Maturity\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth is an evolving open-source framework.\u003C/p\u003E\n\u003Cp\u003EIts architecture covers several authentication models and client environments, but not every designed capability is necessarily available in the current release.\u003C/p\u003E\n\u003Cp\u003EIn particular:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication mode availability must be checked against the current server implementation.\u003C/li\u003E\n\u003Cli\u003EClient adapter availability varies by platform.\u003C/li\u003E\n\u003Cli\u003ESome advanced session and device policy options may be reserved for future enforcement.\u003C/li\u003E\n\u003Cli\u003EProduction adoption requires appropriate configuration, persistence, deployment security, and testing.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe documentation distinguishes supported behavior from planned or partially implemented capabilities.\u003C/p\u003E\n\u003Cp\u003EThis matters because a trustworthy authentication framework should be clear not only about what it can do, but also about its current limits.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022open-source-first.self-hosted-by-design\u0022\u003EOpen Source First. Self-Hosted by Design.\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth is developed as an open-source project with self-hosting at its foundation.\u003C/p\u003E\n\u003Cp\u003EThe project\u0027s direction is to keep self-hosted authentication free, while a potential managed hosting service could provide an alternative for teams that prefer not to operate the infrastructure themselves.\u003C/p\u003E\n\u003Cp\u003EThe intention is not to divide authentication capabilities into free and paid feature tiers.\u003C/p\u003E\n\u003Cp\u003EIt is to make the framework accessible, inspectable, extensible, and useful to the .NET community.\u003C/p\u003E\n\u003Cp\u003E\u003Ca href=\u0022https://github.com/CodeBeamOrg/UltimateAuth\u0022\u003EView UltimateAuth on GitHub\u003C/a\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choose-your-starting-point\u0022\u003EChoose Your Starting Point\u003C/h2\u003E\n\u003Cp\u003EYou do not need to understand the entire architecture before building your first application.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EI want to\u2026\u003C/th\u003E\n\u003Cth\u003EStart here\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESet up UltimateAuth for the first time\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/getting-started/quickstart\u0022\u003EQuickStart\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUnderstand how authentication works internally\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/auth-flows/overview\u0022\u003EAuth Flows\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EConfigure session, token, and security behavior\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EIntegrate authentication into a Blazor application\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUnderstand the source code and contribute\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022https://github.com/CodeBeamOrg/UltimateAuth\u0022\u003EGitHub Repository\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Chr\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-is-a-lifecycle-not-a-login-endpoint\u0022\u003EAuthentication is a lifecycle, not a login endpoint.\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth brings together the concepts needed to establish, maintain, evaluate, and terminate authentication within a consistent .NET architecture.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EStart simple. Understand the security model. Extend when you need to.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ca href=\u0022/docs/getting-started/quickstart\u0022\u003EContinue to QuickStart\u003C/a\u003E\u003C/p\u003E\n", + "Html": "\n\u003Cp\u003E\u003Cstrong\u003EModern authentication and authorization for .NET \u2014 built around a unified security lifecycle.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EAuthentication starts with a login. But it doesn\u0027t end there.\u003C/p\u003E\n\u003Cp\u003EAs applications grow, they introduce new challenges: multiple clients, refresh tokens, device sessions, credential recovery, tenant isolation, permissions, and revocation. What begins as a simple login system can gradually become a collection of disconnected security mechanisms.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth takes a different approach.\u003C/p\u003E\n\u003Cp\u003EIt brings authentication, authorization, users, credentials, sessions, and client integration into \u003Cstrong\u003Eone coherent framework\u003C/strong\u003E, with a shared model for how security decisions are made and how authentication state changes over time.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EOne framework. Multiple client environments. A consistent security lifecycle.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ca href=\u0022https://github.com/CodeBeamOrg/UltimateAuth\u0022\u003EExplore the Source\u003C/a\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-ultimateauth\u0022\u003EWhy UltimateAuth?\u003C/h2\u003E\n\u003Cp\u003EMost applications don\u0027t struggle with generating an access token.\u003C/p\u003E\n\u003Cp\u003EThey struggle with everything that comes afterward.\u003C/p\u003E\n\u003Cp\u003EConsider an application that starts with a single web frontend. Eventually, it adds a mobile application, an administration panel, multiple organizations, and external APIs.\u003C/p\u003E\n\u003Cp\u003ESuddenly, authentication raises questions that a basic login implementation doesn\u0027t answer:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EHow should browser sessions and API tokens coexist?\u003C/li\u003E\n\u003Cli\u003ECan users see and revoke sessions associated with their devices?\u003C/li\u003E\n\u003Cli\u003EWhat happens to existing sessions after a password reset?\u003C/li\u003E\n\u003Cli\u003EHow do we prevent refresh token replay?\u003C/li\u003E\n\u003Cli\u003EHow do we enforce tenant boundaries consistently?\u003C/li\u003E\n\u003Cli\u003EHow do we keep authorization decisions separate from authentication?\u003C/li\u003E\n\u003Cli\u003ECan multiple application types use the same backend security model?\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese concerns are related. Implementing each independently makes the system harder to maintain, audit, and extend.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUltimateAuth is designed to manage these concerns as parts of the same security lifecycle.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-different-way-to-think-about-authentication\u0022\u003EA Different Way to Think About Authentication\u003C/h2\u003E\n\u003Cp\u003ETraditional authentication integration is often organized around credentials and their immediate results:\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\u003ECredentials\n \u2193\nValidate\n \u2193\nIssue Token\n \u2193\nAuthenticated\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThat sequence is necessary, but incomplete.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth approaches authentication as a longer-running lifecycle:\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 UltimateAuth\n \u2502\n \u25BC\n Request Context\n Client \u00B7 Tenant \u00B7 Device\n \u2502\n \u25BC\n Authentication\n Validation \u00B7 Decisions\n \u2502\n \u25BC\n Security State\n User \u00B7 Root \u00B7 Chain \u00B7 Session\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC \u25BC\n Refresh Logout Revoke\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 \u25BC\n Controlled State\n Transitions\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis model makes it possible to reason about authentication beyond a single request.\u003C/p\u003E\n\u003Cp\u003ELogin establishes authentication. Refresh evaluates whether it may continue. Logout and revocation terminate authentication at the appropriate scope. Credential changes and security policies can affect existing sessions.\u003C/p\u003E\n\u003Cp\u003EThe result is a framework where these operations share a consistent security vocabulary.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-makes-ultimateauth-different\u0022\u003EWhat Makes UltimateAuth Different?\u003C/h2\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003E\u003Cescape\u003E\u003C/escape\u003E\u003C/th\u003E\n\u003Cth\u003ECapability\u003C/th\u003E\n\u003Cth\u003EUltimateAuth\u0027s approach\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EUnified architecture\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication, sessions, users, credentials, and authorization share a common foundation\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EClient-aware behavior\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication can adapt to the application profile and effective server configuration\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESession lifecycle\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ERoot, chain, and session concepts support different scopes of session management\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EFlow-driven execution\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication operations use explicit context, validation, decisions, and state transitions\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ECredential lifecycle\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential changes, recovery, and session invalidation are related security operations\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ETenant awareness\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ETenant context participates in authentication and access decisions\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EModularity\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ECore, Server, Client, and domain packages separate responsibilities\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ESelf-hosting\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EApplications can operate their own authentication infrastructure\u003C/td\u003E\n\u003Ctd\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\n\u003Cp\u003EUltimateAuth does not claim that tokens, sessions, PKCE, or policy-based authorization are new concepts.\u003C/p\u003E\n\u003Cp\u003EIts value is in \u003Cstrong\u003Ebringing established security concepts together under a consistent architecture\u003C/strong\u003E, rather than requiring every application to connect them independently.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022one-security-model-across-different-clients\u0022\u003EOne Security Model Across Different Clients\u003C/h2\u003E\n\u003Cp\u003EA browser application, a server-rendered application, and a native client have different security constraints.\u003C/p\u003E\n\u003Cp\u003EThey should not necessarily use identical credential storage, transport, or authentication flows.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth separates the common authentication model from client-specific integration.\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 Your .NET Applications\n\n Blazor Server Blazor WebAssembly\n \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n UltimateAuth Client\n \u2502\n \u25BC\n UltimateAuth Server\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC \u25BC\n Users Sessions Authorization\n \u2502 \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u25BC\n Shared Security\n Lifecycle\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe architecture also provides foundations for .NET MAUI, traditional ASP.NET Core applications, and API-oriented integrations.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESupport depends on the client adapter and authentication modes available in the installed version.\u003C/strong\u003E A supported architectural profile should not be confused with a fully released platform adapter.\u003C/p\u003E\n\u003Cp\u003EThe goal is to share authentication concepts without pretending that all clients have the same trust boundaries.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022sessions-are-more-than-tokens\u0022\u003ESessions Are More Than Tokens\u003C/h2\u003E\n\u003Cp\u003EOne of UltimateAuth\u0027s central concepts is its stateful session 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 \u2014 Browser A\n \u2502 \u251C\u2500\u2500 Session\n \u2502 \u2514\u2500\u2500 Session\n \u2502\n \u2514\u2500\u2500 Chain \u2014 Device B\n \u251C\u2500\u2500 Session\n \u2514\u2500\u2500 Session\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach level represents a different security scope.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ERoot\u003C/strong\u003E represents a broader authentication security boundary.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EChain\u003C/strong\u003E represents the continuity of authentication associated with a device or client context.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ESession\u003C/strong\u003E represents an individual authentication instance within that chain.\u003C/p\u003E\n\u003Cp\u003EThis distinction makes several operations easier to express:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EEnd the current session.\u003C/li\u003E\n\u003Cli\u003ERevoke a particular device-associated chain.\u003C/li\u003E\n\u003Cli\u003ERevoke other active chains while preserving the current one.\u003C/li\u003E\n\u003Cli\u003ERevoke a broader authentication scope after a security-sensitive event.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA token is a credential used to access the system. It is not necessarily the complete record of the user\u0027s authentication lifecycle.\u003C/p\u003E\n\u003Cp\u003EThe hierarchy applies to session-backed authentication modes; different modes can have different persistence and validation characteristics.\u003C/p\u003E\n\u003Cp\u003E\u003Ca href=\u0022https://github.com/CodeBeamOrg/UltimateAuth\u0022\u003EExplore Session Management\u003C/a\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-flows-not-disconnected-endpoints\u0022\u003EAuthentication Flows, Not Disconnected Endpoints\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth organizes security-sensitive operations around explicit flows.\u003C/p\u003E\n\u003Cp\u003EA flow can combine:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003ERequest and tenant context.\u003C/li\u003E\n\u003Cli\u003EUser, credential, and session resolution.\u003C/li\u003E\n\u003Cli\u003EInput and security validation.\u003C/li\u003E\n\u003Cli\u003EAuthorization and authority decisions.\u003C/li\u003E\n\u003Cli\u003EControlled state transitions.\u003C/li\u003E\n\u003Cli\u003EClient-appropriate results and responses.\u003C/li\u003E\n\u003C/ol\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\u003ERequest\n \u2193\nAuthFlowContext\n \u2193\nValidation\n \u2193\nSecurity Decision\n \u2193\nExecution\n \u2193\nState Transition\n \u2193\nResponse\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis approach provides a consistent place for security rules to be evaluated.\u003C/p\u003E\n\u003Cp\u003EIt also makes individual operations easier to test and inspect because the important decisions are part of an explicit execution model.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EThe purpose is not abstraction for its own sake. It is to make authentication behavior understandable and predictable.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-continues-after-login\u0022\u003ESecurity Continues After Login\u003C/h2\u003E\n\u003Cp\u003EA secure authentication system must account for events that happen after a user signs in.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EEvent\u003C/th\u003E\n\u003Cth\u003EUltimateAuth concept\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA user signs in\u003C/td\u003E\n\u003Ctd\u003ELogin flow\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA session needs renewal\u003C/td\u003E\n\u003Ctd\u003ERefresh flow\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA user signs out\u003C/td\u003E\n\u003Ctd\u003ELogout flow\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA device should lose access\u003C/td\u003E\n\u003Ctd\u003EChain revocation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA credential is changed\u003C/td\u003E\n\u003Ctd\u003ECredential lifecycle and session policy\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAn account is recovered\u003C/td\u003E\n\u003Ctd\u003ERecovery proof and session invalidation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA user requests a protected resource\u003C/td\u003E\n\u003Ctd\u003EAuthorization decision\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA request targets a tenant\u003C/td\u003E\n\u003Ctd\u003ETenant-aware security context\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThis is why UltimateAuth treats session management, credential management, and authorization as connected parts of the system.\u003C/p\u003E\n\u003Cp\u003EFor example, a password reset is not simply a database update. It can also affect the validity of existing authentication sessions according to the configured credential session policy.\u003C/p\u003E\n\u003Cp\u003ESimilarly, logout and revocation are not interchangeable operations. They have different scopes and consequences.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-and-authorization-together\u0022\u003EAuthentication and Authorization Together\u003C/h2\u003E\n\u003Cp\u003EKnowing who a user is does not determine what that user is allowed to do.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth separates authentication from authorization while keeping them within the same overall security architecture.\u003C/p\u003E\n\u003Cp\u003EAuthentication establishes identity and applicable security context.\u003C/p\u003E\n\u003Cp\u003EAuthorization evaluates whether an actor may perform an action on a resource.\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\u003EActor: Authenticated user\nAction: update\nResource: products\nResult: Allowed or Denied\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERoles and permissions can be managed through the authorization domain, while the server remains responsible for enforcing access decisions.\u003C/p\u003E\n\u003Cp\u003EThis separation helps applications avoid spreading authorization logic across UI components, controllers, and unrelated service methods.\u003C/p\u003E\n\u003Cp\u003EClient-side authorization checks can improve the interface, but \u003Cstrong\u003Eserver-side enforcement remains the security boundary\u003C/strong\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022tenant-aware-by-design\u0022\u003ETenant-Aware by Design\u003C/h2\u003E\n\u003Cp\u003EMulti-tenant authentication involves more than adding a tenant identifier to a user record.\u003C/p\u003E\n\u003Cp\u003EA request must be interpreted within the correct tenant context, and security operations must respect that boundary.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides tenant resolution and propagation mechanisms that participate in its request and flow infrastructure.\u003C/p\u003E\n\u003Cp\u003EThis allows applications to build tenant-aware authentication and authorization behavior without treating tenancy as an unrelated afterthought.\u003C/p\u003E\n\u003Cp\u003ETenant context must still be configured correctly, and a client-supplied tenant identifier is never sufficient proof of authorization.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022modular-without-becoming-fragmented\u0022\u003EModular Without Becoming Fragmented\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth is divided into packages with distinct responsibilities.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EPackage or domain\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\u003Cstrong\u003ECore\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EShared contracts, domain concepts, and authentication foundations\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EServer\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthentication execution, runtime configuration, and server integration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EClient\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EPlatform-independent authentication and domain APIs\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EClient.Blazor\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EBlazor-specific transport, storage, and authentication state integration\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EUsers\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EUser lifecycle, profiles, and identifiers\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003ECredentials\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ECredential operations, changes, and recovery\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EAuthorization\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003ERoles, permissions, and access checks\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EPolicies\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EApplication access policy integration\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThis structure supports both a straightforward integration experience and deeper customization where the application requires it.\u003C/p\u003E\n\u003Cp\u003EDevelopers can begin with the public registration and client APIs without first learning every internal service.\u003C/p\u003E\n\u003Cp\u003EWhen necessary, they can explore the underlying flows, policies, stores, and extension points.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022designed-for-practical.net-development\u0022\u003EDesigned for Practical .NET Development\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth is intended to fit naturally into .NET applications.\u003C/p\u003E\n\u003Cp\u003EA server application begins by registering UltimateAuth and configuring the security behavior it needs:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.CredentialSessionPolicy.OnRecovery = CredentialSessionBehavior.RevokeAll;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA Blazor application registers the client adapter:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.AutoDetectApplicationProfile = true;\n options.Endpoints.BasePath = \u0026quot;/auth\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThese examples illustrate the configuration entry points rather than a complete application setup.\u003C/p\u003E\n\u003Cp\u003EThe server and client have different responsibilities, and a complete deployment also needs the appropriate hosting, persistence, transport, and authentication integration.\u003C/p\u003E\n\u003Cp\u003EThe important idea is that common behavior is configured through structured options rather than scattered application-specific code.\u003C/p\u003E\n\u003Cp\u003E\u003Ca href=\u0022/docs/getting-started/quickstart\u0022\u003EStart with QuickStart\u003C/a\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022who-is-ultimateauth-for\u0022\u003EWho Is UltimateAuth For?\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth is particularly relevant if you are building:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EA Blazor application\u003C/strong\u003E that needs authentication and authorization integrated with its hosting model.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EA multi-client .NET system\u003C/strong\u003E where different frontends should share the same authentication backend.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EAn application with device-aware sessions\u003C/strong\u003E where users or administrators need control over active authentication.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EA multi-tenant platform\u003C/strong\u003E with explicit tenant resolution and security boundaries.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EA security-sensitive application\u003C/strong\u003E that requires controlled refresh, credential recovery, and revocation behavior.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EA self-hosted system\u003C/strong\u003E where the team wants visibility into and control over its authentication infrastructure.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003E\u003Cstrong\u003EFrom a simple login page to a complex authentication platform, UltimateAuth is designed to make getting started easy without limiting what comes next.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EYou shouldn\u0027t need to understand an entire identity framework just to add authentication to a small .NET application. And you shouldn\u0027t need to replace your authentication system when that application grows.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth is built for both.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022simple-applications.simple-beginnings\u0022\u003ESimple Applications. Simple Beginnings.\u003C/h3\u003E\n\u003Cp\u003EFor a small application, authentication should be straightforward.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth aims to provide a lightweight integration experience with clear configuration, sensible defaults, and ready-to-use authentication flows.\u003C/p\u003E\n\u003Cp\u003EInstead of requiring developers to assemble numerous identity components before they can begin, UltimateAuth provides a cohesive foundation that can be configured through a small number of well-defined entry points.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EStart with what you need. You don\u0027t have to configure everything the framework supports.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022complex-applications.room-to-grow\u0022\u003EComplex Applications. Room to Grow.\u003C/h3\u003E\n\u003Cp\u003EWhen requirements become more demanding, the same framework provides a deeper security architecture.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth is particularly useful for applications requiring multiple client types, device-aware session management, tenant isolation, advanced authorization, credential recovery, controlled refresh, and targeted revocation.\u003C/p\u003E\n\u003Cp\u003EIts modular architecture, explicit authentication flows, configurable policies, and extension points allow developers to introduce additional capabilities without abandoning the original authentication foundation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EThe complexity of your application should not determine how difficult authentication is to begin with.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022one-framework-for-both\u0022\u003EOne Framework for Both\u003C/h3\u003E\n\u003Cp\u003EWhether you\u0027re building a small personal project, a business application, a SaaS platform, or a larger distributed system, UltimateAuth follows the same principle:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EEasy to start. Powerful when needed. Consistent as you grow.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EYou can begin with a straightforward authentication setup and progressively adopt the capabilities your application actually requires.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth can also serve smaller applications, but its architecture becomes especially valuable when authentication requirements extend beyond a basic login form.\u003C/p\u003E\n\u003Cp\u003EIf your application only needs a minimal authentication mechanism, evaluate whether UltimateAuth\u0027s broader lifecycle model provides enough value for your use case.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022current-scope-and-maturity\u0022\u003ECurrent Scope and Maturity\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth is an evolving open-source framework.\u003C/p\u003E\n\u003Cp\u003EIts architecture covers several authentication models and client environments, but not every designed capability is necessarily available in the current release.\u003C/p\u003E\n\u003Cp\u003EIn particular:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EAuthentication mode availability must be checked against the current server implementation.\u003C/li\u003E\n\u003Cli\u003EClient adapter availability varies by platform.\u003C/li\u003E\n\u003Cli\u003ESome advanced session and device policy options may be reserved for future enforcement.\u003C/li\u003E\n\u003Cli\u003EProduction adoption requires appropriate configuration, persistence, deployment security, and testing.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe documentation distinguishes supported behavior from planned or partially implemented capabilities.\u003C/p\u003E\n\u003Cp\u003EThis matters because a trustworthy authentication framework should be clear not only about what it can do, but also about its current limits.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022open-source-first.self-hosted-by-design\u0022\u003EOpen Source First. Self-Hosted by Design.\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth is developed as an open-source project with self-hosting at its foundation.\u003C/p\u003E\n\u003Cp\u003EThe project\u0027s direction is to keep self-hosted authentication free, while a potential managed hosting service could provide an alternative for teams that prefer not to operate the infrastructure themselves.\u003C/p\u003E\n\u003Cp\u003EThe intention is not to divide authentication capabilities into free and paid feature tiers.\u003C/p\u003E\n\u003Cp\u003EIt is to make the framework accessible, inspectable, extensible, and useful to the .NET community.\u003C/p\u003E\n\u003Cp\u003E\u003Ca href=\u0022https://github.com/CodeBeamOrg/UltimateAuth\u0022\u003EView UltimateAuth on GitHub\u003C/a\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choose-your-starting-point\u0022\u003EChoose Your Starting Point\u003C/h2\u003E\n\u003Cp\u003EYou do not need to understand the entire architecture before building your first application.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EI want to\u2026\u003C/th\u003E\n\u003Cth\u003EStart here\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESet up UltimateAuth for the first time\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/getting-started/quickstart\u0022\u003EQuickStart\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUnderstand how authentication works internally\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/auth-flows/overview\u0022\u003EAuth Flows\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EConfigure session, token, and security behavior\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EIntegrate authentication into a Blazor application\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022/docs/configuration/client-options\u0022\u003EClient Options\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUnderstand the source code and contribute\u003C/td\u003E\n\u003Ctd\u003E\u003Ca href=\u0022https://github.com/CodeBeamOrg/UltimateAuth\u0022\u003EGitHub Repository\u003C/a\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Chr\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-is-a-lifecycle-not-a-login-endpoint\u0022\u003EAuthentication is a lifecycle, not a login endpoint.\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth brings together the concepts needed to establish, maintain, evaluate, and terminate authentication within a consistent .NET architecture.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EStart simple. Understand the security model. Extend when you need to.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003E\u003Ca href=\u0022/docs/getting-started/quickstart\u0022\u003EContinue to QuickStart\u003C/a\u003E\u003C/p\u003E\n", "Headings": [ { "Id": "why-ultimateauth", @@ -99,6 +99,6 @@ "Level": 1 } ], - "SourceHash": "3A868457D213F78331D24F076C007DC26666D004350B234C150C0A326408207B", + "SourceHash": "3FDA0501474DBC0BD868279B1FE5B4D730D50AA7B9305756C8351B3191D3757D", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/getting-started/real-world-setup.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/getting-started/real-world-setup.json index 303e94da..74d3909d 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/getting-started/real-world-setup.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/getting-started/real-world-setup.json @@ -1,7 +1,7 @@ { "Slug": "getting-started/real-world-setup", "Title": "Real World Setup", - "Html": "\n\u003Cp\u003E\u003Cstrong\u003EOne authentication framework. Different deployment models.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe \u003Ca href=\u0022/docs/getting-started/quickstart\u0022\u003EQuickStart\u003C/a\u003E demonstrates UltimateAuth with Blazor Server and in-memory storage.\u003C/p\u003E\n\u003Cp\u003EReal applications may require persistent data, a separate authentication server, browser-based clients, or independently deployed APIs.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth supports these scenarios through different service registrations and hosting integrations. You can choose the architecture that fits your application without configuring every available component.\u003C/p\u003E\n\u003Cp\u003EThis guide covers the setup patterns demonstrated by the UltimateAuth samples.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choose-your-architecture\u0022\u003E1. Choose Your Architecture\u003C/h2\u003E\n\u003Cp\u003EStart by identifying where authentication is hosted and how your application communicates with it.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication architecture\u003C/th\u003E\n\u003Cth\u003EAuthentication host\u003C/th\u003E\n\u003Cth\u003EApplication registration\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server, single project\u003C/td\u003E\n\u003Ctd\u003ESame application\u003C/td\u003E\n\u003Ctd\u003EServer \u002B persistence \u002B Blazor client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server with EF Core\u003C/td\u003E\n\u003Ctd\u003ESame application\u003C/td\u003E\n\u003Ctd\u003EServer \u002B EF Core \u002B Blazor client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDedicated UAuthHub\u003C/td\u003E\n\u003Ctd\u003ESeparate authentication application\u003C/td\u003E\n\u003Ctd\u003EServer \u002B persistence \u002B Hub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EStandalone Blazor WASM\u003C/td\u003E\n\u003Ctd\u003ERemote UAuthHub\u003C/td\u003E\n\u003Ctd\u003EBlazor client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Web App, Interactive WASM\u003C/td\u003E\n\u003Ctd\u003ERemote UAuthHub\u003C/td\u003E\n\u003Ctd\u003EHost integration \u002B WASM client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESeparate Resource API\u003C/td\u003E\n\u003Ctd\u003ERemote UAuthHub\u003C/td\u003E\n\u003Ctd\u003EResource API integration\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese models can be combined.\u003C/p\u003E\n\u003Cp\u003EFor example, an application might use an EF Core-backed UAuthHub, a standalone Blazor WASM frontend, and a separate Resource API.\u003C/p\u003E\n\u003Cp\u003EThe frontend handles user interaction, UAuthHub manages authentication, and the Resource API enforces access to protected resources.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022cryptographic-key-configuration\u0022\u003ECryptographic Key Configuration\u003C/h2\u003E\n\u003Cp\u003EEvery application hosting UltimateAuth Server must configure its cryptographic secrets securely.\u003C/p\u003E\n\u003Cp\u003EThis applies to integrated Blazor Server applications, standalone UAuthHub deployments, and applications using either in-memory or Entity Framework Core persistence.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022required-key-configuration\u0022\u003ERequired key configuration\u003C/h3\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\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 for 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 signing of JWT access tokens\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EBoth settings accept Base64-encoded keys containing at least 32 bytes of cryptographically secure random key material.\u003C/p\u003E\n\u003Cp\u003EPureOpaque does not issue JWT access tokens, but it should still configure the token-hashing key.\u003C/p\u003E\n\u003Cp\u003EHybrid and PureJwt require JWT signing capability.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-configuration\u0022\u003ERecommended configuration\u003C/h3\u003E\n\u003Cp\u003EStore secrets outside application source code.\u003C/p\u003E\n\u003Cp\u003EFor local development, use .NET User Secrets. For deployed applications, use environment variables or a trusted secret-management service.\u003C/p\u003E\n\u003Cp\u003EEnvironment variable names:\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\u003EThe double underscore (\u003Ccode\u003E__\u003C/code\u003E) represents a configuration hierarchy separator in .NET environment-variable configuration.\u003C/p\u003E\n\u003Cp\u003EConfigure 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.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;UltimateAuth token hashing key is missing.\u0026quot;);\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;UltimateAuth JWT signing key is missing.\u0026quot;);\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDo not generate new keys automatically on every application startup. Keys must remain consistent across application instances that share authentication state.\u003C/p\u003E\n\u003Cp\u003ENever use the same key for token hashing and JWT signing.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-verification-keys\u0022\u003EResource API verification keys\u003C/h3\u003E\n\u003Cp\u003EA Resource API using PureJwt validates JWT signatures with trusted verification keys.\u003C/p\u003E\n\u003Cp\u003EThe built-in HS256 configuration uses symmetric cryptography, so the Resource API must be configured with the same JWT key material used by the issuing UAuthHub.\u003C/p\u003E\n\u003Cp\u003EThe Resource API does not require the Hub\u0027s token-hashing key.\u003C/p\u003E\n\u003Cp\u003EProtect JWT verification keys as secrets when using symmetric signing algorithms.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022persistent-storage-with-entity-framework-core\u0022\u003E2. Persistent Storage with Entity Framework Core\u003C/h2\u003E\n\u003Cp\u003EFor applications that need authentication state to survive restarts, use a persistent storage provider.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides an Entity Framework Core bundle that registers its reference domain implementations and EF Core-backed stores.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022install-packages\u0022\u003EInstall packages\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.EntityFrameworkCore.Bundle\ndotnet add package Microsoft.EntityFrameworkCore.Sqlite\ndotnet add package Microsoft.EntityFrameworkCore.Design\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe SQLite provider is used here for simplicity. You can use another compatible EF Core database provider.\u003C/p\u003E\n\u003Cp\u003EWhen using the EF Core bundle, you do not need the in-memory bundle.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022register-the-services\u0022\u003ERegister the services\u003C/h3\u003E\n\u003Cp\u003EIn \u003Ccode\u003EProgram.cs\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\u003Eusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing CodeBeam.UltimateAuth.Server.Extensions;\nusing Microsoft.EntityFrameworkCore;\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;Token hashing key is missing.\u0026quot;);\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;JWT signing key is missing.\u0026quot;);\n})\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(\u0026quot;Data Source=uauth.db\u0026quot;, sqlite =\u0026gt; sqlite.MigrationsAssembly(typeof(Program).Assembly.GetName().Name!));\n });\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAddUltimateAuthEntityFrameworkCore()\u003C/code\u003E registers the EF Core stores and reference domain implementations.\u003C/p\u003E\n\u003Cp\u003EThe bundle provides a unified \u003Ccode\u003EUAuthDbContext\u003C/code\u003E for the supported authentication domains.\u003C/p\u003E\n\u003Cp\u003EYou do not need to register each user, session, credential, token, or authorization store individually.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-database-connection\u0022\u003EConfigure the database connection\u003C/h3\u003E\n\u003Cp\u003EFor a deployed application, prefer configuration over hardcoded connection strings.\u003C/p\u003E\n\u003Cp\u003E\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;ConnectionStrings\u0026quot;: {\n \u0026quot;UltimateAuth\u0026quot;: \u0026quot;Data Source=uauth.db\u0026quot;\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EProgram.cs\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\u003Evar connectionString = builder.Configuration.GetConnectionString(\u0026quot;UltimateAuth\u0026quot;)\n ?? throw new InvalidOperationException(\u0026quot;UltimateAuth connection string is missing.\u0026quot;);\n\nbuilder.Services.AddUltimateAuthServer()\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(connectionString);\n });\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor production databases, use your deployment environment\u0027s secret management facilities rather than storing credentials in source control.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022database-migrations\u0022\u003EDatabase migrations\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth does not automatically create or apply migrations when the EF Core bundle is registered.\u003C/p\u003E\n\u003Cp\u003EYour application owns the database migration lifecycle.\u003C/p\u003E\n\u003Cp\u003EInstall the EF Core CLI if 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\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet tool install --global dotnet-ef\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ECreate the initial migration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet ef migrations add InitUAuth --context UAuthDbContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApply it:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet ef database update --context UAuthDbContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor Visual Studio Package Manager Console:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EPOWERSHELL\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-powershell\u0022\u003EAdd-Migration InitUAuth -Context UAuthDbContext\nUpdate-Database -Context UAuthDbContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EInstall \u003Ccode\u003EMicrosoft.EntityFrameworkCore.Tools\u003C/code\u003E if required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022applying-migrations-programmatically\u0022\u003EApplying migrations programmatically\u003C/h3\u003E\n\u003Cp\u003EThe EF Core samples demonstrate initialization through a scoped \u003Ccode\u003EUAuthDbContext\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor a controlled development 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore;\n\nusing (var scope = app.Services.CreateScope())\n{\n var db = scope.ServiceProvider.GetRequiredService\u0026lt;UAuthDbContext\u0026gt;();\n await db.Database.MigrateAsync();\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis applies pending migrations. It does not generate migration files.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EProduction guidance:\u003C/strong\u003E Prefer applying reviewed migrations as a separate deployment step, particularly when multiple application instances share a database.\u003C/p\u003E\n\u003Cp\u003EDo not copy the sample initializer\u0027s \u003Ccode\u003Ereset: true\u003C/code\u003E behavior into production. The samples use database reset functionality for repeatable demonstrations, not as a safe deployment strategy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022optional-sample-accounts-with-ef-core\u0022\u003EOptional: sample accounts with EF Core\u003C/h3\u003E\n\u003Cp\u003EThe sample seed package can also work with EF Core persistence.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Sample.Seed\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister the scoped seed 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddScopedUltimateAuthSampleSeed();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAfter preparing the database:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eif (app.Environment.IsDevelopment())\n{\n await app.SeedUltimateAuthAsync();\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe difference matters:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EAddUltimateAuthSampleSeed()\u003C/code\u003E is used by the in-memory samples.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EAddScopedUltimateAuthSampleSeed()\u003C/code\u003E is used by the EF Core samples.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EDo not deploy the demonstration accounts and passwords to production.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server-integrated-authentication\u0022\u003E3. Blazor Server \u2014 Integrated Authentication\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E A Blazor Server application that wants to host its own authentication system.\u003C/p\u003E\n\u003Cp\u003EThis is the simplest deployment model for a server-side Blazor application.\u003C/p\u003E\n\u003Cp\u003EThe application hosts UltimateAuth Server and uses the Blazor client adapter in the same project.\u003C/p\u003E\n\u003Cp\u003EA separate UAuthHub is not required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022packages\u0022\u003EPackages\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\ndotnet add package CodeBeam.UltimateAuth.EntityFrameworkCore.Bundle\ndotnet add package Microsoft.EntityFrameworkCore.Sqlite\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022services\u0022\u003EServices\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\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing CodeBeam.UltimateAuth.Server.Extensions;\nusing Microsoft.EntityFrameworkCore;\n\nbuilder.Services\n .AddRazorComponents()\n .AddInteractiveServerComponents();\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;Token hashing key is missing.\u0026quot;);\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;JWT signing key is missing.\u0026quot;);\n})\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(\u0026quot;Data Source=uauth.db\u0026quot;);\n });\n\nbuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022pipeline\u0022\u003EPipeline\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\u003Eapp.UseHttpsRedirection();\napp.UseStaticFiles();\n\napp.UseUltimateAuthWithAspNetCore();\napp.UseAntiforgery();\n\napp.MapUltimateAuthEndpoints();\n\napp.MapRazorComponents\u0026lt;App\u0026gt;()\n .AddInteractiveServerRenderMode()\n .AddUltimateAuthRoutes(UAuthAssemblies.BlazorClient());\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAlso configure the \u003Ccode\u003EUAuthApp\u003C/code\u003E root component, login page, and UltimateAuth JavaScript file as demonstrated in QuickStart.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-behavior\u0022\u003EAuthentication behavior\u003C/h3\u003E\n\u003Cp\u003EThe default application profile resolution selects \u003Ccode\u003EPureOpaque\u003C/code\u003E for Blazor Server.\u003C/p\u003E\n\u003Cp\u003EThis uses session-oriented authentication rather than requiring the application to manage access and refresh tokens manually.\u003C/p\u003E\n\u003Cp\u003EYou can configure session lifetimes, login policies, credential policies, and other behavior through \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\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.Login.MaxFailedAttempts = 5;\n options.Login.LockoutDuration = TimeSpan.FromMinutes(15);\n options.Session.Lifetime = TimeSpan.FromDays(7);\n options.Identifiers.Behavior.AllowMultipleUsernames = true;\n options.Password.Level = PasswordPolicyLevel.Strict;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe effective authentication mode is resolved at runtime. The application does not need to select a single mode globally.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022password-security-configuration\u0022\u003EPassword Security Configuration\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth uses the Standard password policy by default. Applications can select Basic or Strict, or override individual requirements through \u003Ccode\u003Eoptions.Password\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor the preset comparison, configuration examples, and password-history settings, see \u003Ca href=\u0022/docs/security/password-policy\u0022\u003EPassword Policy \u0026amp; History\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022uauthhub-dedicated-authentication-server\u0022\u003E4. UAuthHub \u2014 Dedicated Authentication Server\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E Applications where multiple clients share one authentication authority.\u003C/p\u003E\n\u003Cp\u003EUAuthHub hosts UltimateAuth\u0027s authentication services separately from your frontend applications.\u003C/p\u003E\n\u003Cp\u003EIt is particularly relevant for standalone WASM applications, Interactive WASM applications, and systems with separate Resource APIs.\u003C/p\u003E\n\u003Cp\u003EA typical architecture looks like this:\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 Standalone WASM Interactive WASM\n \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u25BC\n UAuthHub\n Authentication\n Sessions \u0026amp; Users\n \u2502\n \u25BC\n Persistence\n\n Resource API \u2500\u2500\u2500\u25BA UAuthHub\n (validation)\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022create-the-hub-application\u0022\u003ECreate the Hub application\u003C/h3\u003E\n\u003Cp\u003EA UAuthHub can be hosted in an ASP.NET Core Blazor Server application.\u003C/p\u003E\n\u003Cp\u003EThe current samples use Blazor Server to provide the Hub\u0027s login UI.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022in-memory-uauthhub\u0022\u003EIn-memory UAuthHub\u003C/h3\u003E\n\u003Cp\u003EFor development:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\ndotnet add package CodeBeam.UltimateAuth.InMemory.Bundle\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.InMemory;\nusing CodeBeam.UltimateAuth.Server.Extensions;\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;Token hashing key is missing.\u0026quot;);\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;JWT signing key is missing.\u0026quot;);\n})\n .AddUltimateAuthInMemory()\n .AddUAuthHub(options =\u0026gt;\n {\n options.AllowedClientOrigins.Add(\u0026quot;https://localhost:6130\u0026quot;);\n });\n\nbuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Hub\u0027s Blazor client registration is needed when the Hub itself hosts UltimateAuth-powered Blazor pages and login UI.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022ef-core-uauthhub\u0022\u003EEF Core UAuthHub\u003C/h3\u003E\n\u003Cp\u003EFor persistent storage:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore;\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;Token hashing key is missing.\u0026quot;);\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;JWT signing key is missing.\u0026quot;);\n})\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(\u0026quot;Data Source=uauthhub.db\u0026quot;);\n })\n .AddUAuthHub(options =\u0026gt;\n {\n options.AllowedClientOrigins.Add(\u0026quot;https://localhost:6132\u0026quot;);\n });\n\nbuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe \u003Ccode\u003EAllowedClientOrigins\u003C/code\u003E collection identifies browser origins permitted to interact with the Hub.\u003C/p\u003E\n\u003Cp\u003EUse exact origins, including scheme and port. Do not include paths such as \u003Ccode\u003E/home\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022hub-pipeline\u0022\u003EHub pipeline\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\u003Eapp.UseHttpsRedirection();\n\napp.UseUltimateAuthWithAspNetCore();\napp.UseAntiforgery();\n\napp.MapUltimateAuthEndpoints();\napp.MapUAuthHub();\n\napp.MapStaticAssets();\n\napp.MapRazorComponents\u0026lt;App\u0026gt;()\n .AddInteractiveServerRenderMode()\n .AddUltimateAuthRoutes(UAuthAssemblies.BlazorClient());\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EMapUltimateAuthEndpoints()\u003C/code\u003E maps the authentication endpoints.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EMapUAuthHub()\u003C/code\u003E maps the Hub-specific entry endpoint.\u003C/p\u003E\n\u003Cp\u003EBoth registrations are used by the current UAuthHub samples.\u003C/p\u003E\n\u003Cp\u003EThe Hub also needs its login page and Blazor application lifecycle components.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-origins\u0022\u003EChoosing origins\u003C/h3\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication\u003C/th\u003E\n\u003Cth\u003EURL\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUAuthHub\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ehttps://localhost:6112\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EStandalone WASM\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ehttps://localhost:6130\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EInteractive WASM\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ehttps://localhost:6132\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EConfigure the Hub\u0027s allowed origins for the actual frontend applications it serves.\u003C/p\u003E\n\u003Cp\u003EThese localhost addresses are illustrative and must match your deployment.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-standalone-webassembly\u0022\u003E5. Blazor Standalone WebAssembly\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E A browser-hosted application with a separate UAuthHub.\u003C/p\u003E\n\u003Cp\u003EStandalone Blazor WASM runs in the browser. It does not host UltimateAuth Server or database persistence.\u003C/p\u003E\n\u003Cp\u003EAuthentication is handled by the remote UAuthHub.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-packages\u0022\u003EClient packages\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-services\u0022\u003EConfigure services\u003C/h3\u003E\n\u003Cp\u003EIn the standalone WASM application\u0027s \u003Ccode\u003EProgram.cs\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\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.Core.Domain;\n\nvar builder = WebAssemblyHostBuilder.CreateDefault(args);\n\nbuilder.RootComponents.Add\u0026lt;App\u0026gt;(\u0026quot;#app\u0026quot;);\nbuilder.RootComponents.Add\u0026lt;HeadOutlet\u0026gt;(\u0026quot;head::after\u0026quot;);\n\nbuilder.Services.AddScoped(sp =\u0026gt; new HttpClient\n{\n BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)\n});\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6110/auth\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;https://localhost:6130/home\u0026quot;;\n options.Login.AllowCredentialPost = true;\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\nawait builder.Build().RunAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe current standalone WASM sample explicitly configures \u003Ccode\u003ELogin.AllowCredentialPost\u003C/code\u003E and the PKCE return URL.\u003C/p\u003E\n\u003Cp\u003EThese are client-side settings. The UAuthHub must be configured independently.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-the-urls-mean\u0022\u003EWhat the URLs mean\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EEndpoints.BasePath\u003C/code\u003E points to the remote authentication endpoints.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EPkce.ReturnUrl\u003C/code\u003E identifies the frontend destination used by the relevant PKCE flow.\u003C/p\u003E\n\u003Cp\u003EThe Hub must recognize the frontend\u0027s origin, and any return URL used in an authentication flow must be validated against the application\u0027s security policy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022root-component\u0022\u003ERoot component\u003C/h3\u003E\n\u003Cp\u003EA standalone WASM application should initialize UltimateAuth through \u003Ccode\u003EUAuthApp\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor example, its root application or routing component can contain:\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@using CodeBeam.UltimateAuth.Client.Blazor\n\n\u0026lt;UAuthApp UseBuiltInRouter=\u0026quot;true\u0026quot; AppAssembly=\u0026quot;typeof(Program).Assembly\u0026quot; DefaultLayout=\u0026quot;typeof(Layout.MainLayout)\u0026quot; /\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EInclude the UltimateAuth JavaScript asset in the application\u0027s HTML host page.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes-and-signing-keys\u0022\u003EAuthentication modes and signing keys\u003C/h3\u003E\n\u003Cp\u003EA single UAuthHub can issue different authentication credentials according to the resolved application profile and server configuration.\u003C/p\u003E\n\u003Cp\u003EBlazor Server defaults to PureOpaque. All other application profiles default to Hybrid under the built-in authentication mode resolver.\u003C/p\u003E\n\u003Cp\u003EPureJwt must be explicitly selected when independent JWT-based authentication is required.\u003C/p\u003E\n\u003Cp\u003EUAuthHub and Resource APIs must be configured with compatible authentication modes and credential transports.\u003C/p\u003E\n\u003Cp\u003EJWT-enabled modes require a signing key. The UAuthHub remains responsible for protecting that key and issuing trusted access tokens.\u003C/p\u003E\n\u003Cp\u003EFor PureJwt, refresh-token persistence is still required even though authentication sessions are not created.\u003C/p\u003E\n\u003Cp\u003EA separate Resource API does not automatically inherit the authentication mode or cryptographic configuration of UAuthHub.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-web-app-interactive-webassembly\u0022\u003E6. Blazor Web App \u2014 Interactive WebAssembly\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E A Blazor Web App with an ASP.NET Core host and a separate \u003Ccode\u003E.Client\u003C/code\u003E project.\u003C/p\u003E\n\u003Cp\u003EThis scenario differs from standalone WASM because components may participate in both server-side rendering and browser-side interactivity.\u003C/p\u003E\n\u003Cp\u003EThe current UltimateAuth sample registers the Blazor client integration in \u003Cstrong\u003Eboth projects\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EIt also adds a separate ASP.NET Core compatibility registration in the host.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022project-structure\u0022\u003EProject structure\u003C/h3\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\u003EMyApplication/\n\u251C\u2500\u2500 MyApplication/\n\u2502 \u251C\u2500\u2500 Program.cs\n\u2502 \u2514\u2500\u2500 Components/\n\u2502 \u2514\u2500\u2500 App.razor\n\u2502\n\u2514\u2500\u2500 MyApplication.Client/\n \u251C\u2500\u2500 Program.cs\n \u2514\u2500\u2500 Pages/\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe host serves the application.\u003C/p\u003E\n\u003Cp\u003EThe \u003Ccode\u003E.Client\u003C/code\u003E project contains browser-executed components and services.\u003C/p\u003E\n\u003Cp\u003EA remote UAuthHub manages authentication.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022host-project-packages\u0022\u003E6.1 Host project packages\u003C/h3\u003E\n\u003Cp\u003EInstall the Blazor client integration and ASP.NET Core compatibility package in the host:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\ndotnet add package CodeBeam.UltimateAuth.Client.AspNetCore\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022host-project-services\u0022\u003E6.2 Host project services\u003C/h3\u003E\n\u003Cp\u003EIn the host \u003Ccode\u003EProgram.cs\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\u003Eusing CodeBeam.UltimateAuth.Client.AspNetCore;\nusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.Core.Domain;\n\nbuilder.Services\n .AddRazorComponents()\n .AddInteractiveWebAssemblyComponents();\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;https://localhost:6132/home\u0026quot;;\n options.Login.AllowCredentialPost = true;\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\nbuilder.Services.AddUltimateAuthAspNetCoreCompatibility();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAddUltimateAuthAspNetCoreCompatibility()\u003C/code\u003E registers the compatibility authentication scheme and ASP.NET Core authorization services used by this hosting pattern.\u003C/p\u003E\n\u003Cp\u003EIt does \u003Cstrong\u003Enot\u003C/strong\u003E turn the host into an UltimateAuth authentication server.\u003C/p\u003E\n\u003Cp\u003EIt is also not equivalent to \u003Ccode\u003EAddUltimateAuthResourceApi()\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022host-project-pipeline\u0022\u003E6.3 Host project pipeline\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\u003Eapp.UseHttpsRedirection();\n\napp.UseAntiforgery();\n\napp.MapStaticAssets();\n\napp.MapRazorComponents\u0026lt;App\u0026gt;()\n .AddInteractiveWebAssemblyRenderMode()\n .AddAdditionalAssemblies(typeof(MyApplication.Client._Imports).Assembly, UAuthAssemblies.BlazorClient().First());\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EReplace \u003Ccode\u003EMyApplication.Client._Imports\u003C/code\u003E with the corresponding type from your client project.\u003C/p\u003E\n\u003Cp\u003EThe additional assemblies allow the host to discover routable components from the WASM client project and UltimateAuth\u0027s Blazor client assembly.\u003C/p\u003E\n\u003Cp\u003EThe sample does not register \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E in this host because authentication is delegated to a separate UAuthHub.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-project-packages\u0022\u003E6.4 Client project packages\u003C/h3\u003E\n\u003Cp\u003EInstall the Blazor client adapter in the \u003Ccode\u003E.Client\u003C/code\u003E project:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-project-services\u0022\u003E6.5 Client project services\u003C/h3\u003E\n\u003Cp\u003EIn \u003Ccode\u003EMyApplication.Client/Program.cs\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\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.Core.Domain;\n\nvar builder = WebAssemblyHostBuilder.CreateDefault(args);\n\nbuilder.Services.AddScoped(sp =\u0026gt; new HttpClient\n{\n BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)\n});\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;https://localhost:6132/home\u0026quot;;\n options.Login.AllowCredentialPost = true;\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\nawait builder.Build().RunAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe host and client configurations should agree on the remote UAuthHub URL and authentication flow settings.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-both-registrations-are-necessary\u0022\u003EWhy both registrations are necessary\u003C/h3\u003E\n\u003Cp\u003EThe host and browser client have separate dependency injection containers.\u003C/p\u003E\n\u003Cp\u003ERegistering \u003Ccode\u003EAddUltimateAuthClientBlazor()\u003C/code\u003E in the host does not automatically register those services inside the WebAssembly runtime.\u003C/p\u003E\n\u003Cp\u003ELikewise, registering the client adapter only in the \u003Ccode\u003E.Client\u003C/code\u003E project does not supply the services required during server-side integration.\u003C/p\u003E\n\u003Cp\u003EThe additional ASP.NET Core compatibility registration addresses the host\u0027s ASP.NET Core authentication and authorization integration requirements.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E This compatibility layer is not a replacement for server-side authorization of your protected business APIs.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-separate-protected-backend\u0022\u003E7. Resource API \u2014 Separate Protected Backend\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E An API that needs UltimateAuth authentication validation but does not host the authentication system itself.\u003C/p\u003E\n\u003Cp\u003EA Resource API can be an ASP.NET Core Web API, MVC application, or another supported server-side application.\u003C/p\u003E\n\u003Cp\u003EIt does not need to be a Blazor application.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022architecture\u0022\u003EArchitecture\u003C/h3\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 Blazor Client\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC\n UAuthHub Resource API\n \u25B2 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n Authentication\n validation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource API uses the configured UAuthHub for remote authentication and session validation behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022install-the-server-integration-package\u0022\u003EInstall the server integration package\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Server\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-services-1\u0022\u003EConfigure services\u003C/h3\u003E\n\u003Ch4 id=\u0022hybrid-resource-api\u0022\u003EHybrid Resource API\u003C/h4\u003E\n\u003Cp\u003EHybrid is the default authentication mode for Resource APIs.\u003C/p\u003E\n\u003Cp\u003EThe current Hybrid Resource API implementation authenticates requests using opaque session credentials and validates those sessions through 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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 builder = WebApplication.CreateBuilder(args);\n\nbuilder.Services.AddControllers();\n\nbuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.Hub.BaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\n options.Cors.AllowedOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n});\n\nvar app = builder.Build();\n\napp.UseHttpsRedirection();\napp.UseUltimateAuthResourceApiWithAspNetCore();\n\napp.MapControllers();\napp.Run();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EHub.BaseUrl\u003C/code\u003E is the base address of the authentication server.\u003C/p\u003E\n\u003Cp\u003EThe default incoming session credential transport is cookie-based.\u003C/p\u003E\n\u003Cp\u003EThe browser must be able to send the session cookie to the Resource API. Compatible cookie scope, deployment topology, and CORS configuration are required.\u003C/p\u003E\n\u003Cp\u003EThe Resource API forwards the selected session credential and device context to UAuthHub for validation.\u003C/p\u003E\n\u003Cp\u003EHybrid-aware JWT access-token validation is not yet supported by separate Resource APIs.\u003C/p\u003E\n\u003Ch4 id=\u0022purejwt-resource-api\u0022\u003EPureJwt Resource API\u003C/h4\u003E\n\u003Cp\u003ESelect PureJwt explicitly when the Resource API should validate JWT access tokens independently of UAuthHub.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EPureJwt\u003C/code\u003E Resource API\u0027s \u003Ccode\u003EProgram.cs\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\u003Evar builder = WebApplication.CreateBuilder(args);\n\nbuilder.Services.AddControllers();\n\nbuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\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 ?? throw new InvalidOperationException(\u0026quot;JWT verification key is missing.\u0026quot;)\n });\n\n options.Auth.Mode = UAuthMode.PureJwt;\n\n options.Cors.AllowedOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n});\n\nvar app = builder.Build();\n\napp.UseHttpsRedirection();\napp.UseUltimateAuthResourceApiWithAspNetCore();\n\napp.MapControllers();\napp.Run();\n\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ENotice that this example uses the Hub origin without the \u003Ccode\u003E/auth\u003C/code\u003E suffix, matching the current Resource API samples.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedOrigins\u003C/code\u003E controls the browser origins permitted by the Resource API\u0027s CORS configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-pipeline\u0022\u003EConfigure the pipeline\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 app = builder.Build();\n\napp.UseHttpsRedirection();\n\napp.UseUltimateAuthResourceApiWithAspNetCore();\n\napp.MapControllers();\n\napp.Run();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EUseUltimateAuthResourceApiWithAspNetCore()\u003C/code\u003E installs the Resource API integration middleware together with ASP.NET Core authentication and authorization middleware.\u003C/p\u003E\n\u003Cp\u003EYou do not need to register a local UltimateAuth Server or its persistence bundle in the Resource API.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022protecting-endpoints\u0022\u003EProtecting endpoints\u003C/h3\u003E\n\u003Cp\u003EUse ASP.NET Core authorization attributes for endpoints that require authentication:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing Microsoft.AspNetCore.Authorization;\nusing Microsoft.AspNetCore.Mvc;\n\n[ApiController]\n[Route(\u0026quot;api/products\u0026quot;)]\npublic class ProductsController : ControllerBase\n{\n [HttpGet]\n [Authorize]\n public IActionResult GetProducts()\n {\n return Ok(new[]\n {\n new { Id = 1, Name = \u0026quot;Example product\u0026quot; }\n });\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe authorization attribute is enforced by ASP.NET Core on the server.\u003C/p\u003E\n\u003Cp\u003EFor permission-specific rules, configure and apply the corresponding authorization policies.\u003C/p\u003E\n\u003Cp\u003EDo not rely on Blazor UI authorization checks to protect Resource API endpoints.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022account-status-enforcement\u0022\u003EAccount Status Enforcement\u003C/h3\u003E\n\u003Cp\u003EProtected Resource API endpoints enforce active-user authorization by default, including endpoints using \u003Ccode\u003E[Authorize]\u003C/code\u003E and role-based authorization.\u003C/p\u003E\n\u003Cp\u003EThe Resource API obtains the current user status through trusted UAuthHub session validation. Suspended and SelfSuspended users remain authenticated but cannot access ordinary protected resources.\u003C/p\u003E\n\u003Cp\u003ETo allow specific operations for suspended users, explicitly apply \u003Ccode\u003E[UAuthAllowInactive]\u003C/code\u003E alongside \u003Ccode\u003E[Authorize]\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe exception does not bypass other authorization requirements.\u003C/p\u003E\n\u003Cp\u003EFor the complete behavior and examples, see \u003Ca href=\u0022/docs/plugin-domains/authorization\u0022\u003EAuthorization\u003C/a\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cors-configuration\u0022\u003ECORS configuration\u003C/h3\u003E\n\u003Cp\u003EThe current Resource API integration registers CORS from the configured allowed origins.\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\u003Eoptions.AllowedClientOrigins.Add(\u0026quot;https://localhost:6132\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EOnly add origins that should be allowed to call your API from a browser.\u003C/p\u003E\n\u003Cp\u003ECORS is a browser access control mechanism, not an authentication or authorization mechanism.\u003C/p\u003E\n\u003Cp\u003EA request must still pass the applicable authentication and authorization checks.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-vs-uauthhub\u0022\u003EResource API vs UAuthHub\u003C/h3\u003E\n\u003Cp\u003EThese are different responsibilities.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EUAuthHub\u003C/th\u003E\n\u003Cth\u003EResource API\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHosts authentication flows\u003C/td\u003E\n\u003Ctd\u003EHosts application resources\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EManages authentication sessions\u003C/td\u003E\n\u003Ctd\u003EValidates remote authentication context\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUses authentication persistence\u003C/td\u003E\n\u003Ctd\u003EDoes not require local authentication stores\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProvides login and related endpoints\u003C/td\u003E\n\u003Ctd\u003EProvides application endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServes authentication clients\u003C/td\u003E\n\u003Ctd\u003EServes authorized API consumers\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EUse a Resource API when you want independent deployment of business endpoints without duplicating the authentication server.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-with-an-ef-core-backed-uauthhub\u0022\u003E8. Resource API with an EF Core-Backed UAuthHub\u003C/h2\u003E\n\u003Cp\u003EThe Resource API does not need to use EF Core just because UAuthHub does.\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\u003EInteractive WASM\n \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25BA Resource API\n \u2502\n \u25BC\n UAuthHub\n \u2502\n \u25BC\n EF Core Database\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Hub stores users, credentials, sessions, and related security state in its database.\u003C/p\u003E\n\u003Cp\u003EThe Resource API communicates with the Hub through the configured remote validation integration.\u003C/p\u003E\n\u003Cp\u003EIts registration remains:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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://localhost:6112\u0026quot;;\n options.AllowedClientOrigins.Add(\u0026quot;https://localhost:6132\u0026quot;);\n options.CorsPolicyName = \u0026quot;resourceApi\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis separation allows the API and authentication infrastructure to be deployed, scaled, and maintained independently.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022calling-a-resource-api-from-blazor\u0022\u003E9. Calling a Resource API from Blazor\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth provides a unified Resource Client for accessing protected application APIs.\u003C/p\u003E\n\u003Cp\u003EInstead of configuring a separate HTTP client and implementing browser credential handling for ordinary resource requests, applications can use \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThis keeps authentication, identity operations, and application resource requests accessible through the same client SDK.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-resource-api\u0022\u003EConfigure the Resource API\u003C/h3\u003E\n\u003Cp\u003EFor a separate Resource API, configure its origin through the Blazor client registration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.Client;\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n\n options.Resource.BaseAddress = \u0026quot;https://localhost:6122\u0026quot;;\n options.Resource.Credentials = UAuthResourceCredentialsMode.Auto;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EEndpoints.BasePath\u003C/code\u003E identifies the authentication server.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EResource.BaseAddress\u003C/code\u003E identifies the application Resource API.\u003C/p\u003E\n\u003Cp\u003EThese addresses can point to different applications.\u003C/p\u003E\n\u003Cp\u003EIf the Resource API shares the application\u0027s origin, \u003Ccode\u003EResource.BaseAddress\u003C/code\u003E can remain \u003Ccode\u003Enull\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022call-protected-resources\u0022\u003ECall Protected Resources\u003C/h3\u003E\n\u003Cp\u003EInject \u003Ccode\u003EIUAuthClient\u003C/code\u003E into a Blazor component:\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@using CodeBeam.UltimateAuth.Client\n@inject IUAuthClient UAuthClient\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThen retrieve application data:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\nif (result.IsSuccess \u0026amp;\u0026amp; result.Value is not null)\n{\n products = result.Value;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource Client also supports POST, PUT, PATCH, and DELETE operations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-specific-api-services\u0022\u003EApplication-Specific API Services\u003C/h3\u003E\n\u003Cp\u003EApplications can organize resource operations into small domain-specific services.\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\u003Eusing CodeBeam.UltimateAuth.Client;\nusing CodeBeam.UltimateAuth.Core.Contracts;\n\npublic sealed class ProductApiService(IUAuthClient client)\n{\n public Task\u0026lt;UAuthResult\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;\u0026gt; GetAllAsync()\n =\u0026gt; client.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\n public Task\u0026lt;UAuthResult\u0026lt;Product\u0026gt;\u0026gt; CreateAsync(Product product)\n =\u0026gt; client.Resource.PostAsync\u0026lt;Product\u0026gt;(\u0026quot;/api/products\u0026quot;,product);\n\n public Task\u0026lt;UAuthResult\u0026gt; DeleteAsync(int id)\n =\u0026gt; client.Resource.DeleteAsync($\u0026quot;/api/products/{id}\u0026quot;);\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister the application service:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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;ProductApiService\u0026gt;();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe service uses UltimateAuth\u0027s transport and result contracts rather than implementing another HTTP abstraction.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022interactive-webassembly\u0022\u003EInteractive WebAssembly\u003C/h3\u003E\n\u003Cp\u003EIn an Interactive WebAssembly application, configure the UltimateAuth Blazor client in each project where the Resource Client will be used.\u003C/p\u003E\n\u003Cp\u003EThe host and \u003Ccode\u003E.Client\u003C/code\u003E project have separate dependency injection containers.\u003C/p\u003E\n\u003Cp\u003EA shared application API service may be registered in both projects when components execute in both environments.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client uses browser-based transport, including when invoked from an interactive Blazor Server component.\u003C/p\u003E\n\u003Cp\u003EBrowser interop must be available before making resource requests. Do not initiate browser-dependent resource requests during static prerendering.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022standalone-webassembly\u0022\u003EStandalone WebAssembly\u003C/h3\u003E\n\u003Cp\u003EStandalone Blazor WebAssembly applications use the same Resource Client 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n options.Resource.BaseAddress = \u0026quot;https://localhost:6122\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EOnce configured, application components can call protected resources through \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EA separate application-specific \u003Ccode\u003EHttpClient\u003C/code\u003E is not required for these requests.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022browser-credentials-and-cors\u0022\u003EBrowser Credentials and CORS\u003C/h3\u003E\n\u003Cp\u003EFor cross-origin requests, the browser and receiving API must agree on credential handling.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client supports \u003Ccode\u003EAuto\u003C/code\u003E, \u003Ccode\u003ESameOrigin\u003C/code\u003E, \u003Ccode\u003EInclude\u003C/code\u003E, and \u003Ccode\u003EOmit\u003C/code\u003E credential policies.\u003C/p\u003E\n\u003Cp\u003EFor cross-origin cookie-based authentication, configure the appropriate credential policy and ensure that the Resource API supports the required CORS and cookie settings.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client does not automatically make an API authenticated merely because the user has signed in through UAuthHub.\u003C/p\u003E\n\u003Cp\u003EThe receiving API must validate the authentication material associated with the configured authentication mode and enforce its authorization policies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server-and-direct-service-calls\u0022\u003EBlazor Server and Direct Service Calls\u003C/h3\u003E\n\u003Cp\u003EBlazor Server applications can often access application services directly when those services are hosted in the same process.\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\u003Evar products = await productService.GetAllAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThere is no need to introduce an HTTP request solely to use the Resource Client.\u003C/p\u003E\n\u003Cp\u003EUse \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E when the application actually needs to communicate with a protected Resource API through the browser.\u003C/p\u003E\n\u003Cp\u003EFor server-to-server requests, use an appropriate server-side HTTP client and authentication mechanism.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022learn-more\u0022\u003ELearn More\u003C/h3\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/client-sdk/resource-api-requests\u0022\u003EResource API Requests\u003C/a\u003E for supported operations, result handling, credential configuration, security considerations, and request cancellation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes-and-application-profiles\u0022\u003E10. Authentication Modes and Application Profiles\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates \u003Cstrong\u003Eapplication profile detection\u003C/strong\u003E from \u003Cstrong\u003Eauthentication mode enforcement\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe default resolver 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 resolved mode\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor WASM\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EWeb Server\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMAUI\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAPI\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EPureJwt\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThis mapping describes the resolver\u0027s behavior, not a guarantee that every mode is currently fully supported by the server.\u003C/p\u003E\n\u003Cp\u003EPureOpaque, Hybrid, and PureJwt are implemented authentication modes.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid remains reserved for future implementation.\u003C/p\u003E\n\u003Cp\u003EHybrid Resource APIs currently support session-based authentication. PureJwt Resource APIs support independent JWT validation.\u003C/p\u003E\n\u003Cp\u003EApplications must explicitly configure compatible authentication modes when the built-in defaults do not match their architecture.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022restrict-allowed-modes\u0022\u003ERestrict allowed modes\u003C/h3\u003E\n\u003Cp\u003EOn the authentication 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.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 guardrail.\u003C/p\u003E\n\u003Cp\u003EIt does not select a mode for every request.\u003C/p\u003E\n\u003Cp\u003EThe effective mode is resolved from the application profile and then checked against the server\u0027s allowed-mode policy.\u003C/p\u003E\n\u003Cp\u003EFor most applications, use the default mode resolution unless you have a specific integration requirement.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-options-for-real-applications\u0022\u003E11. Server Options for Real Applications\u003C/h2\u003E\n\u003Cp\u003EProduction configuration should reflect your application\u0027s security requirements.\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.Login.MaxFailedAttempts = 5;\n options.Login.LockoutDuration = TimeSpan.FromMinutes(15);\n options.Identifiers.Behavior.AllowMultipleUsernames = true;\n options.UserProfile.EnableMultiProfile = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EServer options also compose the Core-defined login, session, token, PKCE, and multi-tenant options.\u003C/p\u003E\n\u003Cp\u003EConfigure those through \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EDo not independently configure Core options and assume the server will automatically use them.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-files\u0022\u003EConfiguration files\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth also supports configuration through \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 \u0026quot;LockoutDuration\u0026quot;: \u0026quot;00:15:00\u0026quot;\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server options registration binds the \u003Ccode\u003EUltimateAuth:Server\u003C/code\u003E configuration section.\u003C/p\u003E\n\u003Cp\u003ERemember that effective mode defaults and mode-specific overrides are applied after the base options have been configured.\u003C/p\u003E\n\u003Cp\u003EFor detailed configuration behavior, see Server Options and Advanced Configuration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-ip-address-reverse-proxy\u0022\u003E12. Client IP Address \u0026amp; Reverse Proxy\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses ASP.NET Core\u0027s resolved client IP address for device information and IP-based rate limiting. It does not directly trust \u003Ccode\u003EX-Forwarded-For\u003C/code\u003E or \u003Ccode\u003ECF-Connecting-IP\u003C/code\u003E headers.\u003C/p\u003E\n\u003Cp\u003EIf your application runs behind Caddy, Nginx, or another reverse proxy, configure ASP.NET Core to trust that proxy.\u003C/p\u003E\n\u003Cp\u003EIn \u003Ccode\u003EProgram.cs\u003C/code\u003E, before \u003Ccode\u003Ebuilder.Build()\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\u003Eusing System.Net;\nusing Microsoft.AspNetCore.HttpOverrides;\n\nbuilder.Services.Configure\u0026lt;ForwardedHeadersOptions\u0026gt;(options =\u0026gt;\n{\n options.ForwardedHeaders =\n ForwardedHeaders.XForwardedFor |\n ForwardedHeaders.XForwardedProto;\n\n // Replace with your actual Caddy or Nginx proxy IP.\n options.KnownProxies.Add(IPAddress.Parse(\u0026quot;172.20.0.5\u0026quot;));\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThen enable the middleware \u003Cstrong\u003Ebefore\u003C/strong\u003E UltimateAuth and HTTPS redirection:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.UseForwardedHeaders();\n\napp.UseHttpsRedirection();\napp.UseUltimateAuthWithAspNetCore();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe example IP \u003Ccode\u003E172.20.0.5\u003C/code\u003E represents a trusted reverse proxy, not the visitor\u0027s IP address. Replace it with your actual proxy IP. For Docker deployments, ensure the proxy address is stable or configure a narrowly scoped trusted network.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E Never trust arbitrary forwarded headers or clear the trusted proxy lists to accept all sources. If your application connects directly to Kestrel without a reverse proxy, no forwarded headers configuration is required.\u003C/p\u003E\n\u003Cp\u003EFor multi-proxy deployments, configure the complete trusted proxy chain and forwarding behavior according to your infrastructure.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022development-and-production-differences\u0022\u003E13. Development and Production Differences\u003C/h2\u003E\n\u003Cp\u003EThe samples intentionally prioritize visibility and repeatability.\u003C/p\u003E\n\u003Cp\u003EA production application needs additional safeguards.\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\u003ESample or development\u003C/th\u003E\n\u003Cth\u003EProduction\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPersistence\u003C/td\u003E\n\u003Ctd\u003EInMemory or local SQLite\u003C/td\u003E\n\u003Ctd\u003EDurable database\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESeed accounts\u003C/td\u003E\n\u003Ctd\u003EExample users and passwords\u003C/td\u003E\n\u003Ctd\u003EReal provisioning\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDatabase initialization\u003C/td\u003E\n\u003Ctd\u003EMay reset sample data\u003C/td\u003E\n\u003Ctd\u003EReviewed migrations\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHTTPS\u003C/td\u003E\n\u003Ctd\u003ELocal development certificate\u003C/td\u003E\n\u003Ctd\u003EProper TLS termination\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECORS\u003C/td\u003E\n\u003Ctd\u003ELocalhost origins\u003C/td\u003E\n\u003Ctd\u003EExact trusted origins\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESigning keys\u003C/td\u003E\n\u003Ctd\u003EDevelopment defaults\u003C/td\u003E\n\u003Ctd\u003EManaged, persistent keys\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDiagnostics\u003C/td\u003E\n\u003Ctd\u003EDetailed debugging\u003C/td\u003E\n\u003Ctd\u003ERestrict sensitive diagnostics\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECredential recovery\u003C/td\u003E\n\u003Ctd\u003EDevelopment notifier\u003C/td\u003E\n\u003Ctd\u003EReal secure notification channel\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EIdentifier verification\u003C/td\u003E\n\u003Ctd\u003EDevelopment bypass\u003C/td\u003E\n\u003Ctd\u003EProof-based verification\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESecrets\u003C/td\u003E\n\u003Ctd\u003ELocal settings\u003C/td\u003E\n\u003Ctd\u003ESecure configuration provider\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe sample projects include development-only implementations for credential reset notifications and identifier verification.\u003C/p\u003E\n\u003Cp\u003EThose implementations demonstrate extension points and should not be treated as production verification systems.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-recovery\u0022\u003ECredential recovery\u003C/h3\u003E\n\u003Cp\u003EIf your application exposes credential recovery, configure a real implementation of the credential reset notifier.\u003C/p\u003E\n\u003Cp\u003ERecovery secrets must be delivered through an appropriate channel and must not be exposed directly through anonymous API responses.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022identifier-verification\u0022\u003EIdentifier verification\u003C/h3\u003E\n\u003Cp\u003EIf your application supports verified email addresses, phone numbers, or other identifiers, use an implementation that verifies ownership through suitable proof.\u003C/p\u003E\n\u003Cp\u003EDo not use a development bypass verifier in production.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022signing-keys\u0022\u003ESigning keys\u003C/h3\u003E\n\u003Cp\u003EConfigure persistent signing keys for authentication modes that issue JWTs.\u003C/p\u003E\n\u003Cp\u003EDevelopment signing key providers are not a substitute for production key management.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022deployment-checklist\u0022\u003E14. Deployment Checklist\u003C/h2\u003E\n\u003Cp\u003EBefore deploying, verify the following:\u003C/p\u003E\n\u003Cul class=\u0022contains-task-list\u0022\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E The selected architecture matches the actual client hosting model.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E The authentication server uses appropriate persistent storage.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Database migrations have been reviewed and applied.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Sample users and development-only verification services are disabled.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Production signing keys and secrets are configured.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E HTTPS is enforced at the appropriate boundary.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E UAuthHub and Resource API origins are explicitly configured.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Authentication endpoints and application endpoints are protected appropriately.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Client and server endpoint URLs match the deployment.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Session expiration, refresh, logout, and revocation have been tested.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Protected resources enforce server-side authorization.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Reverse proxy headers are configured correctly if applicable.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Authentication state and persistence survive the expected application lifecycle.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-your-architecture\u0022\u003E15. Choosing Your Architecture\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EStart with one server and one client. Connect more clients whenever you need them.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth is built around two fundamental responsibilities:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EUltimateAuth Server\u003C/strong\u003E \u2014 Manages authentication, users, credentials, sessions, authorization, and the security lifecycle.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUltimateAuth Client\u003C/strong\u003E \u2014 Integrates an application with the authentication system using the appropriate application profile and authentication flows.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EEvery application needs access to an authentication server, but that server does not have to be a separate application. It can be hosted within your existing ASP.NET Core application or deployed independently as UAuthHub.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022single-application-the-simplest-setup\u0022\u003ESingle Application \u2014 The Simplest Setup\u003C/h3\u003E\n\u003Cp\u003EFor a traditional ASP.NET Core or Blazor Server application, UltimateAuth Server and Client can run together.\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\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Your Application \u2502\n\u2502 \u2502\n\u2502 UltimateAuth Client \u2502\n\u2502 \u2502 \u2502\n\u2502 UltimateAuth Server \u2502\n\u2502 \u2502 \u2502\n\u2502 Database \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis approach is ideal when you want authentication without introducing another service or deployment.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022multiple-applications-one-authentication-server\u0022\u003EMultiple Applications \u2014 One Authentication Server\u003C/h3\u003E\n\u003Cp\u003EAs your system grows, you can connect multiple client applications to the same UltimateAuth 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\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 Blazor Server Blazor WASM\n \u2502 \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 \u2502 \u2502\n Razor Pages MAUI Other .NET Clients\n \u2502 \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u25BC\n UltimateAuth Server\n UAuthHub\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC \u25BC\n Users Sessions Authorization\n \u2502\n \u25BC\n Persistence\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach client can have its own application structure, hosting model, and authentication requirements while sharing the same authentication authority.\u003C/p\u003E\n\u003Cp\u003EFor example, a business platform might use Blazor Server for administration, Blazor WASM for its customer portal, MAUI for mobile access, and Razor Pages for an internal application.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAdding another client does not require replacing the existing clients or creating another UltimateAuth Server.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe same users, credentials, security policies, and session infrastructure can serve multiple applications, subject to the authentication modes and client integrations supported by the installed version.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022distributed-applications-separate-resource-apis\u0022\u003EDistributed Applications \u2014 Separate Resource APIs\u003C/h3\u003E\n\u003Cp\u003EWhen your architecture includes independently deployed backend services, Resource APIs can integrate with the same authentication authority.\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 Multiple Client Applications\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC\n UAuthHub Resource APIs\n \u25B2 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n Authentication\n Validation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EResource APIs protect application resources without becoming additional authentication servers.\u003C/p\u003E\n\u003Cp\u003EThis lets you separate business services from authentication infrastructure while maintaining a shared security model.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022one-foundation-different-scales\u0022\u003EOne Foundation, Different Scales\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EYour scenario\u003C/th\u003E\n\u003Cth\u003ERecommended approach\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA simple Blazor Server application\u003C/td\u003E\n\u003Ctd\u003EIntegrated Server \u002B Client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA traditional ASP.NET Core application\u003C/td\u003E\n\u003Ctd\u003EServer hosted within the application\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA standalone Blazor WASM application\u003C/td\u003E\n\u003Ctd\u003EClient \u002B remote UAuthHub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAn Interactive WASM application\u003C/td\u003E\n\u003Ctd\u003EHost \u002B WASM Client \u002B remote UAuthHub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMultiple web, desktop, or mobile applications\u003C/td\u003E\n\u003Ctd\u003EMultiple Clients \u002B shared UAuthHub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMultiple backend services\u003C/td\u003E\n\u003Ctd\u003EShared UAuthHub \u002B Resource APIs\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EUltimateAuth does not require a complex architecture to get started, and it does not restrict you to a single client as your application grows.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EStart with the simplest deployment that meets your needs. Add new client applications, persistent storage, or separate Resource APIs as your requirements evolve.\u003C/p\u003E\n\u003Cp\u003EThe authentication foundation remains consistent.\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/getting-started/quickstart\u0022\u003EQuickStart\u003C/a\u003E \u2014 Build the minimal in-memory application.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/getting-started/ecosystem\u0022\u003EEcosystem\u003C/a\u003E \u2014 Explore packages and supported integrations.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Configure server 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, endpoints, refresh, and reauthentication.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E \u2014 Explore effective options, dependency injection, and extension points.\u003C/li\u003E\n\u003C/ul\u003E\n", + "Html": "\n\u003Cp\u003E\u003Cstrong\u003EOne authentication framework. Different deployment models.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe \u003Ca href=\u0022/docs/getting-started/quickstart\u0022\u003EQuickStart\u003C/a\u003E demonstrates UltimateAuth with Blazor Server and in-memory storage.\u003C/p\u003E\n\u003Cp\u003EReal applications may require persistent data, a separate authentication server, browser-based clients, or independently deployed APIs.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth supports these scenarios through different service registrations and hosting integrations. You can choose the architecture that fits your application without configuring every available component.\u003C/p\u003E\n\u003Cp\u003EThis guide covers the setup patterns demonstrated by the UltimateAuth samples.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choose-your-architecture\u0022\u003E1. Choose Your Architecture\u003C/h2\u003E\n\u003Cp\u003EStart by identifying where authentication is hosted and how your application communicates with it.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication architecture\u003C/th\u003E\n\u003Cth\u003EAuthentication host\u003C/th\u003E\n\u003Cth\u003EApplication registration\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server, single project\u003C/td\u003E\n\u003Ctd\u003ESame application\u003C/td\u003E\n\u003Ctd\u003EServer \u002B persistence \u002B Blazor client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server with EF Core\u003C/td\u003E\n\u003Ctd\u003ESame application\u003C/td\u003E\n\u003Ctd\u003EServer \u002B EF Core \u002B Blazor client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDedicated UAuthHub\u003C/td\u003E\n\u003Ctd\u003ESeparate authentication application\u003C/td\u003E\n\u003Ctd\u003EServer \u002B persistence \u002B Hub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EStandalone Blazor WASM\u003C/td\u003E\n\u003Ctd\u003ERemote UAuthHub\u003C/td\u003E\n\u003Ctd\u003EBlazor client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Web App, Interactive WASM\u003C/td\u003E\n\u003Ctd\u003ERemote UAuthHub\u003C/td\u003E\n\u003Ctd\u003EHost integration \u002B WASM client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESeparate Resource API\u003C/td\u003E\n\u003Ctd\u003ERemote UAuthHub\u003C/td\u003E\n\u003Ctd\u003EResource API integration\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese models can be combined.\u003C/p\u003E\n\u003Cp\u003EFor example, an application might use an EF Core-backed UAuthHub, a standalone Blazor WASM frontend, and a separate Resource API.\u003C/p\u003E\n\u003Cp\u003EThe frontend handles user interaction, UAuthHub manages authentication, and the Resource API enforces access to protected resources.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022cryptographic-key-configuration\u0022\u003ECryptographic Key Configuration\u003C/h2\u003E\n\u003Cp\u003EEvery application hosting UltimateAuth Server must configure its cryptographic secrets securely.\u003C/p\u003E\n\u003Cp\u003EThis applies to integrated Blazor Server applications, standalone UAuthHub deployments, and applications using either in-memory or Entity Framework Core persistence.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022required-key-configuration\u0022\u003ERequired key configuration\u003C/h3\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\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 for 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 signing of JWT access tokens\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EBoth settings accept Base64-encoded keys containing at least 32 bytes of cryptographically secure random key material.\u003C/p\u003E\n\u003Cp\u003EPureOpaque does not issue JWT access tokens, but it should still configure the token-hashing key.\u003C/p\u003E\n\u003Cp\u003EHybrid and PureJwt require JWT signing capability.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-configuration\u0022\u003ERecommended configuration\u003C/h3\u003E\n\u003Cp\u003EStore secrets outside application source code.\u003C/p\u003E\n\u003Cp\u003EFor local development, use .NET User Secrets. For deployed applications, use environment variables or a trusted secret-management service.\u003C/p\u003E\n\u003Cp\u003EEnvironment variable names:\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\u003EThe double underscore (\u003Ccode\u003E__\u003C/code\u003E) represents a configuration hierarchy separator in .NET environment-variable configuration.\u003C/p\u003E\n\u003Cp\u003EConfigure 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.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? o.Cryptography.TokenHashingKey;\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? o.Cryptography.JwtSigningKey;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDo not generate new keys automatically on every application startup. Keys must remain consistent across application instances that share authentication state.\u003C/p\u003E\n\u003Cp\u003ENever use the same key for token hashing and JWT signing.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-verification-keys\u0022\u003EResource API verification keys\u003C/h3\u003E\n\u003Cp\u003EA Resource API using PureJwt validates JWT signatures with trusted verification keys.\u003C/p\u003E\n\u003Cp\u003EThe built-in HS256 configuration uses symmetric cryptography, so the Resource API must be configured with the same JWT key material used by the issuing UAuthHub.\u003C/p\u003E\n\u003Cp\u003EThe Resource API does not require the Hub\u0027s token-hashing key.\u003C/p\u003E\n\u003Cp\u003EProtect JWT verification keys as secrets when using symmetric signing algorithms.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022persistent-storage-with-entity-framework-core\u0022\u003E2. Persistent Storage with Entity Framework Core\u003C/h2\u003E\n\u003Cp\u003EFor applications that need authentication state to survive restarts, use a persistent storage provider.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides an Entity Framework Core bundle that registers its reference domain implementations and EF Core-backed stores.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022install-packages\u0022\u003EInstall packages\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.EntityFrameworkCore.Bundle\ndotnet add package Microsoft.EntityFrameworkCore.Sqlite\ndotnet add package Microsoft.EntityFrameworkCore.Design\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe SQLite provider is used here for simplicity. You can use another compatible EF Core database provider.\u003C/p\u003E\n\u003Cp\u003EWhen using the EF Core bundle, you do not need the in-memory bundle.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022register-the-services\u0022\u003ERegister the services\u003C/h3\u003E\n\u003Cp\u003EIn \u003Ccode\u003EProgram.cs\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\u003Eusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing CodeBeam.UltimateAuth.Server.Extensions;\nusing Microsoft.EntityFrameworkCore;\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? o.Cryptography.TokenHashingKey;\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? o.Cryptography.JwtSigningKey;\n})\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(\u0026quot;Data Source=uauth.db\u0026quot;, sqlite =\u0026gt; sqlite.MigrationsAssembly(typeof(Program).Assembly.GetName().Name!));\n });\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAddUltimateAuthEntityFrameworkCore()\u003C/code\u003E registers the EF Core stores and reference domain implementations.\u003C/p\u003E\n\u003Cp\u003EThe bundle provides a unified \u003Ccode\u003EUAuthDbContext\u003C/code\u003E for the supported authentication domains.\u003C/p\u003E\n\u003Cp\u003EYou do not need to register each user, session, credential, token, or authorization store individually.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-database-connection\u0022\u003EConfigure the database connection\u003C/h3\u003E\n\u003Cp\u003EFor a deployed application, prefer configuration over hardcoded connection strings.\u003C/p\u003E\n\u003Cp\u003E\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;ConnectionStrings\u0026quot;: {\n \u0026quot;UltimateAuth\u0026quot;: \u0026quot;Data Source=uauth.db\u0026quot;\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EProgram.cs\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\u003Evar connectionString = builder.Configuration.GetConnectionString(\u0026quot;UltimateAuth\u0026quot;)\n ?? throw new InvalidOperationException(\u0026quot;UltimateAuth connection string is missing.\u0026quot;);\n\nbuilder.Services.AddUltimateAuthServer()\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(connectionString);\n });\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor production databases, use your deployment environment\u0027s secret management facilities rather than storing credentials in source control.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022database-migrations\u0022\u003EDatabase migrations\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth does not automatically create or apply migrations when the EF Core bundle is registered.\u003C/p\u003E\n\u003Cp\u003EYour application owns the database migration lifecycle.\u003C/p\u003E\n\u003Cp\u003EInstall the EF Core CLI if 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\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet tool install --global dotnet-ef\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ECreate the initial migration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet ef migrations add InitUAuth --context UAuthDbContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApply it:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet ef database update --context UAuthDbContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor Visual Studio Package Manager Console:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EPOWERSHELL\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-powershell\u0022\u003EAdd-Migration InitUAuth -Context UAuthDbContext\nUpdate-Database -Context UAuthDbContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EInstall \u003Ccode\u003EMicrosoft.EntityFrameworkCore.Tools\u003C/code\u003E if required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022applying-migrations-programmatically\u0022\u003EApplying migrations programmatically\u003C/h3\u003E\n\u003Cp\u003EThe EF Core samples demonstrate initialization through a scoped \u003Ccode\u003EUAuthDbContext\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor a controlled development 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore;\n\nusing (var scope = app.Services.CreateScope())\n{\n var db = scope.ServiceProvider.GetRequiredService\u0026lt;UAuthDbContext\u0026gt;();\n await db.Database.MigrateAsync();\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis applies pending migrations. It does not generate migration files.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EProduction guidance:\u003C/strong\u003E Prefer applying reviewed migrations as a separate deployment step, particularly when multiple application instances share a database.\u003C/p\u003E\n\u003Cp\u003EDo not copy the sample initializer\u0027s \u003Ccode\u003Ereset: true\u003C/code\u003E behavior into production. The samples use database reset functionality for repeatable demonstrations, not as a safe deployment strategy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022optional-sample-accounts-with-ef-core\u0022\u003EOptional: sample accounts with EF Core\u003C/h3\u003E\n\u003Cp\u003EThe sample seed package can also work with EF Core persistence.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Sample.Seed\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister the scoped seed 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddScopedUltimateAuthSampleSeed();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAfter preparing the database:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eif (app.Environment.IsDevelopment())\n{\n await app.SeedUltimateAuthAsync();\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe difference matters:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EAddUltimateAuthSampleSeed()\u003C/code\u003E is used by the in-memory samples.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EAddScopedUltimateAuthSampleSeed()\u003C/code\u003E is used by the EF Core samples.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EDo not deploy the demonstration accounts and passwords to production.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server-integrated-authentication\u0022\u003E3. Blazor Server \u2014 Integrated Authentication\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E A Blazor Server application that wants to host its own authentication system.\u003C/p\u003E\n\u003Cp\u003EThis is the simplest deployment model for a server-side Blazor application.\u003C/p\u003E\n\u003Cp\u003EThe application hosts UltimateAuth Server and uses the Blazor client adapter in the same project.\u003C/p\u003E\n\u003Cp\u003EA separate UAuthHub is not required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022packages\u0022\u003EPackages\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\ndotnet add package CodeBeam.UltimateAuth.EntityFrameworkCore.Bundle\ndotnet add package Microsoft.EntityFrameworkCore.Sqlite\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022services\u0022\u003EServices\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\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing CodeBeam.UltimateAuth.Server.Extensions;\nusing Microsoft.EntityFrameworkCore;\n\nbuilder.Services\n .AddRazorComponents()\n .AddInteractiveServerComponents();\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;Token hashing key is missing.\u0026quot;);\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;JWT signing key is missing.\u0026quot;);\n})\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(\u0026quot;Data Source=uauth.db\u0026quot;);\n });\n\nbuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022pipeline\u0022\u003EPipeline\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\u003Eapp.UseHttpsRedirection();\napp.UseStaticFiles();\n\napp.UseUltimateAuthWithAspNetCore();\napp.UseAntiforgery();\n\napp.MapUltimateAuthEndpoints();\n\napp.MapRazorComponents\u0026lt;App\u0026gt;()\n .AddInteractiveServerRenderMode()\n .AddUltimateAuthRoutes(UAuthAssemblies.BlazorClient());\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAlso configure the \u003Ccode\u003EUAuthApp\u003C/code\u003E root component, login page, and UltimateAuth JavaScript file as demonstrated in QuickStart.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-behavior\u0022\u003EAuthentication behavior\u003C/h3\u003E\n\u003Cp\u003EThe default application profile resolution selects \u003Ccode\u003EPureOpaque\u003C/code\u003E for Blazor Server.\u003C/p\u003E\n\u003Cp\u003EThis uses session-oriented authentication rather than requiring the application to manage access and refresh tokens manually.\u003C/p\u003E\n\u003Cp\u003EYou can configure session lifetimes, login policies, credential policies, and other behavior through \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\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.Login.MaxFailedAttempts = 5;\n options.Login.LockoutDuration = TimeSpan.FromMinutes(15);\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n options.Identifiers.Behavior.AllowMultipleUsernames = true;\n options.Password.Level = PasswordPolicyLevel.Strict;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe effective authentication mode is resolved at runtime. The application does not need to select a single mode globally.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022password-security-configuration\u0022\u003EPassword Security Configuration\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth uses the Standard password policy by default. Applications can select Basic or Strict, or override individual requirements through \u003Ccode\u003Eoptions.Password\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor the preset comparison, configuration examples, and password-history settings, see \u003Ca href=\u0022/docs/security/password-policy\u0022\u003EPassword Policy \u0026amp; History\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022uauthhub-dedicated-authentication-server\u0022\u003E4. UAuthHub \u2014 Dedicated Authentication Server\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E Applications where multiple clients share one authentication authority.\u003C/p\u003E\n\u003Cp\u003EUAuthHub hosts UltimateAuth\u0027s authentication services separately from your frontend applications.\u003C/p\u003E\n\u003Cp\u003EIt is particularly relevant for standalone WASM applications, Interactive WASM applications, and systems with separate Resource APIs.\u003C/p\u003E\n\u003Cp\u003EA typical architecture looks like this:\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 Standalone WASM Interactive WASM\n \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u25BC\n UAuthHub\n Authentication\n Sessions \u0026amp; Users\n \u2502\n \u25BC\n Persistence\n\n Resource API \u2500\u2500\u2500\u25BA UAuthHub\n (validation)\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022create-the-hub-application\u0022\u003ECreate the Hub application\u003C/h3\u003E\n\u003Cp\u003EA UAuthHub can be hosted in an ASP.NET Core Blazor Server application.\u003C/p\u003E\n\u003Cp\u003EThe current samples use Blazor Server to provide the Hub\u0027s login UI.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022in-memory-uauthhub\u0022\u003EIn-memory UAuthHub\u003C/h3\u003E\n\u003Cp\u003EFor development:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\ndotnet add package CodeBeam.UltimateAuth.InMemory.Bundle\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.InMemory;\nusing CodeBeam.UltimateAuth.Server.Extensions;\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? o.Cryptography.TokenHashingKey;\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? o.Cryptography.JwtSigningKey;\n})\n .AddUltimateAuthInMemory()\n .AddUAuthHub(options =\u0026gt;\n {\n options.AllowedClientOrigins.Add(\u0026quot;https://localhost:6130\u0026quot;);\n });\n\nbuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Hub\u0027s Blazor client registration is needed when the Hub itself hosts UltimateAuth-powered Blazor pages and login UI.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022ef-core-uauthhub\u0022\u003EEF Core UAuthHub\u003C/h3\u003E\n\u003Cp\u003EFor persistent storage:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore;\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? o.Cryptography.TokenHashingKey;\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? o.Cryptography.JwtSigningKey;\n})\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(\u0026quot;Data Source=uauthhub.db\u0026quot;);\n })\n .AddUAuthHub(options =\u0026gt;\n {\n options.AllowedClientOrigins.Add(\u0026quot;https://localhost:6132\u0026quot;);\n });\n\nbuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe \u003Ccode\u003EAllowedClientOrigins\u003C/code\u003E collection identifies browser origins permitted to interact with the Hub.\u003C/p\u003E\n\u003Cp\u003EUse exact origins, including scheme and port. Do not include paths such as \u003Ccode\u003E/home\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022hub-pipeline\u0022\u003EHub pipeline\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\u003Eapp.UseHttpsRedirection();\n\napp.UseUltimateAuthWithAspNetCore();\napp.UseAntiforgery();\n\napp.MapUltimateAuthEndpoints();\napp.MapUAuthHub();\n\napp.MapStaticAssets();\n\napp.MapRazorComponents\u0026lt;App\u0026gt;()\n .AddInteractiveServerRenderMode()\n .AddUltimateAuthRoutes(UAuthAssemblies.BlazorClient());\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EMapUltimateAuthEndpoints()\u003C/code\u003E maps the authentication endpoints.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EMapUAuthHub()\u003C/code\u003E maps the Hub-specific entry endpoint.\u003C/p\u003E\n\u003Cp\u003EBoth registrations are used by the current UAuthHub samples.\u003C/p\u003E\n\u003Cp\u003EThe Hub also needs its login page and Blazor application lifecycle components.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-origins\u0022\u003EChoosing origins\u003C/h3\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication\u003C/th\u003E\n\u003Cth\u003EURL\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUAuthHub\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ehttps://localhost:6112\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EStandalone WASM\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ehttps://localhost:6130\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EInteractive WASM\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ehttps://localhost:6132\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EConfigure the Hub\u0027s allowed origins for the actual frontend applications it serves.\u003C/p\u003E\n\u003Cp\u003EThese localhost addresses are illustrative and must match your deployment.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-standalone-webassembly\u0022\u003E5. Blazor Standalone WebAssembly\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E A browser-hosted application with a separate UAuthHub.\u003C/p\u003E\n\u003Cp\u003EStandalone Blazor WASM runs in the browser. It does not host UltimateAuth Server or database persistence.\u003C/p\u003E\n\u003Cp\u003EAuthentication is handled by the remote UAuthHub.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-packages\u0022\u003EClient packages\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-services\u0022\u003EConfigure services\u003C/h3\u003E\n\u003Cp\u003EIn the standalone WASM application\u0027s \u003Ccode\u003EProgram.cs\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\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.Core.Domain;\n\nvar builder = WebAssemblyHostBuilder.CreateDefault(args);\n\nbuilder.RootComponents.Add\u0026lt;App\u0026gt;(\u0026quot;#app\u0026quot;);\nbuilder.RootComponents.Add\u0026lt;HeadOutlet\u0026gt;(\u0026quot;head::after\u0026quot;);\n\nbuilder.Services.AddScoped(sp =\u0026gt; new HttpClient\n{\n BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)\n});\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6110/auth\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;https://localhost:6130/home\u0026quot;;\n options.Login.AllowCredentialPost = true;\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\nawait builder.Build().RunAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe current standalone WASM sample explicitly configures \u003Ccode\u003ELogin.AllowCredentialPost\u003C/code\u003E and the PKCE return URL.\u003C/p\u003E\n\u003Cp\u003EThese are client-side settings. The UAuthHub must be configured independently.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-the-urls-mean\u0022\u003EWhat the URLs mean\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EEndpoints.BasePath\u003C/code\u003E points to the remote authentication endpoints.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EPkce.ReturnUrl\u003C/code\u003E identifies the frontend destination used by the relevant PKCE flow.\u003C/p\u003E\n\u003Cp\u003EThe Hub must recognize the frontend\u0027s origin, and any return URL used in an authentication flow must be validated against the application\u0027s security policy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022root-component\u0022\u003ERoot component\u003C/h3\u003E\n\u003Cp\u003EA standalone WASM application should initialize UltimateAuth through \u003Ccode\u003EUAuthApp\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor example, its root application or routing component can contain:\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@using CodeBeam.UltimateAuth.Client.Blazor\n\n\u0026lt;UAuthApp UseBuiltInRouter=\u0026quot;true\u0026quot; AppAssembly=\u0026quot;typeof(Program).Assembly\u0026quot; DefaultLayout=\u0026quot;typeof(Layout.MainLayout)\u0026quot; /\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EInclude the UltimateAuth JavaScript asset in the application\u0027s HTML host page.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes-and-signing-keys\u0022\u003EAuthentication modes and signing keys\u003C/h3\u003E\n\u003Cp\u003EA single UAuthHub can issue different authentication credentials according to the resolved application profile and server configuration.\u003C/p\u003E\n\u003Cp\u003EBlazor Server defaults to PureOpaque. All other application profiles default to Hybrid under the built-in authentication mode resolver.\u003C/p\u003E\n\u003Cp\u003EPureJwt must be explicitly selected when independent JWT-based authentication is required.\u003C/p\u003E\n\u003Cp\u003EUAuthHub and Resource APIs must be configured with compatible authentication modes and credential transports.\u003C/p\u003E\n\u003Cp\u003EJWT-enabled modes require a signing key. The UAuthHub remains responsible for protecting that key and issuing trusted access tokens.\u003C/p\u003E\n\u003Cp\u003EFor PureJwt, refresh-token persistence is still required even though authentication sessions are not created.\u003C/p\u003E\n\u003Cp\u003EA separate Resource API does not automatically inherit the authentication mode or cryptographic configuration of UAuthHub.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-web-app-interactive-webassembly\u0022\u003E6. Blazor Web App \u2014 Interactive WebAssembly\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E A Blazor Web App with an ASP.NET Core host and a separate \u003Ccode\u003E.Client\u003C/code\u003E project.\u003C/p\u003E\n\u003Cp\u003EThis scenario differs from standalone WASM because components may participate in both server-side rendering and browser-side interactivity.\u003C/p\u003E\n\u003Cp\u003EThe current UltimateAuth sample registers the Blazor client integration in \u003Cstrong\u003Eboth projects\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EIt also adds a separate ASP.NET Core compatibility registration in the host.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022project-structure\u0022\u003EProject structure\u003C/h3\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\u003EMyApplication/\n\u251C\u2500\u2500 MyApplication/\n\u2502 \u251C\u2500\u2500 Program.cs\n\u2502 \u2514\u2500\u2500 Components/\n\u2502 \u2514\u2500\u2500 App.razor\n\u2502\n\u2514\u2500\u2500 MyApplication.Client/\n \u251C\u2500\u2500 Program.cs\n \u2514\u2500\u2500 Pages/\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe host serves the application.\u003C/p\u003E\n\u003Cp\u003EThe \u003Ccode\u003E.Client\u003C/code\u003E project contains browser-executed components and services.\u003C/p\u003E\n\u003Cp\u003EA remote UAuthHub manages authentication.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022host-project-packages\u0022\u003E6.1 Host project packages\u003C/h3\u003E\n\u003Cp\u003EInstall the Blazor client integration and ASP.NET Core compatibility package in the host:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\ndotnet add package CodeBeam.UltimateAuth.Client.AspNetCore\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022host-project-services\u0022\u003E6.2 Host project services\u003C/h3\u003E\n\u003Cp\u003EIn the host \u003Ccode\u003EProgram.cs\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\u003Eusing CodeBeam.UltimateAuth.Client.AspNetCore;\nusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.Core.Domain;\n\nbuilder.Services\n .AddRazorComponents()\n .AddInteractiveWebAssemblyComponents();\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;https://localhost:6132/home\u0026quot;;\n options.Login.AllowCredentialPost = true;\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\nbuilder.Services.AddUltimateAuthAspNetCoreCompatibility();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAddUltimateAuthAspNetCoreCompatibility()\u003C/code\u003E registers the compatibility authentication scheme and ASP.NET Core authorization services used by this hosting pattern.\u003C/p\u003E\n\u003Cp\u003EIt does \u003Cstrong\u003Enot\u003C/strong\u003E turn the host into an UltimateAuth authentication server.\u003C/p\u003E\n\u003Cp\u003EIt is also not equivalent to \u003Ccode\u003EAddUltimateAuthResourceApi()\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022host-project-pipeline\u0022\u003E6.3 Host project pipeline\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\u003Eapp.UseHttpsRedirection();\n\napp.UseAntiforgery();\n\napp.MapStaticAssets();\n\napp.MapRazorComponents\u0026lt;App\u0026gt;()\n .AddInteractiveWebAssemblyRenderMode()\n .AddAdditionalAssemblies(typeof(MyApplication.Client._Imports).Assembly, UAuthAssemblies.BlazorClient().First());\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EReplace \u003Ccode\u003EMyApplication.Client._Imports\u003C/code\u003E with the corresponding type from your client project.\u003C/p\u003E\n\u003Cp\u003EThe additional assemblies allow the host to discover routable components from the WASM client project and UltimateAuth\u0027s Blazor client assembly.\u003C/p\u003E\n\u003Cp\u003EThe sample does not register \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E in this host because authentication is delegated to a separate UAuthHub.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-project-packages\u0022\u003E6.4 Client project packages\u003C/h3\u003E\n\u003Cp\u003EInstall the Blazor client adapter in the \u003Ccode\u003E.Client\u003C/code\u003E project:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-project-services\u0022\u003E6.5 Client project services\u003C/h3\u003E\n\u003Cp\u003EIn \u003Ccode\u003EMyApplication.Client/Program.cs\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\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.Core.Domain;\n\nvar builder = WebAssemblyHostBuilder.CreateDefault(args);\n\nbuilder.Services.AddScoped(sp =\u0026gt; new HttpClient\n{\n BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)\n});\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;https://localhost:6132/home\u0026quot;;\n options.Login.AllowCredentialPost = true;\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\nawait builder.Build().RunAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe host and client configurations should agree on the remote UAuthHub URL and authentication flow settings.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-both-registrations-are-necessary\u0022\u003EWhy both registrations are necessary\u003C/h3\u003E\n\u003Cp\u003EThe host and browser client have separate dependency injection containers.\u003C/p\u003E\n\u003Cp\u003ERegistering \u003Ccode\u003EAddUltimateAuthClientBlazor()\u003C/code\u003E in the host does not automatically register those services inside the WebAssembly runtime.\u003C/p\u003E\n\u003Cp\u003ELikewise, registering the client adapter only in the \u003Ccode\u003E.Client\u003C/code\u003E project does not supply the services required during server-side integration.\u003C/p\u003E\n\u003Cp\u003EThe additional ASP.NET Core compatibility registration addresses the host\u0027s ASP.NET Core authentication and authorization integration requirements.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E This compatibility layer is not a replacement for server-side authorization of your protected business APIs.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-separate-protected-backend\u0022\u003E7. Resource API \u2014 Separate Protected Backend\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E An API that needs UltimateAuth authentication validation but does not host the authentication system itself.\u003C/p\u003E\n\u003Cp\u003EA Resource API can be an ASP.NET Core Web API, MVC application, or another supported server-side application.\u003C/p\u003E\n\u003Cp\u003EIt does not need to be a Blazor application.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022architecture\u0022\u003EArchitecture\u003C/h3\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 Blazor Client\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC\n UAuthHub Resource API\n \u25B2 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n Authentication\n validation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource API uses the configured UAuthHub for remote authentication and session validation behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022install-the-server-integration-package\u0022\u003EInstall the server integration package\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Server\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-services-1\u0022\u003EConfigure services\u003C/h3\u003E\n\u003Ch4 id=\u0022hybrid-resource-api\u0022\u003EHybrid Resource API\u003C/h4\u003E\n\u003Cp\u003EHybrid is the default authentication mode for Resource APIs.\u003C/p\u003E\n\u003Cp\u003EThe current Hybrid Resource API implementation authenticates requests using opaque session credentials and validates those sessions through 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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 builder = WebApplication.CreateBuilder(args);\n\nbuilder.Services.AddControllers();\n\nbuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.Hub.BaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\n options.Cors.AllowedOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n});\n\nvar app = builder.Build();\n\napp.UseHttpsRedirection();\napp.UseUltimateAuthResourceApiWithAspNetCore();\n\napp.MapControllers();\napp.Run();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EHub.BaseUrl\u003C/code\u003E is the base address of the authentication server.\u003C/p\u003E\n\u003Cp\u003EThe default incoming session credential transport is cookie-based.\u003C/p\u003E\n\u003Cp\u003EThe browser must be able to send the session cookie to the Resource API. Compatible cookie scope, deployment topology, and CORS configuration are required.\u003C/p\u003E\n\u003Cp\u003EThe Resource API forwards the selected session credential and device context to UAuthHub for validation.\u003C/p\u003E\n\u003Cp\u003EHybrid-aware JWT access-token validation is not yet supported by separate Resource APIs.\u003C/p\u003E\n\u003Ch4 id=\u0022purejwt-resource-api\u0022\u003EPureJwt Resource API\u003C/h4\u003E\n\u003Cp\u003ESelect PureJwt explicitly when the Resource API should validate JWT access tokens independently of UAuthHub.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EPureJwt\u003C/code\u003E Resource API\u0027s \u003Ccode\u003EProgram.cs\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\u003Evar builder = WebApplication.CreateBuilder(args);\n\nbuilder.Services.AddControllers();\n\nbuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\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 ?? throw new InvalidOperationException(\u0026quot;JWT verification key is missing.\u0026quot;)\n });\n\n options.Auth.Mode = UAuthMode.PureJwt;\n\n options.Cors.AllowedOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n});\n\nvar app = builder.Build();\n\napp.UseHttpsRedirection();\napp.UseUltimateAuthResourceApiWithAspNetCore();\n\napp.MapControllers();\napp.Run();\n\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ENotice that this example uses the Hub origin without the \u003Ccode\u003E/auth\u003C/code\u003E suffix, matching the current Resource API samples.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedOrigins\u003C/code\u003E controls the browser origins permitted by the Resource API\u0027s CORS configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-pipeline\u0022\u003EConfigure the pipeline\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 app = builder.Build();\n\napp.UseHttpsRedirection();\n\napp.UseUltimateAuthResourceApiWithAspNetCore();\n\napp.MapControllers();\n\napp.Run();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EUseUltimateAuthResourceApiWithAspNetCore()\u003C/code\u003E installs the Resource API integration middleware together with ASP.NET Core authentication and authorization middleware.\u003C/p\u003E\n\u003Cp\u003EYou do not need to register a local UltimateAuth Server or its persistence bundle in the Resource API.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022protecting-endpoints\u0022\u003EProtecting endpoints\u003C/h3\u003E\n\u003Cp\u003EUse ASP.NET Core authorization attributes for endpoints that require authentication:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing Microsoft.AspNetCore.Authorization;\nusing Microsoft.AspNetCore.Mvc;\n\n[ApiController]\n[Route(\u0026quot;api/products\u0026quot;)]\npublic class ProductsController : ControllerBase\n{\n [HttpGet]\n [Authorize]\n public IActionResult GetProducts()\n {\n return Ok(new[]\n {\n new { Id = 1, Name = \u0026quot;Example product\u0026quot; }\n });\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe authorization attribute is enforced by ASP.NET Core on the server.\u003C/p\u003E\n\u003Cp\u003EFor permission-specific rules, configure and apply the corresponding authorization policies.\u003C/p\u003E\n\u003Cp\u003EDo not rely on Blazor UI authorization checks to protect Resource API endpoints.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022account-status-enforcement\u0022\u003EAccount Status Enforcement\u003C/h3\u003E\n\u003Cp\u003EProtected Resource API endpoints enforce active-user authorization by default, including endpoints using \u003Ccode\u003E[Authorize]\u003C/code\u003E and role-based authorization.\u003C/p\u003E\n\u003Cp\u003EThe Resource API obtains the current user status through trusted UAuthHub session validation. Suspended and SelfSuspended users remain authenticated but cannot access ordinary protected resources.\u003C/p\u003E\n\u003Cp\u003ETo allow specific operations for suspended users, explicitly apply \u003Ccode\u003E[UAuthAllowInactive]\u003C/code\u003E alongside \u003Ccode\u003E[Authorize]\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe exception does not bypass other authorization requirements.\u003C/p\u003E\n\u003Cp\u003EFor the complete behavior and examples, see \u003Ca href=\u0022/docs/plugin-domains/authorization\u0022\u003EAuthorization\u003C/a\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cors-configuration\u0022\u003ECORS configuration\u003C/h3\u003E\n\u003Cp\u003EThe current Resource API integration registers CORS from the configured allowed origins.\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\u003Eoptions.AllowedClientOrigins.Add(\u0026quot;https://localhost:6132\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EOnly add origins that should be allowed to call your API from a browser.\u003C/p\u003E\n\u003Cp\u003ECORS is a browser access control mechanism, not an authentication or authorization mechanism.\u003C/p\u003E\n\u003Cp\u003EA request must still pass the applicable authentication and authorization checks.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-vs-uauthhub\u0022\u003EResource API vs UAuthHub\u003C/h3\u003E\n\u003Cp\u003EThese are different responsibilities.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EUAuthHub\u003C/th\u003E\n\u003Cth\u003EResource API\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHosts authentication flows\u003C/td\u003E\n\u003Ctd\u003EHosts application resources\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EManages authentication sessions\u003C/td\u003E\n\u003Ctd\u003EValidates remote authentication context\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUses authentication persistence\u003C/td\u003E\n\u003Ctd\u003EDoes not require local authentication stores\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProvides login and related endpoints\u003C/td\u003E\n\u003Ctd\u003EProvides application endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServes authentication clients\u003C/td\u003E\n\u003Ctd\u003EServes authorized API consumers\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EUse a Resource API when you want independent deployment of business endpoints without duplicating the authentication server.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-with-an-ef-core-backed-uauthhub\u0022\u003E8. Resource API with an EF Core-Backed UAuthHub\u003C/h2\u003E\n\u003Cp\u003EThe Resource API does not need to use EF Core just because UAuthHub does.\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\u003EInteractive WASM\n \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25BA Resource API\n \u2502\n \u25BC\n UAuthHub\n \u2502\n \u25BC\n EF Core Database\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Hub stores users, credentials, sessions, and related security state in its database.\u003C/p\u003E\n\u003Cp\u003EThe Resource API communicates with the Hub through the configured remote validation integration.\u003C/p\u003E\n\u003Cp\u003EIts registration remains:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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://localhost:6112\u0026quot;;\n options.AllowedClientOrigins.Add(\u0026quot;https://localhost:6132\u0026quot;);\n options.CorsPolicyName = \u0026quot;resourceApi\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis separation allows the API and authentication infrastructure to be deployed, scaled, and maintained independently.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022calling-a-resource-api-from-blazor\u0022\u003E9. Calling a Resource API from Blazor\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth provides a unified Resource Client for accessing protected application APIs.\u003C/p\u003E\n\u003Cp\u003EInstead of configuring a separate HTTP client and implementing browser credential handling for ordinary resource requests, applications can use \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThis keeps authentication, identity operations, and application resource requests accessible through the same client SDK.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-resource-api\u0022\u003EConfigure the Resource API\u003C/h3\u003E\n\u003Cp\u003EFor a separate Resource API, configure its origin through the Blazor client registration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.Client;\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n\n options.Resource.BaseAddress = \u0026quot;https://localhost:6122\u0026quot;;\n options.Resource.Credentials = UAuthResourceCredentialsMode.Auto;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EEndpoints.BasePath\u003C/code\u003E identifies the authentication server.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EResource.BaseAddress\u003C/code\u003E identifies the application Resource API.\u003C/p\u003E\n\u003Cp\u003EThese addresses can point to different applications.\u003C/p\u003E\n\u003Cp\u003EIf the Resource API shares the application\u0027s origin, \u003Ccode\u003EResource.BaseAddress\u003C/code\u003E can remain \u003Ccode\u003Enull\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022call-protected-resources\u0022\u003ECall Protected Resources\u003C/h3\u003E\n\u003Cp\u003EInject \u003Ccode\u003EIUAuthClient\u003C/code\u003E into a Blazor component:\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@using CodeBeam.UltimateAuth.Client\n@inject IUAuthClient UAuthClient\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThen retrieve application data:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\nif (result.IsSuccess \u0026amp;\u0026amp; result.Value is not null)\n{\n products = result.Value;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource Client also supports POST, PUT, PATCH, and DELETE operations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-specific-api-services\u0022\u003EApplication-Specific API Services\u003C/h3\u003E\n\u003Cp\u003EApplications can organize resource operations into small domain-specific services.\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\u003Eusing CodeBeam.UltimateAuth.Client;\nusing CodeBeam.UltimateAuth.Core.Contracts;\n\npublic sealed class ProductApiService(IUAuthClient client)\n{\n public Task\u0026lt;UAuthResult\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;\u0026gt; GetAllAsync()\n =\u0026gt; client.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\n public Task\u0026lt;UAuthResult\u0026lt;Product\u0026gt;\u0026gt; CreateAsync(Product product)\n =\u0026gt; client.Resource.PostAsync\u0026lt;Product\u0026gt;(\u0026quot;/api/products\u0026quot;,product);\n\n public Task\u0026lt;UAuthResult\u0026gt; DeleteAsync(int id)\n =\u0026gt; client.Resource.DeleteAsync($\u0026quot;/api/products/{id}\u0026quot;);\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister the application service:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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;ProductApiService\u0026gt;();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe service uses UltimateAuth\u0027s transport and result contracts rather than implementing another HTTP abstraction.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022interactive-webassembly\u0022\u003EInteractive WebAssembly\u003C/h3\u003E\n\u003Cp\u003EIn an Interactive WebAssembly application, configure the UltimateAuth Blazor client in each project where the Resource Client will be used.\u003C/p\u003E\n\u003Cp\u003EThe host and \u003Ccode\u003E.Client\u003C/code\u003E project have separate dependency injection containers.\u003C/p\u003E\n\u003Cp\u003EA shared application API service may be registered in both projects when components execute in both environments.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client uses browser-based transport, including when invoked from an interactive Blazor Server component.\u003C/p\u003E\n\u003Cp\u003EBrowser interop must be available before making resource requests. Do not initiate browser-dependent resource requests during static prerendering.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022standalone-webassembly\u0022\u003EStandalone WebAssembly\u003C/h3\u003E\n\u003Cp\u003EStandalone Blazor WebAssembly applications use the same Resource Client 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n options.Resource.BaseAddress = \u0026quot;https://localhost:6122\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EOnce configured, application components can call protected resources through \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EA separate application-specific \u003Ccode\u003EHttpClient\u003C/code\u003E is not required for these requests.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022browser-credentials-and-cors\u0022\u003EBrowser Credentials and CORS\u003C/h3\u003E\n\u003Cp\u003EFor cross-origin requests, the browser and receiving API must agree on credential handling.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client supports \u003Ccode\u003EAuto\u003C/code\u003E, \u003Ccode\u003ESameOrigin\u003C/code\u003E, \u003Ccode\u003EInclude\u003C/code\u003E, and \u003Ccode\u003EOmit\u003C/code\u003E credential policies.\u003C/p\u003E\n\u003Cp\u003EFor cross-origin cookie-based authentication, configure the appropriate credential policy and ensure that the Resource API supports the required CORS and cookie settings.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client does not automatically make an API authenticated merely because the user has signed in through UAuthHub.\u003C/p\u003E\n\u003Cp\u003EThe receiving API must validate the authentication material associated with the configured authentication mode and enforce its authorization policies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server-and-direct-service-calls\u0022\u003EBlazor Server and Direct Service Calls\u003C/h3\u003E\n\u003Cp\u003EBlazor Server applications can often access application services directly when those services are hosted in the same process.\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\u003Evar products = await productService.GetAllAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThere is no need to introduce an HTTP request solely to use the Resource Client.\u003C/p\u003E\n\u003Cp\u003EUse \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E when the application actually needs to communicate with a protected Resource API through the browser.\u003C/p\u003E\n\u003Cp\u003EFor server-to-server requests, use an appropriate server-side HTTP client and authentication mechanism.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022learn-more\u0022\u003ELearn More\u003C/h3\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/client-sdk/resource-api-requests\u0022\u003EResource API Requests\u003C/a\u003E for supported operations, result handling, credential configuration, security considerations, and request cancellation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes-and-application-profiles\u0022\u003E10. Authentication Modes and Application Profiles\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates \u003Cstrong\u003Eapplication profile detection\u003C/strong\u003E from \u003Cstrong\u003Eauthentication mode enforcement\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe default resolver 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 resolved mode\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor WASM\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EWeb Server\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMAUI\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAPI\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResource API\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUAuthHub\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\u003EThis mapping describes the resolver\u0027s behavior, not a guarantee that every mode is currently fully supported by the server.\u003C/p\u003E\n\u003Cp\u003EPureOpaque, Hybrid, SemiHybrd and PureJwt are implemented authentication modes.\u003C/p\u003E\n\u003Cp\u003EHybrid Resource APIs currently support session-based authentication. PureJwt Resource APIs support independent JWT validation.\u003C/p\u003E\n\u003Cp\u003EApplications must explicitly configure compatible authentication modes when the built-in defaults do not match their architecture.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022restrict-allowed-modes\u0022\u003ERestrict allowed modes\u003C/h3\u003E\n\u003Cp\u003EOn the authentication 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.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 guardrail.\u003C/p\u003E\n\u003Cp\u003EIt does not select a mode for every request.\u003C/p\u003E\n\u003Cp\u003EThe effective mode is resolved from the application profile and then checked against the server\u0027s allowed-mode policy.\u003C/p\u003E\n\u003Cp\u003EFor most applications, use the default mode resolution unless you have a specific integration requirement.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-options-for-real-applications\u0022\u003E11. Server Options for Real Applications\u003C/h2\u003E\n\u003Cp\u003EProduction configuration should reflect your application\u0027s security requirements.\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.Login.MaxFailedAttempts = 5;\n options.Login.LockoutDuration = TimeSpan.FromMinutes(15);\n options.Identifiers.Behavior.AllowMultipleUsernames = true;\n options.UserProfile.EnableMultiProfile = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EServer options also compose the Core-defined login, session, token, PKCE, and multi-tenant options.\u003C/p\u003E\n\u003Cp\u003EConfigure those through \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EDo not independently configure Core options and assume the server will automatically use them.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-files\u0022\u003EConfiguration files\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth also supports configuration through \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 \u0026quot;LockoutDuration\u0026quot;: \u0026quot;00:15:00\u0026quot;\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server options registration binds the \u003Ccode\u003EUltimateAuth:Server\u003C/code\u003E configuration section.\u003C/p\u003E\n\u003Cp\u003ERemember that effective mode defaults and mode-specific overrides are applied after the base options have been configured.\u003C/p\u003E\n\u003Cp\u003EFor detailed configuration behavior, see Server Options and Advanced Configuration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-ip-address-reverse-proxy\u0022\u003E12. Client IP Address \u0026amp; Reverse Proxy\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses ASP.NET Core\u0027s resolved client IP address for device information and IP-based rate limiting. It does not directly trust \u003Ccode\u003EX-Forwarded-For\u003C/code\u003E or \u003Ccode\u003ECF-Connecting-IP\u003C/code\u003E headers.\u003C/p\u003E\n\u003Cp\u003EIf your application runs behind Caddy, Nginx, or another reverse proxy, configure ASP.NET Core to trust that proxy.\u003C/p\u003E\n\u003Cp\u003EIn \u003Ccode\u003EProgram.cs\u003C/code\u003E, before \u003Ccode\u003Ebuilder.Build()\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\u003Eusing System.Net;\nusing Microsoft.AspNetCore.HttpOverrides;\n\nbuilder.Services.Configure\u0026lt;ForwardedHeadersOptions\u0026gt;(options =\u0026gt;\n{\n options.ForwardedHeaders =\n ForwardedHeaders.XForwardedFor |\n ForwardedHeaders.XForwardedProto;\n\n // Replace with your actual Caddy or Nginx proxy IP.\n options.KnownProxies.Add(IPAddress.Parse(\u0026quot;172.20.0.5\u0026quot;));\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThen enable the middleware \u003Cstrong\u003Ebefore\u003C/strong\u003E UltimateAuth and HTTPS redirection:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.UseForwardedHeaders();\n\napp.UseHttpsRedirection();\napp.UseUltimateAuthWithAspNetCore();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe example IP \u003Ccode\u003E172.20.0.5\u003C/code\u003E represents a trusted reverse proxy, not the visitor\u0027s IP address. Replace it with your actual proxy IP. For Docker deployments, ensure the proxy address is stable or configure a narrowly scoped trusted network.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E Never trust arbitrary forwarded headers or clear the trusted proxy lists to accept all sources. If your application connects directly to Kestrel without a reverse proxy, no forwarded headers configuration is required.\u003C/p\u003E\n\u003Cp\u003EFor multi-proxy deployments, configure the complete trusted proxy chain and forwarding behavior according to your infrastructure.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022development-and-production-differences\u0022\u003E13. Development and Production Differences\u003C/h2\u003E\n\u003Cp\u003EThe samples intentionally prioritize visibility and repeatability.\u003C/p\u003E\n\u003Cp\u003EA production application needs additional safeguards.\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\u003ESample or development\u003C/th\u003E\n\u003Cth\u003EProduction\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPersistence\u003C/td\u003E\n\u003Ctd\u003EInMemory or local SQLite\u003C/td\u003E\n\u003Ctd\u003EDurable database\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESeed accounts\u003C/td\u003E\n\u003Ctd\u003EExample users and passwords\u003C/td\u003E\n\u003Ctd\u003EReal provisioning\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDatabase initialization\u003C/td\u003E\n\u003Ctd\u003EMay reset sample data\u003C/td\u003E\n\u003Ctd\u003EReviewed migrations\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHTTPS\u003C/td\u003E\n\u003Ctd\u003ELocal development certificate\u003C/td\u003E\n\u003Ctd\u003EProper TLS termination\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECORS\u003C/td\u003E\n\u003Ctd\u003ELocalhost origins\u003C/td\u003E\n\u003Ctd\u003EExact trusted origins\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESigning keys\u003C/td\u003E\n\u003Ctd\u003EDevelopment defaults\u003C/td\u003E\n\u003Ctd\u003EManaged, persistent keys\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDiagnostics\u003C/td\u003E\n\u003Ctd\u003EDetailed debugging\u003C/td\u003E\n\u003Ctd\u003ERestrict sensitive diagnostics\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECredential recovery\u003C/td\u003E\n\u003Ctd\u003EDevelopment notifier\u003C/td\u003E\n\u003Ctd\u003EReal secure notification channel\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EIdentifier verification\u003C/td\u003E\n\u003Ctd\u003EDevelopment bypass\u003C/td\u003E\n\u003Ctd\u003EProof-based verification\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESecrets\u003C/td\u003E\n\u003Ctd\u003ELocal settings\u003C/td\u003E\n\u003Ctd\u003ESecure configuration provider\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe sample projects include development-only implementations for credential reset notifications and identifier verification.\u003C/p\u003E\n\u003Cp\u003EThose implementations demonstrate extension points and should not be treated as production verification systems.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-recovery\u0022\u003ECredential recovery\u003C/h3\u003E\n\u003Cp\u003EIf your application exposes credential recovery, configure a real implementation of the credential reset notifier.\u003C/p\u003E\n\u003Cp\u003ERecovery secrets must be delivered through an appropriate channel and must not be exposed directly through anonymous API responses.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022identifier-verification\u0022\u003EIdentifier verification\u003C/h3\u003E\n\u003Cp\u003EIf your application supports verified email addresses, phone numbers, or other identifiers, use an implementation that verifies ownership through suitable proof.\u003C/p\u003E\n\u003Cp\u003EDo not use a development bypass verifier in production.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022signing-keys\u0022\u003ESigning keys\u003C/h3\u003E\n\u003Cp\u003EConfigure persistent signing keys for authentication modes that issue JWTs.\u003C/p\u003E\n\u003Cp\u003EDevelopment signing key providers are not a substitute for production key management.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022deployment-checklist\u0022\u003E14. Deployment Checklist\u003C/h2\u003E\n\u003Cp\u003EBefore deploying, verify the following:\u003C/p\u003E\n\u003Cul class=\u0022contains-task-list\u0022\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E The selected architecture matches the actual client hosting model.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E The authentication server uses appropriate persistent storage.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Database migrations have been reviewed and applied.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Sample users and development-only verification services are disabled.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Production signing keys and secrets are configured.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E HTTPS is enforced at the appropriate boundary.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E UAuthHub and Resource API origins are explicitly configured.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Authentication endpoints and application endpoints are protected appropriately.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Client and server endpoint URLs match the deployment.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Session expiration, refresh, logout, and revocation have been tested.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Protected resources enforce server-side authorization.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Reverse proxy headers are configured correctly if applicable.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Authentication state and persistence survive the expected application lifecycle.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-your-architecture\u0022\u003E15. Choosing Your Architecture\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EStart with one server and one client. Connect more clients whenever you need them.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth is built around two fundamental responsibilities:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EUltimateAuth Server\u003C/strong\u003E \u2014 Manages authentication, users, credentials, sessions, authorization, and the security lifecycle.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUltimateAuth Client\u003C/strong\u003E \u2014 Integrates an application with the authentication system using the appropriate application profile and authentication flows.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EEvery application needs access to an authentication server, but that server does not have to be a separate application. It can be hosted within your existing ASP.NET Core application or deployed independently as UAuthHub.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022single-application-the-simplest-setup\u0022\u003ESingle Application \u2014 The Simplest Setup\u003C/h3\u003E\n\u003Cp\u003EFor a traditional ASP.NET Core or Blazor Server application, UltimateAuth Server and Client can run together.\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\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Your Application \u2502\n\u2502 \u2502\n\u2502 UltimateAuth Client \u2502\n\u2502 \u2502 \u2502\n\u2502 UltimateAuth Server \u2502\n\u2502 \u2502 \u2502\n\u2502 Database \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis approach is ideal when you want authentication without introducing another service or deployment.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022multiple-applications-one-authentication-server\u0022\u003EMultiple Applications \u2014 One Authentication Server\u003C/h3\u003E\n\u003Cp\u003EAs your system grows, you can connect multiple client applications to the same UltimateAuth 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\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 Blazor Server Blazor WASM\n \u2502 \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 \u2502 \u2502\n Razor Pages MAUI Other .NET Clients\n \u2502 \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u25BC\n UltimateAuth Server\n UAuthHub\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC \u25BC\n Users Sessions Authorization\n \u2502\n \u25BC\n Persistence\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach client can have its own application structure, hosting model, and authentication requirements while sharing the same authentication authority.\u003C/p\u003E\n\u003Cp\u003EFor example, a business platform might use Blazor Server for administration, Blazor WASM for its customer portal, MAUI for mobile access, and Razor Pages for an internal application.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAdding another client does not require replacing the existing clients or creating another UltimateAuth Server.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe same users, credentials, security policies, and session infrastructure can serve multiple applications, subject to the authentication modes and client integrations supported by the installed version.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022distributed-applications-separate-resource-apis\u0022\u003EDistributed Applications \u2014 Separate Resource APIs\u003C/h3\u003E\n\u003Cp\u003EWhen your architecture includes independently deployed backend services, Resource APIs can integrate with the same authentication authority.\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 Multiple Client Applications\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC\n UAuthHub Resource APIs\n \u25B2 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n Authentication\n Validation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EResource APIs protect application resources without becoming additional authentication servers.\u003C/p\u003E\n\u003Cp\u003EThis lets you separate business services from authentication infrastructure while maintaining a shared security model.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022one-foundation-different-scales\u0022\u003EOne Foundation, Different Scales\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EYour scenario\u003C/th\u003E\n\u003Cth\u003ERecommended approach\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA simple Blazor Server application\u003C/td\u003E\n\u003Ctd\u003EIntegrated Server \u002B Client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA traditional ASP.NET Core application\u003C/td\u003E\n\u003Ctd\u003EServer hosted within the application\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA standalone Blazor WASM application\u003C/td\u003E\n\u003Ctd\u003EClient \u002B remote UAuthHub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAn Interactive WASM application\u003C/td\u003E\n\u003Ctd\u003EHost \u002B WASM Client \u002B remote UAuthHub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMultiple web, desktop, or mobile applications\u003C/td\u003E\n\u003Ctd\u003EMultiple Clients \u002B shared UAuthHub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMultiple backend services\u003C/td\u003E\n\u003Ctd\u003EShared UAuthHub \u002B Resource APIs\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EUltimateAuth does not require a complex architecture to get started, and it does not restrict you to a single client as your application grows.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EStart with the simplest deployment that meets your needs. Add new client applications, persistent storage, or separate Resource APIs as your requirements evolve.\u003C/p\u003E\n\u003Cp\u003EThe authentication foundation remains consistent.\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/getting-started/quickstart\u0022\u003EQuickStart\u003C/a\u003E \u2014 Build the minimal in-memory application.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/getting-started/ecosystem\u0022\u003EEcosystem\u003C/a\u003E \u2014 Explore packages and supported integrations.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Configure server 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, endpoints, refresh, and reauthentication.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E \u2014 Explore effective options, dependency injection, and extension points.\u003C/li\u003E\n\u003C/ul\u003E\n", "Headings": [ { "Id": "choose-your-architecture", @@ -369,6 +369,6 @@ "Level": 0 } ], - "SourceHash": "E719659B91C3A4A1967F0FFEE6ED8B853B6A652585D29F6FC9BC46775682BC5E", + "SourceHash": "37E3134CFEA4132EA3C71F781734EBD237AE6D3AD1C35DEB4E2EC508053AC700", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/security/token-security.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/security/token-security.json index 61215795..a83f1caa 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/security/token-security.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/security/token-security.json @@ -1,7 +1,7 @@ { "Slug": "security/token-security", "Title": "Token Security", - "Html": "\n\u003Cp\u003EAuthentication tokens allow clients to present authentication state to protected applications and services.\u003C/p\u003E\n\u003Cp\u003EHowever, not all tokens provide the same security guarantees.\u003C/p\u003E\n\u003Cp\u003EAn opaque credential requires authoritative server-side validation. A JSON Web Token (JWT) can be verified locally using its signature and claims. A refresh credential enables authentication to continue without repeating the original login process.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth supports these different mechanisms through its authentication modes.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EToken security depends on the credential\u0027s purpose, how it is validated, how long it remains valid, and which security state is consulted during validation.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThis page explains the security characteristics of access and refresh credentials, including issuance, expiration, rotation, replay risks, and revocation boundaries.\u003C/p\u003E\n\u003Cp\u003EFor the overall authentication architecture, 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=\u0022authentication-state-and-credentials\u0022\u003EAuthentication State and Credentials\u003C/h2\u003E\n\u003Cp\u003EA token is authentication material presented by a client.\u003C/p\u003E\n\u003Cp\u003EIt is not the user identity itself.\u003C/p\u003E\n\u003Cp\u003EDepending on the authentication mode, the token may reference server-managed authentication state or contain signed claims that can be validated without retrieving a session.\u003C/p\u003E\n\u003Cp\u003EThese approaches establish different trust boundaries.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-authoritative-authentication\u0022\u003EServer-Authoritative Authentication\u003C/h3\u003E\n\u003Cp\u003EIn server-authoritative modes, a presented opaque credential is validated against server-managed authentication state.\u003C/p\u003E\n\u003Cp\u003EThe server can evaluate the current validity of the corresponding session and applicable security conditions.\u003C/p\u003E\n\u003Cp\u003EThis allows revocation and other authoritative state changes to affect subsequent protected requests.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022locally-validated-authentication\u0022\u003ELocally Validated Authentication\u003C/h3\u003E\n\u003Cp\u003EIn JWT-based modes, a protected resource can validate a token using its signature, issuer, audience, expiration, and other applicable token requirements.\u003C/p\u003E\n\u003Cp\u003EThe resource may not need to consult the issuing server or a session store for every request.\u003C/p\u003E\n\u003Cp\u003EThis reduces the dependency on server-side session lookups but changes how quickly revocation and authorization changes can be enforced.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ENeither model makes the token an identity record. The token is a credential whose validity is determined by the selected authentication mechanism.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-types\u0022\u003EToken Types\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses two principal access credential formats: opaque credentials and JWTs.\u003C/p\u003E\n\u003Cp\u003ERefresh credentials serve a separate purpose.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ECredential\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003Cth\u003EValidation model\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EOpaque access credential\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthenticate protected requests\u003C/td\u003E\n\u003Ctd\u003EAuthoritative server-side validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EJWT access token\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthenticate protected requests\u003C/td\u003E\n\u003Ctd\u003ECryptographic and claims validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EOpaque refresh credential\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EContinue authentication and obtain renewed credentials\u003C/td\u003E\n\u003Ctd\u003ERefresh-specific validation and state checks\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe distinction between access and refresh credentials is important.\u003C/p\u003E\n\u003Cp\u003EAccess credentials are presented to protected resources.\u003C/p\u003E\n\u003Cp\u003ERefresh credentials are presented to the authentication system for a continuation operation. They should not be accepted as ordinary access credentials.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022opaque-access-credentials\u0022\u003EOpaque Access Credentials\u003C/h2\u003E\n\u003Cp\u003EAn opaque credential is a value whose contents do not expose the authenticated identity or authorization claims to the client.\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\u003EAccess credential:\nq8Vn2...random-opaque-value...M7x\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client presents the credential, but cannot determine its authorization meaning by decoding it.\u003C/p\u003E\n\u003Cp\u003EThe server resolves and validates the associated authentication state.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-properties\u0022\u003ESecurity Properties\u003C/h3\u003E\n\u003Cp\u003EOpaque access credentials provide several useful characteristics:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ETheir meaning is determined by authoritative server-side state.\u003C/li\u003E\n\u003Cli\u003EThey do not need to expose identity claims in a client-readable payload.\u003C/li\u003E\n\u003Cli\u003ETheir validity can be affected by session expiration or revocation.\u003C/li\u003E\n\u003Cli\u003EThey can participate in account-level and chain-level security enforcement.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EHowever, opaque credentials are still bearer credentials unless an additional proof mechanism is enforced.\u003C/p\u003E\n\u003Cp\u003EAn attacker who obtains a usable opaque credential may be able to present it.\u003C/p\u003E\n\u003Cp\u003EOpacity alone does not prevent credential theft or replay.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-side-validation\u0022\u003EServer-Side Validation\u003C/h3\u003E\n\u003Cp\u003EIn a session-authoritative mode, validation can enforce the applicable session hierarchy requirements, including expiration, revocation, ownership, and security state consistency.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/session-security\u0022\u003ESession Security Model\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-access-tokens\u0022\u003EJWT Access Tokens\u003C/h2\u003E\n\u003Cp\u003EA JWT is a structured token containing signed claims.\u003C/p\u003E\n\u003Cp\u003EA typical JWT contains three encoded sections:\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\u003Eheader.payload.signature\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIts payload may describe the authenticated subject, tenant, authorization information, token lifetime, and other relevant context.\u003C/p\u003E\n\u003Cp\u003EA JWT is not encrypted merely because it is encoded and signed.\u003C/p\u003E\n\u003Cp\u003EApplications should not place secrets or unnecessarily sensitive information in a JWT payload.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cryptographic-validation\u0022\u003ECryptographic Validation\u003C/h3\u003E\n\u003Cp\u003EA protected resource must validate the JWT according to the configured token requirements.\u003C/p\u003E\n\u003Cp\u003ERelevant checks include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESignature validity.\u003C/li\u003E\n\u003Cli\u003EAccepted signing algorithm and key.\u003C/li\u003E\n\u003Cli\u003EExpected issuer.\u003C/li\u003E\n\u003Cli\u003EIntended audience.\u003C/li\u003E\n\u003Cli\u003EExpiration and other applicable time constraints.\u003C/li\u003E\n\u003Cli\u003ERequired token claims and application-specific restrictions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA successfully decoded JWT is not necessarily a valid JWT.\u003C/p\u003E\n\u003Cp\u003ELikewise, a correctly signed JWT is not automatically acceptable to every resource.\u003C/p\u003E\n\u003Cp\u003EThe resource must verify that the token was issued for its intended security context.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022local-validation\u0022\u003ELocal Validation\u003C/h3\u003E\n\u003Cp\u003EJWTs can be validated without loading current server-side session state.\u003C/p\u003E\n\u003Cp\u003EThis is useful for distributed APIs and services that need to authenticate requests efficiently.\u003C/p\u003E\n\u003Cp\u003EHowever, local validation introduces an important limitation:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA token can remain cryptographically valid after the underlying account or authorization state has changed.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EWhether such changes immediately affect access depends on additional validation and revocation mechanisms.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-mode-behavior\u0022\u003EAuthentication Mode Behavior\u003C/h2\u003E\n\u003Cp\u003EAuthentication modes define how credentials participate in authentication and continuation.\u003C/p\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\u003EPrimary authentication credential\u003C/th\u003E\n\u003Cth\u003EServer-managed continuity\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\u003Ctd\u003ESession lifecycle\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\u003Ctd\u003ESession and refresh-token lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003ESession-associated JWT access token\u003C/td\u003E\n\u003Ctd\u003ESession lineage and refresh-token lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ESession-independent JWT access token\u003C/td\u003E\n\u003Ctd\u003EOptional refresh-token lifecycle\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/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E for the architectural guarantees of each mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-identifiers-are-not-always-credentials\u0022\u003ESession identifiers are not always credentials\u003C/h3\u003E\n\u003Cp\u003EA session identifier can have different security purposes depending on the mode.\u003C/p\u003E\n\u003Cp\u003EIn PureOpaque and Hybrid, the opaque session identifier acts as an authentication credential.\u003C/p\u003E\n\u003Cp\u003EPossession of this value must therefore be treated as possession of sensitive authentication material.\u003C/p\u003E\n\u003Cp\u003EIn SemiHybrid, the session identifier is included in the JWT as lineage metadata.\u003C/p\u003E\n\u003Cp\u003EThe metadata identifies the associated server-managed session but does not independently authenticate the caller.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth distinguishes opaque session credentials from metadata-only session identifiers.\u003C/p\u003E\n\u003Cp\u003EA metadata-only identifier must never be accepted through an opaque session authentication path.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-purpose-isolation\u0022\u003ECredential purpose isolation\u003C/h3\u003E\n\u003Cp\u003EAuthentication credentials must be validated according to their intended purpose.\u003C/p\u003E\n\u003Cp\u003EA session identifier, access token, and refresh token are not interchangeable.\u003C/p\u003E\n\u003Cp\u003EA valid refresh token does not directly authorize access to a protected resource.\u003C/p\u003E\n\u003Cp\u003EA valid JWT does not automatically establish that its associated server-managed session remains active.\u003C/p\u003E\n\u003Cp\u003EA session identifier exposed as JWT metadata does not become an authentication credential.\u003C/p\u003E\n\u003Cp\u003ECredential purpose isolation prevents authentication material from being reused outside its intended security boundary.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-validation-requirements\u0022\u003EJWT Validation Requirements\u003C/h2\u003E\n\u003Cp\u003ESemiHybrid and PureJwt Resource APIs validate JWT access tokens locally using trusted verification keys and explicit validation configuration.\u003C/p\u003E\n\u003Cp\u003ESuccessful validation requires the applicable:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECryptographic signature validation.\u003C/li\u003E\n\u003Cli\u003ETrusted signing or verification key.\u003C/li\u003E\n\u003Cli\u003EIssuer validation.\u003C/li\u003E\n\u003Cli\u003EAudience validation.\u003C/li\u003E\n\u003Cli\u003EToken lifetime validation.\u003C/li\u003E\n\u003Cli\u003ESupported signing algorithm.\u003C/li\u003E\n\u003Cli\u003ERequired identity and device claims.\u003C/li\u003E\n\u003Cli\u003EAuthentication-mode-specific claim requirements.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA valid signature alone is insufficient.\u003C/p\u003E\n\u003Cp\u003EThe token must also satisfy the authentication requirements of the configured mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-specific-session-association\u0022\u003EMode-specific session association\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid requires a valid session identifier claim associated with server-managed lineage.\u003C/p\u003E\n\u003Cp\u003EPureJwt requires a session-independent access token and does not accept a session-bound JWT as a PureJwt authentication credential.\u003C/p\u003E\n\u003Cp\u003EThe presence or absence of session association is part of the authentication mode\u0027s security boundary.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-binding\u0022\u003EDevice binding\u003C/h3\u003E\n\u003Cp\u003EJWT access tokens contain a device identifier.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth applies the configured device mismatch behavior during authentication.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EReject\u003C/code\u003E requires the request device to match the device associated with the token.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllow\u003C/code\u003E permits authentication despite a request-device mismatch.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowAndRebind\u003C/code\u003E is not supported for JWT-based authentication modes.\u003C/p\u003E\n\u003Cp\u003EAllowing a request-device mismatch does not permit inconsistent credential-to-session binding during authoritative validation.\u003C/p\u003E\n\u003Cp\u003EA device identifier is not a substitute for cryptographic proof of possession.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authoritative-jwt-validation\u0022\u003EAuthoritative JWT validation\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid can additionally require authoritative validation of the session associated with the JWT.\u003C/p\u003E\n\u003Cp\u003EThis validates the current session lineage and its relationship to the authenticated identity.\u003C/p\u003E\n\u003Cp\u003EIt does not replace JWT signature validation or automatically establish fresh authorization claims.\u003C/p\u003E\n\u003Cp\u003EPureJwt does not support session-authoritative validation because it has no associated authentication session.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022trusted-verification-keys\u0022\u003ETrusted verification keys\u003C/h3\u003E\n\u003Cp\u003EVerification keys must come from trusted application configuration or an explicitly registered verification-key provider.\u003C/p\u003E\n\u003Cp\u003EThe Resource API does not accept signing keys supplied by an untrusted JWT header or automatically retrieve keys from token-provided URLs.\u003C/p\u003E\n\u003Cp\u003EThe built-in configured verification-key provider supports Base64-encoded symmetric keys.\u003C/p\u003E\n\u003Cp\u003EFor the built-in HS256 signing implementation, use at least 32 bytes of cryptographically secure random key material.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022stateless-authorization-freshness\u0022\u003EStateless authorization freshness\u003C/h3\u003E\n\u003Cp\u003EPureJwt Resource APIs do not require a live user-state lookup during normal JWT validation.\u003C/p\u003E\n\u003Cp\u003EAs a result, an otherwise valid JWT can remain accepted after account deletion, suspension, permission changes, or refresh-chain revocation.\u003C/p\u003E\n\u003Cp\u003EApplications requiring immediate enforcement of such changes must implement an additional authoritative validation mechanism or use an appropriate session-backed authentication strategy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022access-token-lifetime\u0022\u003EAccess Token Lifetime\u003C/h2\u003E\n\u003Cp\u003EAccess credentials should have lifetimes appropriate to their authentication mode and security requirements.\u003C/p\u003E\n\u003Cp\u003EShort-lived JWT access tokens are particularly important because a token may remain usable until expiration even after server-side authorization state changes.\u003C/p\u003E\n\u003Cp\u003EFor example, an application might choose a JWT access lifetime of several minutes.\u003C/p\u003E\n\u003Cp\u003EHowever, \u003Cstrong\u003Ea lifetime such as 5\u201315 minutes is an example of an application security choice, not a universal UltimateAuth default or requirement\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe appropriate value depends on factors such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESensitivity of protected resources.\u003C/li\u003E\n\u003Cli\u003EExpected frequency of authorization changes.\u003C/li\u003E\n\u003Cli\u003EAcceptable revocation delay.\u003C/li\u003E\n\u003Cli\u003EAvailability and security of the refresh mechanism.\u003C/li\u003E\n\u003Cli\u003EClient behavior and network conditions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022lifetime-versus-revocation\u0022\u003ELifetime Versus Revocation\u003C/h3\u003E\n\u003Cp\u003EExpiration limits how long a credential can be accepted.\u003C/p\u003E\n\u003Cp\u003ERevocation invalidates authentication state before its ordinary expiration.\u003C/p\u003E\n\u003Cp\u003EThese mechanisms are related but not interchangeable.\u003C/p\u003E\n\u003Cp\u003EIn server-authoritative modes, current revocation state can be checked during protected requests.\u003C/p\u003E\n\u003Cp\u003EIn locally validated JWT modes, expiration may remain the primary limit on an already-issued access token unless an additional revocation check is implemented.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-credentials\u0022\u003ERefresh Credentials\u003C/h2\u003E\n\u003Cp\u003ERefresh credentials allow clients to continue authentication without repeating the original authentication ceremony.\u003C/p\u003E\n\u003Cp\u003EThey are intended for the authentication system\u0027s refresh operation, not for general API access.\u003C/p\u003E\n\u003Cp\u003EIn UltimateAuth, refresh behavior is mode-dependent.\u003C/p\u003E\n\u003Cp\u003EPureOpaque does not issue a separate access-token and refresh-token pair.\u003C/p\u003E\n\u003Cp\u003EHybrid uses refresh-token rotation together with session validation.\u003C/p\u003E\n\u003Cp\u003EPureJwt uses stateful refresh-token rotation without requiring an authentication session.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid is intended to combine JWT authentication with server-managed session lifecycle operations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-security-requirements\u0022\u003ERefresh Security Requirements\u003C/h3\u003E\n\u003Cp\u003EA secure refresh operation must establish that the presented credential is eligible for continued authentication.\u003C/p\u003E\n\u003Cp\u003EDepending on the mode and configured strategy, this may involve checking:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECredential existence and validity.\u003C/li\u003E\n\u003Cli\u003EExpiration.\u003C/li\u003E\n\u003Cli\u003ERevocation or consumption state.\u003C/li\u003E\n\u003Cli\u003EAssociated user or session context.\u003C/li\u003E\n\u003Cli\u003EApplicable client and device context.\u003C/li\u003E\n\u003Cli\u003ERotation and reuse conditions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA valid refresh credential should not automatically bypass account-level or session-level security requirements that apply to the selected mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022access-and-refresh-separation\u0022\u003EAccess and Refresh Separation\u003C/h3\u003E\n\u003Cp\u003EAccess and refresh credentials have different responsibilities.\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\u003EAuthentication\n |\n v\nAccess credential\n |\n | Used for protected requests\n v\nAccess expires\n |\n v\nRefresh operation\n |\n | Validate refresh credential\n | Apply continuation rules\n v\nRenewed access credential\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe refresh operation does not extend the expiration timestamp of an already-issued JWT.\u003C/p\u003E\n\u003Cp\u003EIt issues new authentication material when continuation is permitted.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-rotation\u0022\u003ERefresh Rotation\u003C/h2\u003E\n\u003Cp\u003ERefresh rotation replaces refresh authentication material according to the configured refresh strategy.\u003C/p\u003E\n\u003Cp\u003EA rotating refresh mechanism can invalidate the previously used refresh credential and issue a replacement.\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\u003ERefresh credential A\n |\n | Successful refresh\n v\nRefresh credential A consumed\nRefresh credential B issued\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis reduces the period during which an older refresh credential remains reusable.\u003C/p\u003E\n\u003Cp\u003EHowever, \u003Cstrong\u003Erotation behavior is not identical across every UltimateAuth mode or refresh strategy\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003ESome session continuation operations may update existing server-side state without replacing a separate refresh credential.\u003C/p\u003E\n\u003Cp\u003EThe effective behavior must follow the selected mode and its configured refresh strategy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022rotation-is-not-replay-prevention-by-itself\u0022\u003ERotation Is Not Replay Prevention by Itself\u003C/h3\u003E\n\u003Cp\u003ERotation limits credential reuse only when the server enforces the relevant consumption or replacement state.\u003C/p\u003E\n\u003Cp\u003EA secure rotating refresh mechanism must account for situations such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe same credential being submitted again.\u003C/li\u003E\n\u003Cli\u003EConcurrent refresh requests.\u003C/li\u003E\n\u003Cli\u003EA credential being reused after replacement.\u003C/li\u003E\n\u003Cli\u003EAn interrupted response after a successful rotation.\u003C/li\u003E\n\u003Cli\u003EAn attacker and legitimate client attempting to use the same credential.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe exact outcome depends on the implemented refresh strategy and concurrency guarantees.\u003C/p\u003E\n\u003Cp\u003ERotation should not be described as automatically eliminating every replay risk.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-token-reuse\u0022\u003ERefresh Token Reuse\u003C/h2\u003E\n\u003Cp\u003ERefresh token reuse occurs when a credential is presented after it has already been consumed, replaced, or otherwise invalidated.\u003C/p\u003E\n\u003Cp\u003EFor a single-use rotating refresh credential, this is a security-relevant event.\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\u003EClient refreshes with A\n |\n v\nA replaced by B\n |\n v\nAnother request presents A\n |\n v\nReuse / invalid credential condition\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA reuse attempt may indicate credential theft, but it can also arise from concurrent requests or client synchronization failures.\u003C/p\u003E\n\u003Cp\u003EThe refresh implementation must distinguish these situations according to its supported guarantees and policy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-response\u0022\u003ESecurity Response\u003C/h3\u003E\n\u003Cp\u003EPossible security responses include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ERejecting the invalid refresh attempt.\u003C/li\u003E\n\u003Cli\u003EInvalidating the associated refresh state.\u003C/li\u003E\n\u003Cli\u003ERevoking an affected session.\u003C/li\u003E\n\u003Cli\u003ERevoking a broader session chain where supported and appropriate.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese are distinct actions.\u003C/p\u003E\n\u003Cp\u003EThe presence of a reuse-detection mechanism does not imply that every reuse attempt automatically revokes the entire device-associated chain.\u003C/p\u003E\n\u003Cp\u003ESuch behavior must be explicitly supported by the configured refresh strategy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-credential-storage\u0022\u003ERefresh Credential Storage\u003C/h2\u003E\n\u003Cp\u003ERefresh credentials are generally more sensitive to long-term compromise because they may allow new access credentials to be obtained.\u003C/p\u003E\n\u003Cp\u003ETheir storage therefore deserves stronger protection than ordinary client-visible access metadata.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-side-storage\u0022\u003EServer-Side Storage\u003C/h3\u003E\n\u003Cp\u003EFor persisted opaque refresh credentials, storing a one-way verifier or hash instead of the raw credential can reduce the impact of a storage disclosure.\u003C/p\u003E\n\u003Cp\u003EHowever, the exact persistence model depends on the selected authentication mode and refresh implementation.\u003C/p\u003E\n\u003Cp\u003EIt should not be assumed that every authentication mode uses the same refresh storage structure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-side-storage\u0022\u003EClient-Side Storage\u003C/h3\u003E\n\u003Cp\u003EThe appropriate client storage mechanism depends on the application environment.\u003C/p\u003E\n\u003Cp\u003EFor browser applications, HttpOnly cookies can prevent JavaScript from directly reading refresh credentials, although cookie-based refresh flows still require appropriate CSRF and origin protections.\u003C/p\u003E\n\u003Cp\u003ENative applications may use platform-provided secure storage where suitable.\u003C/p\u003E\n\u003Cp\u003ERefresh credentials should not be exposed through application logs, diagnostic output, URLs, or unrelated API responses.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022transport-security\u0022\u003ETransport Security\u003C/h3\u003E\n\u003Cp\u003EAuthentication credentials must be protected in transit.\u003C/p\u003E\n\u003Cp\u003EProduction authentication and refresh endpoints should use HTTPS.\u003C/p\u003E\n\u003Cp\u003EApplications should also avoid sending refresh credentials to services that do not need to receive them.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022claims-and-authorization-freshness\u0022\u003EClaims and Authorization Freshness\u003C/h2\u003E\n\u003Cp\u003EJWT claims represent information established when the token was issued.\u003C/p\u003E\n\u003Cp\u003EThey may include standard or application-specific information 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\u003Esub Subject identifier\niss Issuer\naud Audience\nexp Expiration\niat Issued-at time\njti Token identifier\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDepending on the application, a JWT may also include tenant information, roles, permissions, or session references.\u003C/p\u003E\n\u003Cp\u003EThese claims are not automatically updated when the underlying account changes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-permission-removal\u0022\u003EExample: Permission Removal\u003C/h3\u003E\n\u003Cp\u003EConsider the following sequence:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EA JWT is issued containing an administrative permission.\u003C/li\u003E\n\u003Cli\u003EAn administrator removes that permission from the user.\u003C/li\u003E\n\u003Cli\u003EThe client continues presenting the previously issued JWT.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EIf the protected resource relies only on the signed claims in that JWT, the removed permission may remain effective until the token expires.\u003C/p\u003E\n\u003Cp\u003EThe signature remains valid because the token has not been modified.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-strategies\u0022\u003EAuthorization Strategies\u003C/h3\u003E\n\u003Cp\u003EApplications can address this limitation through their security architecture, including:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EShorter JWT lifetimes.\u003C/li\u003E\n\u003Cli\u003EReissuing claims during refresh.\u003C/li\u003E\n\u003Cli\u003EConsulting authoritative authorization state for sensitive operations.\u003C/li\u003E\n\u003Cli\u003EUsing server-authoritative authentication modes where immediate state enforcement is required.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe appropriate approach depends on the security requirements of the application.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/plugin-domains/authorization\u0022\u003EAuthorization\u003C/a\u003E and \u003Ca href=\u0022/docs/plugin-domains/policies\u0022\u003EPolicies \u0026amp; Access Control\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-revocation\u0022\u003EToken Revocation\u003C/h2\u003E\n\u003Cp\u003ERevocation behavior differs fundamentally between opaque credentials and locally validated JWTs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022opaque-credential-revocation\u0022\u003EOpaque Credential Revocation\u003C/h3\u003E\n\u003Cp\u003EAn opaque credential depends on authoritative validation.\u003C/p\u003E\n\u003Cp\u003EIf the corresponding server-managed authentication state is revoked, subsequent validation can reject the credential.\u003C/p\u003E\n\u003Cp\u003EThe precise scope depends on whether the security operation targets a session, chain, or account-level root.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-revocation\u0022\u003EJWT Revocation\u003C/h3\u003E\n\u003Cp\u003EA signed JWT cannot be made cryptographically invalid merely by deleting a server-side session record.\u003C/p\u003E\n\u003Cp\u003EIts signature and expiration remain unchanged.\u003C/p\u003E\n\u003Cp\u003ETo reject an otherwise valid JWT before expiration, the resource must enforce an additional condition, such as an authoritative revocation check or another supported invalidation mechanism.\u003C/p\u003E\n\u003Cp\u003EWithout that additional enforcement, a locally validated JWT may remain acceptable until expiration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-revocation\u0022\u003ERefresh Revocation\u003C/h3\u003E\n\u003Cp\u003ERevoking a refresh credential can prevent further successful refresh operations.\u003C/p\u003E\n\u003Cp\u003EHowever, that does not necessarily invalidate access tokens already issued before the revocation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAccess revocation and refresh revocation are separate security concerns.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-security-and-token-security\u0022\u003ESession Security and Token Security\u003C/h2\u003E\n\u003Cp\u003EToken security and session security are closely related, but they operate at different levels.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConcern\u003C/th\u003E\n\u003Cth\u003EToken Security\u003C/th\u003E\n\u003Cth\u003ESession Security\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECredential format\u003C/td\u003E\n\u003Ctd\u003EOpaque or JWT\u003C/td\u003E\n\u003Ctd\u003ERoot, chain, and session state\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECryptographic validation\u003C/td\u003E\n\u003Ctd\u003EJWT signature and claims\u003C/td\u003E\n\u003Ctd\u003ENot a substitute for token signature validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EExpiration\u003C/td\u003E\n\u003Ctd\u003EToken validity period\u003C/td\u003E\n\u003Ctd\u003ESession and chain lifecycle limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERotation\u003C/td\u003E\n\u003Ctd\u003EReplacement of authentication material\u003C/td\u003E\n\u003Ctd\u003EContinuity and associated state transitions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERevocation\u003C/td\u003E\n\u003Ctd\u003EWhether a presented credential remains acceptable\u003C/td\u003E\n\u003Ctd\u003EWhich authentication state has been invalidated\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDevice context\u003C/td\u003E\n\u003Ctd\u003EMay be associated with token use\u003C/td\u003E\n\u003Ctd\u003EManaged through applicable chain and session context\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EA token may be valid according to its own format but unacceptable under authoritative session security rules.\u003C/p\u003E\n\u003Cp\u003EConversely, server-side session state may remain active while a particular access token has expired.\u003C/p\u003E\n\u003Cp\u003EBoth levels must be understood to reason correctly about the selected authentication mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-security-misconceptions\u0022\u003ECommon Security Misconceptions\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-valid-signature-means-current-authorization\u0022\u003EA Valid Signature Means Current Authorization\u003C/h3\u003E\n\u003Cp\u003EA valid JWT signature proves that the token has not been modified and was signed by an accepted key.\u003C/p\u003E\n\u003Cp\u003EIt does not prove that the user\u0027s permissions or account status have remained unchanged since issuance.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-device-identifier-prevents-token-theft\u0022\u003EA Device Identifier Prevents Token Theft\u003C/h3\u003E\n\u003Cp\u003EA device identifier may support context consistency checks.\u003C/p\u003E\n\u003Cp\u003EIt does not independently prevent a stolen bearer credential from being replayed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-rotation-makes-token-theft-impossible\u0022\u003ERefresh Rotation Makes Token Theft Impossible\u003C/h3\u003E\n\u003Cp\u003ERotation can reduce reuse opportunities and support detection of invalid reuse.\u003C/p\u003E\n\u003Cp\u003EIt does not prevent a stolen credential from being used before the legitimate client or server detects the compromise.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-invalidates-every-jwt-immediately\u0022\u003ELogout Invalidates Every JWT Immediately\u003C/h3\u003E\n\u003Cp\u003ELogout may revoke server-managed session or refresh state.\u003C/p\u003E\n\u003Cp\u003EPreviously issued JWT access tokens can remain valid until expiration unless protected resources enforce an additional invalidation mechanism.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022short-lived-tokens-eliminate-the-need-for-session-security\u0022\u003EShort-Lived Tokens Eliminate the Need for Session Security\u003C/h3\u003E\n\u003Cp\u003EShort lifetimes reduce the exposure window of a compromised token.\u003C/p\u003E\n\u003Cp\u003EThey do not replace account-level security policies, credential recovery protections, or session revocation controls where those capabilities are required.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-design-principles\u0022\u003ESecurity Design Principles\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth\u0027s token model is best understood through a few principles.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUse credentials only for their intended purpose.\u003C/strong\u003E Access and refresh credentials must not be interchangeable.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EValidate according to the selected mode.\u003C/strong\u003E Opaque credentials require authoritative validation; JWTs require correct cryptographic and claims validation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ETreat JWT claims as issuance-time information.\u003C/strong\u003E Current authorization state may differ from what an older token contains.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EKeep access credentials appropriately short-lived.\u003C/strong\u003E Token lifetime should reflect the application\u0027s acceptable exposure window.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EEnforce refresh continuation rules.\u003C/strong\u003E Rotation, expiration, consumption, and reuse behavior must be consistent with the configured strategy.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDistinguish token expiration from session revocation.\u003C/strong\u003E They invalidate authentication through different mechanisms.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDo not promise immediate JWT revocation without enforcement.\u003C/strong\u003E Server-side state changes affect locally validated tokens only when the resource checks the relevant state.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022architectural-perspective\u0022\u003EArchitectural Perspective\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth does not impose a single token model on every application.\u003C/p\u003E\n\u003Cp\u003EPureOpaque and Hybrid emphasize server-authoritative authentication state.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid and PureJwt support locally validated JWT access, with different approaches to authentication continuation.\u003C/p\u003E\n\u003Cp\u003EThese choices affect performance, storage requirements, revocation behavior, and authorization freshness.\u003C/p\u003E\n\u003Cp\u003EThe purpose of the token security model is to make those tradeoffs explicit.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA token establishes access only while its applicable validation requirements remain satisfied. The strength and freshness of those requirements depend on the authentication mode.\u003C/strong\u003E\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/security/session-security\u0022\u003ESession Security\u003C/a\u003E \u2014 Understand authoritative session validation and hierarchical revocation.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E \u2014 Compare credential behavior across modes.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/sessions-devices/session-lifecycle\u0022\u003ESession Model \u0026amp; Lifecycle\u003C/a\u003E \u2014 Explore session creation, continuation, and invalidation.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/plugin-domains/credentials\u0022\u003ECredentials\u003C/a\u003E \u2014 Understand credential management and recovery security.\u003C/li\u003E\n\u003C/ul\u003E\n", + "Html": "\n\u003Cp\u003EAuthentication tokens allow clients to present authentication state to protected applications and services.\u003C/p\u003E\n\u003Cp\u003EHowever, not all tokens provide the same security guarantees.\u003C/p\u003E\n\u003Cp\u003EAn opaque credential requires authoritative server-side validation. A JSON Web Token (JWT) can be verified locally using its signature and claims. A refresh credential enables authentication to continue without repeating the original login process.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth supports these different mechanisms through its authentication modes.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EToken security depends on the credential\u0027s purpose, how it is validated, how long it remains valid, and which security state is consulted during validation.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThis page explains the security characteristics of access and refresh credentials, including issuance, expiration, rotation, replay risks, and revocation boundaries.\u003C/p\u003E\n\u003Cp\u003EFor the overall authentication architecture, 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=\u0022authentication-state-and-credentials\u0022\u003EAuthentication State and Credentials\u003C/h2\u003E\n\u003Cp\u003EA token is authentication material presented by a client.\u003C/p\u003E\n\u003Cp\u003EIt is not the user identity itself.\u003C/p\u003E\n\u003Cp\u003EDepending on the authentication mode, the token may reference server-managed authentication state or contain signed claims that can be validated without retrieving a session.\u003C/p\u003E\n\u003Cp\u003EThese approaches establish different trust boundaries.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-authoritative-authentication\u0022\u003EServer-Authoritative Authentication\u003C/h3\u003E\n\u003Cp\u003EIn server-authoritative modes, a presented opaque credential is validated against server-managed authentication state.\u003C/p\u003E\n\u003Cp\u003EThe server can evaluate the current validity of the corresponding session and applicable security conditions.\u003C/p\u003E\n\u003Cp\u003EThis allows revocation and other authoritative state changes to affect subsequent protected requests.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022locally-validated-authentication\u0022\u003ELocally Validated Authentication\u003C/h3\u003E\n\u003Cp\u003EIn JWT-based modes, a protected resource can validate a token using its signature, issuer, audience, expiration, and other applicable token requirements.\u003C/p\u003E\n\u003Cp\u003EThe resource may not need to consult the issuing server or a session store for every request.\u003C/p\u003E\n\u003Cp\u003EThis reduces the dependency on server-side session lookups but changes how quickly revocation and authorization changes can be enforced.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ENeither model makes the token an identity record. The token is a credential whose validity is determined by the selected authentication mechanism.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-types\u0022\u003EToken Types\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses two principal access credential formats: opaque credentials and JWTs.\u003C/p\u003E\n\u003Cp\u003ERefresh credentials serve a separate purpose.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003ECredential\u003C/th\u003E\n\u003Cth\u003EPurpose\u003C/th\u003E\n\u003Cth\u003EValidation model\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EOpaque access credential\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthenticate protected requests\u003C/td\u003E\n\u003Ctd\u003EAuthoritative server-side validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EJWT access token\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EAuthenticate protected requests\u003C/td\u003E\n\u003Ctd\u003ECryptographic and claims validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003E\u003Cstrong\u003EOpaque refresh credential\u003C/strong\u003E\u003C/td\u003E\n\u003Ctd\u003EContinue authentication and obtain renewed credentials\u003C/td\u003E\n\u003Ctd\u003ERefresh-specific validation and state checks\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe distinction between access and refresh credentials is important.\u003C/p\u003E\n\u003Cp\u003EAccess credentials are presented to protected resources.\u003C/p\u003E\n\u003Cp\u003ERefresh credentials are presented to the authentication system for a continuation operation. They should not be accepted as ordinary access credentials.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022opaque-access-credentials\u0022\u003EOpaque Access Credentials\u003C/h2\u003E\n\u003Cp\u003EAn opaque credential is a value whose contents do not expose the authenticated identity or authorization claims to the client.\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\u003EAccess credential:\nq8Vn2...random-opaque-value...M7x\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe client presents the credential, but cannot determine its authorization meaning by decoding it.\u003C/p\u003E\n\u003Cp\u003EThe server resolves and validates the associated authentication state.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-properties\u0022\u003ESecurity Properties\u003C/h3\u003E\n\u003Cp\u003EOpaque access credentials provide several useful characteristics:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ETheir meaning is determined by authoritative server-side state.\u003C/li\u003E\n\u003Cli\u003EThey do not need to expose identity claims in a client-readable payload.\u003C/li\u003E\n\u003Cli\u003ETheir validity can be affected by session expiration or revocation.\u003C/li\u003E\n\u003Cli\u003EThey can participate in account-level and chain-level security enforcement.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EHowever, opaque credentials are still bearer credentials unless an additional proof mechanism is enforced.\u003C/p\u003E\n\u003Cp\u003EAn attacker who obtains a usable opaque credential may be able to present it.\u003C/p\u003E\n\u003Cp\u003EOpacity alone does not prevent credential theft or replay.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-side-validation\u0022\u003EServer-Side Validation\u003C/h3\u003E\n\u003Cp\u003EIn a session-authoritative mode, validation can enforce the applicable session hierarchy requirements, including expiration, revocation, ownership, and security state consistency.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/security/session-security\u0022\u003ESession Security Model\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-access-tokens\u0022\u003EJWT Access Tokens\u003C/h2\u003E\n\u003Cp\u003EA JWT is a structured token containing signed claims.\u003C/p\u003E\n\u003Cp\u003EA typical JWT contains three encoded sections:\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\u003Eheader.payload.signature\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EIts payload may describe the authenticated subject, tenant, authorization information, token lifetime, and other relevant context.\u003C/p\u003E\n\u003Cp\u003EA JWT is not encrypted merely because it is encoded and signed.\u003C/p\u003E\n\u003Cp\u003EApplications should not place secrets or unnecessarily sensitive information in a JWT payload.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cryptographic-validation\u0022\u003ECryptographic Validation\u003C/h3\u003E\n\u003Cp\u003EA protected resource must validate the JWT according to the configured token requirements.\u003C/p\u003E\n\u003Cp\u003ERelevant checks include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESignature validity.\u003C/li\u003E\n\u003Cli\u003EAccepted signing algorithm and key.\u003C/li\u003E\n\u003Cli\u003EExpected issuer.\u003C/li\u003E\n\u003Cli\u003EIntended audience.\u003C/li\u003E\n\u003Cli\u003EExpiration and other applicable time constraints.\u003C/li\u003E\n\u003Cli\u003ERequired token claims and application-specific restrictions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA successfully decoded JWT is not necessarily a valid JWT.\u003C/p\u003E\n\u003Cp\u003ELikewise, a correctly signed JWT is not automatically acceptable to every resource.\u003C/p\u003E\n\u003Cp\u003EThe resource must verify that the token was issued for its intended security context.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022local-validation\u0022\u003ELocal Validation\u003C/h3\u003E\n\u003Cp\u003EJWTs can be validated without loading current server-side session state.\u003C/p\u003E\n\u003Cp\u003EThis is useful for distributed APIs and services that need to authenticate requests efficiently.\u003C/p\u003E\n\u003Cp\u003EHowever, local validation introduces an important limitation:\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA token can remain cryptographically valid after the underlying account or authorization state has changed.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EWhether such changes immediately affect access depends on additional validation and revocation mechanisms.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-mode-behavior\u0022\u003EAuthentication Mode Behavior\u003C/h2\u003E\n\u003Cp\u003EAuthentication modes define how credentials participate in authentication and continuation.\u003C/p\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\u003EPrimary authentication credential\u003C/th\u003E\n\u003Cth\u003EServer-managed continuity\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\u003Ctd\u003ESession lifecycle\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\u003Ctd\u003ESession and refresh-token lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESemiHybrid\u003C/td\u003E\n\u003Ctd\u003ESession-associated JWT access token\u003C/td\u003E\n\u003Ctd\u003ESession lineage and refresh-token lifecycle\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPureJwt\u003C/td\u003E\n\u003Ctd\u003ESession-independent JWT access token\u003C/td\u003E\n\u003Ctd\u003EOptional refresh-token lifecycle\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/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E for the architectural guarantees of each mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-identifiers-are-not-always-credentials\u0022\u003ESession identifiers are not always credentials\u003C/h3\u003E\n\u003Cp\u003EA session identifier can have different security purposes depending on the mode.\u003C/p\u003E\n\u003Cp\u003EIn PureOpaque and Hybrid, the opaque session identifier acts as an authentication credential.\u003C/p\u003E\n\u003Cp\u003EPossession of this value must therefore be treated as possession of sensitive authentication material.\u003C/p\u003E\n\u003Cp\u003EIn SemiHybrid, the session identifier is included in the JWT as lineage metadata.\u003C/p\u003E\n\u003Cp\u003EThe metadata identifies the associated server-managed session but does not independently authenticate the caller.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth distinguishes opaque session credentials from metadata-only session identifiers.\u003C/p\u003E\n\u003Cp\u003EA metadata-only identifier must never be accepted through an opaque session authentication path.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-purpose-isolation\u0022\u003ECredential purpose isolation\u003C/h3\u003E\n\u003Cp\u003EAuthentication credentials must be validated according to their intended purpose.\u003C/p\u003E\n\u003Cp\u003EA session identifier, access token, and refresh token are not interchangeable.\u003C/p\u003E\n\u003Cp\u003EA valid refresh token does not directly authorize access to a protected resource.\u003C/p\u003E\n\u003Cp\u003EA valid JWT does not automatically establish that its associated server-managed session remains active.\u003C/p\u003E\n\u003Cp\u003EA session identifier exposed as JWT metadata does not become an authentication credential.\u003C/p\u003E\n\u003Cp\u003ECredential purpose isolation prevents authentication material from being reused outside its intended security boundary.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-validation-requirements\u0022\u003EJWT Validation Requirements\u003C/h2\u003E\n\u003Cp\u003ESemiHybrid and PureJwt Resource APIs validate JWT access tokens locally using trusted verification keys and explicit validation configuration.\u003C/p\u003E\n\u003Cp\u003ESuccessful validation requires the applicable:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECryptographic signature validation.\u003C/li\u003E\n\u003Cli\u003ETrusted signing or verification key.\u003C/li\u003E\n\u003Cli\u003EIssuer validation.\u003C/li\u003E\n\u003Cli\u003EAudience validation.\u003C/li\u003E\n\u003Cli\u003EToken lifetime validation.\u003C/li\u003E\n\u003Cli\u003ESupported signing algorithm.\u003C/li\u003E\n\u003Cli\u003ERequired identity and device claims.\u003C/li\u003E\n\u003Cli\u003EAuthentication-mode-specific claim requirements.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA valid signature alone is insufficient.\u003C/p\u003E\n\u003Cp\u003EThe token must also satisfy the authentication requirements of the configured mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022mode-specific-session-association\u0022\u003EMode-specific session association\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid requires a valid session identifier claim associated with server-managed lineage.\u003C/p\u003E\n\u003Cp\u003EPureJwt requires a session-independent access token and does not accept a session-bound JWT as a PureJwt authentication credential.\u003C/p\u003E\n\u003Cp\u003EThe presence or absence of session association is part of the authentication mode\u0027s security boundary.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022device-binding\u0022\u003EDevice binding\u003C/h3\u003E\n\u003Cp\u003EJWT access tokens contain a device identifier.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth applies the configured device mismatch behavior during authentication.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EReject\u003C/code\u003E requires the request device to match the device associated with the token.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllow\u003C/code\u003E permits authentication despite a request-device mismatch.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowAndRebind\u003C/code\u003E is not supported for JWT-based authentication modes.\u003C/p\u003E\n\u003Cp\u003EAllowing a request-device mismatch does not permit inconsistent credential-to-session binding during authoritative validation.\u003C/p\u003E\n\u003Cp\u003EA device identifier is not a substitute for cryptographic proof of possession.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authoritative-jwt-validation\u0022\u003EAuthoritative JWT validation\u003C/h3\u003E\n\u003Cp\u003ESemiHybrid can additionally require authoritative validation of the session associated with the JWT.\u003C/p\u003E\n\u003Cp\u003EThis validates the current session lineage and its relationship to the authenticated identity.\u003C/p\u003E\n\u003Cp\u003EIt does not replace JWT signature validation or automatically establish fresh authorization claims.\u003C/p\u003E\n\u003Cp\u003EPureJwt does not support session-authoritative validation because it has no associated authentication session.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022trusted-verification-keys\u0022\u003ETrusted verification keys\u003C/h3\u003E\n\u003Cp\u003EVerification keys must come from trusted application configuration or an explicitly registered verification-key provider.\u003C/p\u003E\n\u003Cp\u003EThe Resource API does not accept signing keys supplied by an untrusted JWT header or automatically retrieve keys from token-provided URLs.\u003C/p\u003E\n\u003Cp\u003EThe built-in configured verification-key provider supports Base64-encoded symmetric keys.\u003C/p\u003E\n\u003Cp\u003EFor the built-in HS256 signing implementation, use at least 32 bytes of cryptographically secure random key material.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022stateless-authorization-freshness\u0022\u003EStateless authorization freshness\u003C/h3\u003E\n\u003Cp\u003EPureJwt Resource APIs do not require a live user-state lookup during normal JWT validation.\u003C/p\u003E\n\u003Cp\u003EAs a result, an otherwise valid JWT can remain accepted after account deletion, suspension, permission changes, or refresh-chain revocation.\u003C/p\u003E\n\u003Cp\u003EApplications requiring immediate enforcement of such changes must implement an additional authoritative validation mechanism or use an appropriate session-backed authentication strategy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022access-token-lifetime\u0022\u003EAccess Token Lifetime\u003C/h2\u003E\n\u003Cp\u003EAccess credentials should have lifetimes appropriate to their authentication mode and security requirements.\u003C/p\u003E\n\u003Cp\u003EShort-lived JWT access tokens are particularly important because a token may remain usable until expiration even after server-side authorization state changes.\u003C/p\u003E\n\u003Cp\u003EFor example, an application might choose a JWT access lifetime of several minutes.\u003C/p\u003E\n\u003Cp\u003EHowever, \u003Cstrong\u003Ea lifetime such as 5\u201315 minutes is an example of an application security choice, not a universal UltimateAuth default or requirement\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe appropriate value depends on factors such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ESensitivity of protected resources.\u003C/li\u003E\n\u003Cli\u003EExpected frequency of authorization changes.\u003C/li\u003E\n\u003Cli\u003EAcceptable revocation delay.\u003C/li\u003E\n\u003Cli\u003EAvailability and security of the refresh mechanism.\u003C/li\u003E\n\u003Cli\u003EClient behavior and network conditions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022lifetime-versus-revocation\u0022\u003ELifetime Versus Revocation\u003C/h3\u003E\n\u003Cp\u003EExpiration limits how long a credential can be accepted.\u003C/p\u003E\n\u003Cp\u003ERevocation invalidates authentication state before its ordinary expiration.\u003C/p\u003E\n\u003Cp\u003EThese mechanisms are related but not interchangeable.\u003C/p\u003E\n\u003Cp\u003EIn server-authoritative modes, current revocation state can be checked during protected requests.\u003C/p\u003E\n\u003Cp\u003EIn locally validated JWT modes, expiration may remain the primary limit on an already-issued access token unless an additional revocation check is implemented.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-credentials\u0022\u003ERefresh Credentials\u003C/h2\u003E\n\u003Cp\u003ERefresh credentials allow clients to continue authentication without repeating the original authentication ceremony.\u003C/p\u003E\n\u003Cp\u003EThey are intended for the authentication system\u0027s refresh operation, not for general API access.\u003C/p\u003E\n\u003Cp\u003EIn UltimateAuth, refresh behavior is mode-dependent.\u003C/p\u003E\n\u003Cp\u003EPureOpaque does not issue a separate access-token and refresh-token pair.\u003C/p\u003E\n\u003Cp\u003EHybrid uses refresh-token rotation together with session validation.\u003C/p\u003E\n\u003Cp\u003EPureJwt uses stateful refresh-token rotation without requiring an authentication session.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid combines JWT authentication with server-managed session lifecycle operations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-security-requirements\u0022\u003ERefresh Security Requirements\u003C/h3\u003E\n\u003Cp\u003EA secure refresh operation must establish that the presented credential is eligible for continued authentication.\u003C/p\u003E\n\u003Cp\u003EDepending on the mode and configured strategy, this may involve checking:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ECredential existence and validity.\u003C/li\u003E\n\u003Cli\u003EExpiration.\u003C/li\u003E\n\u003Cli\u003ERevocation or consumption state.\u003C/li\u003E\n\u003Cli\u003EAssociated user or session context.\u003C/li\u003E\n\u003Cli\u003EApplicable client and device context.\u003C/li\u003E\n\u003Cli\u003ERotation and reuse conditions.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EA valid refresh credential should not automatically bypass account-level or session-level security requirements that apply to the selected mode.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022access-and-refresh-separation\u0022\u003EAccess and Refresh Separation\u003C/h3\u003E\n\u003Cp\u003EAccess and refresh credentials have different responsibilities.\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\u003EAuthentication\n |\n v\nAccess credential\n |\n | Used for protected requests\n v\nAccess expires\n |\n v\nRefresh operation\n |\n | Validate refresh credential\n | Apply continuation rules\n v\nRenewed access credential\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe refresh operation does not extend the expiration timestamp of an already-issued JWT.\u003C/p\u003E\n\u003Cp\u003EIt issues new authentication material when continuation is permitted.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-rotation\u0022\u003ERefresh Rotation\u003C/h2\u003E\n\u003Cp\u003ERefresh rotation replaces refresh authentication material according to the configured refresh strategy.\u003C/p\u003E\n\u003Cp\u003EA rotating refresh mechanism can invalidate the previously used refresh credential and issue a replacement.\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\u003ERefresh credential A\n |\n | Successful refresh\n v\nRefresh credential A consumed\nRefresh credential B issued\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis reduces the period during which an older refresh credential remains reusable.\u003C/p\u003E\n\u003Cp\u003EHowever, \u003Cstrong\u003Erotation behavior is not identical across every UltimateAuth mode or refresh strategy\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003ESome session continuation operations may update existing server-side state without replacing a separate refresh credential.\u003C/p\u003E\n\u003Cp\u003EThe effective behavior must follow the selected mode and its configured refresh strategy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022rotation-is-not-replay-prevention-by-itself\u0022\u003ERotation Is Not Replay Prevention by Itself\u003C/h3\u003E\n\u003Cp\u003ERotation limits credential reuse only when the server enforces the relevant consumption or replacement state.\u003C/p\u003E\n\u003Cp\u003EA secure rotating refresh mechanism must account for situations such as:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe same credential being submitted again.\u003C/li\u003E\n\u003Cli\u003EConcurrent refresh requests.\u003C/li\u003E\n\u003Cli\u003EA credential being reused after replacement.\u003C/li\u003E\n\u003Cli\u003EAn interrupted response after a successful rotation.\u003C/li\u003E\n\u003Cli\u003EAn attacker and legitimate client attempting to use the same credential.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe exact outcome depends on the implemented refresh strategy and concurrency guarantees.\u003C/p\u003E\n\u003Cp\u003ERotation should not be described as automatically eliminating every replay risk.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-token-reuse\u0022\u003ERefresh Token Reuse\u003C/h2\u003E\n\u003Cp\u003ERefresh token reuse occurs when a credential is presented after it has already been consumed, replaced, or otherwise invalidated.\u003C/p\u003E\n\u003Cp\u003EFor a single-use rotating refresh credential, this is a security-relevant event.\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\u003EClient refreshes with A\n |\n v\nA replaced by B\n |\n v\nAnother request presents A\n |\n v\nReuse / invalid credential condition\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EA reuse attempt may indicate credential theft, but it can also arise from concurrent requests or client synchronization failures.\u003C/p\u003E\n\u003Cp\u003EThe refresh implementation must distinguish these situations according to its supported guarantees and policy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-response\u0022\u003ESecurity Response\u003C/h3\u003E\n\u003Cp\u003EPossible security responses include:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003ERejecting the invalid refresh attempt.\u003C/li\u003E\n\u003Cli\u003EInvalidating the associated refresh state.\u003C/li\u003E\n\u003Cli\u003ERevoking an affected session.\u003C/li\u003E\n\u003Cli\u003ERevoking a broader session chain where supported and appropriate.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThese are distinct actions.\u003C/p\u003E\n\u003Cp\u003EThe presence of a reuse-detection mechanism does not imply that every reuse attempt automatically revokes the entire device-associated chain.\u003C/p\u003E\n\u003Cp\u003ESuch behavior must be explicitly supported by the configured refresh strategy.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-credential-storage\u0022\u003ERefresh Credential Storage\u003C/h2\u003E\n\u003Cp\u003ERefresh credentials are generally more sensitive to long-term compromise because they may allow new access credentials to be obtained.\u003C/p\u003E\n\u003Cp\u003ETheir storage therefore deserves stronger protection than ordinary client-visible access metadata.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-side-storage\u0022\u003EServer-Side Storage\u003C/h3\u003E\n\u003Cp\u003EFor persisted opaque refresh credentials, storing a one-way verifier or hash instead of the raw credential can reduce the impact of a storage disclosure.\u003C/p\u003E\n\u003Cp\u003EHowever, the exact persistence model depends on the selected authentication mode and refresh implementation.\u003C/p\u003E\n\u003Cp\u003EIt should not be assumed that every authentication mode uses the same refresh storage structure.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-side-storage\u0022\u003EClient-Side Storage\u003C/h3\u003E\n\u003Cp\u003EThe appropriate client storage mechanism depends on the application environment.\u003C/p\u003E\n\u003Cp\u003EFor browser applications, HttpOnly cookies can prevent JavaScript from directly reading refresh credentials, although cookie-based refresh flows still require appropriate CSRF and origin protections.\u003C/p\u003E\n\u003Cp\u003ENative applications may use platform-provided secure storage where suitable.\u003C/p\u003E\n\u003Cp\u003ERefresh credentials should not be exposed through application logs, diagnostic output, URLs, or unrelated API responses.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022transport-security\u0022\u003ETransport Security\u003C/h3\u003E\n\u003Cp\u003EAuthentication credentials must be protected in transit.\u003C/p\u003E\n\u003Cp\u003EProduction authentication and refresh endpoints should use HTTPS.\u003C/p\u003E\n\u003Cp\u003EApplications should also avoid sending refresh credentials to services that do not need to receive them.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022claims-and-authorization-freshness\u0022\u003EClaims and Authorization Freshness\u003C/h2\u003E\n\u003Cp\u003EJWT claims represent information established when the token was issued.\u003C/p\u003E\n\u003Cp\u003EThey may include standard or application-specific information 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\u003Esub Subject identifier\niss Issuer\naud Audience\nexp Expiration\niat Issued-at time\njti Token identifier\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDepending on the application, a JWT may also include tenant information, roles, permissions, or session references.\u003C/p\u003E\n\u003Cp\u003EThese claims are not automatically updated when the underlying account changes.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022example-permission-removal\u0022\u003EExample: Permission Removal\u003C/h3\u003E\n\u003Cp\u003EConsider the following sequence:\u003C/p\u003E\n\u003Col\u003E\n\u003Cli\u003EA JWT is issued containing an administrative permission.\u003C/li\u003E\n\u003Cli\u003EAn administrator removes that permission from the user.\u003C/li\u003E\n\u003Cli\u003EThe client continues presenting the previously issued JWT.\u003C/li\u003E\n\u003C/ol\u003E\n\u003Cp\u003EIf the protected resource relies only on the signed claims in that JWT, the removed permission may remain effective until the token expires.\u003C/p\u003E\n\u003Cp\u003EThe signature remains valid because the token has not been modified.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authorization-strategies\u0022\u003EAuthorization Strategies\u003C/h3\u003E\n\u003Cp\u003EApplications can address this limitation through their security architecture, including:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003EShorter JWT lifetimes.\u003C/li\u003E\n\u003Cli\u003EReissuing claims during refresh.\u003C/li\u003E\n\u003Cli\u003EConsulting authoritative authorization state for sensitive operations.\u003C/li\u003E\n\u003Cli\u003EUsing server-authoritative authentication modes where immediate state enforcement is required.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EThe appropriate approach depends on the security requirements of the application.\u003C/p\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/plugin-domains/authorization\u0022\u003EAuthorization\u003C/a\u003E and \u003Ca href=\u0022/docs/plugin-domains/policies\u0022\u003EPolicies \u0026amp; Access Control\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022token-revocation\u0022\u003EToken Revocation\u003C/h2\u003E\n\u003Cp\u003ERevocation behavior differs fundamentally between opaque credentials and locally validated JWTs.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022opaque-credential-revocation\u0022\u003EOpaque Credential Revocation\u003C/h3\u003E\n\u003Cp\u003EAn opaque credential depends on authoritative validation.\u003C/p\u003E\n\u003Cp\u003EIf the corresponding server-managed authentication state is revoked, subsequent validation can reject the credential.\u003C/p\u003E\n\u003Cp\u003EThe precise scope depends on whether the security operation targets a session, chain, or account-level root.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022jwt-revocation\u0022\u003EJWT Revocation\u003C/h3\u003E\n\u003Cp\u003EA signed JWT cannot be made cryptographically invalid merely by deleting a server-side session record.\u003C/p\u003E\n\u003Cp\u003EIts signature and expiration remain unchanged.\u003C/p\u003E\n\u003Cp\u003ETo reject an otherwise valid JWT before expiration, the resource must enforce an additional condition, such as an authoritative revocation check or another supported invalidation mechanism.\u003C/p\u003E\n\u003Cp\u003EWithout that additional enforcement, a locally validated JWT may remain acceptable until expiration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-revocation\u0022\u003ERefresh Revocation\u003C/h3\u003E\n\u003Cp\u003ERevoking a refresh credential can prevent further successful refresh operations.\u003C/p\u003E\n\u003Cp\u003EHowever, that does not necessarily invalidate access tokens already issued before the revocation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAccess revocation and refresh revocation are separate security concerns.\u003C/strong\u003E\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022session-security-and-token-security\u0022\u003ESession Security and Token Security\u003C/h2\u003E\n\u003Cp\u003EToken security and session security are closely related, but they operate at different levels.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EConcern\u003C/th\u003E\n\u003Cth\u003EToken Security\u003C/th\u003E\n\u003Cth\u003ESession Security\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECredential format\u003C/td\u003E\n\u003Ctd\u003EOpaque or JWT\u003C/td\u003E\n\u003Ctd\u003ERoot, chain, and session state\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECryptographic validation\u003C/td\u003E\n\u003Ctd\u003EJWT signature and claims\u003C/td\u003E\n\u003Ctd\u003ENot a substitute for token signature validation\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EExpiration\u003C/td\u003E\n\u003Ctd\u003EToken validity period\u003C/td\u003E\n\u003Ctd\u003ESession and chain lifecycle limits\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERotation\u003C/td\u003E\n\u003Ctd\u003EReplacement of authentication material\u003C/td\u003E\n\u003Ctd\u003EContinuity and associated state transitions\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ERevocation\u003C/td\u003E\n\u003Ctd\u003EWhether a presented credential remains acceptable\u003C/td\u003E\n\u003Ctd\u003EWhich authentication state has been invalidated\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDevice context\u003C/td\u003E\n\u003Ctd\u003EMay be associated with token use\u003C/td\u003E\n\u003Ctd\u003EManaged through applicable chain and session context\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EA token may be valid according to its own format but unacceptable under authoritative session security rules.\u003C/p\u003E\n\u003Cp\u003EConversely, server-side session state may remain active while a particular access token has expired.\u003C/p\u003E\n\u003Cp\u003EBoth levels must be understood to reason correctly about the selected authentication mode.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022common-security-misconceptions\u0022\u003ECommon Security Misconceptions\u003C/h2\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-valid-signature-means-current-authorization\u0022\u003EA Valid Signature Means Current Authorization\u003C/h3\u003E\n\u003Cp\u003EA valid JWT signature proves that the token has not been modified and was signed by an accepted key.\u003C/p\u003E\n\u003Cp\u003EIt does not prove that the user\u0027s permissions or account status have remained unchanged since issuance.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022a-device-identifier-prevents-token-theft\u0022\u003EA Device Identifier Prevents Token Theft\u003C/h3\u003E\n\u003Cp\u003EA device identifier may support context consistency checks.\u003C/p\u003E\n\u003Cp\u003EIt does not independently prevent a stolen bearer credential from being replayed.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022refresh-rotation-makes-token-theft-impossible\u0022\u003ERefresh Rotation Makes Token Theft Impossible\u003C/h3\u003E\n\u003Cp\u003ERotation can reduce reuse opportunities and support detection of invalid reuse.\u003C/p\u003E\n\u003Cp\u003EIt does not prevent a stolen credential from being used before the legitimate client or server detects the compromise.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022logout-invalidates-every-jwt-immediately\u0022\u003ELogout Invalidates Every JWT Immediately\u003C/h3\u003E\n\u003Cp\u003ELogout may revoke server-managed session or refresh state.\u003C/p\u003E\n\u003Cp\u003EPreviously issued JWT access tokens can remain valid until expiration unless protected resources enforce an additional invalidation mechanism.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022short-lived-tokens-eliminate-the-need-for-session-security\u0022\u003EShort-Lived Tokens Eliminate the Need for Session Security\u003C/h3\u003E\n\u003Cp\u003EShort lifetimes reduce the exposure window of a compromised token.\u003C/p\u003E\n\u003Cp\u003EThey do not replace account-level security policies, credential recovery protections, or session revocation controls where those capabilities are required.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022security-design-principles\u0022\u003ESecurity Design Principles\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth\u0027s token model is best understood through a few principles.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EUse credentials only for their intended purpose.\u003C/strong\u003E Access and refresh credentials must not be interchangeable.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EValidate according to the selected mode.\u003C/strong\u003E Opaque credentials require authoritative validation; JWTs require correct cryptographic and claims validation.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ETreat JWT claims as issuance-time information.\u003C/strong\u003E Current authorization state may differ from what an older token contains.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EKeep access credentials appropriately short-lived.\u003C/strong\u003E Token lifetime should reflect the application\u0027s acceptable exposure window.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EEnforce refresh continuation rules.\u003C/strong\u003E Rotation, expiration, consumption, and reuse behavior must be consistent with the configured strategy.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDistinguish token expiration from session revocation.\u003C/strong\u003E They invalidate authentication through different mechanisms.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EDo not promise immediate JWT revocation without enforcement.\u003C/strong\u003E Server-side state changes affect locally validated tokens only when the resource checks the relevant state.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022architectural-perspective\u0022\u003EArchitectural Perspective\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth does not impose a single token model on every application.\u003C/p\u003E\n\u003Cp\u003EPureOpaque and Hybrid emphasize server-authoritative authentication state.\u003C/p\u003E\n\u003Cp\u003ESemiHybrid and PureJwt support locally validated JWT access, with different approaches to authentication continuation.\u003C/p\u003E\n\u003Cp\u003EThese choices affect performance, storage requirements, revocation behavior, and authorization freshness.\u003C/p\u003E\n\u003Cp\u003EThe purpose of the token security model is to make those tradeoffs explicit.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EA token establishes access only while its applicable validation requirements remain satisfied. The strength and freshness of those requirements depend on the authentication mode.\u003C/strong\u003E\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/security/session-security\u0022\u003ESession Security\u003C/a\u003E \u2014 Understand authoritative session validation and hierarchical revocation.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/fundamentals/auth-modes\u0022\u003EAuthentication Modes\u003C/a\u003E \u2014 Compare credential behavior across modes.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/sessions-devices/session-lifecycle\u0022\u003ESession Model \u0026amp; Lifecycle\u003C/a\u003E \u2014 Explore session creation, continuation, and invalidation.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/plugin-domains/credentials\u0022\u003ECredentials\u003C/a\u003E \u2014 Understand credential management and recovery security.\u003C/li\u003E\n\u003C/ul\u003E\n", "Headings": [ { "Id": "authentication-state-and-credentials", @@ -249,6 +249,6 @@ "Level": 0 } ], - "SourceHash": "911C8D044E81A644B33C2C9C8BBD12AB2157C210B59B198489B9C28847B66400", + "SourceHash": "162946CA53F0A26F4BCC8B9651006186CFFD91D36AB9918FF6CC314CCF032FB0", "BuilderVersion": "1" } \ No newline at end of file diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/JwtLogoutServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/JwtLogoutServiceTests.cs new file mode 100644 index 00000000..0f9e73b4 --- /dev/null +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/JwtLogoutServiceTests.cs @@ -0,0 +1,667 @@ +using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.MultiTenancy; +using CodeBeam.UltimateAuth.Server.Abstractions; +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Services; +using CodeBeam.UltimateAuth.Tests.Unit.Helpers; +using Moq; + +namespace CodeBeam.UltimateAuth.Tests.Unit; + +public class JwtLogoutServiceTests +{ + private static readonly DateTimeOffset Now = new(2026, 1, 1, 12, 0, 0, TimeSpan.Zero); + + private const string RawToken = "refresh-token"; + private const string TokenHash = "refresh-token-hash"; + + private static readonly UserKey User = UserKey.New(); + private static readonly AuthSessionId Session = TestIds.Session("logout-session"); + private static readonly SessionChainId Chain = SessionChainId.New(); + private static readonly SessionRootId Root = SessionRootId.New(); + + private static readonly RefreshChainId RefreshChain = RefreshChainId.New(); + + private readonly Mock _validator = new(MockBehavior.Strict); + private readonly Mock _storeFactory = new(MockBehavior.Strict); + private readonly Mock _store = new(MockBehavior.Strict); + private readonly Mock _lineageValidator = new(MockBehavior.Strict); + private readonly Mock _sessionIssuer = new(MockBehavior.Strict); + private readonly Mock _clock = new(MockBehavior.Strict); + + private readonly JwtLogoutService _sut; + + private CancellationToken Ct => + TestContext.Current.CancellationToken; + + public JwtLogoutServiceTests() + { + _clock.SetupGet(x => x.UtcNow).Returns(Now); + + _sut = new JwtLogoutService( + _validator.Object, + _storeFactory.Object, + _lineageValidator.Object, + _sessionIssuer.Object, + _clock.Object); + } + + private static AuthFlowContext CreateFlow( + UAuthMode mode = UAuthMode.PureJwt, + bool authenticated = false, + UserKey? user = null, + SessionSecurityContext? session = null) + { + return AuthFlowTestFactory.New( + mode: mode, + userKey: user, + session: session, + isAuthenticated: authenticated); + } + + private static RefreshTokenValidationResult CreateValidation( + AuthFlowContext flow) + { + var semiHybrid = + flow.EffectiveMode == UAuthMode.SemiHybrid; + + return RefreshTokenValidationResult.Valid( + new RefreshToken + { + TokenHash = TokenHash, + Tenant = flow.Tenant, + UserKey = User, + DeviceId = flow.Device.DeviceId, + RefreshChainId = RefreshChain, + SessionId = semiHybrid ? Session : null, + SessionChainId = semiHybrid ? Chain : null, + CreatedAt = Now.AddHours(-1), + ExpiresAt = Now.AddDays(7) + }, + TokenHash); + } + + private static SessionValidationResult CreateLineage( + AuthFlowContext flow, + TenantKey? tenant = null, + UserKey? user = null, + AuthSessionId? session = null, + SessionChainId? chain = null, + DeviceId? device = null) + { + return SessionValidationResult.Active( + tenant: tenant ?? flow.Tenant, + userKey: user ?? User, + sessionId: session ?? Session, + chainId: chain ?? Chain, + rootId: Root, + claims: ClaimsSnapshot.Empty, + authenticatedAt: Now.AddHours(-1), + boundDeviceId: device ?? flow.Device.DeviceId); + } + + private void SetupValidation( + RefreshTokenValidationResult validation) + { + _validator + .Setup(x => x.ValidateAsync( + It.IsAny(), + Ct)) + .ReturnsAsync(validation); + } + + private void SetupLineage(SessionValidationResult result) + { + _lineageValidator + .Setup(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + Ct)) + .ReturnsAsync(result); + } + + private void VerifyNoRevocation() + { + _storeFactory.VerifyNoOtherCalls(); + _store.VerifyNoOtherCalls(); + _sessionIssuer.VerifyNoOtherCalls(); + } + + // Unsupported modes + + [Theory] + [InlineData(UAuthMode.PureOpaque)] + [InlineData(UAuthMode.Hybrid)] + public async Task UnsupportedMode_ShouldReturnFalse( + UAuthMode mode) + { + var result = await _sut.LogoutAsync( + CreateFlow(mode), + RawToken, + Ct); + + Assert.False(result); + + _clock.VerifyNoOtherCalls(); + _validator.VerifyNoOtherCalls(); + _lineageValidator.VerifyNoOtherCalls(); + + VerifyNoRevocation(); + } + + // Missing credential + + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData(" ")] + [InlineData("\t")] + public async Task MissingRefreshToken_ShouldReturnFalse( + string? token) + { + var result = await _sut.LogoutAsync( + CreateFlow(), + token!, + Ct); + + Assert.False(result); + + _clock.VerifyNoOtherCalls(); + _validator.VerifyNoOtherCalls(); + _lineageValidator.VerifyNoOtherCalls(); + + VerifyNoRevocation(); + } + + // Refresh validation context + + [Theory] + [InlineData(DeviceMismatchBehavior.Reject)] + [InlineData(DeviceMismatchBehavior.Allow)] + public async Task Logout_ShouldPassExpectedValidationContext( + DeviceMismatchBehavior behavior) + { + var flow = CreateFlow(); + + flow.Options.Session.DeviceMismatchBehavior = behavior; + + RefreshTokenValidationContext? captured = null; + + _validator + .Setup(x => x.ValidateAsync( + It.IsAny(), + Ct)) + .Callback( + (context, _) => captured = context) + .ReturnsAsync(RefreshTokenValidationResult.Invalid()); + + var result = await _sut.LogoutAsync( + flow, + RawToken, + Ct); + + Assert.False(result); + Assert.NotNull(captured); + + Assert.Equal(flow.Tenant, captured.Tenant); + Assert.Equal(RawToken, captured.RefreshToken); + Assert.Equal(flow.Device, captured.Device); + Assert.Equal(Now, captured.Now); + Assert.Equal(behavior, captured.DeviceMismatchBehavior); + + VerifyNoRevocation(); + } + + // Invalid refresh token + + [Fact] + public async Task InvalidRefreshToken_ShouldNotRevokeAnything() + { + SetupValidation(RefreshTokenValidationResult.Invalid()); + + var result = await _sut.LogoutAsync( + CreateFlow(), + RawToken, + Ct); + + Assert.False(result); + + _lineageValidator.VerifyNoOtherCalls(); + VerifyNoRevocation(); + } + + [Fact] + public async Task MissingRefreshTokenRecord_ShouldNotRevokeAnything() + { + SetupValidation(RefreshTokenValidationResult.NotFound()); + + var result = await _sut.LogoutAsync( + CreateFlow(), + RawToken, + Ct); + + Assert.False(result); + + _lineageValidator.VerifyNoOtherCalls(); + VerifyNoRevocation(); + } + + // Invalid refresh binding + + [Theory] + [InlineData("tenant")] + [InlineData("user")] + [InlineData("device")] + [InlineData("refresh-chain")] + [InlineData("empty-refresh-chain")] + public async Task InvalidRefreshBinding_ShouldRejectLogout( + string mismatch) + { + var flow = CreateFlow(); + var validation = CreateValidation(flow); + + validation = mismatch switch + { + "tenant" => validation with + { + Tenant = default + }, + + "user" => validation with + { + UserKey = null + }, + + "device" => validation with + { + DeviceId = null + }, + + "refresh-chain" => validation with + { + RefreshChainId = null + }, + + "empty-refresh-chain" => validation with + { + RefreshChainId = default(RefreshChainId) + }, + + _ => throw new ArgumentOutOfRangeException( + nameof(mismatch)) + }; + + SetupValidation(validation); + + var result = await _sut.LogoutAsync( + flow, + RawToken, + Ct); + + Assert.False(result); + + _lineageValidator.VerifyNoOtherCalls(); + VerifyNoRevocation(); + } + + [Theory] + [InlineData(UAuthMode.PureJwt)] + [InlineData(UAuthMode.SemiHybrid)] + public async Task AuthenticatedUserMismatch_ShouldRejectLogout( + UAuthMode mode) + { + var flow = CreateFlow( + mode, + authenticated: true, + user: UserKey.New()); + + SetupValidation(CreateValidation(flow)); + + var result = await _sut.LogoutAsync( + flow, + RawToken, + Ct); + + Assert.False(result); + + _lineageValidator.VerifyNoOtherCalls(); + VerifyNoRevocation(); + } + + // PureJwt + + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task PureJwt_ShouldRevokeRefreshChain( + bool authenticated) + { + var flow = CreateFlow( + authenticated: authenticated, + user: authenticated ? User : null); + + SetupValidation(CreateValidation(flow)); + + _storeFactory + .Setup(x => x.Create(flow.Tenant)) + .Returns(_store.Object); + + _store + .Setup(x => x.ExecuteAsync( + It.IsAny>(), + Ct)) + .Returns( + (Func action, + CancellationToken ct) => action(ct)); + + _store + .Setup(x => x.RevokeByRefreshChainAsync( + RefreshChain, + Now, + Ct)) + .Returns(Task.CompletedTask); + + var result = await _sut.LogoutAsync( + flow, + RawToken, + Ct); + + Assert.True(result); + + _storeFactory.Verify( + x => x.Create(flow.Tenant), + Times.Once); + + _store.Verify( + x => x.ExecuteAsync( + It.IsAny>(), + Ct), + Times.Once); + + _store.Verify( + x => x.RevokeByRefreshChainAsync( + RefreshChain, + Now, + Ct), + Times.Once); + + _store.VerifyNoOtherCalls(); + _lineageValidator.VerifyNoOtherCalls(); + _sessionIssuer.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(true, false)] + [InlineData(false, true)] + [InlineData(true, true)] + public async Task PureJwt_SessionBoundRefreshToken_ShouldBeRejected( + bool hasSession, + bool hasChain) + { + var flow = CreateFlow(); + + var validation = CreateValidation(flow) with + { + SessionId = hasSession ? Session : null, + SessionChainId = hasChain ? Chain : null + }; + + SetupValidation(validation); + + var result = await _sut.LogoutAsync( + flow, + RawToken, + Ct); + + Assert.False(result); + + _lineageValidator.VerifyNoOtherCalls(); + VerifyNoRevocation(); + } + + // SemiHybrid + + [Theory] + [InlineData(false, false)] + [InlineData(true, false)] + [InlineData(false, true)] + public async Task SemiHybrid_MissingSessionBinding_ShouldBeRejected( + bool hasSession, + bool hasChain) + { + var flow = CreateFlow(UAuthMode.SemiHybrid); + + var validation = CreateValidation(flow) with + { + SessionId = hasSession ? Session : null, + SessionChainId = hasChain ? Chain : null + }; + + SetupValidation(validation); + + var result = await _sut.LogoutAsync( + flow, + RawToken, + Ct); + + Assert.False(result); + + _lineageValidator.VerifyNoOtherCalls(); + VerifyNoRevocation(); + } + + [Fact] + public async Task SemiHybrid_CurrentSessionMismatch_ShouldBeRejected() + { + var flow = CreateFlow( + UAuthMode.SemiHybrid, + authenticated: true, + user: User, + session: new SessionSecurityContext + { + UserKey = User, + SessionId = TestIds.Session("different-session"), + ChainId = Chain, + State = SessionState.Active + }); + + SetupValidation(CreateValidation(flow)); + + var result = await _sut.LogoutAsync( + flow, + RawToken, + Ct); + + Assert.False(result); + + _lineageValidator.VerifyNoOtherCalls(); + VerifyNoRevocation(); + } + + [Theory] + [InlineData(SessionState.Revoked)] + [InlineData(SessionState.Expired)] + [InlineData(SessionState.NotFound)] + [InlineData(SessionState.Invalid)] + [InlineData(SessionState.SecurityMismatch)] + [InlineData(SessionState.DeviceMismatch)] + public async Task SemiHybrid_InvalidLineage_ShouldRejectLogout( + SessionState state) + { + var flow = CreateFlow(UAuthMode.SemiHybrid); + + SetupValidation(CreateValidation(flow)); + + SetupLineage( + SessionValidationResult.Invalid(state)); + + var result = await _sut.LogoutAsync( + flow, + RawToken, + Ct); + + Assert.False(result); + + VerifyNoRevocation(); + } + + [Theory] + [InlineData("tenant")] + [InlineData("user")] + [InlineData("session")] + [InlineData("chain")] + [InlineData("device")] + public async Task SemiHybrid_LineageBindingMismatch_ShouldRejectLogout( + string mismatch) + { + var flow = CreateFlow(UAuthMode.SemiHybrid); + + SetupValidation(CreateValidation(flow)); + + var lineage = mismatch switch + { + "tenant" => CreateLineage( + flow, + tenant: default(TenantKey)), + + "user" => CreateLineage( + flow, + user: UserKey.New()), + + "session" => CreateLineage( + flow, + session: TestIds.Session("other-session")), + + "chain" => CreateLineage( + flow, + chain: SessionChainId.New()), + + "device" => CreateLineage( + flow, + device: DeviceId.Create( + "different-device-00000001")), + + _ => throw new ArgumentOutOfRangeException( + nameof(mismatch)) + }; + + SetupLineage(lineage); + + var result = await _sut.LogoutAsync( + flow, + RawToken, + Ct); + + Assert.False(result); + + VerifyNoRevocation(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task SemiHybrid_ShouldReturnSessionIssuerResult( + bool issuerResult) + { + var flow = CreateFlow(UAuthMode.SemiHybrid); + + SetupValidation(CreateValidation(flow)); + + var lineage = CreateLineage(flow); + + SessionValidationContext? captured = null; + + _lineageValidator + .Setup(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + Ct)) + .Callback< + SessionValidationContext, + SessionCredentialPurpose, + CancellationToken>( + (context, _, _) => captured = context) + .ReturnsAsync(lineage); + + _sessionIssuer + .Setup(x => x.LogoutChainAsync( + flow.Tenant, + Chain, + Now, + Ct)) + .ReturnsAsync(issuerResult); + + var result = await _sut.LogoutAsync( + flow, + RawToken, + Ct); + + Assert.Equal(issuerResult, result); + + Assert.NotNull(captured); + Assert.Equal(flow.Tenant, captured.Tenant); + Assert.Equal(Session, captured.SessionId); + Assert.Equal(flow.Device, captured.Device); + Assert.Equal(Now, captured.Now); + Assert.Same( + flow.Options.Session, + captured.SessionOptions); + + _sessionIssuer.Verify( + x => x.LogoutChainAsync( + flow.Tenant, + Chain, + Now, + Ct), + Times.Once); + + _storeFactory.VerifyNoOtherCalls(); + _store.VerifyNoOtherCalls(); + } + + [Fact] + public async Task SemiHybrid_MatchingAuthenticatedSession_ShouldLogout() + { + var flow = CreateFlow( + UAuthMode.SemiHybrid, + authenticated: true, + user: User, + session: new SessionSecurityContext + { + UserKey = User, + SessionId = Session, + ChainId = Chain, + State = SessionState.Active + }); + + SetupValidation(CreateValidation(flow)); + SetupLineage(CreateLineage(flow)); + + _sessionIssuer + .Setup(x => x.LogoutChainAsync( + flow.Tenant, + Chain, + Now, + Ct)) + .ReturnsAsync(true); + + var result = await _sut.LogoutAsync( + flow, + RawToken, + Ct); + + Assert.True(result); + + _sessionIssuer.Verify( + x => x.LogoutChainAsync( + flow.Tenant, + Chain, + Now, + Ct), + Times.Once); + + _storeFactory.VerifyNoOtherCalls(); + } +} diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthEndpointValidationClassificationTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthEndpointValidationClassificationTests.cs new file mode 100644 index 00000000..d47ab2ab --- /dev/null +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthEndpointValidationClassificationTests.cs @@ -0,0 +1,61 @@ +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.RateLimiting; + +namespace CodeBeam.UltimateAuth.Tests.Unit; + +public class UAuthEndpointValidationClassificationTests +{ + private static readonly HashSet StandardEndpoints = + [ + UAuthEndpoint.Validate, + UAuthEndpoint.GetMyIdentifiers, + UAuthEndpoint.ProfileGetSelf, + UAuthEndpoint.GetMyRoles, + UAuthEndpoint.GetMyPermissions, + UAuthEndpoint.AuthorizationCheck + ]; + + public static IEnumerable SemiHybridEndpoints => + Enum.GetValues() + .Select(endpoint => new object[] + { + endpoint, + StandardEndpoints.Contains(endpoint) + ? UAuthValidationRequirement.Standard + : UAuthValidationRequirement.HubValidated + }); + + public static IEnumerable OtherModeEndpoints => + from mode in new[] + { + UAuthMode.PureOpaque, + UAuthMode.Hybrid, + UAuthMode.PureJwt + } + from endpoint in Enum.GetValues() + select new object[] { mode, endpoint }; + + [Theory] + [MemberData(nameof(SemiHybridEndpoints))] + public void SemiHybrid_ShouldReturnExpectedRequirement(UAuthEndpoint endpoint, UAuthValidationRequirement expected) + { + var result = UAuthEndpointValidationClassification.Get(endpoint, UAuthMode.SemiHybrid); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(OtherModeEndpoints))] + public void OtherModes_ShouldUseStandardRequirement(UAuthMode mode, UAuthEndpoint endpoint) + { + var result = UAuthEndpointValidationClassification.Get(endpoint, mode); + Assert.Equal(UAuthValidationRequirement.Standard, result); + } + + [Fact] + public void UnclassifiedSemiHybridEndpoint_ShouldDefaultToHubValidated() + { + var result = UAuthEndpointValidationClassification.Get((UAuthEndpoint)int.MaxValue, UAuthMode.SemiHybrid); + Assert.Equal(UAuthValidationRequirement.HubValidated, result); + } +} diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthValidationOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthValidationOptionsValidatorTests.cs new file mode 100644 index 00000000..4ac7d244 --- /dev/null +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthValidationOptionsValidatorTests.cs @@ -0,0 +1,166 @@ +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.Options; +using CodeBeam.UltimateAuth.Server.RateLimiting; + +namespace CodeBeam.UltimateAuth.Tests.Unit; + +public class UAuthValidationOptionsValidatorTests +{ + private readonly UAuthValidationOptionsValidator _sut = new(); + + [Fact] + public void DefaultOptions_ShouldPass() + { + var result = _sut.Validate( + null, + new UAuthServerOptions()); + + Assert.True(result.Succeeded); + } + + [Fact] + public void MissingValidationOptions_ShouldFail() + { + var options = new UAuthServerOptions + { + Validation = null! + }; + + var result = _sut.Validate(null, options); + + Assert.True(result.Failed); + Assert.Equal( + "Validation options are required.", + result.FailureMessage); + } + + [Theory] + [InlineData(-1)] + [InlineData(1)] + [InlineData(999)] + public void InvalidDefaultRequirement_ShouldFail(int value) + { + var options = new UAuthServerOptions(); + + options.Validation.Default = + (UAuthValidationRequirement)value; + + var result = _sut.Validate(null, options); + + Assert.True(result.Failed); + Assert.Equal( + "Validation.Default is invalid.", + result.FailureMessage); + } + + [Fact] + public void MissingEndpointDictionary_ShouldFail() + { + var options = new UAuthServerOptions(); + + options.Validation.Endpoints = null!; + + var result = _sut.Validate(null, options); + + Assert.True(result.Failed); + Assert.Equal( + "Validation.Endpoints cannot be null.", + result.FailureMessage); + } + + [Theory] + [InlineData(-1)] + [InlineData(999)] + public void InvalidEndpoint_ShouldFail(int value) + { + var options = new UAuthServerOptions(); + var endpoint = (UAuthEndpoint)value; + + options.Validation.Endpoints[endpoint] = + UAuthValidationRequirement.Standard; + + var result = _sut.Validate(null, options); + + Assert.True(result.Failed); + Assert.Equal( + $"Invalid endpoint: {endpoint}.", + result.FailureMessage); + } + + [Theory] + [InlineData(-1)] + [InlineData(1)] + [InlineData(999)] + public void InvalidEndpointRequirement_ShouldFail(int value) + { + var options = new UAuthServerOptions(); + + options.Validation.Endpoints[UAuthEndpoint.Logout] = + (UAuthValidationRequirement)value; + + var result = _sut.Validate(null, options); + + Assert.True(result.Failed); + Assert.Equal( + "Invalid validation requirement for Logout.", + result.FailureMessage); + } + + [Theory] + [InlineData(UAuthValidationRequirement.Standard)] + [InlineData(UAuthValidationRequirement.HubValidated)] + public void ValidDefaultAndEndpointRequirements_ShouldPass( + UAuthValidationRequirement requirement) + { + var options = new UAuthServerOptions(); + + options.Validation.Default = requirement; + + foreach (var endpoint in Enum.GetValues()) + { + options.Validation.Endpoints[endpoint] = + requirement; + } + + var result = _sut.Validate(null, options); + + Assert.True(result.Succeeded); + } + + [Fact] + public void MixedEndpointRequirements_ShouldPass() + { + var options = new UAuthServerOptions(); + + options.Validation.Endpoints[ + UAuthEndpoint.GetMyIdentifiers] = + UAuthValidationRequirement.Standard; + + options.Validation.Endpoints[ + UAuthEndpoint.CredentialChangeSelf] = + UAuthValidationRequirement.HubValidated; + + var result = _sut.Validate(null, options); + + Assert.True(result.Succeeded); + } + + [Fact] + public void InvalidEntryAfterValidEntry_ShouldFail() + { + var options = new UAuthServerOptions(); + + options.Validation.Endpoints[UAuthEndpoint.Validate] = + UAuthValidationRequirement.Standard; + + options.Validation.Endpoints[UAuthEndpoint.Logout] = + (UAuthValidationRequirement)999; + + var result = _sut.Validate(null, options); + + Assert.True(result.Failed); + Assert.Equal( + "Invalid validation requirement for Logout.", + result.FailureMessage); + } +} diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthValidationRequirementResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthValidationRequirementResolverTests.cs new file mode 100644 index 00000000..2b553269 --- /dev/null +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthValidationRequirementResolverTests.cs @@ -0,0 +1,357 @@ +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Options; +using CodeBeam.UltimateAuth.Server.RateLimiting; +using Microsoft.AspNetCore.Http; + +namespace CodeBeam.UltimateAuth.Tests.Unit; + +public class UAuthValidationRequirementResolverTests +{ + private const UAuthValidationRequirement Standard = UAuthValidationRequirement.Standard; + private const UAuthValidationRequirement HubValidated = UAuthValidationRequirement.HubValidated; + + private static DefaultHttpContext CreateContext(UAuthEndpoint? endpoint = null, UAuthValidationRequirement? explicitMinimum = null) + { + var context = new DefaultHttpContext(); + var metadata = new List(); + + if (endpoint.HasValue) + { + metadata.Add(UAuthEndpointClassification.Get(endpoint.Value)); + } + + if (explicitMinimum.HasValue) + { + metadata.Add(new UAuthRequireAuthenticationMetadata(explicitMinimum.Value)); + } + + context.SetEndpoint(new Endpoint( + _ => Task.CompletedTask, new EndpointMetadataCollection(metadata), "Test endpoint")); + + return context; + } + + private static UAuthValidationOptions CreateOptions( + UAuthValidationRequirement defaultRequirement = Standard, + UAuthEndpoint? endpoint = null, + UAuthValidationRequirement endpointRequirement = Standard) + { + var options = new UAuthValidationOptions + { + Default = defaultRequirement + }; + + if (endpoint.HasValue) + { + options.Endpoints[endpoint.Value] = endpointRequirement; + } + + return options; + } + + [Fact] + public void MissingEndpoint_ShouldUseStandard() + { + var result = UAuthValidationRequirementResolver.Resolve(new DefaultHttpContext(), UAuthMode.SemiHybrid, CreateOptions()); + Assert.Equal(Standard, result); + } + + [Fact] + public void MissingEndpoint_ShouldHonorGlobalDefault() + { + var result = UAuthValidationRequirementResolver.Resolve( + new DefaultHttpContext(), + UAuthMode.SemiHybrid, + CreateOptions(HubValidated)); + + Assert.Equal(HubValidated, result); + } + + [Fact] + public void UnclassifiedEndpoint_ShouldUseStandard() + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(), + UAuthMode.SemiHybrid, + CreateOptions()); + + Assert.Equal(Standard, result); + } + + [Fact] + public void UnclassifiedEndpoint_ShouldHonorExplicitMinimum() + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(explicitMinimum: HubValidated), + UAuthMode.SemiHybrid, + CreateOptions()); + + Assert.Equal(HubValidated, result); + } + + [Theory] + [InlineData(UAuthEndpoint.GetMyIdentifiers, Standard)] + [InlineData(UAuthEndpoint.ProfileGetSelf, Standard)] + [InlineData(UAuthEndpoint.GetMyRoles, Standard)] + [InlineData(UAuthEndpoint.GetMyPermissions, Standard)] + [InlineData(UAuthEndpoint.AuthorizationCheck, Standard)] + [InlineData(UAuthEndpoint.ProfileUpdateSelf, HubValidated)] + [InlineData(UAuthEndpoint.CredentialChangeSelf, HubValidated)] + [InlineData(UAuthEndpoint.AssignRole, HubValidated)] + public void SemiHybrid_ShouldUseEndpointClassification( + UAuthEndpoint endpoint, + UAuthValidationRequirement expected) + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(endpoint), + UAuthMode.SemiHybrid, + CreateOptions()); + + Assert.Equal(expected, result); + } + + [Theory] + [InlineData(UAuthMode.PureOpaque)] + [InlineData(UAuthMode.Hybrid)] + [InlineData(UAuthMode.PureJwt)] + public void OtherModes_ShouldNotUseSemiHybridClassification( + UAuthMode mode) + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(UAuthEndpoint.ProfileUpdateSelf), + mode, + CreateOptions()); + + Assert.Equal(Standard, result); + } + + [Fact] + public void EndpointOverride_ShouldRaiseRequirement() + { + const UAuthEndpoint endpoint = + UAuthEndpoint.GetMyIdentifiers; + + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(endpoint), + UAuthMode.SemiHybrid, + CreateOptions( + endpoint: endpoint, + endpointRequirement: HubValidated)); + + Assert.Equal(HubValidated, result); + } + + [Fact] + public void EndpointOverride_ShouldLowerNonMandatoryRequirement() + { + const UAuthEndpoint endpoint = + UAuthEndpoint.ProfileUpdateSelf; + + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(endpoint), + UAuthMode.SemiHybrid, + CreateOptions( + endpoint: endpoint, + endpointRequirement: Standard)); + + Assert.Equal(Standard, result); + } + + [Fact] + public void EndpointOverride_ShouldNotAffectOtherEndpoints() + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(UAuthEndpoint.GetMyIdentifiers), + UAuthMode.SemiHybrid, + CreateOptions( + endpoint: UAuthEndpoint.ProfileGetSelf, + endpointRequirement: HubValidated)); + + Assert.Equal(Standard, result); + } + + [Fact] + public void GlobalDefault_ShouldPreventLowerEndpointOverride() + { + const UAuthEndpoint endpoint = + UAuthEndpoint.GetMyIdentifiers; + + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(endpoint), + UAuthMode.SemiHybrid, + CreateOptions( + HubValidated, + endpoint, + Standard)); + + Assert.Equal(HubValidated, result); + } + + [Fact] + public void ExplicitMinimum_ShouldPreventLowerEndpointOverride() + { + const UAuthEndpoint endpoint = + UAuthEndpoint.GetMyIdentifiers; + + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(endpoint, HubValidated), + UAuthMode.SemiHybrid, + CreateOptions( + endpoint: endpoint, + endpointRequirement: Standard)); + + Assert.Equal(HubValidated, result); + } + + [Fact] + public void ExplicitStandard_ShouldNotLowerClassification() + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext( + UAuthEndpoint.ProfileUpdateSelf, + Standard), + UAuthMode.SemiHybrid, + CreateOptions()); + + Assert.Equal(HubValidated, result); + } + + [Theory] + [InlineData(UAuthEndpoint.Logout)] + [InlineData(UAuthEndpoint.LogoutOthersSelf)] + [InlineData(UAuthEndpoint.RevokeOtherChains)] + [InlineData(UAuthEndpoint.RevokeAllMyChains)] + [InlineData(UAuthEndpoint.GetMyChains)] + [InlineData(UAuthEndpoint.GetMyChainDetail)] + [InlineData(UAuthEndpoint.RevokeMyChain)] + public void MandatorySemiHybridEndpoints_CannotBeDowngraded( + UAuthEndpoint endpoint) + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(endpoint, Standard), + UAuthMode.SemiHybrid, + CreateOptions( + Standard, + endpoint, + Standard)); + + Assert.Equal(HubValidated, result); + } + + [Theory] + [InlineData(UAuthMode.PureOpaque)] + [InlineData(UAuthMode.Hybrid)] + [InlineData(UAuthMode.PureJwt)] + public void FrameworkMinimum_ShouldBeSemiHybridSpecific( + UAuthMode mode) + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(UAuthEndpoint.Logout), + mode, + CreateOptions()); + + Assert.Equal(Standard, result); + } + + [Theory] + [InlineData(UAuthEndpoint.Login)] + [InlineData(UAuthEndpoint.TryLogin)] + [InlineData(UAuthEndpoint.Refresh)] + [InlineData(UAuthEndpoint.PkceAuthorize)] + [InlineData(UAuthEndpoint.PkceComplete)] + [InlineData(UAuthEndpoint.PkceTryComplete)] + [InlineData(UAuthEndpoint.CredentialResetBeginAnonymous)] + [InlineData(UAuthEndpoint.CredentialResetCompleteAnonymous)] + [InlineData(UAuthEndpoint.CheckIdentifierAvailability)] + [InlineData(UAuthEndpoint.UserCreateAnonymous)] + [InlineData(UAuthEndpoint.AntiforgeryToken)] + [InlineData(UAuthEndpoint.PasswordPolicy)] + [InlineData(UAuthEndpoint.LoginTransport)] + [InlineData(UAuthEndpoint.HubEntry)] + public void IndependentFlows_ShouldIgnoreProtectedRequestRequirements( + UAuthEndpoint endpoint) + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(endpoint, HubValidated), + UAuthMode.SemiHybrid, + CreateOptions( + HubValidated, + endpoint, + HubValidated), + includeValidateEndpoint: true); + + Assert.Equal(Standard, result); + } + + [Fact] + public void ValidateEndpoint_ShouldBeExcludedByDefault() + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext( + UAuthEndpoint.Validate, + HubValidated), + UAuthMode.SemiHybrid, + CreateOptions( + HubValidated, + UAuthEndpoint.Validate, + HubValidated)); + + Assert.Equal(Standard, result); + } + + [Fact] + public void ValidateEndpoint_WhenIncluded_ShouldHonorGlobalDefault() + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(UAuthEndpoint.Validate), + UAuthMode.SemiHybrid, + CreateOptions(HubValidated), + includeValidateEndpoint: true); + + Assert.Equal(HubValidated, result); + } + + [Fact] + public void ValidateEndpoint_WhenIncluded_ShouldHonorEndpointOverride() + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(UAuthEndpoint.Validate), + UAuthMode.SemiHybrid, + CreateOptions( + endpoint: UAuthEndpoint.Validate, + endpointRequirement: HubValidated), + includeValidateEndpoint: true); + + Assert.Equal(HubValidated, result); + } + + [Fact] + public void ValidateEndpoint_WhenIncluded_ShouldDefaultToStandard() + { + var result = UAuthValidationRequirementResolver.Resolve( + CreateContext(UAuthEndpoint.Validate), + UAuthMode.SemiHybrid, + CreateOptions(), + includeValidateEndpoint: true); + + Assert.Equal(Standard, result); + } + + [Theory] + [InlineData(Standard, Standard, Standard)] + [InlineData(Standard, HubValidated, HubValidated)] + [InlineData(HubValidated, Standard, HubValidated)] + [InlineData(HubValidated, HubValidated, HubValidated)] + public void Max_ShouldReturnStrongerRequirement( + UAuthValidationRequirement first, + UAuthValidationRequirement second, + UAuthValidationRequirement expected) + { + var result = UAuthValidationRequirementResolver.Max( + first, + second); + + Assert.Equal(expected, result); + } +} diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs index 6ccf01b2..b4ab71c3 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs @@ -7,9 +7,9 @@ using CodeBeam.UltimateAuth.Server; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; -using CodeBeam.UltimateAuth.Server.Contracts; using CodeBeam.UltimateAuth.Server.Endpoints; using CodeBeam.UltimateAuth.Server.Infrastructure; +using CodeBeam.UltimateAuth.Server.RateLimiting; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; @@ -22,8 +22,7 @@ namespace CodeBeam.UltimateAuth.Tests.Unit.Server; public sealed class ValidateEndpointHandlerTests { - private static readonly DateTimeOffset Now = - new(2026, 9, 20, 12, 0, 0, TimeSpan.Zero); + private static readonly DateTimeOffset Now = new(2026, 9, 20, 12, 0, 0, TimeSpan.Zero); // ===================================================================== // Missing / unsupported credential @@ -622,6 +621,488 @@ public async Task ValidateAsync_PureJwt_ValidPrincipal_ReturnsActiveSnapshot() fixture.SnapshotFactory.VerifyNoOtherCalls(); } + [Theory] + [InlineData(null)] + [InlineData("Standard")] + [InlineData("standard")] + [InlineData("0")] + public async Task ValidateAsync_SemiHybrid_Standard_ShouldNotValidateLineage(string? requirement) + { + var fixture = CreateSemiHybridFixture( + out var userKey, + out _); + + if (requirement is not null) + { + fixture.HttpContext.Request.Headers[ + UAuthConstants.Headers.Validation] = requirement; + } + + var result = await fixture.Sut.ValidateAsync( + fixture.HttpContext, + fixture.CancellationToken); + + var ok = Assert.IsType>(result); + + Assert.NotNull(ok.Value); + Assert.True(ok.Value.IsValid); + + Assert.Equal( + SessionState.Active, + ok.Value.State); + + Assert.Equal( + UAuthValidationRequirement.Standard, + ok.Value.Validation); + + Assert.NotNull(ok.Value.Snapshot); + Assert.NotNull(ok.Value.Snapshot.Identity); + + Assert.Equal( + userKey, + ok.Value.Snapshot.Identity.UserKey); + + Assert.Equal( + fixture.Flow.Tenant, + ok.Value.Snapshot.Identity.Tenant); + + Assert.Null(ok.Value.ChainId); + Assert.Null(ok.Value.RootId); + + fixture.CredentialResolver.VerifyNoOtherCalls(); + fixture.SessionValidator.VerifyNoOtherCalls(); + fixture.LineageValidator.VerifyNoOtherCalls(); + fixture.SnapshotFactory.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData("")] + [InlineData("Invalid")] + [InlineData("Unknown")] + [InlineData("-1")] + [InlineData("1")] + [InlineData("999")] + public async Task ValidateAsync_InvalidValidationHeader_ShouldReturnBadRequest(string header) + { + var fixture = CreateSemiHybridFixture(out _, out _); + + fixture.HttpContext.Request.Headers[ + UAuthConstants.Headers.Validation] = header; + + var result = await fixture.Sut.ValidateAsync( + fixture.HttpContext, + fixture.CancellationToken); + + Assert.IsType(result); + + fixture.LineageValidator.VerifyNoOtherCalls(); + fixture.SnapshotFactory.VerifyNoOtherCalls(); + } + + [Fact] + public async Task ValidateAsync_MultipleValidationHeaders_ShouldReturnBadRequest() + { + var fixture = CreateSemiHybridFixture(out _, out _); + + fixture.HttpContext.Request.Headers[ + UAuthConstants.Headers.Validation] = + new Microsoft.Extensions.Primitives.StringValues( + new[] { "Standard", "HubValidated" }); + + var result = await fixture.Sut.ValidateAsync( + fixture.HttpContext, + fixture.CancellationToken); + + Assert.IsType(result); + + fixture.LineageValidator.VerifyNoOtherCalls(); + fixture.SnapshotFactory.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task ValidateAsync_PureJwt_HubValidated_ShouldReturnBadRequest(bool configuredRequirement) + { + var principal = new ClaimsPrincipal( + new ClaimsIdentity( + new[] + { + new Claim( + ClaimTypes.NameIdentifier, + UserKey.New().Value) + }, + UAuthConstants.SchemeDefaults.GlobalScheme)); + + var fixture = CreatePureJwtFixture( + JwtSuccess(principal)); + + if (configuredRequirement) + { + fixture.Flow.Options.Validation.Default = + UAuthValidationRequirement.HubValidated; + } + else + { + fixture.HttpContext.Request.Headers[ + UAuthConstants.Headers.Validation] = + "HubValidated"; + } + + var result = await fixture.Sut.ValidateAsync( + fixture.HttpContext, + fixture.CancellationToken); + + Assert.IsType(result); + + fixture.CredentialResolver.VerifyNoOtherCalls(); + fixture.SessionValidator.VerifyNoOtherCalls(); + fixture.LineageValidator.VerifyNoOtherCalls(); + fixture.SnapshotFactory.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData("HubValidated")] + [InlineData("hubvalidated")] + [InlineData("10")] + public async Task ValidateAsync_SemiHybrid_HubValidated_ShouldReturnAuthoritativeSnapshot(string requirement) + { + var fixture = CreateSemiHybridFixture(out var userKey, out var sessionId); + + fixture.HttpContext.Request.Headers[UAuthConstants.Headers.Validation] = requirement; + + var validation = CreateSemiHybridLineage(fixture, userKey, sessionId); + + var snapshot = CreateAuthoritativeSnapshot(fixture, userKey); + + SessionValidationContext? captured = null; + + fixture.LineageValidator + .Setup(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken)) + .Callback< + SessionValidationContext, + SessionCredentialPurpose, + CancellationToken>( + (context, _, _) => captured = context) + .ReturnsAsync(validation); + + fixture.SnapshotFactory + .Setup(x => x.CreateAsync( + validation, + fixture.CancellationToken)) + .ReturnsAsync(snapshot); + + var result = await fixture.Sut.ValidateAsync( + fixture.HttpContext, + fixture.CancellationToken); + + var ok = Assert.IsType>(result); + + Assert.NotNull(ok.Value); + Assert.True(ok.Value.IsValid); + + Assert.Equal( + SessionState.Active, + ok.Value.State); + + Assert.Equal( + UAuthValidationRequirement.HubValidated, + ok.Value.Validation); + + Assert.Equal( + validation.ChainId, + ok.Value.ChainId); + + Assert.Equal( + validation.RootId, + ok.Value.RootId); + + Assert.Equal( + validation.BoundDeviceId, + ok.Value.BoundDeviceId); + + Assert.Same(snapshot, ok.Value.Snapshot); + + Assert.NotNull(captured); + Assert.Equal(sessionId, captured.SessionId); + Assert.Equal(fixture.Flow.Tenant, captured.Tenant); + Assert.Equal(fixture.Flow.Device, captured.Device); + Assert.Equal(Now, captured.Now); + + Assert.Same( + fixture.Flow.Options.Session, + captured.SessionOptions); + + fixture.LineageValidator.Verify( + x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken), + Times.Once); + + fixture.SnapshotFactory.Verify( + x => x.CreateAsync( + validation, + fixture.CancellationToken), + Times.Once); + + fixture.CredentialResolver.VerifyNoOtherCalls(); + fixture.SessionValidator.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(SessionState.Revoked)] + [InlineData(SessionState.Expired)] + [InlineData(SessionState.NotFound)] + [InlineData(SessionState.Invalid)] + [InlineData(SessionState.SecurityMismatch)] + [InlineData(SessionState.DeviceMismatch)] + public async Task ValidateAsync_SemiHybrid_InvalidLineage_ShouldReturnInvalidState(SessionState state) + { + var fixture = CreateSemiHybridFixture( + out _, + out _); + + fixture.HttpContext.Request.Headers[ + UAuthConstants.Headers.Validation] = + "HubValidated"; + + SetupSemiHybridLineage( + fixture, + SessionValidationResult.Invalid(state)); + + var result = await fixture.Sut.ValidateAsync( + fixture.HttpContext, + fixture.CancellationToken); + + var ok = Assert.IsType>(result); + + Assert.NotNull(ok.Value); + Assert.Equal(state, ok.Value.State); + Assert.False(ok.Value.IsValid); + Assert.Null(ok.Value.Snapshot); + + fixture.SnapshotFactory.VerifyNoOtherCalls(); + fixture.CredentialResolver.VerifyNoOtherCalls(); + fixture.SessionValidator.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData("missing-snapshot")] + [InlineData("missing-identity")] + [InlineData("unknown-user-status")] + public async Task ValidateAsync_SemiHybrid_InvalidSnapshot_ShouldReturnUnauthorized(string failure) + { + var fixture = CreateSemiHybridFixture( + out var userKey, + out var sessionId); + + fixture.HttpContext.Request.Headers[ + UAuthConstants.Headers.Validation] = + "HubValidated"; + + var validation = CreateSemiHybridLineage( + fixture, + userKey, + sessionId); + + SetupSemiHybridLineage(fixture, validation); + + AuthStateSnapshot? snapshot = failure switch + { + "missing-snapshot" => null, + + "missing-identity" => new AuthStateSnapshot + { + Identity = null!, + Claims = ClaimsSnapshot.Empty + }, + + "unknown-user-status" => new AuthStateSnapshot + { + Identity = new AuthIdentitySnapshot + { + UserKey = userKey, + Tenant = fixture.Flow.Tenant, + AuthenticatedAt = Now, + SessionState = SessionState.Active, + UserStatus = UserStatus.Unknown + }, + Claims = ClaimsSnapshot.Empty + }, + + _ => throw new ArgumentOutOfRangeException( + nameof(failure)) + }; + + fixture.SnapshotFactory + .Setup(x => x.CreateAsync( + validation, + fixture.CancellationToken)) + .ReturnsAsync(snapshot); + + var result = await fixture.Sut.ValidateAsync( + fixture.HttpContext, + fixture.CancellationToken); + + var json = + Assert.IsType>( + result); + + Assert.Equal( + StatusCodes.Status401Unauthorized, + json.StatusCode); + + Assert.NotNull(json.Value); + Assert.Equal(SessionState.Invalid, json.Value.State); + Assert.False(json.Value.IsValid); + Assert.Null(json.Value.Snapshot); + } + + [Theory] + [InlineData(null)] + [InlineData("Standard")] + [InlineData("HubValidated")] + public async Task ValidateAsync_ConfiguredHubValidation_CannotBeDowngraded(string? requested) + { + var fixture = CreateSemiHybridFixture( + out var userKey, + out var sessionId); + + fixture.Flow.Options.Validation.Default = + UAuthValidationRequirement.HubValidated; + + if (requested is not null) + { + fixture.HttpContext.Request.Headers[ + UAuthConstants.Headers.Validation] = requested; + } + + var validation = CreateSemiHybridLineage( + fixture, + userKey, + sessionId); + + SetupSemiHybridLineage(fixture, validation); + + fixture.SnapshotFactory + .Setup(x => x.CreateAsync( + validation, + fixture.CancellationToken)) + .ReturnsAsync( + CreateAuthoritativeSnapshot(fixture, userKey)); + + var result = await fixture.Sut.ValidateAsync( + fixture.HttpContext, + fixture.CancellationToken); + + var ok = Assert.IsType>(result); + + Assert.NotNull(ok.Value); + + Assert.Equal( + UAuthValidationRequirement.HubValidated, + ok.Value.Validation); + + fixture.LineageValidator.Verify( + x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken), + Times.Once); + } + + [Fact] + public async Task ValidateAsync_EndpointRequirement_CannotBeDowngraded() + { + var fixture = CreateSemiHybridFixture( + out var userKey, + out var sessionId); + + fixture.HttpContext.SetEndpoint( + new Endpoint( + _ => Task.CompletedTask, + new EndpointMetadataCollection( + UAuthEndpointClassification.Get( + UAuthEndpoint.Validate)), + "Validate")); + + fixture.Flow.Options.Validation.Endpoints[ + UAuthEndpoint.Validate] = + UAuthValidationRequirement.HubValidated; + + fixture.HttpContext.Request.Headers[ + UAuthConstants.Headers.Validation] = + "Standard"; + + var validation = CreateSemiHybridLineage( + fixture, + userKey, + sessionId); + + SetupSemiHybridLineage(fixture, validation); + + fixture.SnapshotFactory + .Setup(x => x.CreateAsync( + validation, + fixture.CancellationToken)) + .ReturnsAsync( + CreateAuthoritativeSnapshot(fixture, userKey)); + + var result = await fixture.Sut.ValidateAsync( + fixture.HttpContext, + fixture.CancellationToken); + + var ok = Assert.IsType>(result); + + Assert.NotNull(ok.Value); + + Assert.Equal( + UAuthValidationRequirement.HubValidated, + ok.Value.Validation); + + fixture.LineageValidator.Verify( + x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken), + Times.Once); + } + + [Fact] + public async Task ValidateAsync_StandardRequestedButHubRequired_RevokedSession_ShouldFail() + { + var fixture = CreateSemiHybridFixture(out _, out _); + + fixture.Flow.Options.Validation.Default = + UAuthValidationRequirement.HubValidated; + + fixture.HttpContext.Request.Headers[ + UAuthConstants.Headers.Validation] = + "Standard"; + + SetupSemiHybridLineage( + fixture, + SessionValidationResult.Invalid( + SessionState.Revoked)); + + var result = await fixture.Sut.ValidateAsync( + fixture.HttpContext, + fixture.CancellationToken); + + var ok = Assert.IsType>(result); + + Assert.NotNull(ok.Value); + Assert.Equal(SessionState.Revoked, ok.Value.State); + Assert.False(ok.Value.IsValid); + Assert.Null(ok.Value.Snapshot); + + fixture.SnapshotFactory.VerifyNoOtherCalls(); + } + // ===================================================================== // Helpers // ===================================================================== @@ -677,32 +1158,105 @@ private static Fixture CreateFixture(UAuthMode mode = UAuthMode.PureOpaque) private static Fixture CreatePureJwtFixture(AuthenticateResult authenticationResult) { - var fixture = CreateFixture(UAuthMode.PureJwt); + return CreateJwtFixture(UAuthMode.PureJwt, authenticationResult); + } - var authentication = new Mock(); + private static Fixture CreateJwtFixture(UAuthMode mode, AuthenticateResult authenticationResult) + { + var fixture = CreateFixture(mode); + + var authentication = new Mock(MockBehavior.Strict); authentication - .Setup(x => x.AuthenticateAsync( - It.IsAny(), - UAuthConstants.SchemeDefaults.GlobalScheme)) + .Setup(x => x.AuthenticateAsync(fixture.HttpContext, UAuthConstants.SchemeDefaults.GlobalScheme)) .ReturnsAsync(authenticationResult); - fixture.HttpContext.RequestServices = - new ServiceCollection() - .AddSingleton(authentication.Object) - .BuildServiceProvider(); + fixture.HttpContext.RequestServices = new ServiceCollection().AddSingleton(authentication.Object).BuildServiceProvider(); return fixture; } - private static AuthenticateResult JwtSuccess(ClaimsPrincipal principal) + private static Fixture CreateSemiHybridFixture(out UserKey userKey, out AuthSessionId sessionId) { - return AuthenticateResult.Success( - new AuthenticationTicket( - principal, + userKey = UserKey.New(); + sessionId = TestIds.Session("semi-hybrid-validation"); + var deviceId = TestDevice.Default().DeviceId!.Value; + + var principal = new ClaimsPrincipal( + new ClaimsIdentity( + new[] + { + new Claim( + ClaimTypes.NameIdentifier, + userKey.Value), + + new Claim( + "sid", + sessionId.Value), + + new Claim( + "device_id", + deviceId.Value), + + new Claim( + "uauth:permission", + "users.read") + }, UAuthConstants.SchemeDefaults.GlobalScheme)); + + return CreateJwtFixture(UAuthMode.SemiHybrid, JwtSuccess(principal)); + } + + private static SessionValidationResult CreateSemiHybridLineage( + Fixture fixture, + UserKey userKey, + AuthSessionId sessionId) + { + return SessionValidationResult.Active( + tenant: fixture.Flow.Tenant, + userKey: userKey, + sessionId: sessionId, + chainId: SessionChainId.New(), + rootId: SessionRootId.New(), + claims: ClaimsSnapshot.Empty, + authenticatedAt: Now, + boundDeviceId: fixture.Flow.Device.DeviceId); } + private static void SetupSemiHybridLineage( + Fixture fixture, + SessionValidationResult validation) + { + fixture.LineageValidator + .Setup(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + fixture.CancellationToken)) + .ReturnsAsync(validation); + } + + private static AuthStateSnapshot CreateAuthoritativeSnapshot( + Fixture fixture, + UserKey userKey) + { + return new AuthStateSnapshot + { + Identity = new AuthIdentitySnapshot + { + UserKey = userKey, + Tenant = fixture.Flow.Tenant, + AuthenticatedAt = Now, + SessionState = SessionState.Active, + UserStatus = UserStatus.Active + }, + Claims = ClaimsSnapshot.Empty + }; + } + + private static AuthenticateResult JwtSuccess(ClaimsPrincipal principal) + { + return AuthenticateResult.Success(new AuthenticationTicket(principal, UAuthConstants.SchemeDefaults.GlobalScheme)); + } private static void SetupSessionCredential(Fixture fixture, AuthSessionId sessionId) { From 0d4bd054ab4a7959bb51c62366402f190f86c022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Thu, 3 Dec 2026 12:08:49 +0300 Subject: [PATCH 12/14] Add Tests & Return to Sample Defaults --- .../Program.cs | 1 + .../Program.cs | 2 +- .../Program.cs | 6 +- .../Server/AuthFlowContextFactoryTests.cs | 663 ++++++++++++++++++ 4 files changed, 668 insertions(+), 4 deletions(-) create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthFlowContextFactoryTests.cs diff --git a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Program.cs b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Program.cs index 97845505..2619bf3d 100644 --- a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Program.cs +++ b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Program.cs @@ -44,6 +44,7 @@ builder.Services.AddUltimateAuthServer(o => { + //o.AuthMode = UAuthMode.SemiHybrid; o.Diagnostics.EnableRefreshDetails = true; //o.Session.MaxLifetime = TimeSpan.FromSeconds(32); //o.Token.SessionIdLifetime = TimeSpan.FromSeconds(32); diff --git a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/Program.cs b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/Program.cs index 93e29c2e..215c805f 100644 --- a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/Program.cs +++ b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/Program.cs @@ -47,7 +47,7 @@ builder.Services.AddUltimateAuthServer(o => { - o.AuthMode = UAuthMode.SemiHybrid; + //o.AuthMode = UAuthMode.SemiHybrid; //o.Token.AccessTokenLifetime = TimeSpan.FromSeconds(30); o.Diagnostics.EnableRefreshDetails = true; diff --git a/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/Program.cs b/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/Program.cs index 994ded73..b0a6ac8f 100644 --- a/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/Program.cs +++ b/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/Program.cs @@ -32,11 +32,11 @@ Key = UAuthCryptographyConstants.DevelopmentJwtSigningKey }); - o.Auth.Mode = UAuthMode.SemiHybrid; + //o.Auth.Mode = UAuthMode.SemiHybrid; // TODO: Make multiple UAuthHub support via resolver, then different client apps can use different UAuthHub instances if needed. - //o.Hub.BaseUrl = "https://localhost:6110"; // PureJwt auth mode doesn't need UAuthHub, but other auth modes do. This is the URL of the UAuthHub instance that this resource API trusts. - o.Hub.BaseUrl = "https://localhost:7213"; // Comment upper line and uncomment this if you want to try blazor server sample. + o.Hub.BaseUrl = "https://localhost:6110"; // PureJwt auth mode doesn't need UAuthHub, but other auth modes do. This is the URL of the UAuthHub instance that this resource API trusts. + //o.Hub.BaseUrl = "https://localhost:7213"; // Comment upper line and uncomment this if you want to try blazor server sample. // Standalone WASM o.Cors.AllowedOrigins.Add("https://localhost:6130"); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthFlowContextFactoryTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthFlowContextFactoryTests.cs new file mode 100644 index 00000000..9f4f505e --- /dev/null +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthFlowContextFactoryTests.cs @@ -0,0 +1,663 @@ +using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Defaults; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.MultiTenancy; +using CodeBeam.UltimateAuth.Server; +using CodeBeam.UltimateAuth.Server.Abstractions; +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Infrastructure; +using CodeBeam.UltimateAuth.Server.Options; +using CodeBeam.UltimateAuth.Server.RateLimiting; +using CodeBeam.UltimateAuth.Tests.Unit.Helpers; +using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using Moq; +using System.Security.Claims; + +namespace CodeBeam.UltimateAuth.Tests.Unit.Server; + +public sealed class AuthFlowContextFactoryTests +{ + private static readonly TenantKey Tenant = TenantKey.FromExternal("tenant-a"); + private static readonly UserKey User = UserKey.New(); + + private static readonly AuthSessionId Session = TestIds.Session("semi-hybrid-session"); + private static readonly SessionChainId Chain = SessionChainId.New(); + private static readonly SessionRootId Root = SessionRootId.New(); + + private static readonly DeviceId Device = TestDevice.Default().DeviceId!.Value; + + private static readonly DateTimeOffset Now = new(2026, 12, 1, 12, 0, 0, TimeSpan.Zero); + + private const string Scheme = UAuthConstants.SchemeDefaults.GlobalScheme; + + private const UAuthApplicationProfile Profile = UAuthApplicationProfile.BlazorWasm; + private const AuthFlowType FlowType = AuthFlowType.ApiAccess; + + private readonly Mock _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); + private readonly Mock _deviceContextFactory = new(MockBehavior.Strict); + private readonly Mock _sessionValidator = new(MockBehavior.Strict); + private readonly Mock _lineageValidator = new(MockBehavior.Strict); + private readonly Mock _authentication = new(MockBehavior.Strict); + private readonly Mock _clock = new(MockBehavior.Strict); + + private readonly DefaultHttpContext _http = new(); + + private readonly UAuthServerOptions _options; + + private readonly EffectiveUAuthServerOptions _effective; + + private readonly EffectiveAuthResponse _response; + + private readonly DeviceContext _deviceContext = + TestDevice.Default(); + + private readonly AuthFlowContextFactory _sut; + + private CancellationToken Ct => + TestContext.Current.CancellationToken; + + public AuthFlowContextFactoryTests() + { + _options = new UAuthServerOptions + { + AuthMode = UAuthMode.SemiHybrid + }; + + _options.Validation.Default = + UAuthValidationRequirement.Standard; + + _options.Session.DeviceMismatchBehavior = + DeviceMismatchBehavior.Reject; + + _effective = new EffectiveUAuthServerOptions + { + Mode = UAuthMode.SemiHybrid, + Options = _options + }; + + _response = AuthFlowTestFactory.New( + mode: UAuthMode.SemiHybrid).Response; + + var deviceInfo = new DeviceInfo + { + DeviceId = Device + }; + + _http.Items[UAuthConstants.HttpItems.TenantContextKey] = + UAuthTenantContext.Resolved(Tenant); + + _http.RequestServices = new ServiceCollection() + .AddSingleton( + _authentication.Object) + .BuildServiceProvider(); + + _profileReader + .Setup(x => x.ReadAsync(_http)) + .ReturnsAsync(Profile); + + _optionsProvider + .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, + FlowType, + Profile, + _effective)) + .Returns(_response); + + _deviceResolver + .Setup(x => x.ResolveAsync(_http)) + .ReturnsAsync(deviceInfo); + + _deviceContextFactory + .Setup(x => x.Create(deviceInfo)) + .Returns(_deviceContext); + + _clock + .SetupGet(x => x.UtcNow) + .Returns(Now); + + var authorityValidator = + new SemiHybridAuthorityValidator( + _lineageValidator.Object, + _clock.Object); + + _sut = new AuthFlowContextFactory( + _profileReader.Object, + _primaryTokenResolver.Object, + _optionsProvider.Object, + _responseResolver.Object, + _deviceResolver.Object, + _deviceContextFactory.Object, + _sessionValidator.Object, + authorityValidator, + _clock.Object); + } + + private static ClaimsPrincipal CreatePrincipal( + string? subject, + string? sessionId = null, + string? deviceId = null) + { + var claims = new List + { + new("sid", sessionId ?? Session.Value), + new("device_id", deviceId ?? Device.Value) + }; + + if (subject is not null) + { + claims.Add(new Claim( + ClaimTypes.NameIdentifier, + subject)); + } + + return new ClaimsPrincipal( + new ClaimsIdentity(claims, Scheme)); + } + + private void SetupAuthentication( + AuthenticateResult result) + { + _authentication + .Setup(x => x.AuthenticateAsync( + _http, + Scheme)) + .ReturnsAsync(result); + } + + private void SetupSuccessfulAuthentication( + ClaimsPrincipal? principal = null) + { + principal ??= CreatePrincipal(User.Value); + + SetupAuthentication( + AuthenticateResult.Success( + new AuthenticationTicket( + principal, + Scheme))); + } + + private void RequireHubValidation() + { + _options.Validation.Default = + UAuthValidationRequirement.HubValidated; + } + + private static SessionValidationResult CreateActiveLineage( + TenantKey? tenant = null, + UserKey? user = null, + AuthSessionId? session = null, + DeviceId? device = null) + { + return SessionValidationResult.Active( + tenant: tenant ?? Tenant, + userKey: user ?? User, + sessionId: session ?? Session, + chainId: Chain, + rootId: Root, + claims: ClaimsSnapshot.Empty, + authenticatedAt: Now, + boundDeviceId: device ?? Device); + } + + private void SetupLineage( + SessionValidationResult result) + { + _lineageValidator + .Setup(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + Ct)) + .ReturnsAsync(result); + } + + private async Task CreateAsync() + { + return await _sut.CreateAsync( + _http, + FlowType, + Ct); + } + + private static void AssertAnonymous( + AuthFlowContext result) + { + Assert.False(result.IsAuthenticated); + Assert.Null(result.UserKey); + Assert.Null(result.Session); + } + + private void VerifyNoSessionValidation() + { + _sessionValidator.VerifyNoOtherCalls(); + _lineageValidator.VerifyNoOtherCalls(); + } + + // Authentication failures + + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task CreateAsync_SemiHybrid_AuthenticationFailed_ShouldRemainAnonymous( + bool requireHub) + { + if (requireHub) + { + RequireHubValidation(); + } + + SetupAuthentication( + AuthenticateResult.Fail("Invalid JWT")); + + var result = await CreateAsync(); + + AssertAnonymous(result); + VerifyNoSessionValidation(); + } + + [Fact] + public async Task CreateAsync_SemiHybrid_NoAuthenticationResult_ShouldRemainAnonymous() + { + RequireHubValidation(); + + SetupAuthentication( + AuthenticateResult.NoResult()); + + var result = await CreateAsync(); + + AssertAnonymous(result); + VerifyNoSessionValidation(); + } + + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData(" ")] + public async Task CreateAsync_SemiHybrid_InvalidSubject_ShouldRemainAnonymous( + string? subject) + { + RequireHubValidation(); + + SetupSuccessfulAuthentication( + CreatePrincipal(subject)); + + var result = await CreateAsync(); + + AssertAnonymous(result); + VerifyNoSessionValidation(); + } + + // Standard validation + + [Fact] + public async Task CreateAsync_SemiHybrid_Standard_ShouldAuthenticateWithoutSession() + { + SetupSuccessfulAuthentication(); + + var result = await CreateAsync(); + + Assert.True(result.IsAuthenticated); + Assert.Equal(User, result.UserKey); + Assert.Null(result.Session); + + Assert.Equal(UAuthMode.SemiHybrid, result.EffectiveMode); + Assert.Equal(Profile, result.ApplicationProfile); + Assert.Equal(FlowType, result.FlowType); + 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); + + _authentication.Verify( + x => x.AuthenticateAsync(_http, Scheme), + Times.Once); + + VerifyNoSessionValidation(); + + _clock.VerifyNoOtherCalls(); + } + + // Successful authoritative validation + + [Fact] + public async Task CreateAsync_SemiHybrid_HubValidated_ShouldCreateSessionContext() + { + RequireHubValidation(); + SetupSuccessfulAuthentication(); + + SessionValidationContext? captured = null; + + _lineageValidator + .Setup(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + Ct)) + .Callback< + SessionValidationContext, + SessionCredentialPurpose, + CancellationToken>( + (context, _, _) => captured = context) + .ReturnsAsync(CreateActiveLineage()); + + var result = await CreateAsync(); + + Assert.True(result.IsAuthenticated); + Assert.Equal(User, result.UserKey); + + Assert.NotNull(result.Session); + + Assert.Equal(User, result.Session.UserKey); + Assert.Equal(Session, result.Session.SessionId); + Assert.Equal(Chain, result.Session.ChainId); + Assert.Equal(Device, result.Session.BoundDeviceId); + Assert.Equal(SessionState.Active, result.Session.State); + + Assert.NotNull(captured); + + Assert.Equal(Tenant, captured.Tenant); + Assert.Equal(Session, captured.SessionId); + Assert.Equal(_deviceContext, captured.Device); + Assert.Equal(Now, captured.Now); + + Assert.Same( + _options.Session, + captured.SessionOptions); + + _lineageValidator.Verify( + x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + Ct), + Times.Once); + + _lineageValidator.VerifyNoOtherCalls(); + _sessionValidator.VerifyNoOtherCalls(); + } + + // Invalid authoritative validation + + [Theory] + [InlineData(SessionState.Revoked)] + [InlineData(SessionState.Expired)] + [InlineData(SessionState.NotFound)] + [InlineData(SessionState.Invalid)] + [InlineData(SessionState.SecurityMismatch)] + [InlineData(SessionState.DeviceMismatch)] + [InlineData(SessionState.Unsupported)] + public async Task CreateAsync_SemiHybrid_InvalidLineage_ShouldRemainAnonymous( + SessionState state) + { + RequireHubValidation(); + SetupSuccessfulAuthentication(); + + SetupLineage( + SessionValidationResult.Invalid(state)); + + var result = await CreateAsync(); + + AssertAnonymous(result); + + _lineageValidator.Verify( + x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + Ct), + Times.Once); + + _sessionValidator.VerifyNoOtherCalls(); + } + + // Binding integrity + + [Theory] + [InlineData("tenant")] + [InlineData("user")] + [InlineData("session")] + [InlineData("device")] + public async Task CreateAsync_SemiHybrid_LineageBindingMismatch_ShouldRemainAnonymous( + string mismatch) + { + RequireHubValidation(); + SetupSuccessfulAuthentication(); + + var validation = mismatch switch + { + "tenant" => CreateActiveLineage( + tenant: TenantKey.FromExternal("tenant-b")), + + "user" => CreateActiveLineage( + user: UserKey.New()), + + "session" => CreateActiveLineage( + session: TestIds.Session("other-session")), + + "device" => CreateActiveLineage( + device: TestDevice.Alternative().DeviceId!.Value), + + _ => throw new ArgumentOutOfRangeException( + nameof(mismatch)) + }; + + SetupLineage(validation); + + var result = await CreateAsync(); + + AssertAnonymous(result); + + _lineageValidator.Verify( + x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + Ct), + Times.Once); + + _sessionValidator.VerifyNoOtherCalls(); + } + + [Fact] + public async Task CreateAsync_SemiHybrid_DeviceMismatch_ShouldRemainAnonymous() + { + RequireHubValidation(); + + SetupSuccessfulAuthentication( + CreatePrincipal( + User.Value, + deviceId: TestDevice.Alternative() + .DeviceId!.Value.Value)); + + var result = await CreateAsync(); + + AssertAnonymous(result); + + VerifyNoSessionValidation(); + } + + [Fact] + public async Task CreateAsync_SemiHybrid_InvalidSessionClaim_ShouldRemainAnonymous() + { + RequireHubValidation(); + + SetupSuccessfulAuthentication( + CreatePrincipal( + User.Value, + sessionId: "invalid")); + + var result = await CreateAsync(); + + AssertAnonymous(result); + + VerifyNoSessionValidation(); + } + + // Request-scoped validation reuse + + [Fact] + public async Task CreateAsync_SemiHybrid_RepeatedHubValidation_ShouldReuseLineageResult() + { + RequireHubValidation(); + SetupSuccessfulAuthentication(); + SetupLineage(CreateActiveLineage()); + + var first = await CreateAsync(); + var second = await CreateAsync(); + + Assert.True(first.IsAuthenticated); + Assert.True(second.IsAuthenticated); + + Assert.Equal(User, first.UserKey); + Assert.Equal(User, second.UserKey); + + Assert.NotNull(first.Session); + Assert.NotNull(second.Session); + + Assert.Equal(Session, first.Session.SessionId); + Assert.Equal(Session, second.Session.SessionId); + + _lineageValidator.Verify( + x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + Ct), + Times.Once); + + _sessionValidator.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(UAuthEndpoint.GetMyIdentifiers, false)] + [InlineData(UAuthEndpoint.ProfileGetSelf, false)] + [InlineData(UAuthEndpoint.GetMyRoles, false)] + [InlineData(UAuthEndpoint.ProfileUpdateSelf, true)] + [InlineData(UAuthEndpoint.Logout, true)] + public async Task CreateAsync_SemiHybrid_ShouldHonorEndpointClassification(UAuthEndpoint endpoint, bool requiresHub) + { + _http.SetEndpoint(new Endpoint( + _ => Task.CompletedTask, + new EndpointMetadataCollection( + UAuthEndpointClassification.Get(endpoint)), + endpoint.ToString())); + + SetupSuccessfulAuthentication(); + + if (requiresHub) + { + SetupLineage(CreateActiveLineage()); + } + + var result = await CreateAsync(); + + Assert.True(result.IsAuthenticated); + Assert.Equal(User, result.UserKey); + + if (requiresHub) + { + Assert.NotNull(result.Session); + + _lineageValidator.Verify( + x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + Ct), + Times.Once); + } + else + { + Assert.Null(result.Session); + _lineageValidator.VerifyNoOtherCalls(); + } + + _sessionValidator.VerifyNoOtherCalls(); + } + + [Fact] + public async Task CreateAsync_SemiHybrid_EndpointOverride_ShouldRequireHubValidation() + { + const UAuthEndpoint endpoint = + UAuthEndpoint.GetMyIdentifiers; + + _http.SetEndpoint(new Endpoint( + _ => Task.CompletedTask, + new EndpointMetadataCollection( + UAuthEndpointClassification.Get(endpoint)), + endpoint.ToString())); + + _options.Validation.Endpoints[endpoint] = + UAuthValidationRequirement.HubValidated; + + SetupSuccessfulAuthentication(); + SetupLineage(CreateActiveLineage()); + + var result = await CreateAsync(); + + Assert.True(result.IsAuthenticated); + Assert.Equal(User, result.UserKey); + Assert.NotNull(result.Session); + + _lineageValidator.Verify( + x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + Ct), + Times.Once); + + _sessionValidator.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(UAuthEndpoint.Logout)] + [InlineData(UAuthEndpoint.GetMyChains)] + [InlineData(UAuthEndpoint.RevokeMyChain)] + [InlineData(UAuthEndpoint.RevokeAllMyChains)] + public async Task CreateAsync_SemiHybrid_MandatoryHubValidation_CannotBeDowngraded(UAuthEndpoint endpoint) + { + _http.SetEndpoint(new Endpoint( + _ => Task.CompletedTask, + new EndpointMetadataCollection( + UAuthEndpointClassification.Get(endpoint)), + endpoint.ToString())); + + _options.Validation.Default = + UAuthValidationRequirement.Standard; + + _options.Validation.Endpoints[endpoint] = + UAuthValidationRequirement.Standard; + + SetupSuccessfulAuthentication(); + + SetupLineage( + SessionValidationResult.Invalid( + SessionState.Revoked)); + + var result = await CreateAsync(); + + AssertAnonymous(result); + + _lineageValidator.Verify( + x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + Ct), + Times.Once); + + _sessionValidator.VerifyNoOtherCalls(); + } +} From 68f8959d4b78b0ed9cb9488413bbe32bcabf225f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Thu, 3 Dec 2026 12:15:15 +0300 Subject: [PATCH 13/14] Add Last Tests --- ...thStatusAuthorizationResultHandlerTests.cs | 1294 +++++++++++++++++ 1 file changed, 1294 insertions(+) create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthStatusAuthorizationResultHandlerTests.cs diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthStatusAuthorizationResultHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthStatusAuthorizationResultHandlerTests.cs new file mode 100644 index 00000000..eb7ba4d2 --- /dev/null +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthStatusAuthorizationResultHandlerTests.cs @@ -0,0 +1,1294 @@ +using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Defaults; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.MultiTenancy; +using CodeBeam.UltimateAuth.Core.Runtime; +using CodeBeam.UltimateAuth.Server.Abstractions; +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Authorization; +using CodeBeam.UltimateAuth.Server.Extensions; +using CodeBeam.UltimateAuth.Server.Infrastructure; +using CodeBeam.UltimateAuth.Server.Options; +using CodeBeam.UltimateAuth.Server.ResourceApi; +using CodeBeam.UltimateAuth.Server.Runtime; +using CodeBeam.UltimateAuth.Tests.Unit.Helpers; +using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization.Policy; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Moq; +using System.Net; +using System.Security.Claims; + +namespace CodeBeam.UltimateAuth.Tests.Unit.Server; + +public sealed class UAuthStatusAuthorizationResultHandlerTests +{ + private const string Scheme = UAuthConstants.SchemeDefaults.GlobalScheme; + + private static readonly TenantKey Tenant = + TenantKey.FromExternal("tenant-a"); + + private static readonly UserKey User = UserKey.New(); + + private static readonly AuthSessionId Session = + TestIds.Session("authorization-session"); + + private static readonly SessionChainId Chain = + SessionChainId.New(); + + private static readonly SessionRootId Root = + SessionRootId.New(); + + private static readonly DeviceId Device = + TestDevice.Default().DeviceId!.Value; + + private static readonly DateTimeOffset Now = + new(2026, 12, 1, 12, 0, 0, TimeSpan.Zero); + + private const UAuthApplicationProfile Profile = + UAuthApplicationProfile.BlazorWasm; + + private static ClaimsPrincipal CreatePrincipal( + string? subject, + string? scheme = Scheme) + { + var claims = new List + { + new("sid", Session.Value), + new("device_id", Device.Value) + }; + + if (subject is not null) + { + claims.Add(new Claim( + ClaimTypes.NameIdentifier, + subject)); + } + + return new ClaimsPrincipal( + new ClaimsIdentity(claims, scheme)); + } + + private static UserRuntimeRecord CreateActiveUser() + { + return new UserRuntimeRecord + { + UserKey = User, + Exists = true, + IsActive = true, + CanAuthenticate = true, + IsDeleted = false + }; + } + + private static SessionValidationResult CreateActiveLineage( + UserStatus status = UserStatus.Active, + TenantKey? tenant = null, + UserKey? user = null) + { + return SessionValidationResult.Active( + tenant: tenant ?? Tenant, + userKey: user ?? User, + sessionId: Session, + chainId: Chain, + rootId: Root, + claims: ClaimsSnapshot.Empty, + authenticatedAt: Now, + boundDeviceId: Device, + userStatus: status); + } + + private static AuthValidationResult CreateHubResponse( + UserStatus status = UserStatus.Active) + { + return new AuthValidationResult + { + State = SessionState.Active, + Validation = UAuthValidationRequirement.HubValidated, + ChainId = Chain, + RootId = Root, + BoundDeviceId = Device, + + Snapshot = new AuthStateSnapshot + { + Identity = new AuthIdentitySnapshot + { + UserKey = User, + Tenant = Tenant, + AuthenticatedAt = Now, + SessionState = SessionState.Active, + UserStatus = status + }, + + Claims = ClaimsSnapshot.Empty + } + }; + } + + private sealed class Fixture : IDisposable + { + public DefaultHttpContext Context { get; } = new(); + + public Mock Authentication { get; } + = new(MockBehavior.Strict); + + public Mock Schemes { get; } + = new(MockBehavior.Strict); + + public Mock Users { get; } + = new(MockBehavior.Strict); + + public Mock Lineage { get; } + = new(MockBehavior.Strict); + + public Mock ProfileReader { get; } + = new(MockBehavior.Strict); + + public Mock OptionsProvider { get; } + = new(MockBehavior.Strict); + + public Mock DeviceResolver { get; } + = new(MockBehavior.Strict); + + public Mock DeviceContextFactory { get; } + = new(MockBehavior.Strict); + + public Mock Credentials { get; } + = new(MockBehavior.Strict); + + public Mock Clock { get; } + = new(MockBehavior.Strict); + + public UAuthServerOptions ServerOptions { get; } = new(); + + public UAuthResourceApiOptions ResourceOptions { get; } = new(); + + public RecordingHttpHandler HubHandler { get; } = new(); + + public int NextCalls { get; private set; } + + public CancellationToken CancellationToken { get; } + = TestContext.Current.CancellationToken; + + private readonly HttpClient _client; + private readonly ServiceProvider _services; + + private readonly UAuthStatusAuthorizationResultHandler _sut = + new(); + + public Fixture( + UAuthMode mode, + bool resource = false) + { + Context.User = CreatePrincipal(User.Value); + Context.RequestAborted = CancellationToken; + + Context.Items[ + UAuthConstants.HttpItems.TenantContextKey] = + UAuthTenantContext.Resolved(Tenant); + + ServerOptions.AuthMode = mode; + + ServerOptions.Session.DeviceMismatchBehavior = + DeviceMismatchBehavior.Reject; + + ResourceOptions.Auth.Mode = mode; + + ResourceOptions.Auth.Device.MismatchBehavior = + DeviceMismatchBehavior.Reject; + + var effective = new EffectiveUAuthServerOptions + { + Mode = mode, + Options = ServerOptions + }; + + ProfileReader + .Setup(x => x.ReadAsync(Context)) + .ReturnsAsync(Profile); + + OptionsProvider + .Setup(x => x.GetEffective(Context, Profile)) + .Returns(effective); + + var deviceInfo = new DeviceInfo + { + DeviceId = Device + }; + + DeviceResolver + .Setup(x => x.ResolveAsync(Context)) + .ReturnsAsync(deviceInfo); + + DeviceContextFactory + .Setup(x => x.Create(deviceInfo)) + .Returns(TestDevice.Default()); + + Clock + .SetupGet(x => x.UtcNow) + .Returns(Now); + + Authentication + .Setup(x => x.ForbidAsync( + Context, + It.IsAny(), + It.IsAny())) + .Callback( + (context, _, _) => + { + context.Response.StatusCode = + StatusCodes.Status403Forbidden; + }) + .Returns(Task.CompletedTask); + + Authentication + .Setup(x => x.ChallengeAsync( + Context, + It.IsAny(), + It.IsAny())) + .Callback( + (context, _, _) => + { + context.Response.StatusCode = + StatusCodes.Status401Unauthorized; + }) + .Returns(Task.CompletedTask); + + Credentials + .Setup(x => x.ResolveAsync( + Context, + UAuthMode.SemiHybrid, + It.IsAny())) + .ReturnsAsync(new TransportCredential + { + Kind = TransportCredentialKind.AccessToken, + Value = "test-access-token", + TenantId = Tenant.Value, + Device = deviceInfo + }); + + _client = new HttpClient(HubHandler) + { + BaseAddress = new Uri("https://uauth.test") + }; + + var resourceOptions = Options.Create(ResourceOptions); + + var modeResolver = + new Mock( + MockBehavior.Strict); + + var modeProvider = new ResourceApiAuthModeProvider( + resourceOptions, + modeResolver.Object); + + IUAuthRuntimeMarker runtime = resource + ? new ResourceRuntimeMarker() + : new ServerRuntimeMarker(); + + _services = new ServiceCollection() + .AddSingleton(runtime) + .AddSingleton(Authentication.Object) + .AddSingleton(Schemes.Object) + .AddSingleton(Users.Object) + .AddSingleton(ProfileReader.Object) + .AddSingleton(OptionsProvider.Object) + .AddSingleton(DeviceResolver.Object) + .AddSingleton(DeviceContextFactory.Object) + .AddSingleton(resourceOptions) + .AddSingleton(modeProvider) + .AddSingleton( + new SemiHybridAuthorityValidator( + Lineage.Object, + Clock.Object)) + .AddSingleton( + new RemoteHubValidationService( + _client, + Credentials.Object, + resourceOptions)) + .BuildServiceProvider(); + + Context.RequestServices = _services; + } + + public void SetEndpoint( + bool hubValidated = false, + bool allowInactive = false) + { + var metadata = new List(); + + if (hubValidated) + { + metadata.Add(new UAuthHubValidatedAttribute()); + } + + if (allowInactive) + { + metadata.Add(new UAuthAllowInactiveAttribute()); + } + + Context.SetEndpoint(new Endpoint( + _ => Task.CompletedTask, + new EndpointMetadataCollection(metadata), + "Test endpoint")); + } + + public void SetupUser(UserRuntimeRecord? user) + { + Users + .Setup(x => x.GetAsync( + Tenant, + User, + CancellationToken)) + .ReturnsAsync(user); + } + + public void SetupLineage(SessionValidationResult result) + { + Lineage + .Setup(x => x.ValidateAsync( + It.IsAny(), + SessionCredentialPurpose.MetadataOnly, + CancellationToken)) + .ReturnsAsync(result); + } + + public void SetTrustedValidation( + SessionValidationResult result) + { + Context.Items[ + UAuthConstants.HttpItems.SessionValidationResult] = + result; + } + + public void SetHubResponse(AuthValidationResult response) + { + HubHandler.Response = response; + } + + public Task ExecuteAsync( + PolicyAuthorizationResult? result = null, + AuthorizationPolicy? policy = null) + { + policy ??= new AuthorizationPolicyBuilder(Scheme) + .RequireAuthenticatedUser() + .Build(); + + return _sut.HandleAsync( + context => + { + NextCalls++; + + context.Response.StatusCode = + StatusCodes.Status200OK; + + return Task.CompletedTask; + }, + Context, + policy, + result ?? PolicyAuthorizationResult.Success()); + } + + public void AssertAllowed() + { + Assert.Equal(1, NextCalls); + + Assert.Equal( + StatusCodes.Status200OK, + Context.Response.StatusCode); + + Authentication.Verify(x => x.ForbidAsync( + Context, + It.IsAny(), + It.IsAny()), + Times.Never); + } + + public void AssertForbidden() + { + Assert.Equal(0, NextCalls); + + Assert.Equal( + StatusCodes.Status403Forbidden, + Context.Response.StatusCode); + + Authentication.Verify(x => x.ForbidAsync( + Context, + It.IsAny(), + It.IsAny()), + Times.Once); + } + + public void VerifyNoAuthorityValidation() + { + Lineage.VerifyNoOtherCalls(); + Credentials.VerifyNoOtherCalls(); + + Assert.Equal(0, HubHandler.CallCount); + } + + public void VerifyLocalAuthorityValidation() + { + Lineage.Verify(x => x.ValidateAsync( + It.Is(context => + context.Tenant == Tenant && + context.SessionId == Session && + context.Device.DeviceId == Device && + context.SessionOptions == ServerOptions.Session && + context.Now == Now), + SessionCredentialPurpose.MetadataOnly, + CancellationToken), + Times.Once); + + Lineage.VerifyNoOtherCalls(); + + Assert.Equal(0, HubHandler.CallCount); + } + + public void Dispose() + { + _client.Dispose(); + _services.Dispose(); + } + } + + private sealed class RecordingHttpHandler : HttpMessageHandler + { + public int CallCount { get; private set; } + + public AuthValidationResult Response { get; set; } + = CreateHubResponse(); + + public HttpStatusCode StatusCode { get; set; } + = HttpStatusCode.OK; + + public string? ValidationRequirement { get; private set; } + + protected override Task SendAsync( + HttpRequestMessage request, + CancellationToken cancellationToken) + { + CallCount++; + + ValidationRequirement = request.Headers.TryGetValues( + UAuthConstants.Headers.Validation, + out var values) + ? values.SingleOrDefault() + : null; + + return Task.FromResult(new HttpResponseMessage(StatusCode) + { + Content = JsonContent.Create(Response) + }); + } + } + + [Theory] + [InlineData(Scheme, true)] + [InlineData("OtherScheme", false)] + public async Task HandleAsync_Challenge_ShouldSetRecoveryHeaderOnlyForUAuth( + string scheme, + bool expectedRecoveryHeader) + { + using var fixture = new Fixture(UAuthMode.SemiHybrid); + + var policy = new AuthorizationPolicyBuilder(scheme) + .RequireAuthenticatedUser() + .Build(); + + await fixture.ExecuteAsync( + PolicyAuthorizationResult.Challenge(), + policy); + + Assert.Equal(0, fixture.NextCalls); + + Assert.Equal( + StatusCodes.Status401Unauthorized, + fixture.Context.Response.StatusCode); + + Assert.Equal( + expectedRecoveryHeader, + fixture.Context.Response.Headers.ContainsKey( + UAuthConstants.Headers.AuthRecovery)); + + if (expectedRecoveryHeader) + { + Assert.Equal( + "challenge", + fixture.Context.Response.Headers[ + UAuthConstants.Headers.AuthRecovery].ToString()); + } + + fixture.VerifyNoAuthorityValidation(); + fixture.Users.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(Scheme, true)] + [InlineData("OtherScheme", false)] + [InlineData(null, false)] + public async Task HandleAsync_DefaultChallengeScheme_ShouldDetermineRecoveryHeader(string? scheme, bool expectedRecoveryHeader) + { + using var fixture = new Fixture(UAuthMode.SemiHybrid); + + fixture.Schemes + .Setup(x => x.GetDefaultChallengeSchemeAsync()) + .ReturnsAsync(scheme is null + ? null + : new AuthenticationScheme( + scheme, + null, + typeof(AuthenticationHandler))); + + var policy = new AuthorizationPolicyBuilder() + .RequireAuthenticatedUser() + .Build(); + + await fixture.ExecuteAsync( + PolicyAuthorizationResult.Challenge(), + policy); + + Assert.Equal(0, fixture.NextCalls); + + Assert.Equal( + StatusCodes.Status401Unauthorized, + fixture.Context.Response.StatusCode); + + Assert.Equal( + expectedRecoveryHeader, + fixture.Context.Response.Headers.ContainsKey( + UAuthConstants.Headers.AuthRecovery)); + + fixture.VerifyNoAuthorityValidation(); + fixture.Users.VerifyNoOtherCalls(); + } + + [Fact] + public async Task HandleAsync_MultipleChallengeSchemes_ShouldNotSetRecoveryHeader() + { + using var fixture = new Fixture(UAuthMode.SemiHybrid); + + var policy = new AuthorizationPolicyBuilder( + Scheme, + "OtherScheme") + .RequireAuthenticatedUser() + .Build(); + + await fixture.ExecuteAsync( + PolicyAuthorizationResult.Challenge(), + policy); + + Assert.Equal(0, fixture.NextCalls); + + Assert.False( + fixture.Context.Response.Headers.ContainsKey( + UAuthConstants.Headers.AuthRecovery)); + + fixture.VerifyNoAuthorityValidation(); + } + + [Fact] + public async Task HandleAsync_AlreadyForbidden_ShouldNotRunAdditionalValidation() + { + using var fixture = new Fixture(UAuthMode.SemiHybrid); + + await fixture.ExecuteAsync( + PolicyAuthorizationResult.Forbid()); + + fixture.AssertForbidden(); + fixture.VerifyNoAuthorityValidation(); + fixture.Users.VerifyNoOtherCalls(); + + Assert.False( + fixture.Context.Response.Headers.ContainsKey( + UAuthConstants.Headers.AuthRecovery)); + } + + [Theory] + [InlineData(null, Scheme)] + [InlineData("", Scheme)] + [InlineData(" ", Scheme)] + [InlineData("valid-user", null)] + [InlineData("valid-user", "OtherScheme")] + public async Task HandleAsync_InvalidUAuthIdentity_ShouldForbid(string? subject, string? scheme) + { + using var fixture = new Fixture(UAuthMode.SemiHybrid); + + fixture.Context.User = CreatePrincipal(subject, scheme); + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + fixture.VerifyNoAuthorityValidation(); + fixture.Users.VerifyNoOtherCalls(); + fixture.ProfileReader.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task HandleAsync_PureJwt_Standard_ShouldAllowWithoutServerState( + bool resource) + { + using var fixture = new Fixture( + UAuthMode.PureJwt, + resource); + + await fixture.ExecuteAsync(); + + fixture.AssertAllowed(); + fixture.VerifyNoAuthorityValidation(); + fixture.Users.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task HandleAsync_PureJwt_HubValidatedEndpoint_ShouldForbid( + bool resource) + { + using var fixture = new Fixture( + UAuthMode.PureJwt, + resource); + + fixture.SetEndpoint(hubValidated: true); + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + fixture.VerifyNoAuthorityValidation(); + fixture.Users.VerifyNoOtherCalls(); + } + + [Fact] + public async Task HandleAsync_ResourcePureJwt_GlobalHubValidation_ShouldForbid() + { + using var fixture = new Fixture( + UAuthMode.PureJwt, + resource: true); + + fixture.ResourceOptions.Auth.Validation.Default = + UAuthValidationRequirement.HubValidated; + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + fixture.VerifyNoAuthorityValidation(); + fixture.Users.VerifyNoOtherCalls(); + } + + [Fact] + public async Task HandleAsync_ServerSemiHybrid_Standard_ShouldOnlyValidateUserStatus() + { + using var fixture = new Fixture(UAuthMode.SemiHybrid); + + fixture.SetupUser(CreateActiveUser()); + + await fixture.ExecuteAsync(); + + fixture.AssertAllowed(); + fixture.VerifyNoAuthorityValidation(); + + fixture.Users.Verify(x => x.GetAsync( + Tenant, + User, + fixture.CancellationToken), + Times.Once); + } + + [Fact] + public async Task HandleAsync_ServerSemiHybrid_Standard_ShouldNotRequireActiveLineage() + { + using var fixture = new Fixture(UAuthMode.SemiHybrid); + + fixture.SetupUser(CreateActiveUser()); + + fixture.SetTrustedValidation( + SessionValidationResult.Invalid(SessionState.Revoked)); + + await fixture.ExecuteAsync(); + + fixture.AssertAllowed(); + fixture.VerifyNoAuthorityValidation(); + } + + [Fact] + public async Task HandleAsync_ServerSemiHybrid_HubValidated_ShouldValidateLineageAndUser() + { + using var fixture = new Fixture(UAuthMode.SemiHybrid); + + fixture.SetEndpoint(hubValidated: true); + + fixture.SetupLineage(CreateActiveLineage()); + fixture.SetupUser(CreateActiveUser()); + + await fixture.ExecuteAsync(); + + fixture.AssertAllowed(); + fixture.VerifyLocalAuthorityValidation(); + + fixture.Users.Verify(x => x.GetAsync( + Tenant, + User, + fixture.CancellationToken), + Times.Once); + + fixture.DeviceResolver.Verify( + x => x.ResolveAsync(fixture.Context), + Times.Once); + } + + [Theory] + [InlineData(SessionState.Revoked)] + [InlineData(SessionState.Expired)] + [InlineData(SessionState.NotFound)] + [InlineData(SessionState.Invalid)] + [InlineData(SessionState.SecurityMismatch)] + [InlineData(SessionState.DeviceMismatch)] + public async Task HandleAsync_ServerSemiHybrid_InvalidLineage_ShouldForbid( + SessionState state) + { + using var fixture = new Fixture(UAuthMode.SemiHybrid); + + fixture.SetEndpoint(hubValidated: true); + + fixture.SetupLineage( + SessionValidationResult.Invalid(state)); + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + fixture.VerifyLocalAuthorityValidation(); + + fixture.Users.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData("tenant")] + [InlineData("user")] + public async Task HandleAsync_ServerSemiHybrid_LineageBindingMismatch_ShouldForbid(string mismatch) + { + using var fixture = new Fixture(UAuthMode.SemiHybrid); + + fixture.SetEndpoint(hubValidated: true); + + var validation = mismatch == "tenant" + ? CreateActiveLineage( + tenant: TenantKey.FromExternal("tenant-b")) + : CreateActiveLineage( + user: UserKey.New()); + + fixture.SetupLineage(validation); + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + fixture.VerifyLocalAuthorityValidation(); + + fixture.Users.VerifyNoOtherCalls(); + } + + [Fact] + public async Task HandleAsync_ServerSemiHybrid_ValidLineageButDeletedUser_ShouldForbid() + { + using var fixture = new Fixture(UAuthMode.SemiHybrid); + + fixture.SetEndpoint(hubValidated: true); + + fixture.SetupLineage(CreateActiveLineage()); + + fixture.SetupUser(CreateActiveUser() with + { + IsDeleted = true + }); + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + fixture.VerifyLocalAuthorityValidation(); + + fixture.Users.Verify(x => x.GetAsync( + Tenant, + User, + fixture.CancellationToken), + Times.Once); + } + + [Fact] + public async Task HandleAsync_ResourceSemiHybrid_Standard_ShouldAllowWithoutHub() + { + using var fixture = new Fixture( + UAuthMode.SemiHybrid, + resource: true); + + await fixture.ExecuteAsync(); + + fixture.AssertAllowed(); + fixture.VerifyNoAuthorityValidation(); + + fixture.Users.VerifyNoOtherCalls(); + fixture.ProfileReader.VerifyNoOtherCalls(); + fixture.OptionsProvider.VerifyNoOtherCalls(); + } + + [Fact] + public async Task HandleAsync_ResourceSemiHybrid_Standard_ShouldIgnoreRevokedLineage() + { + using var fixture = new Fixture( + UAuthMode.SemiHybrid, + resource: true); + + fixture.SetTrustedValidation( + SessionValidationResult.Invalid(SessionState.Revoked)); + + await fixture.ExecuteAsync(); + + fixture.AssertAllowed(); + fixture.VerifyNoAuthorityValidation(); + fixture.Users.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(true, false)] + [InlineData(false, true)] + [InlineData(true, true)] + public async Task HandleAsync_ResourceSemiHybrid_HubValidated_ShouldRequireRemoteAuthority( + bool endpointRequirement, + bool globalRequirement) + { + using var fixture = new Fixture( + UAuthMode.SemiHybrid, + resource: true); + + fixture.SetEndpoint( + hubValidated: endpointRequirement); + + if (globalRequirement) + { + fixture.ResourceOptions.Auth.Validation.Default = + UAuthValidationRequirement.HubValidated; + } + + fixture.SetHubResponse(CreateHubResponse()); + + await fixture.ExecuteAsync(); + + fixture.AssertAllowed(); + + Assert.Equal(1, fixture.HubHandler.CallCount); + + Assert.Equal( + nameof(UAuthValidationRequirement.HubValidated), + fixture.HubHandler.ValidationRequirement); + + var validation = Assert.IsType( + fixture.Context.Items[ + UAuthConstants.HttpItems.SessionValidationResult]); + + Assert.True(validation.IsValid); + Assert.Equal(Tenant, validation.Tenant); + Assert.Equal(User, validation.UserKey); + Assert.Equal(Session, validation.SessionId); + Assert.Equal(UserStatus.Active, validation.UserStatus); + + fixture.Lineage.VerifyNoOtherCalls(); + fixture.Users.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(SessionState.Revoked)] + [InlineData(SessionState.Expired)] + [InlineData(SessionState.NotFound)] + [InlineData(SessionState.Invalid)] + [InlineData(SessionState.SecurityMismatch)] + [InlineData(SessionState.DeviceMismatch)] + public async Task HandleAsync_ResourceSemiHybrid_InvalidHubResult_ShouldForbid( + SessionState state) + { + using var fixture = new Fixture( + UAuthMode.SemiHybrid, + resource: true); + + fixture.SetEndpoint(hubValidated: true); + + fixture.SetHubResponse(new AuthValidationResult + { + State = state, + Validation = UAuthValidationRequirement.HubValidated + }); + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + + Assert.Equal(1, fixture.HubHandler.CallCount); + + fixture.Users.VerifyNoOtherCalls(); + fixture.Lineage.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(HttpStatusCode.Unauthorized)] + [InlineData(HttpStatusCode.Forbidden)] + [InlineData(HttpStatusCode.InternalServerError)] + [InlineData(HttpStatusCode.ServiceUnavailable)] + public async Task HandleAsync_ResourceSemiHybrid_HubUnavailable_ShouldFailClosed( + HttpStatusCode statusCode) + { + using var fixture = new Fixture( + UAuthMode.SemiHybrid, + resource: true); + + fixture.SetEndpoint(hubValidated: true); + + fixture.HubHandler.StatusCode = statusCode; + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + + Assert.Equal(1, fixture.HubHandler.CallCount); + + fixture.Users.VerifyNoOtherCalls(); + fixture.Lineage.VerifyNoOtherCalls(); + } + + [Fact] + public async Task HandleAsync_ResourceSemiHybrid_StandardHubResponse_ShouldNotSatisfyHubValidation() + { + using var fixture = new Fixture( + UAuthMode.SemiHybrid, + resource: true); + + fixture.SetEndpoint(hubValidated: true); + + fixture.SetHubResponse(CreateHubResponse() with + { + Validation = UAuthValidationRequirement.Standard + }); + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + + Assert.Equal(1, fixture.HubHandler.CallCount); + + fixture.Users.VerifyNoOtherCalls(); + fixture.Lineage.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData("tenant")] + [InlineData("user")] + [InlineData("device")] + public async Task HandleAsync_ResourceSemiHybrid_HubBindingMismatch_ShouldForbid( + string mismatch) + { + using var fixture = new Fixture( + UAuthMode.SemiHybrid, + resource: true); + + fixture.SetEndpoint(hubValidated: true); + + var response = CreateHubResponse(); + + var identity = response.Snapshot!.Identity; + + response = mismatch switch + { + "tenant" => response with + { + Snapshot = response.Snapshot with + { + Identity = identity with + { + Tenant = TenantKey.FromExternal("tenant-b") + } + } + }, + + "user" => response with + { + Snapshot = response.Snapshot with + { + Identity = identity with + { + UserKey = UserKey.New() + } + } + }, + + "device" => response with + { + BoundDeviceId = + TestDevice.Alternative().DeviceId!.Value + }, + + _ => throw new ArgumentOutOfRangeException( + nameof(mismatch)) + }; + + fixture.SetHubResponse(response); + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + + Assert.Equal(1, fixture.HubHandler.CallCount); + + fixture.Users.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData("missing")] + [InlineData("not-exists")] + [InlineData("deleted")] + [InlineData("cannot-authenticate")] + public async Task HandleAsync_Server_InvalidUserState_ShouldForbid(string failure) + { + using var fixture = new Fixture(UAuthMode.SemiHybrid); + + var active = CreateActiveUser(); + + UserRuntimeRecord? user = failure switch + { + "missing" => null, + + "not-exists" => active with + { + Exists = false + }, + + "deleted" => active with + { + IsDeleted = true + }, + + "cannot-authenticate" => active with + { + CanAuthenticate = false + }, + + _ => throw new ArgumentOutOfRangeException( + nameof(failure)) + }; + + fixture.SetupUser(user); + + // AllowInactive must not bypass these checks. + fixture.SetEndpoint(allowInactive: true); + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + fixture.VerifyNoAuthorityValidation(); + } + + [Theory] + [InlineData(UAuthMode.PureOpaque, false)] + [InlineData(UAuthMode.PureOpaque, true)] + [InlineData(UAuthMode.Hybrid, false)] + [InlineData(UAuthMode.Hybrid, true)] + [InlineData(UAuthMode.SemiHybrid, false)] + [InlineData(UAuthMode.SemiHybrid, true)] + public async Task HandleAsync_Server_InactiveUser_ShouldRequireExplicitException( + UAuthMode mode, + bool allowInactive) + { + using var fixture = new Fixture(mode); + + fixture.SetEndpoint( + allowInactive: allowInactive); + + fixture.SetupUser(CreateActiveUser() with + { + IsActive = false + }); + + await fixture.ExecuteAsync(); + + if (allowInactive) + { + fixture.AssertAllowed(); + } + else + { + fixture.AssertForbidden(); + } + + fixture.VerifyNoAuthorityValidation(); + } + + [Theory] + [InlineData(UAuthMode.PureOpaque)] + [InlineData(UAuthMode.Hybrid)] + [InlineData(UAuthMode.SemiHybrid)] + public async Task HandleAsync_Server_ActiveUser_ShouldAllow(UAuthMode mode) + { + using var fixture = new Fixture(mode); + + fixture.SetupUser(CreateActiveUser()); + + await fixture.ExecuteAsync(); + + fixture.AssertAllowed(); + fixture.VerifyNoAuthorityValidation(); + } + + [Theory] + [InlineData(UserStatus.Active, false, true)] + [InlineData(UserStatus.Active, true, true)] + [InlineData(UserStatus.Suspended, false, false)] + [InlineData(UserStatus.Suspended, true, true)] + [InlineData(UserStatus.SelfSuspended, false, false)] + [InlineData(UserStatus.SelfSuspended, true, true)] + [InlineData(UserStatus.Disabled, false, false)] + [InlineData(UserStatus.Disabled, true, false)] + [InlineData(UserStatus.Locked, true, false)] + [InlineData(UserStatus.RiskHold, true, false)] + [InlineData(UserStatus.PendingActivation, true, false)] + [InlineData(UserStatus.PendingVerification, true, false)] + [InlineData(UserStatus.Unknown, true, false)] + public async Task HandleAsync_ResourceSemiHybrid_ShouldEnforceAuthoritativeUserStatus(UserStatus status, bool allowInactive, bool expectedAllowed) + { + using var fixture = new Fixture( + UAuthMode.SemiHybrid, + resource: true); + + fixture.SetEndpoint( + hubValidated: true, + allowInactive: allowInactive); + + fixture.SetHubResponse( + CreateHubResponse(status)); + + await fixture.ExecuteAsync(); + + if (expectedAllowed) + { + fixture.AssertAllowed(); + } + else + { + fixture.AssertForbidden(); + } + + Assert.Equal(1, fixture.HubHandler.CallCount); + + fixture.Users.VerifyNoOtherCalls(); + fixture.Lineage.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(UAuthMode.PureOpaque)] + [InlineData(UAuthMode.Hybrid)] + public async Task HandleAsync_ResourceOpaqueMode_ValidTrustedSession_ShouldAllow( + UAuthMode mode) + { + using var fixture = new Fixture( + mode, + resource: true); + + fixture.SetTrustedValidation( + CreateActiveLineage()); + + await fixture.ExecuteAsync(); + + fixture.AssertAllowed(); + fixture.VerifyNoAuthorityValidation(); + fixture.Users.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(UAuthMode.PureOpaque)] + [InlineData(UAuthMode.Hybrid)] + public async Task HandleAsync_ResourceOpaqueMode_MissingTrustedValidation_ShouldForbid( + UAuthMode mode) + { + using var fixture = new Fixture( + mode, + resource: true); + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + fixture.VerifyNoAuthorityValidation(); + fixture.Users.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData("revoked")] + [InlineData("expired")] + [InlineData("tenant")] + [InlineData("user")] + public async Task HandleAsync_ResourceOpaqueMode_InvalidTrustedValidation_ShouldForbid(string failure) + { + using var fixture = new Fixture( + UAuthMode.Hybrid, + resource: true); + + var validation = failure switch + { + "revoked" => SessionValidationResult.Invalid( + SessionState.Revoked), + + "expired" => SessionValidationResult.Invalid( + SessionState.Expired), + + "tenant" => CreateActiveLineage( + tenant: TenantKey.FromExternal("tenant-b")), + + "user" => CreateActiveLineage( + user: UserKey.New()), + + _ => throw new ArgumentOutOfRangeException( + nameof(failure)) + }; + + fixture.SetTrustedValidation(validation); + + await fixture.ExecuteAsync(); + + fixture.AssertForbidden(); + fixture.VerifyNoAuthorityValidation(); + fixture.Users.VerifyNoOtherCalls(); + } + + [Theory] + [InlineData(UserStatus.Active, false, true)] + [InlineData(UserStatus.Suspended, false, false)] + [InlineData(UserStatus.Suspended, true, true)] + [InlineData(UserStatus.SelfSuspended, true, true)] + [InlineData(UserStatus.Disabled, true, false)] + [InlineData(UserStatus.Unknown, true, false)] + public async Task HandleAsync_ResourceOpaqueMode_ShouldEnforceTrustedUserStatus(UserStatus status, bool allowInactive, bool expectedAllowed) + { + using var fixture = new Fixture( + UAuthMode.Hybrid, + resource: true); + + fixture.SetEndpoint( + allowInactive: allowInactive); + + fixture.SetTrustedValidation( + CreateActiveLineage(status)); + + await fixture.ExecuteAsync(); + + if (expectedAllowed) + { + fixture.AssertAllowed(); + } + else + { + fixture.AssertForbidden(); + } + + fixture.VerifyNoAuthorityValidation(); + fixture.Users.VerifyNoOtherCalls(); + } +} From dd1a8cfc78e4cb1d5389be8702a57571f9df6860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Thu, 3 Dec 2026 15:08:48 +0300 Subject: [PATCH 14/14] Last Changes --- docs/content/configuration/server-options.md | 6 +++--- docs/content/getting-started/real-world-setup.md | 2 +- .../wwwroot/docs/configuration/server-options.json | 4 ++-- .../wwwroot/docs/getting-started/real-world-setup.json | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/content/configuration/server-options.md b/docs/content/configuration/server-options.md index e4d32a44..efd226f9 100644 --- a/docs/content/configuration/server-options.md +++ b/docs/content/configuration/server-options.md @@ -416,9 +416,9 @@ Alternatively, authentication modes can be selected for individual application p ```csharp builder.Services.AddUltimateAuthServer(options => { - options.ApplicationProfileModes[ApplicationProfile.BlazorServer] = UAuthMode.PureOpaque; - options.ApplicationProfileModes[ApplicationProfile.BlazorWasm] = UAuthMode.SemiHybrid; - options.ApplicationProfileModes[ApplicationProfile.Maui] = UAuthMode.Hybrid; + options.ApplicationProfileModes[UAuthApplicationProfile.BlazorServer] = UAuthMode.PureOpaque; + options.ApplicationProfileModes[UAuthApplicationProfile.BlazorWasm] = UAuthMode.SemiHybrid; + options.ApplicationProfileModes[UAuthApplicationProfile.Maui] = UAuthMode.Hybrid; }); ``` diff --git a/docs/content/getting-started/real-world-setup.md b/docs/content/getting-started/real-world-setup.md index 5dfb05ed..08558463 100644 --- a/docs/content/getting-started/real-world-setup.md +++ b/docs/content/getting-started/real-world-setup.md @@ -1126,7 +1126,7 @@ The default resolver maps application profiles to authentication modes. This mapping describes the resolver's behavior, not a guarantee that every mode is currently fully supported by the server. -PureOpaque, Hybrid, SemiHybrd and PureJwt are implemented authentication modes. +PureOpaque, Hybrid, SemiHybrid and PureJwt are implemented authentication modes. Hybrid Resource APIs currently support session-based authentication. PureJwt Resource APIs support independent JWT validation. 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 f4853f30..72ad5cf8 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[ApplicationProfile.BlazorServer] = UAuthMode.PureOpaque;\n options.ApplicationProfileModes[ApplicationProfile.BlazorWasm] = UAuthMode.SemiHybrid;\n options.ApplicationProfileModes[ApplicationProfile.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\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", "Headings": [ { "Id": "register-ultimateauth-server", @@ -594,6 +594,6 @@ "Level": 0 } ], - "SourceHash": "E6F68F88A162B13C585185BEF6B63671DFD879EF75FAB418BE1CFC9D600A2D4F", + "SourceHash": "30BE9A5D40E59047F46A420220E092442A015B259D3F5119EF4A1265A746D174", "BuilderVersion": "1" } \ No newline at end of file diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/getting-started/real-world-setup.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/getting-started/real-world-setup.json index 74d3909d..92fffa40 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/getting-started/real-world-setup.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/getting-started/real-world-setup.json @@ -1,7 +1,7 @@ { "Slug": "getting-started/real-world-setup", "Title": "Real World Setup", - "Html": "\n\u003Cp\u003E\u003Cstrong\u003EOne authentication framework. Different deployment models.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe \u003Ca href=\u0022/docs/getting-started/quickstart\u0022\u003EQuickStart\u003C/a\u003E demonstrates UltimateAuth with Blazor Server and in-memory storage.\u003C/p\u003E\n\u003Cp\u003EReal applications may require persistent data, a separate authentication server, browser-based clients, or independently deployed APIs.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth supports these scenarios through different service registrations and hosting integrations. You can choose the architecture that fits your application without configuring every available component.\u003C/p\u003E\n\u003Cp\u003EThis guide covers the setup patterns demonstrated by the UltimateAuth samples.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choose-your-architecture\u0022\u003E1. Choose Your Architecture\u003C/h2\u003E\n\u003Cp\u003EStart by identifying where authentication is hosted and how your application communicates with it.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication architecture\u003C/th\u003E\n\u003Cth\u003EAuthentication host\u003C/th\u003E\n\u003Cth\u003EApplication registration\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server, single project\u003C/td\u003E\n\u003Ctd\u003ESame application\u003C/td\u003E\n\u003Ctd\u003EServer \u002B persistence \u002B Blazor client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server with EF Core\u003C/td\u003E\n\u003Ctd\u003ESame application\u003C/td\u003E\n\u003Ctd\u003EServer \u002B EF Core \u002B Blazor client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDedicated UAuthHub\u003C/td\u003E\n\u003Ctd\u003ESeparate authentication application\u003C/td\u003E\n\u003Ctd\u003EServer \u002B persistence \u002B Hub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EStandalone Blazor WASM\u003C/td\u003E\n\u003Ctd\u003ERemote UAuthHub\u003C/td\u003E\n\u003Ctd\u003EBlazor client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Web App, Interactive WASM\u003C/td\u003E\n\u003Ctd\u003ERemote UAuthHub\u003C/td\u003E\n\u003Ctd\u003EHost integration \u002B WASM client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESeparate Resource API\u003C/td\u003E\n\u003Ctd\u003ERemote UAuthHub\u003C/td\u003E\n\u003Ctd\u003EResource API integration\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese models can be combined.\u003C/p\u003E\n\u003Cp\u003EFor example, an application might use an EF Core-backed UAuthHub, a standalone Blazor WASM frontend, and a separate Resource API.\u003C/p\u003E\n\u003Cp\u003EThe frontend handles user interaction, UAuthHub manages authentication, and the Resource API enforces access to protected resources.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022cryptographic-key-configuration\u0022\u003ECryptographic Key Configuration\u003C/h2\u003E\n\u003Cp\u003EEvery application hosting UltimateAuth Server must configure its cryptographic secrets securely.\u003C/p\u003E\n\u003Cp\u003EThis applies to integrated Blazor Server applications, standalone UAuthHub deployments, and applications using either in-memory or Entity Framework Core persistence.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022required-key-configuration\u0022\u003ERequired key configuration\u003C/h3\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\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 for 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 signing of JWT access tokens\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EBoth settings accept Base64-encoded keys containing at least 32 bytes of cryptographically secure random key material.\u003C/p\u003E\n\u003Cp\u003EPureOpaque does not issue JWT access tokens, but it should still configure the token-hashing key.\u003C/p\u003E\n\u003Cp\u003EHybrid and PureJwt require JWT signing capability.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-configuration\u0022\u003ERecommended configuration\u003C/h3\u003E\n\u003Cp\u003EStore secrets outside application source code.\u003C/p\u003E\n\u003Cp\u003EFor local development, use .NET User Secrets. For deployed applications, use environment variables or a trusted secret-management service.\u003C/p\u003E\n\u003Cp\u003EEnvironment variable names:\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\u003EThe double underscore (\u003Ccode\u003E__\u003C/code\u003E) represents a configuration hierarchy separator in .NET environment-variable configuration.\u003C/p\u003E\n\u003Cp\u003EConfigure 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.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? o.Cryptography.TokenHashingKey;\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? o.Cryptography.JwtSigningKey;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDo not generate new keys automatically on every application startup. Keys must remain consistent across application instances that share authentication state.\u003C/p\u003E\n\u003Cp\u003ENever use the same key for token hashing and JWT signing.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-verification-keys\u0022\u003EResource API verification keys\u003C/h3\u003E\n\u003Cp\u003EA Resource API using PureJwt validates JWT signatures with trusted verification keys.\u003C/p\u003E\n\u003Cp\u003EThe built-in HS256 configuration uses symmetric cryptography, so the Resource API must be configured with the same JWT key material used by the issuing UAuthHub.\u003C/p\u003E\n\u003Cp\u003EThe Resource API does not require the Hub\u0027s token-hashing key.\u003C/p\u003E\n\u003Cp\u003EProtect JWT verification keys as secrets when using symmetric signing algorithms.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022persistent-storage-with-entity-framework-core\u0022\u003E2. Persistent Storage with Entity Framework Core\u003C/h2\u003E\n\u003Cp\u003EFor applications that need authentication state to survive restarts, use a persistent storage provider.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides an Entity Framework Core bundle that registers its reference domain implementations and EF Core-backed stores.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022install-packages\u0022\u003EInstall packages\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.EntityFrameworkCore.Bundle\ndotnet add package Microsoft.EntityFrameworkCore.Sqlite\ndotnet add package Microsoft.EntityFrameworkCore.Design\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe SQLite provider is used here for simplicity. You can use another compatible EF Core database provider.\u003C/p\u003E\n\u003Cp\u003EWhen using the EF Core bundle, you do not need the in-memory bundle.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022register-the-services\u0022\u003ERegister the services\u003C/h3\u003E\n\u003Cp\u003EIn \u003Ccode\u003EProgram.cs\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\u003Eusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing CodeBeam.UltimateAuth.Server.Extensions;\nusing Microsoft.EntityFrameworkCore;\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? o.Cryptography.TokenHashingKey;\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? o.Cryptography.JwtSigningKey;\n})\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(\u0026quot;Data Source=uauth.db\u0026quot;, sqlite =\u0026gt; sqlite.MigrationsAssembly(typeof(Program).Assembly.GetName().Name!));\n });\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAddUltimateAuthEntityFrameworkCore()\u003C/code\u003E registers the EF Core stores and reference domain implementations.\u003C/p\u003E\n\u003Cp\u003EThe bundle provides a unified \u003Ccode\u003EUAuthDbContext\u003C/code\u003E for the supported authentication domains.\u003C/p\u003E\n\u003Cp\u003EYou do not need to register each user, session, credential, token, or authorization store individually.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-database-connection\u0022\u003EConfigure the database connection\u003C/h3\u003E\n\u003Cp\u003EFor a deployed application, prefer configuration over hardcoded connection strings.\u003C/p\u003E\n\u003Cp\u003E\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;ConnectionStrings\u0026quot;: {\n \u0026quot;UltimateAuth\u0026quot;: \u0026quot;Data Source=uauth.db\u0026quot;\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EProgram.cs\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\u003Evar connectionString = builder.Configuration.GetConnectionString(\u0026quot;UltimateAuth\u0026quot;)\n ?? throw new InvalidOperationException(\u0026quot;UltimateAuth connection string is missing.\u0026quot;);\n\nbuilder.Services.AddUltimateAuthServer()\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(connectionString);\n });\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor production databases, use your deployment environment\u0027s secret management facilities rather than storing credentials in source control.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022database-migrations\u0022\u003EDatabase migrations\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth does not automatically create or apply migrations when the EF Core bundle is registered.\u003C/p\u003E\n\u003Cp\u003EYour application owns the database migration lifecycle.\u003C/p\u003E\n\u003Cp\u003EInstall the EF Core CLI if 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\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet tool install --global dotnet-ef\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ECreate the initial migration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet ef migrations add InitUAuth --context UAuthDbContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApply it:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet ef database update --context UAuthDbContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor Visual Studio Package Manager Console:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EPOWERSHELL\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-powershell\u0022\u003EAdd-Migration InitUAuth -Context UAuthDbContext\nUpdate-Database -Context UAuthDbContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EInstall \u003Ccode\u003EMicrosoft.EntityFrameworkCore.Tools\u003C/code\u003E if required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022applying-migrations-programmatically\u0022\u003EApplying migrations programmatically\u003C/h3\u003E\n\u003Cp\u003EThe EF Core samples demonstrate initialization through a scoped \u003Ccode\u003EUAuthDbContext\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor a controlled development 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore;\n\nusing (var scope = app.Services.CreateScope())\n{\n var db = scope.ServiceProvider.GetRequiredService\u0026lt;UAuthDbContext\u0026gt;();\n await db.Database.MigrateAsync();\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis applies pending migrations. It does not generate migration files.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EProduction guidance:\u003C/strong\u003E Prefer applying reviewed migrations as a separate deployment step, particularly when multiple application instances share a database.\u003C/p\u003E\n\u003Cp\u003EDo not copy the sample initializer\u0027s \u003Ccode\u003Ereset: true\u003C/code\u003E behavior into production. The samples use database reset functionality for repeatable demonstrations, not as a safe deployment strategy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022optional-sample-accounts-with-ef-core\u0022\u003EOptional: sample accounts with EF Core\u003C/h3\u003E\n\u003Cp\u003EThe sample seed package can also work with EF Core persistence.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Sample.Seed\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister the scoped seed 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddScopedUltimateAuthSampleSeed();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAfter preparing the database:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eif (app.Environment.IsDevelopment())\n{\n await app.SeedUltimateAuthAsync();\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe difference matters:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EAddUltimateAuthSampleSeed()\u003C/code\u003E is used by the in-memory samples.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EAddScopedUltimateAuthSampleSeed()\u003C/code\u003E is used by the EF Core samples.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EDo not deploy the demonstration accounts and passwords to production.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server-integrated-authentication\u0022\u003E3. Blazor Server \u2014 Integrated Authentication\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E A Blazor Server application that wants to host its own authentication system.\u003C/p\u003E\n\u003Cp\u003EThis is the simplest deployment model for a server-side Blazor application.\u003C/p\u003E\n\u003Cp\u003EThe application hosts UltimateAuth Server and uses the Blazor client adapter in the same project.\u003C/p\u003E\n\u003Cp\u003EA separate UAuthHub is not required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022packages\u0022\u003EPackages\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\ndotnet add package CodeBeam.UltimateAuth.EntityFrameworkCore.Bundle\ndotnet add package Microsoft.EntityFrameworkCore.Sqlite\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022services\u0022\u003EServices\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\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing CodeBeam.UltimateAuth.Server.Extensions;\nusing Microsoft.EntityFrameworkCore;\n\nbuilder.Services\n .AddRazorComponents()\n .AddInteractiveServerComponents();\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;Token hashing key is missing.\u0026quot;);\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;JWT signing key is missing.\u0026quot;);\n})\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(\u0026quot;Data Source=uauth.db\u0026quot;);\n });\n\nbuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022pipeline\u0022\u003EPipeline\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\u003Eapp.UseHttpsRedirection();\napp.UseStaticFiles();\n\napp.UseUltimateAuthWithAspNetCore();\napp.UseAntiforgery();\n\napp.MapUltimateAuthEndpoints();\n\napp.MapRazorComponents\u0026lt;App\u0026gt;()\n .AddInteractiveServerRenderMode()\n .AddUltimateAuthRoutes(UAuthAssemblies.BlazorClient());\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAlso configure the \u003Ccode\u003EUAuthApp\u003C/code\u003E root component, login page, and UltimateAuth JavaScript file as demonstrated in QuickStart.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-behavior\u0022\u003EAuthentication behavior\u003C/h3\u003E\n\u003Cp\u003EThe default application profile resolution selects \u003Ccode\u003EPureOpaque\u003C/code\u003E for Blazor Server.\u003C/p\u003E\n\u003Cp\u003EThis uses session-oriented authentication rather than requiring the application to manage access and refresh tokens manually.\u003C/p\u003E\n\u003Cp\u003EYou can configure session lifetimes, login policies, credential policies, and other behavior through \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\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.Login.MaxFailedAttempts = 5;\n options.Login.LockoutDuration = TimeSpan.FromMinutes(15);\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n options.Identifiers.Behavior.AllowMultipleUsernames = true;\n options.Password.Level = PasswordPolicyLevel.Strict;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe effective authentication mode is resolved at runtime. The application does not need to select a single mode globally.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022password-security-configuration\u0022\u003EPassword Security Configuration\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth uses the Standard password policy by default. Applications can select Basic or Strict, or override individual requirements through \u003Ccode\u003Eoptions.Password\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor the preset comparison, configuration examples, and password-history settings, see \u003Ca href=\u0022/docs/security/password-policy\u0022\u003EPassword Policy \u0026amp; History\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022uauthhub-dedicated-authentication-server\u0022\u003E4. UAuthHub \u2014 Dedicated Authentication Server\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E Applications where multiple clients share one authentication authority.\u003C/p\u003E\n\u003Cp\u003EUAuthHub hosts UltimateAuth\u0027s authentication services separately from your frontend applications.\u003C/p\u003E\n\u003Cp\u003EIt is particularly relevant for standalone WASM applications, Interactive WASM applications, and systems with separate Resource APIs.\u003C/p\u003E\n\u003Cp\u003EA typical architecture looks like this:\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 Standalone WASM Interactive WASM\n \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u25BC\n UAuthHub\n Authentication\n Sessions \u0026amp; Users\n \u2502\n \u25BC\n Persistence\n\n Resource API \u2500\u2500\u2500\u25BA UAuthHub\n (validation)\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022create-the-hub-application\u0022\u003ECreate the Hub application\u003C/h3\u003E\n\u003Cp\u003EA UAuthHub can be hosted in an ASP.NET Core Blazor Server application.\u003C/p\u003E\n\u003Cp\u003EThe current samples use Blazor Server to provide the Hub\u0027s login UI.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022in-memory-uauthhub\u0022\u003EIn-memory UAuthHub\u003C/h3\u003E\n\u003Cp\u003EFor development:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\ndotnet add package CodeBeam.UltimateAuth.InMemory.Bundle\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.InMemory;\nusing CodeBeam.UltimateAuth.Server.Extensions;\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? o.Cryptography.TokenHashingKey;\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? o.Cryptography.JwtSigningKey;\n})\n .AddUltimateAuthInMemory()\n .AddUAuthHub(options =\u0026gt;\n {\n options.AllowedClientOrigins.Add(\u0026quot;https://localhost:6130\u0026quot;);\n });\n\nbuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Hub\u0027s Blazor client registration is needed when the Hub itself hosts UltimateAuth-powered Blazor pages and login UI.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022ef-core-uauthhub\u0022\u003EEF Core UAuthHub\u003C/h3\u003E\n\u003Cp\u003EFor persistent storage:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore;\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? o.Cryptography.TokenHashingKey;\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? o.Cryptography.JwtSigningKey;\n})\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(\u0026quot;Data Source=uauthhub.db\u0026quot;);\n })\n .AddUAuthHub(options =\u0026gt;\n {\n options.AllowedClientOrigins.Add(\u0026quot;https://localhost:6132\u0026quot;);\n });\n\nbuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe \u003Ccode\u003EAllowedClientOrigins\u003C/code\u003E collection identifies browser origins permitted to interact with the Hub.\u003C/p\u003E\n\u003Cp\u003EUse exact origins, including scheme and port. Do not include paths such as \u003Ccode\u003E/home\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022hub-pipeline\u0022\u003EHub pipeline\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\u003Eapp.UseHttpsRedirection();\n\napp.UseUltimateAuthWithAspNetCore();\napp.UseAntiforgery();\n\napp.MapUltimateAuthEndpoints();\napp.MapUAuthHub();\n\napp.MapStaticAssets();\n\napp.MapRazorComponents\u0026lt;App\u0026gt;()\n .AddInteractiveServerRenderMode()\n .AddUltimateAuthRoutes(UAuthAssemblies.BlazorClient());\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EMapUltimateAuthEndpoints()\u003C/code\u003E maps the authentication endpoints.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EMapUAuthHub()\u003C/code\u003E maps the Hub-specific entry endpoint.\u003C/p\u003E\n\u003Cp\u003EBoth registrations are used by the current UAuthHub samples.\u003C/p\u003E\n\u003Cp\u003EThe Hub also needs its login page and Blazor application lifecycle components.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-origins\u0022\u003EChoosing origins\u003C/h3\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication\u003C/th\u003E\n\u003Cth\u003EURL\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUAuthHub\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ehttps://localhost:6112\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EStandalone WASM\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ehttps://localhost:6130\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EInteractive WASM\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ehttps://localhost:6132\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EConfigure the Hub\u0027s allowed origins for the actual frontend applications it serves.\u003C/p\u003E\n\u003Cp\u003EThese localhost addresses are illustrative and must match your deployment.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-standalone-webassembly\u0022\u003E5. Blazor Standalone WebAssembly\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E A browser-hosted application with a separate UAuthHub.\u003C/p\u003E\n\u003Cp\u003EStandalone Blazor WASM runs in the browser. It does not host UltimateAuth Server or database persistence.\u003C/p\u003E\n\u003Cp\u003EAuthentication is handled by the remote UAuthHub.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-packages\u0022\u003EClient packages\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-services\u0022\u003EConfigure services\u003C/h3\u003E\n\u003Cp\u003EIn the standalone WASM application\u0027s \u003Ccode\u003EProgram.cs\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\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.Core.Domain;\n\nvar builder = WebAssemblyHostBuilder.CreateDefault(args);\n\nbuilder.RootComponents.Add\u0026lt;App\u0026gt;(\u0026quot;#app\u0026quot;);\nbuilder.RootComponents.Add\u0026lt;HeadOutlet\u0026gt;(\u0026quot;head::after\u0026quot;);\n\nbuilder.Services.AddScoped(sp =\u0026gt; new HttpClient\n{\n BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)\n});\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6110/auth\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;https://localhost:6130/home\u0026quot;;\n options.Login.AllowCredentialPost = true;\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\nawait builder.Build().RunAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe current standalone WASM sample explicitly configures \u003Ccode\u003ELogin.AllowCredentialPost\u003C/code\u003E and the PKCE return URL.\u003C/p\u003E\n\u003Cp\u003EThese are client-side settings. The UAuthHub must be configured independently.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-the-urls-mean\u0022\u003EWhat the URLs mean\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EEndpoints.BasePath\u003C/code\u003E points to the remote authentication endpoints.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EPkce.ReturnUrl\u003C/code\u003E identifies the frontend destination used by the relevant PKCE flow.\u003C/p\u003E\n\u003Cp\u003EThe Hub must recognize the frontend\u0027s origin, and any return URL used in an authentication flow must be validated against the application\u0027s security policy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022root-component\u0022\u003ERoot component\u003C/h3\u003E\n\u003Cp\u003EA standalone WASM application should initialize UltimateAuth through \u003Ccode\u003EUAuthApp\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor example, its root application or routing component can contain:\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@using CodeBeam.UltimateAuth.Client.Blazor\n\n\u0026lt;UAuthApp UseBuiltInRouter=\u0026quot;true\u0026quot; AppAssembly=\u0026quot;typeof(Program).Assembly\u0026quot; DefaultLayout=\u0026quot;typeof(Layout.MainLayout)\u0026quot; /\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EInclude the UltimateAuth JavaScript asset in the application\u0027s HTML host page.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes-and-signing-keys\u0022\u003EAuthentication modes and signing keys\u003C/h3\u003E\n\u003Cp\u003EA single UAuthHub can issue different authentication credentials according to the resolved application profile and server configuration.\u003C/p\u003E\n\u003Cp\u003EBlazor Server defaults to PureOpaque. All other application profiles default to Hybrid under the built-in authentication mode resolver.\u003C/p\u003E\n\u003Cp\u003EPureJwt must be explicitly selected when independent JWT-based authentication is required.\u003C/p\u003E\n\u003Cp\u003EUAuthHub and Resource APIs must be configured with compatible authentication modes and credential transports.\u003C/p\u003E\n\u003Cp\u003EJWT-enabled modes require a signing key. The UAuthHub remains responsible for protecting that key and issuing trusted access tokens.\u003C/p\u003E\n\u003Cp\u003EFor PureJwt, refresh-token persistence is still required even though authentication sessions are not created.\u003C/p\u003E\n\u003Cp\u003EA separate Resource API does not automatically inherit the authentication mode or cryptographic configuration of UAuthHub.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-web-app-interactive-webassembly\u0022\u003E6. Blazor Web App \u2014 Interactive WebAssembly\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E A Blazor Web App with an ASP.NET Core host and a separate \u003Ccode\u003E.Client\u003C/code\u003E project.\u003C/p\u003E\n\u003Cp\u003EThis scenario differs from standalone WASM because components may participate in both server-side rendering and browser-side interactivity.\u003C/p\u003E\n\u003Cp\u003EThe current UltimateAuth sample registers the Blazor client integration in \u003Cstrong\u003Eboth projects\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EIt also adds a separate ASP.NET Core compatibility registration in the host.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022project-structure\u0022\u003EProject structure\u003C/h3\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\u003EMyApplication/\n\u251C\u2500\u2500 MyApplication/\n\u2502 \u251C\u2500\u2500 Program.cs\n\u2502 \u2514\u2500\u2500 Components/\n\u2502 \u2514\u2500\u2500 App.razor\n\u2502\n\u2514\u2500\u2500 MyApplication.Client/\n \u251C\u2500\u2500 Program.cs\n \u2514\u2500\u2500 Pages/\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe host serves the application.\u003C/p\u003E\n\u003Cp\u003EThe \u003Ccode\u003E.Client\u003C/code\u003E project contains browser-executed components and services.\u003C/p\u003E\n\u003Cp\u003EA remote UAuthHub manages authentication.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022host-project-packages\u0022\u003E6.1 Host project packages\u003C/h3\u003E\n\u003Cp\u003EInstall the Blazor client integration and ASP.NET Core compatibility package in the host:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\ndotnet add package CodeBeam.UltimateAuth.Client.AspNetCore\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022host-project-services\u0022\u003E6.2 Host project services\u003C/h3\u003E\n\u003Cp\u003EIn the host \u003Ccode\u003EProgram.cs\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\u003Eusing CodeBeam.UltimateAuth.Client.AspNetCore;\nusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.Core.Domain;\n\nbuilder.Services\n .AddRazorComponents()\n .AddInteractiveWebAssemblyComponents();\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;https://localhost:6132/home\u0026quot;;\n options.Login.AllowCredentialPost = true;\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\nbuilder.Services.AddUltimateAuthAspNetCoreCompatibility();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAddUltimateAuthAspNetCoreCompatibility()\u003C/code\u003E registers the compatibility authentication scheme and ASP.NET Core authorization services used by this hosting pattern.\u003C/p\u003E\n\u003Cp\u003EIt does \u003Cstrong\u003Enot\u003C/strong\u003E turn the host into an UltimateAuth authentication server.\u003C/p\u003E\n\u003Cp\u003EIt is also not equivalent to \u003Ccode\u003EAddUltimateAuthResourceApi()\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022host-project-pipeline\u0022\u003E6.3 Host project pipeline\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\u003Eapp.UseHttpsRedirection();\n\napp.UseAntiforgery();\n\napp.MapStaticAssets();\n\napp.MapRazorComponents\u0026lt;App\u0026gt;()\n .AddInteractiveWebAssemblyRenderMode()\n .AddAdditionalAssemblies(typeof(MyApplication.Client._Imports).Assembly, UAuthAssemblies.BlazorClient().First());\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EReplace \u003Ccode\u003EMyApplication.Client._Imports\u003C/code\u003E with the corresponding type from your client project.\u003C/p\u003E\n\u003Cp\u003EThe additional assemblies allow the host to discover routable components from the WASM client project and UltimateAuth\u0027s Blazor client assembly.\u003C/p\u003E\n\u003Cp\u003EThe sample does not register \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E in this host because authentication is delegated to a separate UAuthHub.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-project-packages\u0022\u003E6.4 Client project packages\u003C/h3\u003E\n\u003Cp\u003EInstall the Blazor client adapter in the \u003Ccode\u003E.Client\u003C/code\u003E project:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-project-services\u0022\u003E6.5 Client project services\u003C/h3\u003E\n\u003Cp\u003EIn \u003Ccode\u003EMyApplication.Client/Program.cs\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\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.Core.Domain;\n\nvar builder = WebAssemblyHostBuilder.CreateDefault(args);\n\nbuilder.Services.AddScoped(sp =\u0026gt; new HttpClient\n{\n BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)\n});\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;https://localhost:6132/home\u0026quot;;\n options.Login.AllowCredentialPost = true;\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\nawait builder.Build().RunAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe host and client configurations should agree on the remote UAuthHub URL and authentication flow settings.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-both-registrations-are-necessary\u0022\u003EWhy both registrations are necessary\u003C/h3\u003E\n\u003Cp\u003EThe host and browser client have separate dependency injection containers.\u003C/p\u003E\n\u003Cp\u003ERegistering \u003Ccode\u003EAddUltimateAuthClientBlazor()\u003C/code\u003E in the host does not automatically register those services inside the WebAssembly runtime.\u003C/p\u003E\n\u003Cp\u003ELikewise, registering the client adapter only in the \u003Ccode\u003E.Client\u003C/code\u003E project does not supply the services required during server-side integration.\u003C/p\u003E\n\u003Cp\u003EThe additional ASP.NET Core compatibility registration addresses the host\u0027s ASP.NET Core authentication and authorization integration requirements.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E This compatibility layer is not a replacement for server-side authorization of your protected business APIs.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-separate-protected-backend\u0022\u003E7. Resource API \u2014 Separate Protected Backend\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E An API that needs UltimateAuth authentication validation but does not host the authentication system itself.\u003C/p\u003E\n\u003Cp\u003EA Resource API can be an ASP.NET Core Web API, MVC application, or another supported server-side application.\u003C/p\u003E\n\u003Cp\u003EIt does not need to be a Blazor application.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022architecture\u0022\u003EArchitecture\u003C/h3\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 Blazor Client\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC\n UAuthHub Resource API\n \u25B2 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n Authentication\n validation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource API uses the configured UAuthHub for remote authentication and session validation behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022install-the-server-integration-package\u0022\u003EInstall the server integration package\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Server\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-services-1\u0022\u003EConfigure services\u003C/h3\u003E\n\u003Ch4 id=\u0022hybrid-resource-api\u0022\u003EHybrid Resource API\u003C/h4\u003E\n\u003Cp\u003EHybrid is the default authentication mode for Resource APIs.\u003C/p\u003E\n\u003Cp\u003EThe current Hybrid Resource API implementation authenticates requests using opaque session credentials and validates those sessions through 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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 builder = WebApplication.CreateBuilder(args);\n\nbuilder.Services.AddControllers();\n\nbuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.Hub.BaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\n options.Cors.AllowedOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n});\n\nvar app = builder.Build();\n\napp.UseHttpsRedirection();\napp.UseUltimateAuthResourceApiWithAspNetCore();\n\napp.MapControllers();\napp.Run();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EHub.BaseUrl\u003C/code\u003E is the base address of the authentication server.\u003C/p\u003E\n\u003Cp\u003EThe default incoming session credential transport is cookie-based.\u003C/p\u003E\n\u003Cp\u003EThe browser must be able to send the session cookie to the Resource API. Compatible cookie scope, deployment topology, and CORS configuration are required.\u003C/p\u003E\n\u003Cp\u003EThe Resource API forwards the selected session credential and device context to UAuthHub for validation.\u003C/p\u003E\n\u003Cp\u003EHybrid-aware JWT access-token validation is not yet supported by separate Resource APIs.\u003C/p\u003E\n\u003Ch4 id=\u0022purejwt-resource-api\u0022\u003EPureJwt Resource API\u003C/h4\u003E\n\u003Cp\u003ESelect PureJwt explicitly when the Resource API should validate JWT access tokens independently of UAuthHub.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EPureJwt\u003C/code\u003E Resource API\u0027s \u003Ccode\u003EProgram.cs\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\u003Evar builder = WebApplication.CreateBuilder(args);\n\nbuilder.Services.AddControllers();\n\nbuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\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 ?? throw new InvalidOperationException(\u0026quot;JWT verification key is missing.\u0026quot;)\n });\n\n options.Auth.Mode = UAuthMode.PureJwt;\n\n options.Cors.AllowedOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n});\n\nvar app = builder.Build();\n\napp.UseHttpsRedirection();\napp.UseUltimateAuthResourceApiWithAspNetCore();\n\napp.MapControllers();\napp.Run();\n\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ENotice that this example uses the Hub origin without the \u003Ccode\u003E/auth\u003C/code\u003E suffix, matching the current Resource API samples.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedOrigins\u003C/code\u003E controls the browser origins permitted by the Resource API\u0027s CORS configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-pipeline\u0022\u003EConfigure the pipeline\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 app = builder.Build();\n\napp.UseHttpsRedirection();\n\napp.UseUltimateAuthResourceApiWithAspNetCore();\n\napp.MapControllers();\n\napp.Run();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EUseUltimateAuthResourceApiWithAspNetCore()\u003C/code\u003E installs the Resource API integration middleware together with ASP.NET Core authentication and authorization middleware.\u003C/p\u003E\n\u003Cp\u003EYou do not need to register a local UltimateAuth Server or its persistence bundle in the Resource API.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022protecting-endpoints\u0022\u003EProtecting endpoints\u003C/h3\u003E\n\u003Cp\u003EUse ASP.NET Core authorization attributes for endpoints that require authentication:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing Microsoft.AspNetCore.Authorization;\nusing Microsoft.AspNetCore.Mvc;\n\n[ApiController]\n[Route(\u0026quot;api/products\u0026quot;)]\npublic class ProductsController : ControllerBase\n{\n [HttpGet]\n [Authorize]\n public IActionResult GetProducts()\n {\n return Ok(new[]\n {\n new { Id = 1, Name = \u0026quot;Example product\u0026quot; }\n });\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe authorization attribute is enforced by ASP.NET Core on the server.\u003C/p\u003E\n\u003Cp\u003EFor permission-specific rules, configure and apply the corresponding authorization policies.\u003C/p\u003E\n\u003Cp\u003EDo not rely on Blazor UI authorization checks to protect Resource API endpoints.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022account-status-enforcement\u0022\u003EAccount Status Enforcement\u003C/h3\u003E\n\u003Cp\u003EProtected Resource API endpoints enforce active-user authorization by default, including endpoints using \u003Ccode\u003E[Authorize]\u003C/code\u003E and role-based authorization.\u003C/p\u003E\n\u003Cp\u003EThe Resource API obtains the current user status through trusted UAuthHub session validation. Suspended and SelfSuspended users remain authenticated but cannot access ordinary protected resources.\u003C/p\u003E\n\u003Cp\u003ETo allow specific operations for suspended users, explicitly apply \u003Ccode\u003E[UAuthAllowInactive]\u003C/code\u003E alongside \u003Ccode\u003E[Authorize]\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe exception does not bypass other authorization requirements.\u003C/p\u003E\n\u003Cp\u003EFor the complete behavior and examples, see \u003Ca href=\u0022/docs/plugin-domains/authorization\u0022\u003EAuthorization\u003C/a\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cors-configuration\u0022\u003ECORS configuration\u003C/h3\u003E\n\u003Cp\u003EThe current Resource API integration registers CORS from the configured allowed origins.\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\u003Eoptions.AllowedClientOrigins.Add(\u0026quot;https://localhost:6132\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EOnly add origins that should be allowed to call your API from a browser.\u003C/p\u003E\n\u003Cp\u003ECORS is a browser access control mechanism, not an authentication or authorization mechanism.\u003C/p\u003E\n\u003Cp\u003EA request must still pass the applicable authentication and authorization checks.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-vs-uauthhub\u0022\u003EResource API vs UAuthHub\u003C/h3\u003E\n\u003Cp\u003EThese are different responsibilities.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EUAuthHub\u003C/th\u003E\n\u003Cth\u003EResource API\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHosts authentication flows\u003C/td\u003E\n\u003Ctd\u003EHosts application resources\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EManages authentication sessions\u003C/td\u003E\n\u003Ctd\u003EValidates remote authentication context\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUses authentication persistence\u003C/td\u003E\n\u003Ctd\u003EDoes not require local authentication stores\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProvides login and related endpoints\u003C/td\u003E\n\u003Ctd\u003EProvides application endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServes authentication clients\u003C/td\u003E\n\u003Ctd\u003EServes authorized API consumers\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EUse a Resource API when you want independent deployment of business endpoints without duplicating the authentication server.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-with-an-ef-core-backed-uauthhub\u0022\u003E8. Resource API with an EF Core-Backed UAuthHub\u003C/h2\u003E\n\u003Cp\u003EThe Resource API does not need to use EF Core just because UAuthHub does.\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\u003EInteractive WASM\n \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25BA Resource API\n \u2502\n \u25BC\n UAuthHub\n \u2502\n \u25BC\n EF Core Database\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Hub stores users, credentials, sessions, and related security state in its database.\u003C/p\u003E\n\u003Cp\u003EThe Resource API communicates with the Hub through the configured remote validation integration.\u003C/p\u003E\n\u003Cp\u003EIts registration remains:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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://localhost:6112\u0026quot;;\n options.AllowedClientOrigins.Add(\u0026quot;https://localhost:6132\u0026quot;);\n options.CorsPolicyName = \u0026quot;resourceApi\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis separation allows the API and authentication infrastructure to be deployed, scaled, and maintained independently.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022calling-a-resource-api-from-blazor\u0022\u003E9. Calling a Resource API from Blazor\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth provides a unified Resource Client for accessing protected application APIs.\u003C/p\u003E\n\u003Cp\u003EInstead of configuring a separate HTTP client and implementing browser credential handling for ordinary resource requests, applications can use \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThis keeps authentication, identity operations, and application resource requests accessible through the same client SDK.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-resource-api\u0022\u003EConfigure the Resource API\u003C/h3\u003E\n\u003Cp\u003EFor a separate Resource API, configure its origin through the Blazor client registration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.Client;\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n\n options.Resource.BaseAddress = \u0026quot;https://localhost:6122\u0026quot;;\n options.Resource.Credentials = UAuthResourceCredentialsMode.Auto;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EEndpoints.BasePath\u003C/code\u003E identifies the authentication server.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EResource.BaseAddress\u003C/code\u003E identifies the application Resource API.\u003C/p\u003E\n\u003Cp\u003EThese addresses can point to different applications.\u003C/p\u003E\n\u003Cp\u003EIf the Resource API shares the application\u0027s origin, \u003Ccode\u003EResource.BaseAddress\u003C/code\u003E can remain \u003Ccode\u003Enull\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022call-protected-resources\u0022\u003ECall Protected Resources\u003C/h3\u003E\n\u003Cp\u003EInject \u003Ccode\u003EIUAuthClient\u003C/code\u003E into a Blazor component:\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@using CodeBeam.UltimateAuth.Client\n@inject IUAuthClient UAuthClient\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThen retrieve application data:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\nif (result.IsSuccess \u0026amp;\u0026amp; result.Value is not null)\n{\n products = result.Value;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource Client also supports POST, PUT, PATCH, and DELETE operations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-specific-api-services\u0022\u003EApplication-Specific API Services\u003C/h3\u003E\n\u003Cp\u003EApplications can organize resource operations into small domain-specific services.\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\u003Eusing CodeBeam.UltimateAuth.Client;\nusing CodeBeam.UltimateAuth.Core.Contracts;\n\npublic sealed class ProductApiService(IUAuthClient client)\n{\n public Task\u0026lt;UAuthResult\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;\u0026gt; GetAllAsync()\n =\u0026gt; client.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\n public Task\u0026lt;UAuthResult\u0026lt;Product\u0026gt;\u0026gt; CreateAsync(Product product)\n =\u0026gt; client.Resource.PostAsync\u0026lt;Product\u0026gt;(\u0026quot;/api/products\u0026quot;,product);\n\n public Task\u0026lt;UAuthResult\u0026gt; DeleteAsync(int id)\n =\u0026gt; client.Resource.DeleteAsync($\u0026quot;/api/products/{id}\u0026quot;);\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister the application service:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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;ProductApiService\u0026gt;();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe service uses UltimateAuth\u0027s transport and result contracts rather than implementing another HTTP abstraction.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022interactive-webassembly\u0022\u003EInteractive WebAssembly\u003C/h3\u003E\n\u003Cp\u003EIn an Interactive WebAssembly application, configure the UltimateAuth Blazor client in each project where the Resource Client will be used.\u003C/p\u003E\n\u003Cp\u003EThe host and \u003Ccode\u003E.Client\u003C/code\u003E project have separate dependency injection containers.\u003C/p\u003E\n\u003Cp\u003EA shared application API service may be registered in both projects when components execute in both environments.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client uses browser-based transport, including when invoked from an interactive Blazor Server component.\u003C/p\u003E\n\u003Cp\u003EBrowser interop must be available before making resource requests. Do not initiate browser-dependent resource requests during static prerendering.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022standalone-webassembly\u0022\u003EStandalone WebAssembly\u003C/h3\u003E\n\u003Cp\u003EStandalone Blazor WebAssembly applications use the same Resource Client 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n options.Resource.BaseAddress = \u0026quot;https://localhost:6122\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EOnce configured, application components can call protected resources through \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EA separate application-specific \u003Ccode\u003EHttpClient\u003C/code\u003E is not required for these requests.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022browser-credentials-and-cors\u0022\u003EBrowser Credentials and CORS\u003C/h3\u003E\n\u003Cp\u003EFor cross-origin requests, the browser and receiving API must agree on credential handling.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client supports \u003Ccode\u003EAuto\u003C/code\u003E, \u003Ccode\u003ESameOrigin\u003C/code\u003E, \u003Ccode\u003EInclude\u003C/code\u003E, and \u003Ccode\u003EOmit\u003C/code\u003E credential policies.\u003C/p\u003E\n\u003Cp\u003EFor cross-origin cookie-based authentication, configure the appropriate credential policy and ensure that the Resource API supports the required CORS and cookie settings.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client does not automatically make an API authenticated merely because the user has signed in through UAuthHub.\u003C/p\u003E\n\u003Cp\u003EThe receiving API must validate the authentication material associated with the configured authentication mode and enforce its authorization policies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server-and-direct-service-calls\u0022\u003EBlazor Server and Direct Service Calls\u003C/h3\u003E\n\u003Cp\u003EBlazor Server applications can often access application services directly when those services are hosted in the same process.\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\u003Evar products = await productService.GetAllAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThere is no need to introduce an HTTP request solely to use the Resource Client.\u003C/p\u003E\n\u003Cp\u003EUse \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E when the application actually needs to communicate with a protected Resource API through the browser.\u003C/p\u003E\n\u003Cp\u003EFor server-to-server requests, use an appropriate server-side HTTP client and authentication mechanism.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022learn-more\u0022\u003ELearn More\u003C/h3\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/client-sdk/resource-api-requests\u0022\u003EResource API Requests\u003C/a\u003E for supported operations, result handling, credential configuration, security considerations, and request cancellation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes-and-application-profiles\u0022\u003E10. Authentication Modes and Application Profiles\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates \u003Cstrong\u003Eapplication profile detection\u003C/strong\u003E from \u003Cstrong\u003Eauthentication mode enforcement\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe default resolver 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 resolved mode\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor WASM\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EWeb Server\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMAUI\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAPI\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResource API\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUAuthHub\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\u003EThis mapping describes the resolver\u0027s behavior, not a guarantee that every mode is currently fully supported by the server.\u003C/p\u003E\n\u003Cp\u003EPureOpaque, Hybrid, SemiHybrd and PureJwt are implemented authentication modes.\u003C/p\u003E\n\u003Cp\u003EHybrid Resource APIs currently support session-based authentication. PureJwt Resource APIs support independent JWT validation.\u003C/p\u003E\n\u003Cp\u003EApplications must explicitly configure compatible authentication modes when the built-in defaults do not match their architecture.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022restrict-allowed-modes\u0022\u003ERestrict allowed modes\u003C/h3\u003E\n\u003Cp\u003EOn the authentication 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.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 guardrail.\u003C/p\u003E\n\u003Cp\u003EIt does not select a mode for every request.\u003C/p\u003E\n\u003Cp\u003EThe effective mode is resolved from the application profile and then checked against the server\u0027s allowed-mode policy.\u003C/p\u003E\n\u003Cp\u003EFor most applications, use the default mode resolution unless you have a specific integration requirement.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-options-for-real-applications\u0022\u003E11. Server Options for Real Applications\u003C/h2\u003E\n\u003Cp\u003EProduction configuration should reflect your application\u0027s security requirements.\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.Login.MaxFailedAttempts = 5;\n options.Login.LockoutDuration = TimeSpan.FromMinutes(15);\n options.Identifiers.Behavior.AllowMultipleUsernames = true;\n options.UserProfile.EnableMultiProfile = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EServer options also compose the Core-defined login, session, token, PKCE, and multi-tenant options.\u003C/p\u003E\n\u003Cp\u003EConfigure those through \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EDo not independently configure Core options and assume the server will automatically use them.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-files\u0022\u003EConfiguration files\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth also supports configuration through \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 \u0026quot;LockoutDuration\u0026quot;: \u0026quot;00:15:00\u0026quot;\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server options registration binds the \u003Ccode\u003EUltimateAuth:Server\u003C/code\u003E configuration section.\u003C/p\u003E\n\u003Cp\u003ERemember that effective mode defaults and mode-specific overrides are applied after the base options have been configured.\u003C/p\u003E\n\u003Cp\u003EFor detailed configuration behavior, see Server Options and Advanced Configuration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-ip-address-reverse-proxy\u0022\u003E12. Client IP Address \u0026amp; Reverse Proxy\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses ASP.NET Core\u0027s resolved client IP address for device information and IP-based rate limiting. It does not directly trust \u003Ccode\u003EX-Forwarded-For\u003C/code\u003E or \u003Ccode\u003ECF-Connecting-IP\u003C/code\u003E headers.\u003C/p\u003E\n\u003Cp\u003EIf your application runs behind Caddy, Nginx, or another reverse proxy, configure ASP.NET Core to trust that proxy.\u003C/p\u003E\n\u003Cp\u003EIn \u003Ccode\u003EProgram.cs\u003C/code\u003E, before \u003Ccode\u003Ebuilder.Build()\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\u003Eusing System.Net;\nusing Microsoft.AspNetCore.HttpOverrides;\n\nbuilder.Services.Configure\u0026lt;ForwardedHeadersOptions\u0026gt;(options =\u0026gt;\n{\n options.ForwardedHeaders =\n ForwardedHeaders.XForwardedFor |\n ForwardedHeaders.XForwardedProto;\n\n // Replace with your actual Caddy or Nginx proxy IP.\n options.KnownProxies.Add(IPAddress.Parse(\u0026quot;172.20.0.5\u0026quot;));\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThen enable the middleware \u003Cstrong\u003Ebefore\u003C/strong\u003E UltimateAuth and HTTPS redirection:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.UseForwardedHeaders();\n\napp.UseHttpsRedirection();\napp.UseUltimateAuthWithAspNetCore();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe example IP \u003Ccode\u003E172.20.0.5\u003C/code\u003E represents a trusted reverse proxy, not the visitor\u0027s IP address. Replace it with your actual proxy IP. For Docker deployments, ensure the proxy address is stable or configure a narrowly scoped trusted network.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E Never trust arbitrary forwarded headers or clear the trusted proxy lists to accept all sources. If your application connects directly to Kestrel without a reverse proxy, no forwarded headers configuration is required.\u003C/p\u003E\n\u003Cp\u003EFor multi-proxy deployments, configure the complete trusted proxy chain and forwarding behavior according to your infrastructure.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022development-and-production-differences\u0022\u003E13. Development and Production Differences\u003C/h2\u003E\n\u003Cp\u003EThe samples intentionally prioritize visibility and repeatability.\u003C/p\u003E\n\u003Cp\u003EA production application needs additional safeguards.\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\u003ESample or development\u003C/th\u003E\n\u003Cth\u003EProduction\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPersistence\u003C/td\u003E\n\u003Ctd\u003EInMemory or local SQLite\u003C/td\u003E\n\u003Ctd\u003EDurable database\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESeed accounts\u003C/td\u003E\n\u003Ctd\u003EExample users and passwords\u003C/td\u003E\n\u003Ctd\u003EReal provisioning\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDatabase initialization\u003C/td\u003E\n\u003Ctd\u003EMay reset sample data\u003C/td\u003E\n\u003Ctd\u003EReviewed migrations\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHTTPS\u003C/td\u003E\n\u003Ctd\u003ELocal development certificate\u003C/td\u003E\n\u003Ctd\u003EProper TLS termination\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECORS\u003C/td\u003E\n\u003Ctd\u003ELocalhost origins\u003C/td\u003E\n\u003Ctd\u003EExact trusted origins\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESigning keys\u003C/td\u003E\n\u003Ctd\u003EDevelopment defaults\u003C/td\u003E\n\u003Ctd\u003EManaged, persistent keys\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDiagnostics\u003C/td\u003E\n\u003Ctd\u003EDetailed debugging\u003C/td\u003E\n\u003Ctd\u003ERestrict sensitive diagnostics\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECredential recovery\u003C/td\u003E\n\u003Ctd\u003EDevelopment notifier\u003C/td\u003E\n\u003Ctd\u003EReal secure notification channel\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EIdentifier verification\u003C/td\u003E\n\u003Ctd\u003EDevelopment bypass\u003C/td\u003E\n\u003Ctd\u003EProof-based verification\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESecrets\u003C/td\u003E\n\u003Ctd\u003ELocal settings\u003C/td\u003E\n\u003Ctd\u003ESecure configuration provider\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe sample projects include development-only implementations for credential reset notifications and identifier verification.\u003C/p\u003E\n\u003Cp\u003EThose implementations demonstrate extension points and should not be treated as production verification systems.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-recovery\u0022\u003ECredential recovery\u003C/h3\u003E\n\u003Cp\u003EIf your application exposes credential recovery, configure a real implementation of the credential reset notifier.\u003C/p\u003E\n\u003Cp\u003ERecovery secrets must be delivered through an appropriate channel and must not be exposed directly through anonymous API responses.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022identifier-verification\u0022\u003EIdentifier verification\u003C/h3\u003E\n\u003Cp\u003EIf your application supports verified email addresses, phone numbers, or other identifiers, use an implementation that verifies ownership through suitable proof.\u003C/p\u003E\n\u003Cp\u003EDo not use a development bypass verifier in production.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022signing-keys\u0022\u003ESigning keys\u003C/h3\u003E\n\u003Cp\u003EConfigure persistent signing keys for authentication modes that issue JWTs.\u003C/p\u003E\n\u003Cp\u003EDevelopment signing key providers are not a substitute for production key management.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022deployment-checklist\u0022\u003E14. Deployment Checklist\u003C/h2\u003E\n\u003Cp\u003EBefore deploying, verify the following:\u003C/p\u003E\n\u003Cul class=\u0022contains-task-list\u0022\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E The selected architecture matches the actual client hosting model.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E The authentication server uses appropriate persistent storage.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Database migrations have been reviewed and applied.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Sample users and development-only verification services are disabled.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Production signing keys and secrets are configured.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E HTTPS is enforced at the appropriate boundary.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E UAuthHub and Resource API origins are explicitly configured.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Authentication endpoints and application endpoints are protected appropriately.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Client and server endpoint URLs match the deployment.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Session expiration, refresh, logout, and revocation have been tested.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Protected resources enforce server-side authorization.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Reverse proxy headers are configured correctly if applicable.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Authentication state and persistence survive the expected application lifecycle.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-your-architecture\u0022\u003E15. Choosing Your Architecture\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EStart with one server and one client. Connect more clients whenever you need them.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth is built around two fundamental responsibilities:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EUltimateAuth Server\u003C/strong\u003E \u2014 Manages authentication, users, credentials, sessions, authorization, and the security lifecycle.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUltimateAuth Client\u003C/strong\u003E \u2014 Integrates an application with the authentication system using the appropriate application profile and authentication flows.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EEvery application needs access to an authentication server, but that server does not have to be a separate application. It can be hosted within your existing ASP.NET Core application or deployed independently as UAuthHub.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022single-application-the-simplest-setup\u0022\u003ESingle Application \u2014 The Simplest Setup\u003C/h3\u003E\n\u003Cp\u003EFor a traditional ASP.NET Core or Blazor Server application, UltimateAuth Server and Client can run together.\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\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Your Application \u2502\n\u2502 \u2502\n\u2502 UltimateAuth Client \u2502\n\u2502 \u2502 \u2502\n\u2502 UltimateAuth Server \u2502\n\u2502 \u2502 \u2502\n\u2502 Database \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis approach is ideal when you want authentication without introducing another service or deployment.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022multiple-applications-one-authentication-server\u0022\u003EMultiple Applications \u2014 One Authentication Server\u003C/h3\u003E\n\u003Cp\u003EAs your system grows, you can connect multiple client applications to the same UltimateAuth 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\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 Blazor Server Blazor WASM\n \u2502 \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 \u2502 \u2502\n Razor Pages MAUI Other .NET Clients\n \u2502 \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u25BC\n UltimateAuth Server\n UAuthHub\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC \u25BC\n Users Sessions Authorization\n \u2502\n \u25BC\n Persistence\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach client can have its own application structure, hosting model, and authentication requirements while sharing the same authentication authority.\u003C/p\u003E\n\u003Cp\u003EFor example, a business platform might use Blazor Server for administration, Blazor WASM for its customer portal, MAUI for mobile access, and Razor Pages for an internal application.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAdding another client does not require replacing the existing clients or creating another UltimateAuth Server.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe same users, credentials, security policies, and session infrastructure can serve multiple applications, subject to the authentication modes and client integrations supported by the installed version.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022distributed-applications-separate-resource-apis\u0022\u003EDistributed Applications \u2014 Separate Resource APIs\u003C/h3\u003E\n\u003Cp\u003EWhen your architecture includes independently deployed backend services, Resource APIs can integrate with the same authentication authority.\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 Multiple Client Applications\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC\n UAuthHub Resource APIs\n \u25B2 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n Authentication\n Validation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EResource APIs protect application resources without becoming additional authentication servers.\u003C/p\u003E\n\u003Cp\u003EThis lets you separate business services from authentication infrastructure while maintaining a shared security model.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022one-foundation-different-scales\u0022\u003EOne Foundation, Different Scales\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EYour scenario\u003C/th\u003E\n\u003Cth\u003ERecommended approach\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA simple Blazor Server application\u003C/td\u003E\n\u003Ctd\u003EIntegrated Server \u002B Client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA traditional ASP.NET Core application\u003C/td\u003E\n\u003Ctd\u003EServer hosted within the application\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA standalone Blazor WASM application\u003C/td\u003E\n\u003Ctd\u003EClient \u002B remote UAuthHub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAn Interactive WASM application\u003C/td\u003E\n\u003Ctd\u003EHost \u002B WASM Client \u002B remote UAuthHub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMultiple web, desktop, or mobile applications\u003C/td\u003E\n\u003Ctd\u003EMultiple Clients \u002B shared UAuthHub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMultiple backend services\u003C/td\u003E\n\u003Ctd\u003EShared UAuthHub \u002B Resource APIs\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EUltimateAuth does not require a complex architecture to get started, and it does not restrict you to a single client as your application grows.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EStart with the simplest deployment that meets your needs. Add new client applications, persistent storage, or separate Resource APIs as your requirements evolve.\u003C/p\u003E\n\u003Cp\u003EThe authentication foundation remains consistent.\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/getting-started/quickstart\u0022\u003EQuickStart\u003C/a\u003E \u2014 Build the minimal in-memory application.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/getting-started/ecosystem\u0022\u003EEcosystem\u003C/a\u003E \u2014 Explore packages and supported integrations.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Configure server 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, endpoints, refresh, and reauthentication.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E \u2014 Explore effective options, dependency injection, and extension points.\u003C/li\u003E\n\u003C/ul\u003E\n", + "Html": "\n\u003Cp\u003E\u003Cstrong\u003EOne authentication framework. Different deployment models.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe \u003Ca href=\u0022/docs/getting-started/quickstart\u0022\u003EQuickStart\u003C/a\u003E demonstrates UltimateAuth with Blazor Server and in-memory storage.\u003C/p\u003E\n\u003Cp\u003EReal applications may require persistent data, a separate authentication server, browser-based clients, or independently deployed APIs.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth supports these scenarios through different service registrations and hosting integrations. You can choose the architecture that fits your application without configuring every available component.\u003C/p\u003E\n\u003Cp\u003EThis guide covers the setup patterns demonstrated by the UltimateAuth samples.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choose-your-architecture\u0022\u003E1. Choose Your Architecture\u003C/h2\u003E\n\u003Cp\u003EStart by identifying where authentication is hosted and how your application communicates with it.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication architecture\u003C/th\u003E\n\u003Cth\u003EAuthentication host\u003C/th\u003E\n\u003Cth\u003EApplication registration\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server, single project\u003C/td\u003E\n\u003Ctd\u003ESame application\u003C/td\u003E\n\u003Ctd\u003EServer \u002B persistence \u002B Blazor client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server with EF Core\u003C/td\u003E\n\u003Ctd\u003ESame application\u003C/td\u003E\n\u003Ctd\u003EServer \u002B EF Core \u002B Blazor client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDedicated UAuthHub\u003C/td\u003E\n\u003Ctd\u003ESeparate authentication application\u003C/td\u003E\n\u003Ctd\u003EServer \u002B persistence \u002B Hub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EStandalone Blazor WASM\u003C/td\u003E\n\u003Ctd\u003ERemote UAuthHub\u003C/td\u003E\n\u003Ctd\u003EBlazor client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Web App, Interactive WASM\u003C/td\u003E\n\u003Ctd\u003ERemote UAuthHub\u003C/td\u003E\n\u003Ctd\u003EHost integration \u002B WASM client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESeparate Resource API\u003C/td\u003E\n\u003Ctd\u003ERemote UAuthHub\u003C/td\u003E\n\u003Ctd\u003EResource API integration\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThese models can be combined.\u003C/p\u003E\n\u003Cp\u003EFor example, an application might use an EF Core-backed UAuthHub, a standalone Blazor WASM frontend, and a separate Resource API.\u003C/p\u003E\n\u003Cp\u003EThe frontend handles user interaction, UAuthHub manages authentication, and the Resource API enforces access to protected resources.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022cryptographic-key-configuration\u0022\u003ECryptographic Key Configuration\u003C/h2\u003E\n\u003Cp\u003EEvery application hosting UltimateAuth Server must configure its cryptographic secrets securely.\u003C/p\u003E\n\u003Cp\u003EThis applies to integrated Blazor Server applications, standalone UAuthHub deployments, and applications using either in-memory or Entity Framework Core persistence.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022required-key-configuration\u0022\u003ERequired key configuration\u003C/h3\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\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 for 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 signing of JWT access tokens\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EBoth settings accept Base64-encoded keys containing at least 32 bytes of cryptographically secure random key material.\u003C/p\u003E\n\u003Cp\u003EPureOpaque does not issue JWT access tokens, but it should still configure the token-hashing key.\u003C/p\u003E\n\u003Cp\u003EHybrid and PureJwt require JWT signing capability.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022recommended-configuration\u0022\u003ERecommended configuration\u003C/h3\u003E\n\u003Cp\u003EStore secrets outside application source code.\u003C/p\u003E\n\u003Cp\u003EFor local development, use .NET User Secrets. For deployed applications, use environment variables or a trusted secret-management service.\u003C/p\u003E\n\u003Cp\u003EEnvironment variable names:\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\u003EThe double underscore (\u003Ccode\u003E__\u003C/code\u003E) represents a configuration hierarchy separator in .NET environment-variable configuration.\u003C/p\u003E\n\u003Cp\u003EConfigure 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.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? o.Cryptography.TokenHashingKey;\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? o.Cryptography.JwtSigningKey;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EDo not generate new keys automatically on every application startup. Keys must remain consistent across application instances that share authentication state.\u003C/p\u003E\n\u003Cp\u003ENever use the same key for token hashing and JWT signing.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-verification-keys\u0022\u003EResource API verification keys\u003C/h3\u003E\n\u003Cp\u003EA Resource API using PureJwt validates JWT signatures with trusted verification keys.\u003C/p\u003E\n\u003Cp\u003EThe built-in HS256 configuration uses symmetric cryptography, so the Resource API must be configured with the same JWT key material used by the issuing UAuthHub.\u003C/p\u003E\n\u003Cp\u003EThe Resource API does not require the Hub\u0027s token-hashing key.\u003C/p\u003E\n\u003Cp\u003EProtect JWT verification keys as secrets when using symmetric signing algorithms.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022persistent-storage-with-entity-framework-core\u0022\u003E2. Persistent Storage with Entity Framework Core\u003C/h2\u003E\n\u003Cp\u003EFor applications that need authentication state to survive restarts, use a persistent storage provider.\u003C/p\u003E\n\u003Cp\u003EUltimateAuth provides an Entity Framework Core bundle that registers its reference domain implementations and EF Core-backed stores.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022install-packages\u0022\u003EInstall packages\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.EntityFrameworkCore.Bundle\ndotnet add package Microsoft.EntityFrameworkCore.Sqlite\ndotnet add package Microsoft.EntityFrameworkCore.Design\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe SQLite provider is used here for simplicity. You can use another compatible EF Core database provider.\u003C/p\u003E\n\u003Cp\u003EWhen using the EF Core bundle, you do not need the in-memory bundle.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022register-the-services\u0022\u003ERegister the services\u003C/h3\u003E\n\u003Cp\u003EIn \u003Ccode\u003EProgram.cs\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\u003Eusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing CodeBeam.UltimateAuth.Server.Extensions;\nusing Microsoft.EntityFrameworkCore;\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? o.Cryptography.TokenHashingKey;\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? o.Cryptography.JwtSigningKey;\n})\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(\u0026quot;Data Source=uauth.db\u0026quot;, sqlite =\u0026gt; sqlite.MigrationsAssembly(typeof(Program).Assembly.GetName().Name!));\n });\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAddUltimateAuthEntityFrameworkCore()\u003C/code\u003E registers the EF Core stores and reference domain implementations.\u003C/p\u003E\n\u003Cp\u003EThe bundle provides a unified \u003Ccode\u003EUAuthDbContext\u003C/code\u003E for the supported authentication domains.\u003C/p\u003E\n\u003Cp\u003EYou do not need to register each user, session, credential, token, or authorization store individually.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-database-connection\u0022\u003EConfigure the database connection\u003C/h3\u003E\n\u003Cp\u003EFor a deployed application, prefer configuration over hardcoded connection strings.\u003C/p\u003E\n\u003Cp\u003E\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;ConnectionStrings\u0026quot;: {\n \u0026quot;UltimateAuth\u0026quot;: \u0026quot;Data Source=uauth.db\u0026quot;\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EProgram.cs\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\u003Evar connectionString = builder.Configuration.GetConnectionString(\u0026quot;UltimateAuth\u0026quot;)\n ?? throw new InvalidOperationException(\u0026quot;UltimateAuth connection string is missing.\u0026quot;);\n\nbuilder.Services.AddUltimateAuthServer()\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(connectionString);\n });\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor production databases, use your deployment environment\u0027s secret management facilities rather than storing credentials in source control.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022database-migrations\u0022\u003EDatabase migrations\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth does not automatically create or apply migrations when the EF Core bundle is registered.\u003C/p\u003E\n\u003Cp\u003EYour application owns the database migration lifecycle.\u003C/p\u003E\n\u003Cp\u003EInstall the EF Core CLI if 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\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet tool install --global dotnet-ef\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ECreate the initial migration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet ef migrations add InitUAuth --context UAuthDbContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EApply it:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet ef database update --context UAuthDbContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EFor Visual Studio Package Manager Console:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EPOWERSHELL\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-powershell\u0022\u003EAdd-Migration InitUAuth -Context UAuthDbContext\nUpdate-Database -Context UAuthDbContext\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EInstall \u003Ccode\u003EMicrosoft.EntityFrameworkCore.Tools\u003C/code\u003E if required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022applying-migrations-programmatically\u0022\u003EApplying migrations programmatically\u003C/h3\u003E\n\u003Cp\u003EThe EF Core samples demonstrate initialization through a scoped \u003Ccode\u003EUAuthDbContext\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor a controlled development 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore;\n\nusing (var scope = app.Services.CreateScope())\n{\n var db = scope.ServiceProvider.GetRequiredService\u0026lt;UAuthDbContext\u0026gt;();\n await db.Database.MigrateAsync();\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis applies pending migrations. It does not generate migration files.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EProduction guidance:\u003C/strong\u003E Prefer applying reviewed migrations as a separate deployment step, particularly when multiple application instances share a database.\u003C/p\u003E\n\u003Cp\u003EDo not copy the sample initializer\u0027s \u003Ccode\u003Ereset: true\u003C/code\u003E behavior into production. The samples use database reset functionality for repeatable demonstrations, not as a safe deployment strategy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022optional-sample-accounts-with-ef-core\u0022\u003EOptional: sample accounts with EF Core\u003C/h3\u003E\n\u003Cp\u003EThe sample seed package can also work with EF Core persistence.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Sample.Seed\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister the scoped seed 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.AddScopedUltimateAuthSampleSeed();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAfter preparing the database:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eif (app.Environment.IsDevelopment())\n{\n await app.SeedUltimateAuthAsync();\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe difference matters:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Ccode\u003EAddUltimateAuthSampleSeed()\u003C/code\u003E is used by the in-memory samples.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EAddScopedUltimateAuthSampleSeed()\u003C/code\u003E is used by the EF Core samples.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EDo not deploy the demonstration accounts and passwords to production.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server-integrated-authentication\u0022\u003E3. Blazor Server \u2014 Integrated Authentication\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E A Blazor Server application that wants to host its own authentication system.\u003C/p\u003E\n\u003Cp\u003EThis is the simplest deployment model for a server-side Blazor application.\u003C/p\u003E\n\u003Cp\u003EThe application hosts UltimateAuth Server and uses the Blazor client adapter in the same project.\u003C/p\u003E\n\u003Cp\u003EA separate UAuthHub is not required.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022packages\u0022\u003EPackages\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\ndotnet add package CodeBeam.UltimateAuth.EntityFrameworkCore.Bundle\ndotnet add package Microsoft.EntityFrameworkCore.Sqlite\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022services\u0022\u003EServices\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\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing CodeBeam.UltimateAuth.Server.Extensions;\nusing Microsoft.EntityFrameworkCore;\n\nbuilder.Services\n .AddRazorComponents()\n .AddInteractiveServerComponents();\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;Token hashing key is missing.\u0026quot;);\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? throw new InvalidOperationException(\u0026quot;JWT signing key is missing.\u0026quot;);\n})\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(\u0026quot;Data Source=uauth.db\u0026quot;);\n });\n\nbuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022pipeline\u0022\u003EPipeline\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\u003Eapp.UseHttpsRedirection();\napp.UseStaticFiles();\n\napp.UseUltimateAuthWithAspNetCore();\napp.UseAntiforgery();\n\napp.MapUltimateAuthEndpoints();\n\napp.MapRazorComponents\u0026lt;App\u0026gt;()\n .AddInteractiveServerRenderMode()\n .AddUltimateAuthRoutes(UAuthAssemblies.BlazorClient());\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EAlso configure the \u003Ccode\u003EUAuthApp\u003C/code\u003E root component, login page, and UltimateAuth JavaScript file as demonstrated in QuickStart.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-behavior\u0022\u003EAuthentication behavior\u003C/h3\u003E\n\u003Cp\u003EThe default application profile resolution selects \u003Ccode\u003EPureOpaque\u003C/code\u003E for Blazor Server.\u003C/p\u003E\n\u003Cp\u003EThis uses session-oriented authentication rather than requiring the application to manage access and refresh tokens manually.\u003C/p\u003E\n\u003Cp\u003EYou can configure session lifetimes, login policies, credential policies, and other behavior through \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\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.Login.MaxFailedAttempts = 5;\n options.Login.LockoutDuration = TimeSpan.FromMinutes(15);\n options.Token.SessionIdLifetime = TimeSpan.FromDays(7);\n options.Identifiers.Behavior.AllowMultipleUsernames = true;\n options.Password.Level = PasswordPolicyLevel.Strict;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe effective authentication mode is resolved at runtime. The application does not need to select a single mode globally.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022password-security-configuration\u0022\u003EPassword Security Configuration\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth uses the Standard password policy by default. Applications can select Basic or Strict, or override individual requirements through \u003Ccode\u003Eoptions.Password\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor the preset comparison, configuration examples, and password-history settings, see \u003Ca href=\u0022/docs/security/password-policy\u0022\u003EPassword Policy \u0026amp; History\u003C/a\u003E.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022uauthhub-dedicated-authentication-server\u0022\u003E4. UAuthHub \u2014 Dedicated Authentication Server\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E Applications where multiple clients share one authentication authority.\u003C/p\u003E\n\u003Cp\u003EUAuthHub hosts UltimateAuth\u0027s authentication services separately from your frontend applications.\u003C/p\u003E\n\u003Cp\u003EIt is particularly relevant for standalone WASM applications, Interactive WASM applications, and systems with separate Resource APIs.\u003C/p\u003E\n\u003Cp\u003EA typical architecture looks like this:\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 Standalone WASM Interactive WASM\n \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u25BC\n UAuthHub\n Authentication\n Sessions \u0026amp; Users\n \u2502\n \u25BC\n Persistence\n\n Resource API \u2500\u2500\u2500\u25BA UAuthHub\n (validation)\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022create-the-hub-application\u0022\u003ECreate the Hub application\u003C/h3\u003E\n\u003Cp\u003EA UAuthHub can be hosted in an ASP.NET Core Blazor Server application.\u003C/p\u003E\n\u003Cp\u003EThe current samples use Blazor Server to provide the Hub\u0027s login UI.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022in-memory-uauthhub\u0022\u003EIn-memory UAuthHub\u003C/h3\u003E\n\u003Cp\u003EFor development:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\ndotnet add package CodeBeam.UltimateAuth.InMemory.Bundle\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.InMemory;\nusing CodeBeam.UltimateAuth.Server.Extensions;\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? o.Cryptography.TokenHashingKey;\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? o.Cryptography.JwtSigningKey;\n})\n .AddUltimateAuthInMemory()\n .AddUAuthHub(options =\u0026gt;\n {\n options.AllowedClientOrigins.Add(\u0026quot;https://localhost:6130\u0026quot;);\n });\n\nbuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Hub\u0027s Blazor client registration is needed when the Hub itself hosts UltimateAuth-powered Blazor pages and login UI.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022ef-core-uauthhub\u0022\u003EEF Core UAuthHub\u003C/h3\u003E\n\u003Cp\u003EFor persistent storage:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore;\n\nbuilder.Services.AddUltimateAuthServer(options =\u0026gt;\n{\n options.Cryptography.TokenHashingKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:TokenHashingKey\u0026quot;]\n ?? o.Cryptography.TokenHashingKey;\n\n options.Cryptography.JwtSigningKey =\n builder.Configuration[\u0026quot;UltimateAuth:Cryptography:JwtSigningKey\u0026quot;]\n ?? o.Cryptography.JwtSigningKey;\n})\n .AddUltimateAuthEntityFrameworkCore(db =\u0026gt;\n {\n db.UseSqlite(\u0026quot;Data Source=uauthhub.db\u0026quot;);\n })\n .AddUAuthHub(options =\u0026gt;\n {\n options.AllowedClientOrigins.Add(\u0026quot;https://localhost:6132\u0026quot;);\n });\n\nbuilder.Services.AddUltimateAuthClientBlazor();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe \u003Ccode\u003EAllowedClientOrigins\u003C/code\u003E collection identifies browser origins permitted to interact with the Hub.\u003C/p\u003E\n\u003Cp\u003EUse exact origins, including scheme and port. Do not include paths such as \u003Ccode\u003E/home\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022hub-pipeline\u0022\u003EHub pipeline\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\u003Eapp.UseHttpsRedirection();\n\napp.UseUltimateAuthWithAspNetCore();\napp.UseAntiforgery();\n\napp.MapUltimateAuthEndpoints();\napp.MapUAuthHub();\n\napp.MapStaticAssets();\n\napp.MapRazorComponents\u0026lt;App\u0026gt;()\n .AddInteractiveServerRenderMode()\n .AddUltimateAuthRoutes(UAuthAssemblies.BlazorClient());\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EMapUltimateAuthEndpoints()\u003C/code\u003E maps the authentication endpoints.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EMapUAuthHub()\u003C/code\u003E maps the Hub-specific entry endpoint.\u003C/p\u003E\n\u003Cp\u003EBoth registrations are used by the current UAuthHub samples.\u003C/p\u003E\n\u003Cp\u003EThe Hub also needs its login page and Blazor application lifecycle components.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-origins\u0022\u003EChoosing origins\u003C/h3\u003E\n\u003Cp\u003EFor example:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EApplication\u003C/th\u003E\n\u003Cth\u003EURL\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUAuthHub\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ehttps://localhost:6112\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EStandalone WASM\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ehttps://localhost:6130\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EInteractive WASM\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003Ehttps://localhost:6132\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EConfigure the Hub\u0027s allowed origins for the actual frontend applications it serves.\u003C/p\u003E\n\u003Cp\u003EThese localhost addresses are illustrative and must match your deployment.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-standalone-webassembly\u0022\u003E5. Blazor Standalone WebAssembly\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E A browser-hosted application with a separate UAuthHub.\u003C/p\u003E\n\u003Cp\u003EStandalone Blazor WASM runs in the browser. It does not host UltimateAuth Server or database persistence.\u003C/p\u003E\n\u003Cp\u003EAuthentication is handled by the remote UAuthHub.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-packages\u0022\u003EClient packages\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-services\u0022\u003EConfigure services\u003C/h3\u003E\n\u003Cp\u003EIn the standalone WASM application\u0027s \u003Ccode\u003EProgram.cs\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\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.Core.Domain;\n\nvar builder = WebAssemblyHostBuilder.CreateDefault(args);\n\nbuilder.RootComponents.Add\u0026lt;App\u0026gt;(\u0026quot;#app\u0026quot;);\nbuilder.RootComponents.Add\u0026lt;HeadOutlet\u0026gt;(\u0026quot;head::after\u0026quot;);\n\nbuilder.Services.AddScoped(sp =\u0026gt; new HttpClient\n{\n BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)\n});\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6110/auth\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;https://localhost:6130/home\u0026quot;;\n options.Login.AllowCredentialPost = true;\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\nawait builder.Build().RunAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe current standalone WASM sample explicitly configures \u003Ccode\u003ELogin.AllowCredentialPost\u003C/code\u003E and the PKCE return URL.\u003C/p\u003E\n\u003Cp\u003EThese are client-side settings. The UAuthHub must be configured independently.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022what-the-urls-mean\u0022\u003EWhat the URLs mean\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EEndpoints.BasePath\u003C/code\u003E points to the remote authentication endpoints.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EPkce.ReturnUrl\u003C/code\u003E identifies the frontend destination used by the relevant PKCE flow.\u003C/p\u003E\n\u003Cp\u003EThe Hub must recognize the frontend\u0027s origin, and any return URL used in an authentication flow must be validated against the application\u0027s security policy.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022root-component\u0022\u003ERoot component\u003C/h3\u003E\n\u003Cp\u003EA standalone WASM application should initialize UltimateAuth through \u003Ccode\u003EUAuthApp\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EFor example, its root application or routing component can contain:\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@using CodeBeam.UltimateAuth.Client.Blazor\n\n\u0026lt;UAuthApp UseBuiltInRouter=\u0026quot;true\u0026quot; AppAssembly=\u0026quot;typeof(Program).Assembly\u0026quot; DefaultLayout=\u0026quot;typeof(Layout.MainLayout)\u0026quot; /\u0026gt;\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EInclude the UltimateAuth JavaScript asset in the application\u0027s HTML host page.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes-and-signing-keys\u0022\u003EAuthentication modes and signing keys\u003C/h3\u003E\n\u003Cp\u003EA single UAuthHub can issue different authentication credentials according to the resolved application profile and server configuration.\u003C/p\u003E\n\u003Cp\u003EBlazor Server defaults to PureOpaque. All other application profiles default to Hybrid under the built-in authentication mode resolver.\u003C/p\u003E\n\u003Cp\u003EPureJwt must be explicitly selected when independent JWT-based authentication is required.\u003C/p\u003E\n\u003Cp\u003EUAuthHub and Resource APIs must be configured with compatible authentication modes and credential transports.\u003C/p\u003E\n\u003Cp\u003EJWT-enabled modes require a signing key. The UAuthHub remains responsible for protecting that key and issuing trusted access tokens.\u003C/p\u003E\n\u003Cp\u003EFor PureJwt, refresh-token persistence is still required even though authentication sessions are not created.\u003C/p\u003E\n\u003Cp\u003EA separate Resource API does not automatically inherit the authentication mode or cryptographic configuration of UAuthHub.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-web-app-interactive-webassembly\u0022\u003E6. Blazor Web App \u2014 Interactive WebAssembly\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E A Blazor Web App with an ASP.NET Core host and a separate \u003Ccode\u003E.Client\u003C/code\u003E project.\u003C/p\u003E\n\u003Cp\u003EThis scenario differs from standalone WASM because components may participate in both server-side rendering and browser-side interactivity.\u003C/p\u003E\n\u003Cp\u003EThe current UltimateAuth sample registers the Blazor client integration in \u003Cstrong\u003Eboth projects\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EIt also adds a separate ASP.NET Core compatibility registration in the host.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022project-structure\u0022\u003EProject structure\u003C/h3\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\u003EMyApplication/\n\u251C\u2500\u2500 MyApplication/\n\u2502 \u251C\u2500\u2500 Program.cs\n\u2502 \u2514\u2500\u2500 Components/\n\u2502 \u2514\u2500\u2500 App.razor\n\u2502\n\u2514\u2500\u2500 MyApplication.Client/\n \u251C\u2500\u2500 Program.cs\n \u2514\u2500\u2500 Pages/\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe host serves the application.\u003C/p\u003E\n\u003Cp\u003EThe \u003Ccode\u003E.Client\u003C/code\u003E project contains browser-executed components and services.\u003C/p\u003E\n\u003Cp\u003EA remote UAuthHub manages authentication.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022host-project-packages\u0022\u003E6.1 Host project packages\u003C/h3\u003E\n\u003Cp\u003EInstall the Blazor client integration and ASP.NET Core compatibility package in the host:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\ndotnet add package CodeBeam.UltimateAuth.Client.AspNetCore\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022host-project-services\u0022\u003E6.2 Host project services\u003C/h3\u003E\n\u003Cp\u003EIn the host \u003Ccode\u003EProgram.cs\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\u003Eusing CodeBeam.UltimateAuth.Client.AspNetCore;\nusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.Core.Domain;\n\nbuilder.Services\n .AddRazorComponents()\n .AddInteractiveWebAssemblyComponents();\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;https://localhost:6132/home\u0026quot;;\n options.Login.AllowCredentialPost = true;\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\nbuilder.Services.AddUltimateAuthAspNetCoreCompatibility();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EAddUltimateAuthAspNetCoreCompatibility()\u003C/code\u003E registers the compatibility authentication scheme and ASP.NET Core authorization services used by this hosting pattern.\u003C/p\u003E\n\u003Cp\u003EIt does \u003Cstrong\u003Enot\u003C/strong\u003E turn the host into an UltimateAuth authentication server.\u003C/p\u003E\n\u003Cp\u003EIt is also not equivalent to \u003Ccode\u003EAddUltimateAuthResourceApi()\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022host-project-pipeline\u0022\u003E6.3 Host project pipeline\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\u003Eapp.UseHttpsRedirection();\n\napp.UseAntiforgery();\n\napp.MapStaticAssets();\n\napp.MapRazorComponents\u0026lt;App\u0026gt;()\n .AddInteractiveWebAssemblyRenderMode()\n .AddAdditionalAssemblies(typeof(MyApplication.Client._Imports).Assembly, UAuthAssemblies.BlazorClient().First());\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EReplace \u003Ccode\u003EMyApplication.Client._Imports\u003C/code\u003E with the corresponding type from your client project.\u003C/p\u003E\n\u003Cp\u003EThe additional assemblies allow the host to discover routable components from the WASM client project and UltimateAuth\u0027s Blazor client assembly.\u003C/p\u003E\n\u003Cp\u003EThe sample does not register \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E in this host because authentication is delegated to a separate UAuthHub.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-project-packages\u0022\u003E6.4 Client project packages\u003C/h3\u003E\n\u003Cp\u003EInstall the Blazor client adapter in the \u003Ccode\u003E.Client\u003C/code\u003E project:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Client.Blazor\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-project-services\u0022\u003E6.5 Client project services\u003C/h3\u003E\n\u003Cp\u003EIn \u003Ccode\u003EMyApplication.Client/Program.cs\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\u003Eusing CodeBeam.UltimateAuth.Client.Blazor.Extensions;\nusing CodeBeam.UltimateAuth.Core.Domain;\n\nvar builder = WebAssemblyHostBuilder.CreateDefault(args);\n\nbuilder.Services.AddScoped(sp =\u0026gt; new HttpClient\n{\n BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)\n});\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n options.Pkce.ReturnUrl = \u0026quot;https://localhost:6132/home\u0026quot;;\n options.Login.AllowCredentialPost = true;\n options.Reauth.Behavior = ReauthBehavior.RaiseEvent;\n});\n\nawait builder.Build().RunAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe host and client configurations should agree on the remote UAuthHub URL and authentication flow settings.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022why-both-registrations-are-necessary\u0022\u003EWhy both registrations are necessary\u003C/h3\u003E\n\u003Cp\u003EThe host and browser client have separate dependency injection containers.\u003C/p\u003E\n\u003Cp\u003ERegistering \u003Ccode\u003EAddUltimateAuthClientBlazor()\u003C/code\u003E in the host does not automatically register those services inside the WebAssembly runtime.\u003C/p\u003E\n\u003Cp\u003ELikewise, registering the client adapter only in the \u003Ccode\u003E.Client\u003C/code\u003E project does not supply the services required during server-side integration.\u003C/p\u003E\n\u003Cp\u003EThe additional ASP.NET Core compatibility registration addresses the host\u0027s ASP.NET Core authentication and authorization integration requirements.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E This compatibility layer is not a replacement for server-side authorization of your protected business APIs.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-separate-protected-backend\u0022\u003E7. Resource API \u2014 Separate Protected Backend\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EBest for:\u003C/strong\u003E An API that needs UltimateAuth authentication validation but does not host the authentication system itself.\u003C/p\u003E\n\u003Cp\u003EA Resource API can be an ASP.NET Core Web API, MVC application, or another supported server-side application.\u003C/p\u003E\n\u003Cp\u003EIt does not need to be a Blazor application.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022architecture\u0022\u003EArchitecture\u003C/h3\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 Blazor Client\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC\n UAuthHub Resource API\n \u25B2 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n Authentication\n validation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource API uses the configured UAuthHub for remote authentication and session validation behavior.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022install-the-server-integration-package\u0022\u003EInstall the server integration package\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EBash\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-bash\u0022\u003Edotnet add package CodeBeam.UltimateAuth.Server\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-services-1\u0022\u003EConfigure services\u003C/h3\u003E\n\u003Ch4 id=\u0022hybrid-resource-api\u0022\u003EHybrid Resource API\u003C/h4\u003E\n\u003Cp\u003EHybrid is the default authentication mode for Resource APIs.\u003C/p\u003E\n\u003Cp\u003EThe current Hybrid Resource API implementation authenticates requests using opaque session credentials and validates those sessions through 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\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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 builder = WebApplication.CreateBuilder(args);\n\nbuilder.Services.AddControllers();\n\nbuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\n{\n options.Hub.BaseUrl = \u0026quot;https://auth.example.com\u0026quot;;\n options.Cors.AllowedOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n});\n\nvar app = builder.Build();\n\napp.UseHttpsRedirection();\napp.UseUltimateAuthResourceApiWithAspNetCore();\n\napp.MapControllers();\napp.Run();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EHub.BaseUrl\u003C/code\u003E is the base address of the authentication server.\u003C/p\u003E\n\u003Cp\u003EThe default incoming session credential transport is cookie-based.\u003C/p\u003E\n\u003Cp\u003EThe browser must be able to send the session cookie to the Resource API. Compatible cookie scope, deployment topology, and CORS configuration are required.\u003C/p\u003E\n\u003Cp\u003EThe Resource API forwards the selected session credential and device context to UAuthHub for validation.\u003C/p\u003E\n\u003Cp\u003EHybrid-aware JWT access-token validation is not yet supported by separate Resource APIs.\u003C/p\u003E\n\u003Ch4 id=\u0022purejwt-resource-api\u0022\u003EPureJwt Resource API\u003C/h4\u003E\n\u003Cp\u003ESelect PureJwt explicitly when the Resource API should validate JWT access tokens independently of UAuthHub.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EPureJwt\u003C/code\u003E Resource API\u0027s \u003Ccode\u003EProgram.cs\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\u003Evar builder = WebApplication.CreateBuilder(args);\n\nbuilder.Services.AddControllers();\n\nbuilder.Services.AddUltimateAuthResourceApi(options =\u0026gt;\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 ?? throw new InvalidOperationException(\u0026quot;JWT verification key is missing.\u0026quot;)\n });\n\n options.Auth.Mode = UAuthMode.PureJwt;\n\n options.Cors.AllowedOrigins.Add(\u0026quot;https://app.example.com\u0026quot;);\n});\n\nvar app = builder.Build();\n\napp.UseHttpsRedirection();\napp.UseUltimateAuthResourceApiWithAspNetCore();\n\napp.MapControllers();\napp.Run();\n\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ENotice that this example uses the Hub origin without the \u003Ccode\u003E/auth\u003C/code\u003E suffix, matching the current Resource API samples.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EAllowedOrigins\u003C/code\u003E controls the browser origins permitted by the Resource API\u0027s CORS configuration.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-pipeline\u0022\u003EConfigure the pipeline\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 app = builder.Build();\n\napp.UseHttpsRedirection();\n\napp.UseUltimateAuthResourceApiWithAspNetCore();\n\napp.MapControllers();\n\napp.Run();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EUseUltimateAuthResourceApiWithAspNetCore()\u003C/code\u003E installs the Resource API integration middleware together with ASP.NET Core authentication and authorization middleware.\u003C/p\u003E\n\u003Cp\u003EYou do not need to register a local UltimateAuth Server or its persistence bundle in the Resource API.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022protecting-endpoints\u0022\u003EProtecting endpoints\u003C/h3\u003E\n\u003Cp\u003EUse ASP.NET Core authorization attributes for endpoints that require authentication:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing Microsoft.AspNetCore.Authorization;\nusing Microsoft.AspNetCore.Mvc;\n\n[ApiController]\n[Route(\u0026quot;api/products\u0026quot;)]\npublic class ProductsController : ControllerBase\n{\n [HttpGet]\n [Authorize]\n public IActionResult GetProducts()\n {\n return Ok(new[]\n {\n new { Id = 1, Name = \u0026quot;Example product\u0026quot; }\n });\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe authorization attribute is enforced by ASP.NET Core on the server.\u003C/p\u003E\n\u003Cp\u003EFor permission-specific rules, configure and apply the corresponding authorization policies.\u003C/p\u003E\n\u003Cp\u003EDo not rely on Blazor UI authorization checks to protect Resource API endpoints.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022account-status-enforcement\u0022\u003EAccount Status Enforcement\u003C/h3\u003E\n\u003Cp\u003EProtected Resource API endpoints enforce active-user authorization by default, including endpoints using \u003Ccode\u003E[Authorize]\u003C/code\u003E and role-based authorization.\u003C/p\u003E\n\u003Cp\u003EThe Resource API obtains the current user status through trusted UAuthHub session validation. Suspended and SelfSuspended users remain authenticated but cannot access ordinary protected resources.\u003C/p\u003E\n\u003Cp\u003ETo allow specific operations for suspended users, explicitly apply \u003Ccode\u003E[UAuthAllowInactive]\u003C/code\u003E alongside \u003Ccode\u003E[Authorize]\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThe exception does not bypass other authorization requirements.\u003C/p\u003E\n\u003Cp\u003EFor the complete behavior and examples, see \u003Ca href=\u0022/docs/plugin-domains/authorization\u0022\u003EAuthorization\u003C/a\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022cors-configuration\u0022\u003ECORS configuration\u003C/h3\u003E\n\u003Cp\u003EThe current Resource API integration registers CORS from the configured allowed origins.\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\u003Eoptions.AllowedClientOrigins.Add(\u0026quot;https://localhost:6132\u0026quot;);\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EOnly add origins that should be allowed to call your API from a browser.\u003C/p\u003E\n\u003Cp\u003ECORS is a browser access control mechanism, not an authentication or authorization mechanism.\u003C/p\u003E\n\u003Cp\u003EA request must still pass the applicable authentication and authorization checks.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-vs-uauthhub\u0022\u003EResource API vs UAuthHub\u003C/h3\u003E\n\u003Cp\u003EThese are different responsibilities.\u003C/p\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EUAuthHub\u003C/th\u003E\n\u003Cth\u003EResource API\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHosts authentication flows\u003C/td\u003E\n\u003Ctd\u003EHosts application resources\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EManages authentication sessions\u003C/td\u003E\n\u003Ctd\u003EValidates remote authentication context\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUses authentication persistence\u003C/td\u003E\n\u003Ctd\u003EDoes not require local authentication stores\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EProvides login and related endpoints\u003C/td\u003E\n\u003Ctd\u003EProvides application endpoints\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EServes authentication clients\u003C/td\u003E\n\u003Ctd\u003EServes authorized API consumers\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EUse a Resource API when you want independent deployment of business endpoints without duplicating the authentication server.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022resource-api-with-an-ef-core-backed-uauthhub\u0022\u003E8. Resource API with an EF Core-Backed UAuthHub\u003C/h2\u003E\n\u003Cp\u003EThe Resource API does not need to use EF Core just because UAuthHub does.\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\u003EInteractive WASM\n \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25BA Resource API\n \u2502\n \u25BC\n UAuthHub\n \u2502\n \u25BC\n EF Core Database\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Hub stores users, credentials, sessions, and related security state in its database.\u003C/p\u003E\n\u003Cp\u003EThe Resource API communicates with the Hub through the configured remote validation integration.\u003C/p\u003E\n\u003Cp\u003EIts registration remains:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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://localhost:6112\u0026quot;;\n options.AllowedClientOrigins.Add(\u0026quot;https://localhost:6132\u0026quot;);\n options.CorsPolicyName = \u0026quot;resourceApi\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis separation allows the API and authentication infrastructure to be deployed, scaled, and maintained independently.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022calling-a-resource-api-from-blazor\u0022\u003E9. Calling a Resource API from Blazor\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth provides a unified Resource Client for accessing protected application APIs.\u003C/p\u003E\n\u003Cp\u003EInstead of configuring a separate HTTP client and implementing browser credential handling for ordinary resource requests, applications can use \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EThis keeps authentication, identity operations, and application resource requests accessible through the same client SDK.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configure-the-resource-api\u0022\u003EConfigure the Resource API\u003C/h3\u003E\n\u003Cp\u003EFor a separate Resource API, configure its origin through the Blazor client registration:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 class=\u0022docs-code-copy\u0022 aria-label=\u0022Copy code\u0022\u003ECopy\u003C/button\u003E\u003C/div\u003E\u003Cpre\u003E\u003Ccode class=\u0022language-csharp\u0022\u003Eusing CodeBeam.UltimateAuth.Client;\n\nbuilder.Services.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n\n options.Resource.BaseAddress = \u0026quot;https://localhost:6122\u0026quot;;\n options.Resource.Credentials = UAuthResourceCredentialsMode.Auto;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003EEndpoints.BasePath\u003C/code\u003E identifies the authentication server.\u003C/p\u003E\n\u003Cp\u003E\u003Ccode\u003EResource.BaseAddress\u003C/code\u003E identifies the application Resource API.\u003C/p\u003E\n\u003Cp\u003EThese addresses can point to different applications.\u003C/p\u003E\n\u003Cp\u003EIf the Resource API shares the application\u0027s origin, \u003Ccode\u003EResource.BaseAddress\u003C/code\u003E can remain \u003Ccode\u003Enull\u003C/code\u003E.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022call-protected-resources\u0022\u003ECall Protected Resources\u003C/h3\u003E\n\u003Cp\u003EInject \u003Ccode\u003EIUAuthClient\u003C/code\u003E into a Blazor component:\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@using CodeBeam.UltimateAuth.Client\n@inject IUAuthClient UAuthClient\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThen retrieve application data:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\nif (result.IsSuccess \u0026amp;\u0026amp; result.Value is not null)\n{\n products = result.Value;\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe Resource Client also supports POST, PUT, PATCH, and DELETE operations.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022application-specific-api-services\u0022\u003EApplication-Specific API Services\u003C/h3\u003E\n\u003Cp\u003EApplications can organize resource operations into small domain-specific services.\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\u003Eusing CodeBeam.UltimateAuth.Client;\nusing CodeBeam.UltimateAuth.Core.Contracts;\n\npublic sealed class ProductApiService(IUAuthClient client)\n{\n public Task\u0026lt;UAuthResult\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;\u0026gt; GetAllAsync()\n =\u0026gt; client.Resource.GetAsync\u0026lt;List\u0026lt;Product\u0026gt;\u0026gt;(\u0026quot;/api/products\u0026quot;);\n\n public Task\u0026lt;UAuthResult\u0026lt;Product\u0026gt;\u0026gt; CreateAsync(Product product)\n =\u0026gt; client.Resource.PostAsync\u0026lt;Product\u0026gt;(\u0026quot;/api/products\u0026quot;,product);\n\n public Task\u0026lt;UAuthResult\u0026gt; DeleteAsync(int id)\n =\u0026gt; client.Resource.DeleteAsync($\u0026quot;/api/products/{id}\u0026quot;);\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003ERegister the application service:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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;ProductApiService\u0026gt;();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe service uses UltimateAuth\u0027s transport and result contracts rather than implementing another HTTP abstraction.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022interactive-webassembly\u0022\u003EInteractive WebAssembly\u003C/h3\u003E\n\u003Cp\u003EIn an Interactive WebAssembly application, configure the UltimateAuth Blazor client in each project where the Resource Client will be used.\u003C/p\u003E\n\u003Cp\u003EThe host and \u003Ccode\u003E.Client\u003C/code\u003E project have separate dependency injection containers.\u003C/p\u003E\n\u003Cp\u003EA shared application API service may be registered in both projects when components execute in both environments.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client uses browser-based transport, including when invoked from an interactive Blazor Server component.\u003C/p\u003E\n\u003Cp\u003EBrowser interop must be available before making resource requests. Do not initiate browser-dependent resource requests during static prerendering.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022standalone-webassembly\u0022\u003EStandalone WebAssembly\u003C/h3\u003E\n\u003Cp\u003EStandalone Blazor WebAssembly applications use the same Resource Client 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.AddUltimateAuthClientBlazor(options =\u0026gt;\n{\n options.Endpoints.BasePath = \u0026quot;https://localhost:6112/auth\u0026quot;;\n options.Resource.BaseAddress = \u0026quot;https://localhost:6122\u0026quot;;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EOnce configured, application components can call protected resources through \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EA separate application-specific \u003Ccode\u003EHttpClient\u003C/code\u003E is not required for these requests.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022browser-credentials-and-cors\u0022\u003EBrowser Credentials and CORS\u003C/h3\u003E\n\u003Cp\u003EFor cross-origin requests, the browser and receiving API must agree on credential handling.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client supports \u003Ccode\u003EAuto\u003C/code\u003E, \u003Ccode\u003ESameOrigin\u003C/code\u003E, \u003Ccode\u003EInclude\u003C/code\u003E, and \u003Ccode\u003EOmit\u003C/code\u003E credential policies.\u003C/p\u003E\n\u003Cp\u003EFor cross-origin cookie-based authentication, configure the appropriate credential policy and ensure that the Resource API supports the required CORS and cookie settings.\u003C/p\u003E\n\u003Cp\u003EThe Resource Client does not automatically make an API authenticated merely because the user has signed in through UAuthHub.\u003C/p\u003E\n\u003Cp\u003EThe receiving API must validate the authentication material associated with the configured authentication mode and enforce its authorization policies.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022blazor-server-and-direct-service-calls\u0022\u003EBlazor Server and Direct Service Calls\u003C/h3\u003E\n\u003Cp\u003EBlazor Server applications can often access application services directly when those services are hosted in the same process.\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\u003Evar products = await productService.GetAllAsync();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThere is no need to introduce an HTTP request solely to use the Resource Client.\u003C/p\u003E\n\u003Cp\u003EUse \u003Ccode\u003EIUAuthClient.Resource\u003C/code\u003E when the application actually needs to communicate with a protected Resource API through the browser.\u003C/p\u003E\n\u003Cp\u003EFor server-to-server requests, use an appropriate server-side HTTP client and authentication mechanism.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022learn-more\u0022\u003ELearn More\u003C/h3\u003E\n\u003Cp\u003ESee \u003Ca href=\u0022/docs/client-sdk/resource-api-requests\u0022\u003EResource API Requests\u003C/a\u003E for supported operations, result handling, credential configuration, security considerations, and request cancellation.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022authentication-modes-and-application-profiles\u0022\u003E10. Authentication Modes and Application Profiles\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth separates \u003Cstrong\u003Eapplication profile detection\u003C/strong\u003E from \u003Cstrong\u003Eauthentication mode enforcement\u003C/strong\u003E.\u003C/p\u003E\n\u003Cp\u003EThe default resolver 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 resolved mode\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor Server\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EPureOpaque\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EBlazor WASM\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EWeb Server\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMAUI\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAPI\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EResource API\u003C/td\u003E\n\u003Ctd\u003E\u003Ccode\u003EHybrid\u003C/code\u003E\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EUAuthHub\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\u003EThis mapping describes the resolver\u0027s behavior, not a guarantee that every mode is currently fully supported by the server.\u003C/p\u003E\n\u003Cp\u003EPureOpaque, Hybrid, SemiHybrid and PureJwt are implemented authentication modes.\u003C/p\u003E\n\u003Cp\u003EHybrid Resource APIs currently support session-based authentication. PureJwt Resource APIs support independent JWT validation.\u003C/p\u003E\n\u003Cp\u003EApplications must explicitly configure compatible authentication modes when the built-in defaults do not match their architecture.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022restrict-allowed-modes\u0022\u003ERestrict allowed modes\u003C/h3\u003E\n\u003Cp\u003EOn the authentication 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.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 guardrail.\u003C/p\u003E\n\u003Cp\u003EIt does not select a mode for every request.\u003C/p\u003E\n\u003Cp\u003EThe effective mode is resolved from the application profile and then checked against the server\u0027s allowed-mode policy.\u003C/p\u003E\n\u003Cp\u003EFor most applications, use the default mode resolution unless you have a specific integration requirement.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022server-options-for-real-applications\u0022\u003E11. Server Options for Real Applications\u003C/h2\u003E\n\u003Cp\u003EProduction configuration should reflect your application\u0027s security requirements.\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.Login.MaxFailedAttempts = 5;\n options.Login.LockoutDuration = TimeSpan.FromMinutes(15);\n options.Identifiers.Behavior.AllowMultipleUsernames = true;\n options.UserProfile.EnableMultiProfile = false;\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EServer options also compose the Core-defined login, session, token, PKCE, and multi-tenant options.\u003C/p\u003E\n\u003Cp\u003EConfigure those through \u003Ccode\u003EAddUltimateAuthServer()\u003C/code\u003E.\u003C/p\u003E\n\u003Cp\u003EDo not independently configure Core options and assume the server will automatically use them.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022configuration-files\u0022\u003EConfiguration files\u003C/h3\u003E\n\u003Cp\u003EUltimateAuth also supports configuration through \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 \u0026quot;LockoutDuration\u0026quot;: \u0026quot;00:15:00\u0026quot;\n }\n }\n }\n}\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe server options registration binds the \u003Ccode\u003EUltimateAuth:Server\u003C/code\u003E configuration section.\u003C/p\u003E\n\u003Cp\u003ERemember that effective mode defaults and mode-specific overrides are applied after the base options have been configured.\u003C/p\u003E\n\u003Cp\u003EFor detailed configuration behavior, see Server Options and Advanced Configuration.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022client-ip-address-reverse-proxy\u0022\u003E12. Client IP Address \u0026amp; Reverse Proxy\u003C/h2\u003E\n\u003Cp\u003EUltimateAuth uses ASP.NET Core\u0027s resolved client IP address for device information and IP-based rate limiting. It does not directly trust \u003Ccode\u003EX-Forwarded-For\u003C/code\u003E or \u003Ccode\u003ECF-Connecting-IP\u003C/code\u003E headers.\u003C/p\u003E\n\u003Cp\u003EIf your application runs behind Caddy, Nginx, or another reverse proxy, configure ASP.NET Core to trust that proxy.\u003C/p\u003E\n\u003Cp\u003EIn \u003Ccode\u003EProgram.cs\u003C/code\u003E, before \u003Ccode\u003Ebuilder.Build()\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\u003Eusing System.Net;\nusing Microsoft.AspNetCore.HttpOverrides;\n\nbuilder.Services.Configure\u0026lt;ForwardedHeadersOptions\u0026gt;(options =\u0026gt;\n{\n options.ForwardedHeaders =\n ForwardedHeaders.XForwardedFor |\n ForwardedHeaders.XForwardedProto;\n\n // Replace with your actual Caddy or Nginx proxy IP.\n options.KnownProxies.Add(IPAddress.Parse(\u0026quot;172.20.0.5\u0026quot;));\n});\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThen enable the middleware \u003Cstrong\u003Ebefore\u003C/strong\u003E UltimateAuth and HTTPS redirection:\u003C/p\u003E\n\u003Cdiv class=\u0022docs-code-wrapper\u0022\u003E\u003Cdiv class=\u0022docs-code-header\u0022\u003E\u003Cspan class=\u0022docs-code-language\u0022\u003EC#\u003C/span\u003E\u003Cbutton type=\u0022button\u0022 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.UseForwardedHeaders();\n\napp.UseHttpsRedirection();\napp.UseUltimateAuthWithAspNetCore();\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThe example IP \u003Ccode\u003E172.20.0.5\u003C/code\u003E represents a trusted reverse proxy, not the visitor\u0027s IP address. Replace it with your actual proxy IP. For Docker deployments, ensure the proxy address is stable or configure a narrowly scoped trusted network.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EImportant:\u003C/strong\u003E Never trust arbitrary forwarded headers or clear the trusted proxy lists to accept all sources. If your application connects directly to Kestrel without a reverse proxy, no forwarded headers configuration is required.\u003C/p\u003E\n\u003Cp\u003EFor multi-proxy deployments, configure the complete trusted proxy chain and forwarding behavior according to your infrastructure.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022development-and-production-differences\u0022\u003E13. Development and Production Differences\u003C/h2\u003E\n\u003Cp\u003EThe samples intentionally prioritize visibility and repeatability.\u003C/p\u003E\n\u003Cp\u003EA production application needs additional safeguards.\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\u003ESample or development\u003C/th\u003E\n\u003Cth\u003EProduction\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EPersistence\u003C/td\u003E\n\u003Ctd\u003EInMemory or local SQLite\u003C/td\u003E\n\u003Ctd\u003EDurable database\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESeed accounts\u003C/td\u003E\n\u003Ctd\u003EExample users and passwords\u003C/td\u003E\n\u003Ctd\u003EReal provisioning\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDatabase initialization\u003C/td\u003E\n\u003Ctd\u003EMay reset sample data\u003C/td\u003E\n\u003Ctd\u003EReviewed migrations\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EHTTPS\u003C/td\u003E\n\u003Ctd\u003ELocal development certificate\u003C/td\u003E\n\u003Ctd\u003EProper TLS termination\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECORS\u003C/td\u003E\n\u003Ctd\u003ELocalhost origins\u003C/td\u003E\n\u003Ctd\u003EExact trusted origins\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESigning keys\u003C/td\u003E\n\u003Ctd\u003EDevelopment defaults\u003C/td\u003E\n\u003Ctd\u003EManaged, persistent keys\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EDiagnostics\u003C/td\u003E\n\u003Ctd\u003EDetailed debugging\u003C/td\u003E\n\u003Ctd\u003ERestrict sensitive diagnostics\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ECredential recovery\u003C/td\u003E\n\u003Ctd\u003EDevelopment notifier\u003C/td\u003E\n\u003Ctd\u003EReal secure notification channel\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EIdentifier verification\u003C/td\u003E\n\u003Ctd\u003EDevelopment bypass\u003C/td\u003E\n\u003Ctd\u003EProof-based verification\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003ESecrets\u003C/td\u003E\n\u003Ctd\u003ELocal settings\u003C/td\u003E\n\u003Ctd\u003ESecure configuration provider\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003EThe sample projects include development-only implementations for credential reset notifications and identifier verification.\u003C/p\u003E\n\u003Cp\u003EThose implementations demonstrate extension points and should not be treated as production verification systems.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022credential-recovery\u0022\u003ECredential recovery\u003C/h3\u003E\n\u003Cp\u003EIf your application exposes credential recovery, configure a real implementation of the credential reset notifier.\u003C/p\u003E\n\u003Cp\u003ERecovery secrets must be delivered through an appropriate channel and must not be exposed directly through anonymous API responses.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022identifier-verification\u0022\u003EIdentifier verification\u003C/h3\u003E\n\u003Cp\u003EIf your application supports verified email addresses, phone numbers, or other identifiers, use an implementation that verifies ownership through suitable proof.\u003C/p\u003E\n\u003Cp\u003EDo not use a development bypass verifier in production.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022signing-keys\u0022\u003ESigning keys\u003C/h3\u003E\n\u003Cp\u003EConfigure persistent signing keys for authentication modes that issue JWTs.\u003C/p\u003E\n\u003Cp\u003EDevelopment signing key providers are not a substitute for production key management.\u003C/p\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022deployment-checklist\u0022\u003E14. Deployment Checklist\u003C/h2\u003E\n\u003Cp\u003EBefore deploying, verify the following:\u003C/p\u003E\n\u003Cul class=\u0022contains-task-list\u0022\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E The selected architecture matches the actual client hosting model.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E The authentication server uses appropriate persistent storage.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Database migrations have been reviewed and applied.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Sample users and development-only verification services are disabled.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Production signing keys and secrets are configured.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E HTTPS is enforced at the appropriate boundary.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E UAuthHub and Resource API origins are explicitly configured.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Authentication endpoints and application endpoints are protected appropriately.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Client and server endpoint URLs match the deployment.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Session expiration, refresh, logout, and revocation have been tested.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Protected resources enforce server-side authorization.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Reverse proxy headers are configured correctly if applicable.\u003C/li\u003E\n\u003Cli class=\u0022task-list-item\u0022\u003E\u003Cinput disabled=\u0022disabled\u0022 type=\u0022checkbox\u0022\u003E Authentication state and persistence survive the expected application lifecycle.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2 class=\u0022mud-scrollspy-section\u0022 id=\u0022choosing-your-architecture\u0022\u003E15. Choosing Your Architecture\u003C/h2\u003E\n\u003Cp\u003E\u003Cstrong\u003EStart with one server and one client. Connect more clients whenever you need them.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EUltimateAuth is built around two fundamental responsibilities:\u003C/p\u003E\n\u003Cul\u003E\n\u003Cli\u003E\u003Cstrong\u003EUltimateAuth Server\u003C/strong\u003E \u2014 Manages authentication, users, credentials, sessions, authorization, and the security lifecycle.\u003C/li\u003E\n\u003Cli\u003E\u003Cstrong\u003EUltimateAuth Client\u003C/strong\u003E \u2014 Integrates an application with the authentication system using the appropriate application profile and authentication flows.\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cp\u003EEvery application needs access to an authentication server, but that server does not have to be a separate application. It can be hosted within your existing ASP.NET Core application or deployed independently as UAuthHub.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022single-application-the-simplest-setup\u0022\u003ESingle Application \u2014 The Simplest Setup\u003C/h3\u003E\n\u003Cp\u003EFor a traditional ASP.NET Core or Blazor Server application, UltimateAuth Server and Client can run together.\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\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Your Application \u2502\n\u2502 \u2502\n\u2502 UltimateAuth Client \u2502\n\u2502 \u2502 \u2502\n\u2502 UltimateAuth Server \u2502\n\u2502 \u2502 \u2502\n\u2502 Database \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EThis approach is ideal when you want authentication without introducing another service or deployment.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022multiple-applications-one-authentication-server\u0022\u003EMultiple Applications \u2014 One Authentication Server\u003C/h3\u003E\n\u003Cp\u003EAs your system grows, you can connect multiple client applications to the same UltimateAuth 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\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 Blazor Server Blazor WASM\n \u2502 \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 \u2502 \u2502\n Razor Pages MAUI Other .NET Clients\n \u2502 \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \u2502\n \u25BC\n UltimateAuth Server\n UAuthHub\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC \u25BC\n Users Sessions Authorization\n \u2502\n \u25BC\n Persistence\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EEach client can have its own application structure, hosting model, and authentication requirements while sharing the same authentication authority.\u003C/p\u003E\n\u003Cp\u003EFor example, a business platform might use Blazor Server for administration, Blazor WASM for its customer portal, MAUI for mobile access, and Razor Pages for an internal application.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003EAdding another client does not require replacing the existing clients or creating another UltimateAuth Server.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThe same users, credentials, security policies, and session infrastructure can serve multiple applications, subject to the authentication modes and client integrations supported by the installed version.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022distributed-applications-separate-resource-apis\u0022\u003EDistributed Applications \u2014 Separate Resource APIs\u003C/h3\u003E\n\u003Cp\u003EWhen your architecture includes independently deployed backend services, Resource APIs can integrate with the same authentication authority.\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 Multiple Client Applications\n \u2502\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u25BC \u25BC\n UAuthHub Resource APIs\n \u25B2 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n Authentication\n Validation\n\u003C/code\u003E\u003C/pre\u003E\u003C/div\u003E\n\u003Cp\u003EResource APIs protect application resources without becoming additional authentication servers.\u003C/p\u003E\n\u003Cp\u003EThis lets you separate business services from authentication infrastructure while maintaining a shared security model.\u003C/p\u003E\n\u003Ch3 class=\u0022mud-scrollspy-section\u0022 id=\u0022one-foundation-different-scales\u0022\u003EOne Foundation, Different Scales\u003C/h3\u003E\n\u003Cdiv class=\u0022docs-table-wrapper\u0022\u003E\u003Ctable\u003E\n\u003Cthead\u003E\n\u003Ctr\u003E\n\u003Cth\u003EYour scenario\u003C/th\u003E\n\u003Cth\u003ERecommended approach\u003C/th\u003E\n\u003C/tr\u003E\n\u003C/thead\u003E\n\u003Ctbody\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA simple Blazor Server application\u003C/td\u003E\n\u003Ctd\u003EIntegrated Server \u002B Client\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA traditional ASP.NET Core application\u003C/td\u003E\n\u003Ctd\u003EServer hosted within the application\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EA standalone Blazor WASM application\u003C/td\u003E\n\u003Ctd\u003EClient \u002B remote UAuthHub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EAn Interactive WASM application\u003C/td\u003E\n\u003Ctd\u003EHost \u002B WASM Client \u002B remote UAuthHub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMultiple web, desktop, or mobile applications\u003C/td\u003E\n\u003Ctd\u003EMultiple Clients \u002B shared UAuthHub\u003C/td\u003E\n\u003C/tr\u003E\n\u003Ctr\u003E\n\u003Ctd\u003EMultiple backend services\u003C/td\u003E\n\u003Ctd\u003EShared UAuthHub \u002B Resource APIs\u003C/td\u003E\n\u003C/tr\u003E\n\u003C/tbody\u003E\n\u003C/table\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EUltimateAuth does not require a complex architecture to get started, and it does not restrict you to a single client as your application grows.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EStart with the simplest deployment that meets your needs. Add new client applications, persistent storage, or separate Resource APIs as your requirements evolve.\u003C/p\u003E\n\u003Cp\u003EThe authentication foundation remains consistent.\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/getting-started/quickstart\u0022\u003EQuickStart\u003C/a\u003E \u2014 Build the minimal in-memory application.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/getting-started/ecosystem\u0022\u003EEcosystem\u003C/a\u003E \u2014 Explore packages and supported integrations.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/server-options\u0022\u003EServer Options\u003C/a\u003E \u2014 Configure server 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, endpoints, refresh, and reauthentication.\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\u0022/docs/configuration/advanced-configuration\u0022\u003EAdvanced Configuration\u003C/a\u003E \u2014 Explore effective options, dependency injection, and extension points.\u003C/li\u003E\n\u003C/ul\u003E\n", "Headings": [ { "Id": "choose-your-architecture", @@ -369,6 +369,6 @@ "Level": 0 } ], - "SourceHash": "37E3134CFEA4132EA3C71F781734EBD237AE6D3AD1C35DEB4E2EC508053AC700", + "SourceHash": "7AA3BB3DF22C6A356324E53CDAF62BBDB38D60CCF696B1A3C509F3995FB4D8EE", "BuilderVersion": "1" } \ No newline at end of file