>, CancellationToken>(
+ (action, ct) => action(ct));
+
var options = new UAuthServerOptions();
options.Session.Lifetime =
@@ -1687,7 +1695,8 @@ private static Fixture CreateFixture(
var sut =
new UAuthSessionIssuer(
storeFactory.Object,
- tokenGenerator.Object);
+ tokenGenerator.Object,
+ Options.Create(options));
return new Fixture(
sut,
From 9c73e77505318243ca8e4b769697d416e7994e1f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?=
<78308169+mckaragoz@users.noreply.github.com>
Date: Sat, 21 Nov 2026 20:17:47 +0300
Subject: [PATCH 2/6] Add cryptography keys to Docker Compose configuration
---
.docker/docker-compose.identitylab.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.docker/docker-compose.identitylab.yml b/.docker/docker-compose.identitylab.yml
index 63621954..92a1de9a 100644
--- a/.docker/docker-compose.identitylab.yml
+++ b/.docker/docker-compose.identitylab.yml
@@ -15,6 +15,9 @@ services:
LabAdmin__Email: ${LAB_ADMIN_EMAIL:?Admin email is required}
LabAdmin__Password: ${LAB_ADMIN_PASSWORD:?Admin password is required}
+ UltimateAuth__Cryptography__TokenHashingKey: ${ULTIMATEAUTH_TOKEN_HASHING_KEY:?Token hashing key is required}
+ UltimateAuth__Cryptography__JwtSigningKey: ${ULTIMATEAUTH_JWT_SIGNING_KEY:?JWT signing key is required}
+
DataProtection__KeysPath: /app/keys
volumes:
From 7b4190ac2921e0770c41cc1feefc0489d5b395ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?=
<78308169+mckaragoz@users.noreply.github.com>
Date: Sat, 21 Nov 2026 22:40:28 +0300
Subject: [PATCH 3/6] feat(production): Implement PureJwt Authentication &
Unify Authentication Architecture (#172)
* feat(production): Introduce PureJwt Auth Mode
* Login Implementation
* Fix Tests
* Add Tests
* Independent and Per ClientProfile AuthMode Options Design
* User Validation Arrangement & Tests
* Stateless Flow Arrangements
* Fix & Add Tests
* Validate & Logout Flow
* New Design of Mode Options
* Fix Grant Resolvers
* Fix Validate Snapshot
* JWT & Refresh Token Signing/Hashing Key Seperation
* PureJwt Refresh Implementation - Part 1
* PureJwt Refresh Implementation - Part 2
* Fix & Add Tests
* Try Resource API Support in PureJwt Auth Mode
* Resource API Implementation - Part 2
* Fix Tests
* Fix Refresh Chain Revoke on Logout on PureJwt
* Device Mismatch Arrangements & Add Tests for Missing Coverage
* More Breaking Changes
* More Improvements
* Fix Authorization & Add Tests
* Add Tests
* DX Improvements
* Add Docs
* Identity Lab Crypthography Implementation
* Last Arrangements
* Added Some Other Migration Explanation
---
README.md | 28 +-
...160941_004_PureJwtRefreshToken.Designer.cs | 793 +++++++++++
.../20261118160941_004_PureJwtRefreshToken.cs | 107 ++
.../Migrations/UAuthDbContextModelSnapshot.cs | 23 +-
.../Program.cs | 6 +
docs/content/auth-flows/login-flow.md | 12 +-
docs/content/auth-flows/logout-flow.md | 20 +
docs/content/auth-flows/overview.md | 12 +-
docs/content/auth-flows/refresh-flow.md | 42 +-
docs/content/client-sdk/authentication.md | 10 +-
.../client-sdk/resource-api-requests.md | 56 +-
.../configuration/advanced-configuration.md | 41 +-
docs/content/configuration/client-options.md | 83 +-
docs/content/configuration/overview.md | 73 +-
docs/content/configuration/server-options.md | 47 +-
...nt-profiles.md => application-profiles.md} | 80 +-
docs/content/fundamentals/auth-modes.md | 174 +--
docs/content/fundamentals/flow-based-auth.md | 14 +-
docs/content/fundamentals/overview.md | 2 +-
.../content/fundamentals/request-lifecycle.md | 2 +-
.../fundamentals/runtime-architecture.md | 4 +-
docs/content/getting-started/index.md | 4 +-
docs/content/getting-started/quickstart.md | 106 +-
.../getting-started/real-world-setup.md | 190 ++-
docs/content/migration/v0.2.0.md | 494 ++++++-
docs/content/security/rate-limiting.md | 2 +-
docs/content/security/token-security.md | 38 +
.../Pages/DocsLandingPage.razor | 3 +-
.../Pages/Home.razor | 2 +-
.../wwwroot/docs/auth-flows/login-flow.json | 4 +-
.../wwwroot/docs/auth-flows/logout-flow.json | 9 +-
.../wwwroot/docs/auth-flows/overview.json | 4 +-
.../wwwroot/docs/auth-flows/refresh-flow.json | 14 +-
.../docs/client-sdk/authentication.json | 4 +-
.../client-sdk/resource-api-requests.json | 23 +-
.../configuration/advanced-configuration.json | 4 +-
.../docs/configuration/client-options.json | 16 +-
.../wwwroot/docs/configuration/overview.json | 13 +-
.../docs/configuration/server-options.json | 9 +-
.../wwwroot/docs/docs-index.json | 4 +-
.../fundamentals/application-profiles.json | 154 ++
.../wwwroot/docs/fundamentals/auth-modes.json | 38 +-
.../docs/fundamentals/client-profiles.json | 154 --
.../docs/fundamentals/flow-based-auth.json | 4 +-
.../wwwroot/docs/fundamentals/overview.json | 4 +-
.../docs/fundamentals/request-lifecycle.json | 4 +-
.../fundamentals/runtime-architecture.json | 4 +-
.../wwwroot/docs/getting-started/index.json | 4 +-
.../docs/getting-started/quickstart.json | 40 +-
.../getting-started/real-world-setup.json | 32 +-
.../wwwroot/docs/migration/v0.2.0.json | 124 +-
.../wwwroot/docs/security/rate-limiting.json | 4 +-
.../wwwroot/docs/security/token-security.json | 24 +-
.../docs/sessions-devices/device-limits.json | 2 +-
.../Components/Page/SampleHubHome.razor | 2 +-
.../Components/Page/SampleLogin.razor | 2 +-
.../Components/Page/SamplePkceLogin.razor | 2 +-
.../Components/Page/SampleRegister.razor | 2 +-
...160909_004_PureJwtRefreshToken.Designer.cs | 779 +++++++++++
.../20261118160909_004_PureJwtRefreshToken.cs | 107 ++
.../Migrations/UAuthDbContextModelSnapshot.cs | 21 +-
.../Program.cs | 6 +
.../uauthhub.db | Bin 339968 -> 4096 bytes
.../Program.cs | 6 +
...160634_004_PureJwtRefreshToken.Designer.cs | 779 +++++++++++
.../20261118160634_004_PureJwtRefreshToken.cs | 107 ++
.../Migrations/UAuthDbContextModelSnapshot.cs | 21 +-
.../Program.cs | 28 +-
.../Program.cs | 27 +-
.../Program.cs | 52 +-
.../SampleData/ProductsController.cs | 4 +-
.../Abstractions/Stores/IRefreshTokenStore.cs | 4 +-
.../Contracts/Authority/AccessContext.cs | 8 +-
.../Contracts/Authority/AuthContext.cs | 2 +-
.../Contracts/Login/LoginResult.cs | 13 +
.../Contracts/Pkce/PkceAuthorizeCommand.cs | 2 +-
.../Token/RefreshTokenRotationExecution.cs | 2 +-
.../Token/RefreshTokenValidationResult.cs | 17 +-
.../Contracts/Token/TokenIssuanceContext.cs | 9 +-
.../Defaults/UAuthConstants.cs | 4 +-
.../Defaults/UAuthJwtProfileClaims.cs | 9 +
.../Domain/Auth/LoginPreviewArtifact.cs | 12 +-
.../Domain/Hub/HubCredentials.cs | 2 +-
.../Domain/Hub/HubFlowArtifact.cs | 6 +-
.../Domain/Hub/HubFlowState.cs | 4 +-
.../Domain/Token/RefreshChainId.cs | 17 +
.../Domain/Token/RefreshToken.cs | 34 +-
.../Domain/Token/UAuthJwtTokenDescriptor.cs | 1 +
.../Authority/DeviceRequiredInvariant.cs | 8 +-
.../UAuthRefreshTokenValidator.cs | 12 +-
.../Options/GrantDeliveryMode.cs | 27 +
.../Options/IApplicationProfileDetector.cs | 6 +
.../Options/IClientProfileDetector.cs | 6 -
.../Options/TokenResponseMode.cs | 1 +
.../Options/UAuthApplicationProfile.cs | 92 ++
.../Options/UAuthClientProfile.cs | 12 -
.../IJwtVerificationKeyProvider.cs | 12 +
.../Abstractions/IPureJwtLogoutService.cs | 8 +
.../Abstractions/IUAuthJwtValidator.cs | 9 +
...eReader.cs => ApplicationProfileReader.cs} | 12 +-
.../Auth/Context/AccessContextFactory.cs | 2 +-
.../Auth/Context/AuthExecutionContext.cs | 2 +-
.../Auth/Context/AuthFlowContext.cs | 10 +-
.../Auth/Context/AuthFlowContextFactory.cs | 85 +-
.../Auth/Context/IAuthFlowContextFactory.cs | 2 +-
.../Auth/EffectiveServerOptionsProvider.cs | 50 +-
...Reader.cs => IApplicationProfileReader.cs} | 4 +-
.../Auth/PureJwtSnapshotFactory.cs | 49 +
.../Response/AuthModeResolutionContext.cs | 39 +
...AuthResponseOptionsModeTemplateResolver.cs | 166 ---
.../Auth/Response/AuthResponseResolver.cs | 216 ++-
.../ClientProfileAuthResponseAdapter.cs | 92 --
.../Response/EffectiveAuthModeResolver.cs | 16 +-
.../Auth/Response/EffectiveAuthResponse.cs | 16 +-
.../Auth/Response/EffectiveGrantDelivery.cs | 38 +
.../Response/EffectiveRedirectResponse.cs | 23 +-
.../Auth/Response/IAuthResponseResolver.cs | 3 +-
.../Response/IEffectiveAuthModeResolver.cs | 21 +-
.../AspNetCore/UAuthAuthenticationHandler.cs | 111 +-
.../UAuthResourceAuthenticationHandler.cs | 173 ++-
.../ResourceAccessContextBuilder.cs | 2 +-
.../UAuthStatusAuthorizationResultHandler.cs | 38 +-
.../Contracts/Hub/HubBeginRequest.cs | 2 +-
.../Contracts/ValidatedJwtIdentity.cs | 22 +
.../Endpoints/LoginEndpointHandler.cs | 6 +-
.../Endpoints/LogoutEndpointHandler.cs | 48 +-
.../Endpoints/PkceEndpointHandler.cs | 6 +-
.../Endpoints/ValidateEndpointHandler.cs | 54 +-
.../Extensions/AuthFlowContextExtensions.cs | 2 +-
.../Extensions/ServiceCollectionExtensions.cs | 130 +-
.../UAuthApplicationBuilderExtensions.cs | 23 +-
.../Flows/Login/LoginOrchestrator.cs | 76 +-
.../Flows/Pkce/PkceAuthorizationValidator.cs | 4 +-
.../Flows/Pkce/PkceContextSnapshot.cs | 8 +-
.../Flows/Refresh/RefreshResponsePolicy.cs | 3 +-
.../Flows/Refresh/RefreshTokenResolver.cs | 5 +-
.../Cookies/IUAuthCookiePolicyBuilder.cs | 3 +-
.../Cookies/UAuthCookiePolicyBuilder.cs | 17 +-
.../ITransportCredentialResolver.cs | 6 +-
.../AspNetCore/TransportCredentialResolver.cs | 140 +-
.../Credentials/CredentialResponseWriter.cs | 77 +-
.../Credentials/IUAuthBodyPolicyBuilder.cs | 2 +-
.../Credentials/IUAuthHeaderPolicyBuilder.cs | 2 +-
.../Credentials/UAuthBodyPolicyBuilder.cs | 3 +-
.../Credentials/UAuthHeaderPolicyBuilder.cs | 14 +-
.../Credentials/ValidateCredentialResolver.cs | 24 +-
.../UAuthCrypthographyConstants.cs | 16 +
.../Crypthography/UAuthKeyMaterial.cs | 45 +
.../DevelopmentJwtSigningKeyProvider.cs | 31 -
.../Generators/JwtTokenGenerator.cs | 80 +-
.../Infrastructure/Hub/HandleHubEntry.cs | 6 +-
.../Hub/HubCredentialResolver.cs | 2 +-
.../Infrastructure/Hub/HubFlowReader.cs | 2 +-
.../Issuers/UAuthTokenIssuer.cs | 86 +-
.../SessionId/CompositeSessionIdResolver.cs | 10 +-
.../Token/ConfiguredJwtSigningKeyProvider.cs | 41 +
.../ConfiguredJwtVerificationKeyProvider.cs | 56 +
.../Infrastructure/Token/JwtPayloadGuard.cs | 106 ++
.../Token/PureJwtDevicePolicy.cs | 23 +
.../{ => Token}/RefreshTokenMapper.cs | 0
.../Token/StaticJwtVerificationKeyProvider.cs | 40 +
.../Infrastructure/Token/UAuthJwtValidator.cs | 178 +++
.../Infrastructure/UAuthJwtValidator.cs | 83 --
.../Infrastructure/User/UAuthUserAccessor.cs | 84 +-
.../Options/CredentialResponseOptions.cs | 1 +
.../Options/Defaults/ConfigureDefaults.cs | 155 +-
.../Options/GrantDeliveryOptions.cs | 40 +
.../IEffectiveServerOptionsProvider.cs | 4 +-
.../Options/LoginRedirectOptions.cs | 13 -
.../Options/UAuthCorsOptionsSetup.cs | 25 +
.../Options/UAuthCrypthographyOptions.cs | 24 +
.../Options/UAuthGrantDeliveryOptions.cs | 45 +
.../Options/UAuthJwtValidationOptions.cs | 17 +
.../Options/UAuthRedirectOptions.cs | 23 +
.../Options/UAuthResourceApiOptions.cs | 176 ++-
.../Options/UAuthResponseOptions.cs | 23 +-
.../Options/UAuthServerOptions.cs | 65 +-
.../UAuthCrypthographyOptionsValidator.cs | 80 ++
.../UAuthResourceApiOptionsValidator.cs | 164 +++
.../Validators/UAuthServerOptionsValidator.cs | 70 +-
.../ResourceApiAuthModeProvider.cs | 47 +
.../ResourceApi/ResourceAuthContextFactory.cs | 4 +-
.../ResourceApi/ResourceUserAccessor.cs | 65 +-
.../Security/UAuthCsrfResponseInspector.cs | 6 +-
.../Services/HubFlowService.cs | 2 +-
.../Services/PkceService.cs | 8 +-
.../Services/PureJwtLogoutService.cs | 69 +
.../Services/RefreshTokenRotationService.cs | 149 +-
.../Services/UAuthFlowService.cs | 8 +-
.../Components/UAuthLoginForm.razor | 2 +-
.../Components/UAuthLoginForm.razor.cs | 4 +-
.../Infrastructure/UAuthRequestClient.cs | 10 +-
.../UAuthResourceRequestClient.cs | 2 +-
.../TScripts/uauth.js | 30 +-
.../wwwroot/uauth.min.js | 2 +-
.../Extensions/ServiceCollectionExtensions.cs | 2 +-
.../Infrastructure/ClientLoginCapabilities.cs | 6 +-
....cs => UAuthApplicationProfileDetector.cs} | 14 +-
.../Options/UAuthClientOptions.cs | 20 +-
.../Options/UAuthOptionsPostConfigure.cs | 10 +-
.../Validators/UAuthClientOptionsValidator.cs | 6 +-
.../Runtime/UAuthClientProductInfo.cs | 6 +-
.../Runtime/UAuthClientProductInfoProvider.cs | 2 +-
.../Abstractions/ICredentialClient.cs | 6 +-
.../Services/Abstractions/IFlowClient.cs | 4 +-
.../Services/Abstractions/IUAuthClient.cs | 4 +-
.../Services/UAuthFlowClient.cs | 6 +-
.../PasswordUserLifecycleIntegration.cs | 4 +-
.../Services/CredentialManagementService.cs | 6 +-
.../Data/UAuthTokenModelBuilder.cs | 20 +-
.../Mappers/RefreshTokenProjectionMapper.cs | 12 +-
.../Projections/RefreshTokenProjection.cs | 9 +-
.../Stores/EfCoreRefreshTokenStore.cs | 21 +-
.../InMemoryRefreshTokenStore.cs | 24 +-
.../Services/UserApplicationService.cs | 2 +-
.../Abstractions/IUserLifecycleIntegration.cs | 2 +-
.../Infrastructure/Contexts.cs | 2 +-
.../Infrastructure/LabHttpHost.cs | 34 +-
.../Infrastructure/LabRuntime.cs | 15 +-
.../Infrastructure/EfCoreTestRuntime.cs | 11 +-
.../Infrastructure/TestAccessContext.cs | 8 +-
.../ClientRateLimitingIntegrationTests.cs | 4 +-
.../Infrastructure/TestAccessContext.cs | 8 +-
.../PureJwtIdentityTests.cs | 767 ++++++++++
.../RateLimitingProofFlowTests.cs | 2 +-
.../RateLimitingTests.cs | 75 +-
.../RefreshTests.cs | 74 +-
.../ResourceApiAuthenticationTests.cs | 307 ++--
.../ResourceApi/ResourceApiTestHost.cs | 80 +-
.../UAuthServerStatusAuthorizationTests.cs | 177 ++-
.../SessionSlidingExpirationTests.cs | 4 +-
.../UserLifecycleTests.cs | 2 +-
.../Bunit/UAuthLoginFormTests.cs | 2 +-
...ileTests.cs => ApplicationProfileTests.cs} | 36 +-
.../Client/Blazor/UAuthLoginFormTests.cs | 4 +-
.../Client/Blazor/UAuthRequestClientTests.cs | 4 +-
.../Client/ClientOptionsValidatorTests.cs | 14 +-
.../Client/ClientProductInfoTests.cs | 4 +-
.../CredentialManagementServiceTests.cs | 6 +-
.../Helpers/AuthFlowTestFactory.cs | 9 +-
.../Helpers/TestAccessContext.cs | 6 +-
.../Helpers/TestAuthModeResolver.cs | 2 +-
.../Helpers/TestAuthRuntime.cs | 7 +
.../Helpers/TestHostEnvironment.cs | 13 +
.../Helpers/TestHttpContext.cs | 2 +-
.../Helpers/TestHubFactory.cs | 2 +-
.../Helpers/TestPkceFactory.cs | 4 +-
.../Policies/AccessPoliciesTests.cs | 6 +-
...nfiguredJwtVerificationKeyProviderTests.cs | 292 ++++
.../RemoteSessionValidatorTests.cs | 2 +-
.../ResourceApi/ResourceApiAuthModeTests.cs | 204 +++
.../ResourceApi/ResourceUserAccessorTests.cs | 331 +++++
.../UAuthResourceApiOptionsTests.cs | 362 +++++
.../UAuthResourceApiOptionsValidatorTests.cs | 660 +++++++++
.../UAuthResourceApiRegistrationTests.cs | 19 +-
.../Samples/ComponentTestBase.cs | 9 +-
.../Samples/HomeTests.cs | 2 -
.../Server/AuthArtifactCleanupServiceTests.cs | 8 +-
.../Server/AuthResponseResolverTests.cs | 31 +
.../Server/CookieInfrastructureTests.cs | 71 +-
.../Server/CredentialInfrastructureTests.cs | 70 +-
.../Server/CredentialResponseWriterTests.cs | 164 ++-
.../Server/EffectiveAuthModeResolverTests.cs | 15 +-
.../EffectiveServerOptionsProviderTests.cs | 191 ++-
.../Server/HandleHubTests.cs | 36 +-
.../Server/HubCredentialResolverTests.cs | 8 +-
.../Server/HubFlowReaderTests.cs | 10 +-
.../Server/HubFlowServiceTests.cs | 6 +-
.../Server/InMemoryAuthStoreTests.cs | 2 +-
.../Server/JwtPayloadGuardTests.cs | 92 ++
.../Server/JwtTokenGeneratorTests.cs | 219 ++-
.../Server/LoginEndpointHandlerTests.cs | 8 +-
.../Server/LoginOrchestratorTests.cs | 188 ++-
.../Server/LogoutEndpointHandlerTests.cs | 188 ++-
.../Server/PkceEndpointHandlerTests.cs | 14 +-
.../Server/PkceServiceTests.cs | 26 +-
.../Server/PkceTests.cs | 2 +-
.../Server/PureJwtDevicePolicyTests.cs | 53 +
.../Server/PureJwtSnapshotFactoryTests.cs | 93 ++
.../Server/RateLimitingPartitionTests.cs | 2 +-
.../Server/RedirectTests.cs | 69 +-
.../Server/RefreshFlowServiceTests.cs | 10 +-
.../Server/RefreshTokenResolverTests.cs | 188 ++-
.../RefreshTokenRotationServiceTests.cs | 1244 ++++++++---------
.../Server/ServerOptionsValidatorTests.cs | 8 +-
.../Server/SessionApplicationServiceTests.cs | 2 +-
.../Server/SessionEndpointHandlerTests.cs | 6 +-
.../StaticJwtVerificationKeyProviderTests.cs | 58 +
.../TransportCredentialResolverTests.cs | 233 +++
...UAuthCrypthographyOptionsValidatorTests.cs | 328 +++++
.../Server/UAuthFlowServiceTests.cs | 45 +-
.../Server/UAuthJwtValidatorTests.cs | 513 +++++++
.../UAuthResourceAccessOrchestratorTests.cs | 2 +-
...UAuthResourceAuthenticationHandlerTests.cs | 682 +++++++--
.../Server/ValidateCredentialResolverTests.cs | 117 +-
.../Server/ValidateEndpointHandlerTests.cs | 171 ++-
.../CompositeSessionIdResolverTests.cs | 8 +-
.../Tokens/RefreshTokenStoreContractTests.cs | 196 ++-
.../Tokens/UAuthTokenIssuerTests.cs | 200 ++-
.../Users/UserApplicationServiceTests.cs | 6 +-
.../Users/UserEndpointHandlerTests.cs | 2 +-
.../javascript/uauth.test.cjs | 22 +-
302 files changed, 15502 insertions(+), 3380 deletions(-)
create mode 100644 apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261118160941_004_PureJwtRefreshToken.Designer.cs
create mode 100644 apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261118160941_004_PureJwtRefreshToken.cs
rename docs/content/fundamentals/{client-profiles.md => application-profiles.md} (79%)
create mode 100644 docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/application-profiles.json
delete mode 100644 docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/wwwroot/docs/fundamentals/client-profiles.json
create mode 100644 samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/20261118160909_004_PureJwtRefreshToken.Designer.cs
create mode 100644 samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/Migrations/20261118160909_004_PureJwtRefreshToken.cs
create mode 100644 samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/20261118160634_004_PureJwtRefreshToken.Designer.cs
create mode 100644 samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/Migrations/20261118160634_004_PureJwtRefreshToken.cs
create mode 100644 src/CodeBeam.UltimateAuth.Core/Defaults/UAuthJwtProfileClaims.cs
create mode 100644 src/CodeBeam.UltimateAuth.Core/Domain/Token/RefreshChainId.cs
create mode 100644 src/CodeBeam.UltimateAuth.Core/Options/GrantDeliveryMode.cs
create mode 100644 src/CodeBeam.UltimateAuth.Core/Options/IApplicationProfileDetector.cs
delete mode 100644 src/CodeBeam.UltimateAuth.Core/Options/IClientProfileDetector.cs
create mode 100644 src/CodeBeam.UltimateAuth.Core/Options/UAuthApplicationProfile.cs
delete mode 100644 src/CodeBeam.UltimateAuth.Core/Options/UAuthClientProfile.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Abstractions/IJwtVerificationKeyProvider.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Abstractions/IPureJwtLogoutService.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Abstractions/IUAuthJwtValidator.cs
rename src/CodeBeam.UltimateAuth.Server/Auth/{ClientProfileReader.cs => ApplicationProfileReader.cs} (55%)
rename src/CodeBeam.UltimateAuth.Server/Auth/{IClientProfileReader.cs => IApplicationProfileReader.cs} (54%)
create mode 100644 src/CodeBeam.UltimateAuth.Server/Auth/PureJwtSnapshotFactory.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthModeResolutionContext.cs
delete mode 100644 src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseOptionsModeTemplateResolver.cs
delete mode 100644 src/CodeBeam.UltimateAuth.Server/Auth/Response/ClientProfileAuthResponseAdapter.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveGrantDelivery.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Contracts/ValidatedJwtIdentity.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Crypthography/UAuthCrypthographyConstants.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Crypthography/UAuthKeyMaterial.cs
delete mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/DevelopmentJwtSigningKeyProvider.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Token/ConfiguredJwtSigningKeyProvider.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Token/ConfiguredJwtVerificationKeyProvider.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Token/JwtPayloadGuard.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Token/PureJwtDevicePolicy.cs
rename src/CodeBeam.UltimateAuth.Server/Infrastructure/{ => Token}/RefreshTokenMapper.cs (100%)
create mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Token/StaticJwtVerificationKeyProvider.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/Token/UAuthJwtValidator.cs
delete mode 100644 src/CodeBeam.UltimateAuth.Server/Infrastructure/UAuthJwtValidator.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Options/GrantDeliveryOptions.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Options/UAuthCorsOptionsSetup.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Options/UAuthCrypthographyOptions.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Options/UAuthGrantDeliveryOptions.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Options/UAuthJwtValidationOptions.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Options/UAuthRedirectOptions.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthCrypthographyOptionsValidator.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceApiAuthModeProvider.cs
create mode 100644 src/CodeBeam.UltimateAuth.Server/Services/PureJwtLogoutService.cs
rename src/client/CodeBeam.UltimateAuth.Client/Options/{UAuthClientProfileDetector.cs => UAuthApplicationProfileDetector.cs} (70%)
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Integration/PureJwtIdentityTests.cs
rename tests/CodeBeam.UltimateAuth.Tests.Unit/Client/{ClientProfileTests.cs => ApplicationProfileTests.cs} (62%)
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestHostEnvironment.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ConfiguredJwtVerificationKeyProviderTests.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceApiAuthModeTests.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceUserAccessorTests.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/JwtPayloadGuardTests.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/PureJwtDevicePolicyTests.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/PureJwtSnapshotFactoryTests.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/StaticJwtVerificationKeyProviderTests.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthCrypthographyOptionsValidatorTests.cs
create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthJwtValidatorTests.cs
diff --git a/README.md b/README.md
index 48349343..73d4890f 100644
--- a/README.md
+++ b/README.md
@@ -92,7 +92,7 @@ UltimateAuth eliminates fragmentation by handling client differences internally
Built-in capabilities designed for real-world scenarios:
-- Automatic client profile detection (blazor server - WASM - MAUI)
+- Automatic application profile detection (blazor server - WASM - MAUI)
- Selectable authentication modes (Session / Token / Hybrid / SemiHybrid)
- Device-aware sessions
- PKCE flows out of the box
@@ -251,6 +251,32 @@ Change `Components/Pages/Home.razor`:
Welcome, @AuthState?.Identity?.DisplayName!
```
+### Note: Cryptographic Key Configuration
+
+UltimateAuth provides development-only cryptographic defaults for local testing. Applications can run without explicitly configuring keys in development, but **production deployments require securely configured cryptographic keys**.
+
+Generate independent, cryptographically secure keys (at least 32 random bytes each, Base64-encoded) and store them using environment variables or a trusted secret manager.
+
+```csharp
+builder.Services.AddUltimateAuthServer(options =>
+{
+ options.Cryptography.TokenHashingKey =
+ builder.Configuration["UltimateAuth:Cryptography:TokenHashingKey"]
+ ?? throw new InvalidOperationException("Token hashing key is missing.");
+
+ options.Cryptography.JwtSigningKey =
+ builder.Configuration["UltimateAuth:Cryptography:JwtSigningKey"]
+ ?? throw new InvalidOperationException("JWT signing key is missing.");
+});
+```
+
+- **TokenHashingKey:** Protects server-managed token hashes, including opaque and refresh-token material.
+- **JwtSigningKey:** Signs JWT access tokens for JWT-enabled authentication modes.
+
+Never use development keys in production, commit cryptographic secrets to source control, or reuse the same key for both purposes.
+
+For detailed configuration instructions, see the [QuickStart](https://ultimateauth.com/docs/getting-started/quickstart) and [Real-World Setup](https://ultimateauth.com/docs/getting-started/real-world-setup) guides.
+
The examples above provide a simplified overview of UltimateAuth integration and are not intended to be a complete, copy-paste-ready application.
For a **complete, step-by-step setup with all required configuration, components, and sample data**, follow the full Quick Start guide.
diff --git a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261118160941_004_PureJwtRefreshToken.Designer.cs b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261118160941_004_PureJwtRefreshToken.Designer.cs
new file mode 100644
index 00000000..fc9747f3
--- /dev/null
+++ b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Migrations/20261118160941_004_PureJwtRefreshToken.Designer.cs
@@ -0,0 +1,793 @@
+//
+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("20261118160941_004_PureJwtRefreshToken")]
+ partial class _004_PureJwtRefreshToken
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "10.0.14")
+ .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");
+
+ b.HasIndex("Tenant", "UserKey", "Scope", "CredentialType")
+ .IsUnique();
+
+ NpgsqlIndexBuilderExtensions.AreNullsDistinct(b.HasIndex("Tenant", "UserKey", "Scope", "CredentialType"), false);
+
+ b.ToTable("UAuth_Authentication", (string)null);
+ });
+
+ 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", (string)null);
+ });
+
+ 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", (string)null);
+ });
+
+ 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", (string)null);
+ });
+
+ 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", (string)null);
+ });
+
+ 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", (string)null);
+ });
+
+ modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionChainProjection", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("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", (string)null);
+ });
+
+ modelBuilder.Entity("CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.SessionProjection", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ChainId")
+ .HasColumnType("uuid");
+
+ b.Property("Claims")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Device")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("ExpiresAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property