From 170e7a414469ceb4b9aaeb200b97914ff93781bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Mon, 30 Nov 2026 15:48:26 +0300 Subject: [PATCH 1/3] product(Refactor): Align Configuration, Domain and Contract Ownership --- .../Credential/ICredentialSessionPolicy.cs | 2 +- .../Principals}/CredentialChangeReason.cs | 2 +- .../Principals}/CredentialSessionBehavior.cs | 2 +- .../UAuthApplicationProfile.cs | 2 +- .../Authority/DeviceRequiredInvariant.cs | 2 +- .../Auth/ApplicationProfileReader.cs | 1 + .../Auth/Context/AuthFlowContext.cs | 1 + .../Auth/EffectiveServerOptionsProvider.cs | 1 + .../Auth/IApplicationProfileReader.cs | 2 +- .../Response/AuthModeResolutionContext.cs | 3 ++- .../Auth/Response/AuthResponseResolver.cs | 26 ++++++------------- .../Response/EffectiveAuthModeResolver.cs | 2 +- .../Auth/Response/EffectiveGrantDelivery.cs | 2 +- .../GrantDeliveryCollisionValidator.cs | 2 +- .../UAuthResourceAuthenticationHandler.cs | 1 + .../ResourceAccessContextBuilder.cs | 1 + .../Domain}/GrantDeliveryMode.cs | 2 +- .../Domain}/HeaderTokenFormat.cs | 2 +- .../Endpoints/LoginEndpointHandler.cs | 2 +- .../Endpoints/LogoutEndpointHandler.cs | 1 + .../Endpoints/PkceEndpointHandler.cs | 1 + .../Endpoints/UAuthLoginTransportEndpoint.cs | 4 +-- .../Cookies/UAuthCookiePolicyBuilder.cs | 2 +- .../Credentials/CredentialResponseWriter.cs | 1 + .../Credentials/GrantCredentialReader.cs | 4 +-- .../UAuthCredentialSessionPolicy.cs | 2 +- .../Credentials/UAuthHeaderPolicyBuilder.cs | 4 +-- .../Options/CredentialResponseOptions.cs | 1 + .../Options/GrantDeliveryOptions.cs | 2 +- .../UAuthCredentialSessionPolicyOptions.cs | 2 +- .../Options/UAuthGrantDeliveryOptions.cs | 2 +- .../Options/UAuthResourceApiOptions.cs | 1 + .../Options/UAuthServerOptions.cs | 1 + .../ResourceApiAuthModeProvider.cs | 1 + .../ResourceApi/ResourceSessionIdResolver.cs | 2 +- .../Security/UAuthCsrfGrantInspector.cs | 4 +-- .../IApplicationProfileDetector.cs | 4 ++- .../Infrastructure/ClientLoginCapabilities.cs | 2 +- .../UAuthApplicationProfileDetector.cs | 3 ++- .../Options/UAuthClientOptions.cs | 2 +- .../Options/UAuthOptionsPostConfigure.cs | 5 ++-- .../Validators/UAuthClientOptionsValidator.cs | 2 +- .../Services/CredentialManagementService.cs | 1 - .../CredentialManagementTests.cs | 2 -- .../Infrastructure/AuthServerFactory.cs | 1 + .../LoginTests.cs | 1 + .../PureJwtIdentityTests.cs | 1 + .../RefreshTests.cs | 1 + .../ResourceApi/ResourceApiTestHost.cs | 1 + .../Client/ApplicationProfileTests.cs | 3 ++- .../Client/Blazor/UAuthRequestClientTests.cs | 2 +- .../Client/ClientOptionsValidatorTests.cs | 2 +- .../CredentialManagementServiceTests.cs | 1 - .../Helpers/TestHttpContext.cs | 2 +- .../Helpers/TestPkceFactory.cs | 4 +-- .../ResourceApi/ResourceApiAuthModeTests.cs | 1 + .../ResourceSessionIdResolverTests.cs | 1 + .../UAuthResourceApiOptionsTests.cs | 1 + .../UAuthResourceApiOptionsValidatorTests.cs | 2 ++ .../Security/UAuthCsrfGrantInspectorTests.cs | 2 +- .../Security/UAuthCsrfPolicyEvaluatorTests.cs | 1 + .../Server/AuthResponseResolverTests.cs | 3 ++- .../Server/CookieInfrastructureTests.cs | 1 + .../Server/CredentialInfrastructureTests.cs | 1 + .../Server/CredentialResponseWriterTests.cs | 1 + .../Server/EffectiveAuthModeResolverTests.cs | 2 +- .../EffectiveServerOptionsProviderTests.cs | 2 +- .../Server/GrantCredentialReaderTests.cs | 1 + .../GrantDeliveryCollisionValidatorTests.cs | 1 + .../Server/LoginEndpointHandlerTests.cs | 1 + .../Server/PkceEndpointHandlerTests.cs | 1 + .../Server/RefreshTokenResolverTests.cs | 1 + .../TransportCredentialResolverTests.cs | 1 + .../UAuthLoginTransportEndpointTests.cs | 2 +- .../UAuthResourceAccessOrchestratorTests.cs | 1 + ...UAuthResourceAuthenticationHandlerTests.cs | 1 + .../Sessions/SessionIdResolverTests.cs | 1 + 77 files changed, 95 insertions(+), 67 deletions(-) rename src/CodeBeam.UltimateAuth.Core/{Options => Domain/Principals}/CredentialChangeReason.cs (67%) rename src/CodeBeam.UltimateAuth.Core/{Options/Validators => Domain/Principals}/CredentialSessionBehavior.cs (68%) rename src/CodeBeam.UltimateAuth.Core/{Options => Domain}/UAuthApplicationProfile.cs (98%) rename src/{CodeBeam.UltimateAuth.Core/Options => CodeBeam.UltimateAuth.Server/Domain}/GrantDeliveryMode.cs (92%) rename src/{CodeBeam.UltimateAuth.Core/Options => CodeBeam.UltimateAuth.Server/Domain}/HeaderTokenFormat.cs (56%) rename src/{CodeBeam.UltimateAuth.Core/Options => client/CodeBeam.UltimateAuth.Client/Abstractions}/IApplicationProfileDetector.cs (53%) diff --git a/src/CodeBeam.UltimateAuth.Core/Abstractions/Credential/ICredentialSessionPolicy.cs b/src/CodeBeam.UltimateAuth.Core/Abstractions/Credential/ICredentialSessionPolicy.cs index 6c48f9ab..0d3753fd 100644 --- a/src/CodeBeam.UltimateAuth.Core/Abstractions/Credential/ICredentialSessionPolicy.cs +++ b/src/CodeBeam.UltimateAuth.Core/Abstractions/Credential/ICredentialSessionPolicy.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Core.Abstractions; diff --git a/src/CodeBeam.UltimateAuth.Core/Options/CredentialChangeReason.cs b/src/CodeBeam.UltimateAuth.Core/Domain/Principals/CredentialChangeReason.cs similarity index 67% rename from src/CodeBeam.UltimateAuth.Core/Options/CredentialChangeReason.cs rename to src/CodeBeam.UltimateAuth.Core/Domain/Principals/CredentialChangeReason.cs index da589672..3d18d6ef 100644 --- a/src/CodeBeam.UltimateAuth.Core/Options/CredentialChangeReason.cs +++ b/src/CodeBeam.UltimateAuth.Core/Domain/Principals/CredentialChangeReason.cs @@ -1,4 +1,4 @@ -namespace CodeBeam.UltimateAuth.Core.Options; +namespace CodeBeam.UltimateAuth.Core.Domain; public enum CredentialChangeReason { diff --git a/src/CodeBeam.UltimateAuth.Core/Options/Validators/CredentialSessionBehavior.cs b/src/CodeBeam.UltimateAuth.Core/Domain/Principals/CredentialSessionBehavior.cs similarity index 68% rename from src/CodeBeam.UltimateAuth.Core/Options/Validators/CredentialSessionBehavior.cs rename to src/CodeBeam.UltimateAuth.Core/Domain/Principals/CredentialSessionBehavior.cs index 6665f0ef..bebbf760 100644 --- a/src/CodeBeam.UltimateAuth.Core/Options/Validators/CredentialSessionBehavior.cs +++ b/src/CodeBeam.UltimateAuth.Core/Domain/Principals/CredentialSessionBehavior.cs @@ -1,4 +1,4 @@ -namespace CodeBeam.UltimateAuth.Core.Options; +namespace CodeBeam.UltimateAuth.Core.Domain; public enum CredentialSessionBehavior { diff --git a/src/CodeBeam.UltimateAuth.Core/Options/UAuthApplicationProfile.cs b/src/CodeBeam.UltimateAuth.Core/Domain/UAuthApplicationProfile.cs similarity index 98% rename from src/CodeBeam.UltimateAuth.Core/Options/UAuthApplicationProfile.cs rename to src/CodeBeam.UltimateAuth.Core/Domain/UAuthApplicationProfile.cs index deee586f..fff9dd06 100644 --- a/src/CodeBeam.UltimateAuth.Core/Options/UAuthApplicationProfile.cs +++ b/src/CodeBeam.UltimateAuth.Core/Domain/UAuthApplicationProfile.cs @@ -1,4 +1,4 @@ -namespace CodeBeam.UltimateAuth.Core.Options; +namespace CodeBeam.UltimateAuth.Core.Domain; /// /// Identifies the type of application participating in the UltimateAuth ecosystem. diff --git a/src/CodeBeam.UltimateAuth.Core/Infrastructure/Authority/DeviceRequiredInvariant.cs b/src/CodeBeam.UltimateAuth.Core/Infrastructure/Authority/DeviceRequiredInvariant.cs index 3b4fefe4..a0d38f96 100644 --- a/src/CodeBeam.UltimateAuth.Core/Infrastructure/Authority/DeviceRequiredInvariant.cs +++ b/src/CodeBeam.UltimateAuth.Core/Infrastructure/Authority/DeviceRequiredInvariant.cs @@ -1,6 +1,6 @@ using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Core.Infrastructure; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/ApplicationProfileReader.cs b/src/CodeBeam.UltimateAuth.Server/Auth/ApplicationProfileReader.cs index bcce7907..861707e0 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/ApplicationProfileReader.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/ApplicationProfileReader.cs @@ -1,4 +1,5 @@ using CodeBeam.UltimateAuth.Core.Defaults; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Extensions; using Microsoft.AspNetCore.Http; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContext.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContext.cs index aa02942e..0ddfb246 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContext.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContext.cs @@ -3,6 +3,7 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/EffectiveServerOptionsProvider.cs b/src/CodeBeam.UltimateAuth.Server/Auth/EffectiveServerOptionsProvider.cs index 8758a3c1..4a4818cc 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/EffectiveServerOptionsProvider.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/EffectiveServerOptionsProvider.cs @@ -1,4 +1,5 @@ using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/IApplicationProfileReader.cs b/src/CodeBeam.UltimateAuth.Server/Auth/IApplicationProfileReader.cs index 787b30c0..61807b02 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/IApplicationProfileReader.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/IApplicationProfileReader.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Core.Domain; using Microsoft.AspNetCore.Http; namespace CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthModeResolutionContext.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthModeResolutionContext.cs index 0c8145bb..57d9e718 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthModeResolutionContext.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthModeResolutionContext.cs @@ -1,4 +1,5 @@ -using CodeBeam.UltimateAuth.Core.MultiTenancy; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Core.Options; using Microsoft.AspNetCore.Http; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseResolver.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseResolver.cs index 97f68edc..e97acce7 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseResolver.cs @@ -1,9 +1,8 @@ using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Options; -using Microsoft.Extensions.Options; using Microsoft.Net.Http.Headers; namespace CodeBeam.UltimateAuth.Server.Auth; @@ -96,11 +95,9 @@ private static EffectiveGrantDelivery ResolveGrant( { if (!available) { - if (configured.Mode is not null && - configured.Mode != GrantDeliveryMode.None) + if (configured.Mode is not null && configured.Mode != GrantDeliveryMode.None) { - throw new InvalidOperationException( - $"Grant '{kind}' is not available in the selected authentication mode."); + throw new InvalidOperationException($"Grant '{kind}' is not available in the selected authentication mode."); } return EffectiveGrantDelivery.Disabled(kind); @@ -130,8 +127,7 @@ private static EffectiveGrantDelivery ResolveGrant( if (mode == GrantDeliveryMode.Body) { - throw new NotSupportedException( - $"Body grant delivery is not supported for '{kind}'."); + throw new NotSupportedException($"Body grant delivery is not supported for '{kind}'."); } var cookie = mode == GrantDeliveryMode.Cookie @@ -140,8 +136,7 @@ private static EffectiveGrantDelivery ResolveGrant( GrantKind.Session => server.Cookie.Session, GrantKind.AccessToken => server.Cookie.AccessToken, GrantKind.RefreshToken => server.Cookie.RefreshToken, - _ => throw new InvalidOperationException( - $"Unsupported grant kind '{kind}'.") + _ => throw new InvalidOperationException($"Unsupported grant kind '{kind}'.") } : null; @@ -149,15 +144,11 @@ private static EffectiveGrantDelivery ResolveGrant( { try { - _ = new SetCookieHeaderValue( - cookie.Name, - "validation").ToString(); + _ = new SetCookieHeaderValue(cookie.Name, "validation").ToString(); } catch (ArgumentException ex) { - throw new InvalidOperationException( - $"Invalid cookie name '{cookie.Name}' for grant '{kind}'.", - ex); + throw new InvalidOperationException($"Invalid cookie name '{cookie.Name}' for grant '{kind}'.", ex); } } @@ -166,8 +157,7 @@ private static EffectiveGrantDelivery ResolveGrant( GrantKind.Session => "uas", GrantKind.AccessToken => "uat", GrantKind.RefreshToken => "uar", - _ => throw new InvalidOperationException( - $"Unsupported grant kind '{kind}'.") + _ => throw new InvalidOperationException($"Unsupported grant kind '{kind}'.") }; var headerFormat = configured.HeaderFormat ?? HeaderTokenFormat.Bearer; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveAuthModeResolver.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveAuthModeResolver.cs index d5ca7692..076d86c2 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveAuthModeResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveAuthModeResolver.cs @@ -1,5 +1,5 @@ using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveGrantDelivery.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveGrantDelivery.cs index 86deb9b6..b433395b 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveGrantDelivery.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveGrantDelivery.cs @@ -1,6 +1,6 @@ using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Options; namespace CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/GrantDeliveryCollisionValidator.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/GrantDeliveryCollisionValidator.cs index 7f7284c3..13978318 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/GrantDeliveryCollisionValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/GrantDeliveryCollisionValidator.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Domain; namespace CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs index 231230f6..50f2f4af 100644 --- a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs @@ -7,6 +7,7 @@ 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; diff --git a/src/CodeBeam.UltimateAuth.Server/Authorization/AspNetCore/ResourceAccessContextBuilder.cs b/src/CodeBeam.UltimateAuth.Server/Authorization/AspNetCore/ResourceAccessContextBuilder.cs index 804137ee..270d45cc 100644 --- a/src/CodeBeam.UltimateAuth.Server/Authorization/AspNetCore/ResourceAccessContextBuilder.cs +++ b/src/CodeBeam.UltimateAuth.Server/Authorization/AspNetCore/ResourceAccessContextBuilder.cs @@ -2,6 +2,7 @@ using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Core.Runtime; using CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Core/Options/GrantDeliveryMode.cs b/src/CodeBeam.UltimateAuth.Server/Domain/GrantDeliveryMode.cs similarity index 92% rename from src/CodeBeam.UltimateAuth.Core/Options/GrantDeliveryMode.cs rename to src/CodeBeam.UltimateAuth.Server/Domain/GrantDeliveryMode.cs index e2d1e7a5..a955a20d 100644 --- a/src/CodeBeam.UltimateAuth.Core/Options/GrantDeliveryMode.cs +++ b/src/CodeBeam.UltimateAuth.Server/Domain/GrantDeliveryMode.cs @@ -1,4 +1,4 @@ -namespace CodeBeam.UltimateAuth.Core.Options; +namespace CodeBeam.UltimateAuth.Server.Domain; /// /// Defines how an issued authentication grant is delivered to the client in an HTTP response. diff --git a/src/CodeBeam.UltimateAuth.Core/Options/HeaderTokenFormat.cs b/src/CodeBeam.UltimateAuth.Server/Domain/HeaderTokenFormat.cs similarity index 56% rename from src/CodeBeam.UltimateAuth.Core/Options/HeaderTokenFormat.cs rename to src/CodeBeam.UltimateAuth.Server/Domain/HeaderTokenFormat.cs index 85b9c8ce..42fdd5de 100644 --- a/src/CodeBeam.UltimateAuth.Core/Options/HeaderTokenFormat.cs +++ b/src/CodeBeam.UltimateAuth.Server/Domain/HeaderTokenFormat.cs @@ -1,4 +1,4 @@ -namespace CodeBeam.UltimateAuth.Core.Options; +namespace CodeBeam.UltimateAuth.Server.Domain; public enum HeaderTokenFormat { diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/LoginEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/LoginEndpointHandler.cs index 84db0de1..6cccc125 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/LoginEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/LoginEndpointHandler.cs @@ -1,9 +1,9 @@ using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Flows; using CodeBeam.UltimateAuth.Server.Infrastructure; diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs index 21095273..92335de3 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs @@ -5,6 +5,7 @@ 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; diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/PkceEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/PkceEndpointHandler.cs index 758a4e2b..4a7ddbc5 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/PkceEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/PkceEndpointHandler.cs @@ -6,6 +6,7 @@ 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.Flows; using CodeBeam.UltimateAuth.Server.Infrastructure; diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/UAuthLoginTransportEndpoint.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/UAuthLoginTransportEndpoint.cs index 89684d38..d8be8510 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/UAuthLoginTransportEndpoint.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/UAuthLoginTransportEndpoint.cs @@ -1,5 +1,5 @@ -using CodeBeam.UltimateAuth.Core.Options; -using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using Microsoft.AspNetCore.Http; namespace CodeBeam.UltimateAuth.Server.Endpoints; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/UAuthCookiePolicyBuilder.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/UAuthCookiePolicyBuilder.cs index e7ff44a7..822ed714 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/UAuthCookiePolicyBuilder.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/UAuthCookiePolicyBuilder.cs @@ -1,7 +1,7 @@ using CodeBeam.UltimateAuth.Core; 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; using Microsoft.AspNetCore.Http; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/CredentialResponseWriter.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/CredentialResponseWriter.cs index 093f8638..ae510830 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/CredentialResponseWriter.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/CredentialResponseWriter.cs @@ -3,6 +3,7 @@ using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using Microsoft.AspNetCore.Http; namespace CodeBeam.UltimateAuth.Server.Infrastructure; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/GrantCredentialReader.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/GrantCredentialReader.cs index be6b8f25..a06eab25 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/GrantCredentialReader.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/GrantCredentialReader.cs @@ -1,5 +1,5 @@ -using CodeBeam.UltimateAuth.Core.Options; -using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using Microsoft.AspNetCore.Http; namespace CodeBeam.UltimateAuth.Server.Infrastructure; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthCredentialSessionPolicy.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthCredentialSessionPolicy.cs index d5dcfbd9..b62131d6 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthCredentialSessionPolicy.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthCredentialSessionPolicy.cs @@ -1,5 +1,5 @@ using CodeBeam.UltimateAuth.Core.Abstractions; -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Options; using Microsoft.Extensions.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthHeaderPolicyBuilder.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthHeaderPolicyBuilder.cs index 75ca8e08..7e678d21 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthHeaderPolicyBuilder.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/UAuthHeaderPolicyBuilder.cs @@ -1,5 +1,5 @@ -using CodeBeam.UltimateAuth.Core.Options; -using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; namespace CodeBeam.UltimateAuth.Server.Infrastructure; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/CredentialResponseOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/CredentialResponseOptions.cs index 25f2d92b..2ca502b8 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/CredentialResponseOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/CredentialResponseOptions.cs @@ -1,6 +1,7 @@ using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Domain; namespace CodeBeam.UltimateAuth.Server.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/GrantDeliveryOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/GrantDeliveryOptions.cs index a32494a9..f529170c 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/GrantDeliveryOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/GrantDeliveryOptions.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Domain; namespace CodeBeam.UltimateAuth.Server.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthCredentialSessionPolicyOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthCredentialSessionPolicyOptions.cs index b495a0f0..58c0935e 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthCredentialSessionPolicyOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthCredentialSessionPolicyOptions.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Server.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthGrantDeliveryOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthGrantDeliveryOptions.cs index 83413f23..e8e6ad92 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthGrantDeliveryOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthGrantDeliveryOptions.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Domain; namespace CodeBeam.UltimateAuth.Server.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs index 32134b39..e37af318 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs @@ -1,6 +1,7 @@ using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Domain; namespace CodeBeam.UltimateAuth.Server.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs index 2834d79c..e5204efd 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs @@ -1,4 +1,5 @@ using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Events; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Credentials.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceApiAuthModeProvider.cs b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceApiAuthModeProvider.cs index 8ef80d4e..7321b6ed 100644 --- a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceApiAuthModeProvider.cs +++ b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceApiAuthModeProvider.cs @@ -1,4 +1,5 @@ using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSessionIdResolver.cs b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSessionIdResolver.cs index 6cb188bb..63b302fc 100644 --- a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSessionIdResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSessionIdResolver.cs @@ -1,8 +1,8 @@ using CodeBeam.UltimateAuth.Core; 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; using CodeBeam.UltimateAuth.Server.ResourceApi; using Microsoft.AspNetCore.Http; diff --git a/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfGrantInspector.cs b/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfGrantInspector.cs index d4e05485..6cd07c67 100644 --- a/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfGrantInspector.cs +++ b/src/CodeBeam.UltimateAuth.Server/Security/UAuthCsrfGrantInspector.cs @@ -1,5 +1,5 @@ -using CodeBeam.UltimateAuth.Core.Options; -using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; namespace CodeBeam.UltimateAuth.Server.Security; diff --git a/src/CodeBeam.UltimateAuth.Core/Options/IApplicationProfileDetector.cs b/src/client/CodeBeam.UltimateAuth.Client/Abstractions/IApplicationProfileDetector.cs similarity index 53% rename from src/CodeBeam.UltimateAuth.Core/Options/IApplicationProfileDetector.cs rename to src/client/CodeBeam.UltimateAuth.Client/Abstractions/IApplicationProfileDetector.cs index 7d0799e5..bbac2c1a 100644 --- a/src/CodeBeam.UltimateAuth.Core/Options/IApplicationProfileDetector.cs +++ b/src/client/CodeBeam.UltimateAuth.Client/Abstractions/IApplicationProfileDetector.cs @@ -1,4 +1,6 @@ -namespace CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Core.Domain; + +namespace CodeBeam.UltimateAuth.Client.Abstractions; public interface IApplicationProfileDetector { diff --git a/src/client/CodeBeam.UltimateAuth.Client/Infrastructure/ClientLoginCapabilities.cs b/src/client/CodeBeam.UltimateAuth.Client/Infrastructure/ClientLoginCapabilities.cs index c6ab6fc0..2036eea7 100644 --- a/src/client/CodeBeam.UltimateAuth.Client/Infrastructure/ClientLoginCapabilities.cs +++ b/src/client/CodeBeam.UltimateAuth.Client/Infrastructure/ClientLoginCapabilities.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Client.Infrastructure; diff --git a/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthApplicationProfileDetector.cs b/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthApplicationProfileDetector.cs index 4d9a7340..75cf5e4c 100644 --- a/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthApplicationProfileDetector.cs +++ b/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthApplicationProfileDetector.cs @@ -1,4 +1,5 @@ -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Client.Abstractions; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Runtime; using Microsoft.Extensions.DependencyInjection; diff --git a/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthClientOptions.cs b/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthClientOptions.cs index 63ff7006..1105910b 100644 --- a/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthClientOptions.cs +++ b/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthClientOptions.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Client.Options; diff --git a/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthOptionsPostConfigure.cs b/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthOptionsPostConfigure.cs index 03b4be19..2f0ae98a 100644 --- a/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthOptionsPostConfigure.cs +++ b/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthOptionsPostConfigure.cs @@ -1,5 +1,6 @@ -using CodeBeam.UltimateAuth.Client.Options; -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Client.Abstractions; +using CodeBeam.UltimateAuth.Client.Options; +using CodeBeam.UltimateAuth.Core.Domain; using Microsoft.Extensions.Options; namespace CodeBeam.UltimateAuth.Client.Infrastructure; diff --git a/src/client/CodeBeam.UltimateAuth.Client/Options/Validators/UAuthClientOptionsValidator.cs b/src/client/CodeBeam.UltimateAuth.Client/Options/Validators/UAuthClientOptionsValidator.cs index f10bf720..c0c8c119 100644 --- a/src/client/CodeBeam.UltimateAuth.Client/Options/Validators/UAuthClientOptionsValidator.cs +++ b/src/client/CodeBeam.UltimateAuth.Client/Options/Validators/UAuthClientOptionsValidator.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Core.Domain; using Microsoft.Extensions.Options; namespace CodeBeam.UltimateAuth.Client.Options; diff --git a/src/credentials/CodeBeam.UltimateAuth.Credentials.Reference/Services/CredentialManagementService.cs b/src/credentials/CodeBeam.UltimateAuth.Credentials.Reference/Services/CredentialManagementService.cs index d6c419a1..532c45e0 100644 --- a/src/credentials/CodeBeam.UltimateAuth.Credentials.Reference/Services/CredentialManagementService.cs +++ b/src/credentials/CodeBeam.UltimateAuth.Credentials.Reference/Services/CredentialManagementService.cs @@ -3,7 +3,6 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Errors; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Credentials.Contracts; using CodeBeam.UltimateAuth.Credentials.Options; using CodeBeam.UltimateAuth.Credentials.Policies; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/CredentialManagementTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/CredentialManagementTests.cs index 1075fc27..fb057a92 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/CredentialManagementTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/CredentialManagementTests.cs @@ -2,7 +2,6 @@ using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Credentials; using CodeBeam.UltimateAuth.Credentials.Contracts; using CodeBeam.UltimateAuth.Credentials.Reference; @@ -13,7 +12,6 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using System.Collections.Concurrent; using System.Net; -using System.Net.Http.Json; using System.Text.Json; namespace CodeBeam.UltimateAuth.Tests.Integration; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/Infrastructure/AuthServerFactory.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/Infrastructure/AuthServerFactory.cs index 5dfb4dbd..98145c0c 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/Infrastructure/AuthServerFactory.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/Infrastructure/AuthServerFactory.cs @@ -6,6 +6,7 @@ using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Credentials.Contracts; using CodeBeam.UltimateAuth.Credentials.Reference; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Users.Contracts; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/LoginTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/LoginTests.cs index 586aac5b..aef73e3d 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/LoginTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/LoginTests.cs @@ -3,6 +3,7 @@ using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Tests.Integration.Infrastructure; using CodeBeam.UltimateAuth.Users.Contracts; using Microsoft.AspNetCore.Mvc.Testing; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/PureJwtIdentityTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/PureJwtIdentityTests.cs index 6b486ce4..fce7226f 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/PureJwtIdentityTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/PureJwtIdentityTests.cs @@ -9,6 +9,7 @@ using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Contracts; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Infrastructure; using Microsoft.AspNetCore.Authorization; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs index 6f728bf9..fd510186 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs @@ -5,6 +5,7 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Tests.Integration.Infrastructure; using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.Extensions.DependencyInjection; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/ResourceApi/ResourceApiTestHost.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/ResourceApi/ResourceApiTestHost.cs index 5216c20a..94f800d3 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/ResourceApi/ResourceApiTestHost.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/ResourceApi/ResourceApiTestHost.cs @@ -5,6 +5,7 @@ using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Options; using Microsoft.AspNetCore.Builder; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/ApplicationProfileTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/ApplicationProfileTests.cs index 8adc9e09..02c59f09 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/ApplicationProfileTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/ApplicationProfileTests.cs @@ -1,10 +1,11 @@ using CodeBeam.UltimateAuth.Client.Infrastructure; using CodeBeam.UltimateAuth.Client.Options; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Core.Runtime; using AwesomeAssertions; using Microsoft.Extensions.DependencyInjection; using Moq; +using CodeBeam.UltimateAuth.Client.Abstractions; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Tests.Unit; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/Blazor/UAuthRequestClientTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/Blazor/UAuthRequestClientTests.cs index bc2ddf01..22ca5016 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/Blazor/UAuthRequestClientTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/Blazor/UAuthRequestClientTests.cs @@ -6,11 +6,11 @@ using CodeBeam.UltimateAuth.Client.Errors; using CodeBeam.UltimateAuth.Client.Infrastructure; using CodeBeam.UltimateAuth.Client.Options; -using CodeBeam.UltimateAuth.Core.Options; using Microsoft.AspNetCore.Components; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Moq; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Tests.Unit.Client.Blazor; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/ClientOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/ClientOptionsValidatorTests.cs index e950122b..9621cb22 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/ClientOptionsValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/ClientOptionsValidatorTests.cs @@ -1,8 +1,8 @@ using CodeBeam.UltimateAuth.Client.Options; -using CodeBeam.UltimateAuth.Core.Options; using AwesomeAssertions; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Tests.Unit; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Credentials/CredentialManagementServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Credentials/CredentialManagementServiceTests.cs index 8427276b..20da1480 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Credentials/CredentialManagementServiceTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Credentials/CredentialManagementServiceTests.cs @@ -6,7 +6,6 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Errors; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Core.Security; using CodeBeam.UltimateAuth.Credentials; using CodeBeam.UltimateAuth.Credentials.Contracts; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestHttpContext.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestHttpContext.cs index e083f35d..f2aaa7d6 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestHttpContext.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestHttpContext.cs @@ -1,6 +1,6 @@ using CodeBeam.UltimateAuth.Core.Defaults; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using Microsoft.AspNetCore.Http; namespace CodeBeam.UltimateAuth.Tests.Unit.Helpers; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestPkceFactory.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestPkceFactory.cs index 9aebbd0b..0137dcf1 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestPkceFactory.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestPkceFactory.cs @@ -1,6 +1,6 @@ -using CodeBeam.UltimateAuth.Core.Infrastructure; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Infrastructure; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Flows; using CodeBeam.UltimateAuth.Server.Stores; using System.Security.Cryptography; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceApiAuthModeTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceApiAuthModeTests.cs index 32d36de3..ad9e1af8 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceApiAuthModeTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceApiAuthModeTests.cs @@ -10,6 +10,7 @@ using Microsoft.Extensions.Options; using Moq; using Microsoft.IdentityModel.Tokens; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Tests.Unit.Server.ResourceApi; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceSessionIdResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceSessionIdResolverTests.cs index 046a07a4..2cf6788f 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceSessionIdResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceSessionIdResolverTests.cs @@ -4,6 +4,7 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Server.ResourceApi; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs index 4b4258e1..486f9a51 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs @@ -1,6 +1,7 @@ using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Options; namespace CodeBeam.UltimateAuth.Tests.Unit.Server.ResourceApi; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs index 41b15a02..ed85ad4b 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs @@ -1,7 +1,9 @@ using CodeBeam.UltimateAuth.Core; 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; using Microsoft.Extensions.Options; using Moq; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfGrantInspectorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfGrantInspectorTests.cs index 34445fdc..ca8534cd 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfGrantInspectorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfGrantInspectorTests.cs @@ -1,8 +1,8 @@ using AwesomeAssertions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Security; namespace CodeBeam.UltimateAuth.Tests.Unit.Server; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfPolicyEvaluatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfPolicyEvaluatorTests.cs index c34e0502..ac0945c2 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfPolicyEvaluatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Security/UAuthCsrfPolicyEvaluatorTests.cs @@ -3,6 +3,7 @@ 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; using CodeBeam.UltimateAuth.Server.Security; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs index 55a83183..3d6d1966 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs @@ -1,6 +1,7 @@ using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Options; namespace CodeBeam.UltimateAuth.Tests.Unit.Server; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CookieInfrastructureTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CookieInfrastructureTests.cs index fb315b57..b64334e6 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CookieInfrastructureTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CookieInfrastructureTests.cs @@ -4,6 +4,7 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialInfrastructureTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialInfrastructureTests.cs index c5205c07..f119ce1b 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialInfrastructureTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialInfrastructureTests.cs @@ -3,6 +3,7 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using Microsoft.AspNetCore.Http; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialResponseWriterTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialResponseWriterTests.cs index 0c8758a4..3f8f50d2 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialResponseWriterTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CredentialResponseWriterTests.cs @@ -3,6 +3,7 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveAuthModeResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveAuthModeResolverTests.cs index 6c34f512..1045e300 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveAuthModeResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveAuthModeResolverTests.cs @@ -1,6 +1,6 @@ using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; namespace CodeBeam.UltimateAuth.Tests.Unit; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs index 2efe24a4..0d75edb6 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs @@ -1,8 +1,8 @@ using AwesomeAssertions; using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Options; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantCredentialReaderTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantCredentialReaderTests.cs index 3709a4f3..9a0ac369 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantCredentialReaderTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantCredentialReaderTests.cs @@ -3,6 +3,7 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using Microsoft.AspNetCore.Http; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantDeliveryCollisionValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantDeliveryCollisionValidatorTests.cs index 91daa699..2a4042c5 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantDeliveryCollisionValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/GrantDeliveryCollisionValidatorTests.cs @@ -3,6 +3,7 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Options; namespace CodeBeam.UltimateAuth.Tests.Unit.Server; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginEndpointHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginEndpointHandlerTests.cs index bdd4ba3f..7a26ae18 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginEndpointHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginEndpointHandlerTests.cs @@ -6,6 +6,7 @@ using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Endpoints; using CodeBeam.UltimateAuth.Server.Flows; using CodeBeam.UltimateAuth.Server.Infrastructure; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/PkceEndpointHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/PkceEndpointHandlerTests.cs index 88ee7af8..6025cc6e 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/PkceEndpointHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/PkceEndpointHandlerTests.cs @@ -5,6 +5,7 @@ using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Endpoints; using CodeBeam.UltimateAuth.Server.Flows; using CodeBeam.UltimateAuth.Server.Infrastructure; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenResolverTests.cs index ce0dc1a6..bddce4e1 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenResolverTests.cs @@ -4,6 +4,7 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Flows; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs index 6668c4ef..4a8e7035 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs @@ -7,6 +7,7 @@ using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthLoginTransportEndpointTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthLoginTransportEndpointTests.cs index a11ea35f..2d987485 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthLoginTransportEndpointTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthLoginTransportEndpointTests.cs @@ -2,8 +2,8 @@ using AwesomeAssertions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Endpoints; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; using Microsoft.AspNetCore.Http; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAccessOrchestratorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAccessOrchestratorTests.cs index 8e1c5755..044d59f7 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAccessOrchestratorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAccessOrchestratorTests.cs @@ -3,6 +3,7 @@ using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Errors; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Policies.Abstractions; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs index fd4e9d73..5eb14b01 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs @@ -11,6 +11,7 @@ using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Authentication; using CodeBeam.UltimateAuth.Server.Contracts; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Server.ResourceApi; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/SessionIdResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/SessionIdResolverTests.cs index 582b64a0..e568f08c 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/SessionIdResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/SessionIdResolverTests.cs @@ -4,6 +4,7 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Tests.Unit.Helpers; From ebc062e45fb0a3036b21edfa4624f8513ddc3fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Mon, 30 Nov 2026 22:36:56 +0300 Subject: [PATCH 2/3] Options and Validators Refactoring --- .../LabSessionDiagnosticsPolicyService.cs | 1 + .../CodeBeam.UltimateAuth.Core.csproj | 14 +- .../{Options => Domain}/UAuthMode.cs | 4 +- .../Extensions/ServiceCollectionExtensions.cs | 57 +----- .../CoreConfigurationIntentDetector.cs | 29 --- .../Options/UAuthOptions.cs | 55 ------ .../Options/UAuthOptionsPostConfigureGuard.cs | 38 ---- .../Validators/UAuthLoginOptionsValidator.cs | 24 --- .../UAuthMultiTenantOptionsValidator.cs | 42 ----- .../Validators/UAuthOptionsValidator.cs | 49 ------ .../Validators/UAuthPkceOptionsValidator.cs | 20 --- .../UAuthSessionOptionsValidator.cs | 97 ---------- .../Validators/UAuthTokenOptionsValidator.cs | 48 ----- .../Runtime/DirectCoreConfigurationMarker.cs | 15 -- .../Runtime/UAuthProductInfoProvider.cs | 6 +- .../IEffectiveServerOptionsProvider.cs | 4 +- .../Auth/Context/AuthFlowContext.cs | 3 +- .../Auth/Context/AuthFlowContextFactory.cs | 4 +- .../Auth/EffectiveServerOptionsProvider.cs | 4 +- .../Auth/EffectiveUAuthServerOptions.cs | 2 +- .../Auth/IPrimaryTokenResolver.cs | 3 +- .../Auth/PrimaryTokenResolver.cs | 3 +- .../Auth/Response/AuthResponseResolver.cs | 3 +- .../Response/EffectiveAuthModeResolver.cs | 3 +- .../Auth/Response/IAuthResponseResolver.cs | 3 +- .../Response/IEffectiveAuthModeResolver.cs | 2 +- .../AspNetCore/UAuthAuthenticationHandler.cs | 3 +- .../UAuthResourceAuthenticationHandler.cs | 3 +- .../UAuthStatusAuthorizationResultHandler.cs | 5 +- .../DeviceLimitBehavior.cs | 4 +- .../UAuthHubDeploymentMode.cs | 2 +- .../Endpoints/LogoutEndpointHandler.cs | 3 +- .../Endpoints/ValidateEndpointHandler.cs | 3 +- .../Extensions/ServiceCollectionExtensions.cs | 1 + .../UAuthServerOptionsExtensions.cs | 2 +- .../Flows/Refresh/RefreshResponsePolicy.cs | 3 +- .../Cookies/UAuthCookiePolicyBuilder.cs | 3 +- .../ITransportCredentialResolver.cs | 2 +- .../AspNetCore/TransportCredentialResolver.cs | 3 +- .../Issuers/UAuthSessionIssuer.cs | 4 +- .../Issuers/UAuthTokenIssuer.cs | 5 +- .../SessionId/SessionIdResolver.cs | 5 +- .../Infrastructure/User/UAuthUserAccessor.cs | 4 +- .../Options/Defaults/ConfigureDefaults.cs | 2 +- .../Options/UAuthDeviceLimitOptions.cs | 4 +- .../Options/UAuthLoginOptions.cs | 4 +- .../Options/UAuthPkceOptions.cs | 5 +- .../Options/UAuthResourceApiOptions.cs | 4 +- .../Options/UAuthServerOptions.cs | 4 +- .../Options/UAuthTokenOptions.cs | 2 +- .../UAuthResourceApiOptionsValidator.cs | 4 +- .../UAuthServerMultiTenantOptionsValidator.cs | 5 +- .../Validators/UAuthServerOptionsValidator.cs | 3 +- .../ResourceApiAuthModeProvider.cs | 3 +- .../ResourceApi/ResourceSessionIdResolver.cs | 3 +- .../Runtime/UAuthServerProductInfo.cs | 2 +- .../Services/PureJwtLogoutService.cs | 3 +- .../Services/RefreshFlowService.cs | 3 +- .../CodeBeam.UltimateAuth.Client.csproj | 21 ++- .../ClientConfigurationMarker.cs | 2 +- .../UAuthApplicationProfileDetector.cs | 2 +- .../UAuthOptionsPostConfigure.cs | 0 .../PasswordUserLifecycleIntegration.cs | 2 +- .../Services/CredentialManagementService.cs | 1 + ...sswordPolicyServiceCollectionExtensions.cs | 4 +- .../DeviceLimitPostgresTests.cs | 4 +- .../LoginTests.cs | 1 - .../RefreshTests.cs | 1 - .../ResourceApi/ResourceApiTestHost.cs | 4 +- .../Security/AntiforgeryCookiePolicyTests.cs | 2 +- .../UAuthServerStatusAuthorizationTests.cs | 2 +- .../Client/ClientOptionsValidatorTests.cs | 1 + .../Core/ConfigurationGuardsTests.cs | 166 ------------------ .../Core/CoreProductInfoTests.cs | 48 +---- .../Core/CoreRegistrationTests.cs | 89 ++++++++++ .../Core/OptionValidatorTests.cs | 70 -------- .../CredentialManagementServiceTests.cs | 1 + .../Helpers/AuthFlowTestFactory.cs | 3 +- .../Helpers/TestAuthModeResolver.cs | 3 +- .../Helpers/TestAuthRuntime.cs | 8 +- .../Helpers/TestServerOptions.cs | 2 +- .../ResourceApi/ResourceApiAuthModeTests.cs | 3 +- .../ResourceSessionIdResolverTests.cs | 1 - .../UAuthResourceApiOptionsTests.cs | 4 +- .../UAuthResourceApiOptionsValidatorTests.cs | 3 +- .../UAuthResourceApiRegistrationTests.cs | 1 - .../Server/AuthResponseResolverTests.cs | 3 +- .../Server/CookieInfrastructureTests.cs | 1 - .../Server/DeviceLimitOptionsTests.cs | 3 +- .../Server/EffectiveAuthModeResolverTests.cs | 3 +- .../EffectiveServerOptionsProviderTests.cs | 1 - .../Server/LoginOrchestratorTests.cs | 5 +- .../Server/LogoutEndpointHandlerTests.cs | 1 - .../Server/RedirectTests.cs | 4 +- .../Server/RefreshFlowServiceTests.cs | 3 +- .../Server/RefreshTokenResolverTests.cs | 1 - .../Server/ServerOptionsValidatorTests.cs | 3 +- .../TransportCredentialResolverTests.cs | 1 - .../Server/UAuthFlowServiceTests.cs | 3 +- ...UAuthResourceAuthenticationHandlerTests.cs | 1 - .../Server/UAuthServerProductInfoTests.cs | 1 + .../Server/ValidateEndpointHandlerTests.cs | 1 - .../Sessions/DeviceLimitAdmissionTests.cs | 4 +- .../Sessions/SessionIdResolverTests.cs | 2 +- .../Sessions/UAuthSessionIssuerTests.cs | 3 +- .../Tokens/UAuthTokenIssuerTests.cs | 3 +- 106 files changed, 230 insertions(+), 905 deletions(-) rename src/CodeBeam.UltimateAuth.Core/{Options => Domain}/UAuthMode.cs (90%) delete mode 100644 src/CodeBeam.UltimateAuth.Core/Options/CoreConfigurationIntentDetector.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Options/UAuthOptions.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Options/UAuthOptionsPostConfigureGuard.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthLoginOptionsValidator.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthMultiTenantOptionsValidator.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthOptionsValidator.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthPkceOptionsValidator.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthSessionOptionsValidator.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthTokenOptionsValidator.cs delete mode 100644 src/CodeBeam.UltimateAuth.Core/Runtime/DirectCoreConfigurationMarker.cs rename src/CodeBeam.UltimateAuth.Server/{Options => Abstractions}/IEffectiveServerOptionsProvider.cs (83%) rename src/CodeBeam.UltimateAuth.Server/{Options => Domain}/DeviceLimitBehavior.cs (85%) rename src/CodeBeam.UltimateAuth.Server/{Options => Domain}/UAuthHubDeploymentMode.cs (93%) rename src/{CodeBeam.UltimateAuth.Core => CodeBeam.UltimateAuth.Server}/Options/UAuthLoginOptions.cs (96%) rename src/{CodeBeam.UltimateAuth.Core => CodeBeam.UltimateAuth.Server}/Options/UAuthPkceOptions.cs (76%) rename src/{CodeBeam.UltimateAuth.Core => CodeBeam.UltimateAuth.Server}/Options/UAuthTokenOptions.cs (98%) rename src/client/CodeBeam.UltimateAuth.Client/{Options => Infrastructure}/ClientConfigurationMarker.cs (87%) rename src/client/CodeBeam.UltimateAuth.Client/{Options => Infrastructure}/UAuthApplicationProfileDetector.cs (96%) rename src/client/CodeBeam.UltimateAuth.Client/{Options => Infrastructure}/UAuthOptionsPostConfigure.cs (100%) delete mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Core/ConfigurationGuardsTests.cs create mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Core/CoreRegistrationTests.cs delete mode 100644 tests/CodeBeam.UltimateAuth.Tests.Unit/Core/OptionValidatorTests.cs diff --git a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Services/LabSessionDiagnosticsPolicyService.cs b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Services/LabSessionDiagnosticsPolicyService.cs index 734c852c..592fb970 100644 --- a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Services/LabSessionDiagnosticsPolicyService.cs +++ b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/Services/LabSessionDiagnosticsPolicyService.cs @@ -1,4 +1,5 @@ using CodeBeam.UltimateAuth.Client.Options; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Options; using Microsoft.Extensions.Options; diff --git a/src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj b/src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj index 3214552c..db07fb60 100644 --- a/src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj +++ b/src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj @@ -12,7 +12,7 @@ README.md - + + + + + + + + + + + + diff --git a/src/CodeBeam.UltimateAuth.Core/Options/UAuthMode.cs b/src/CodeBeam.UltimateAuth.Core/Domain/UAuthMode.cs similarity index 90% rename from src/CodeBeam.UltimateAuth.Core/Options/UAuthMode.cs rename to src/CodeBeam.UltimateAuth.Core/Domain/UAuthMode.cs index e9d3533b..92ce44da 100644 --- a/src/CodeBeam.UltimateAuth.Core/Options/UAuthMode.cs +++ b/src/CodeBeam.UltimateAuth.Core/Domain/UAuthMode.cs @@ -1,4 +1,4 @@ -namespace CodeBeam.UltimateAuth.Core; +namespace CodeBeam.UltimateAuth.Core.Domain; /// /// Defines the authentication execution model for UltimateAuth. @@ -34,7 +34,7 @@ public enum UAuthMode /// /// Pure JWT mode. - /// Fully stateless authentication. + /// Fully stateless authentication with stateful refresh. /// No session, no server-side lookup. /// Revocation only via token expiration. /// diff --git a/src/CodeBeam.UltimateAuth.Core/Extensions/ServiceCollectionExtensions.cs b/src/CodeBeam.UltimateAuth.Core/Extensions/ServiceCollectionExtensions.cs index 5cfc2f39..ed3c6aef 100644 --- a/src/CodeBeam.UltimateAuth.Core/Extensions/ServiceCollectionExtensions.cs +++ b/src/CodeBeam.UltimateAuth.Core/Extensions/ServiceCollectionExtensions.cs @@ -1,18 +1,15 @@ using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Infrastructure; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Core.Runtime; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.Extensions.Options; namespace CodeBeam.UltimateAuth.Core.Extensions; /// /// Provides extension methods for registering UltimateAuth core services into the application's dependency injection container. /// -/// These methods configure options, validators, converters, and factories required for the authentication subsystem. +/// These methods required for the authentication subsystem. /// /// IMPORTANT: /// This extension registers only CORE services — session stores, token factories, PKCE handlers, and any server-specific @@ -20,59 +17,11 @@ namespace CodeBeam.UltimateAuth.Core.Extensions; /// public static class ServiceCollectionExtensions { - public static IServiceCollection AddUltimateAuth(this IServiceCollection services, Action? configure = null) + public static IServiceCollection AddUltimateAuth(this IServiceCollection services) { ArgumentNullException.ThrowIfNull(services); - var optionsBuilder = services.AddOptions(); - - if (configure is not null) - { - optionsBuilder.Configure((options, marker) => - { - marker.MarkConfigured(); - configure(options); - }); - } - - optionsBuilder.BindConfiguration("UltimateAuth:Core"); - - services.TryAddSingleton>(sp => - { - var marker = sp.GetRequiredService(); - var config = sp.GetService(); - - return new CoreConfigurationIntentDetector(marker, config); - }); - - return services.AddUltimateAuthInternal(); - } - - /// - /// Internal shared registration pipeline invoked by all AddUltimateAuth overloads. - /// Registers validators, user ID converters, and placeholder factories. - /// Core-level invariant validation. - /// Server layer may add additional validators. - /// NOTE: - /// This method does not register session stores or server-side services. - /// A server project must explicitly call: - /// "services.AddUltimateAuthSessionStore'TStore'();" - /// to provide a concrete ISessionStore implementation. - /// - private static IServiceCollection AddUltimateAuthInternal(this IServiceCollection services) - { - services.TryAddSingleton(); - services.AddSingleton, UAuthOptionsPostConfigureGuard>(); - - - services.AddSingleton, UAuthOptionsValidator>(); - services.AddSingleton, UAuthSessionOptionsValidator>(); - services.AddSingleton, UAuthTokenOptionsValidator>(); - services.AddSingleton, UAuthLoginOptionsValidator>(); - services.AddSingleton, UAuthPkceOptionsValidator>(); - services.AddSingleton, UAuthMultiTenantOptionsValidator>(); - - services.AddSingleton(); + services.TryAddSingleton(); services.TryAddSingleton(); services.TryAddSingleton(); diff --git a/src/CodeBeam.UltimateAuth.Core/Options/CoreConfigurationIntentDetector.cs b/src/CodeBeam.UltimateAuth.Core/Options/CoreConfigurationIntentDetector.cs deleted file mode 100644 index 3a8e1265..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Options/CoreConfigurationIntentDetector.cs +++ /dev/null @@ -1,29 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Runtime; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Options; - -namespace CodeBeam.UltimateAuth.Core.Options; - -internal sealed class CoreConfigurationIntentDetector : IPostConfigureOptions -{ - private readonly DirectCoreConfigurationMarker _marker; - private readonly IConfiguration? _configuration; - - public CoreConfigurationIntentDetector(DirectCoreConfigurationMarker marker, IConfiguration? configuration) - { - _marker = marker; - _configuration = configuration; - } - - public void PostConfigure(string? name, UAuthOptions options) - { - if (_configuration is null) - return; - - var coreSection = _configuration.GetSection("UltimateAuth:Core"); - if (coreSection.Exists()) - { - _marker.MarkConfigured(); - } - } -} diff --git a/src/CodeBeam.UltimateAuth.Core/Options/UAuthOptions.cs b/src/CodeBeam.UltimateAuth.Core/Options/UAuthOptions.cs deleted file mode 100644 index 69702225..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Options/UAuthOptions.cs +++ /dev/null @@ -1,55 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Events; - -namespace CodeBeam.UltimateAuth.Core.Options; - -/// -/// Top-level configuration container for all UltimateAuth features. -/// Combines login policies, session lifecycle rules, token behavior, PKCE settings, multi-tenancy behavior, and user-id normalization. -/// -/// All sub-options are resolved from configuration (appsettings.json) or through inline setup in AddUltimateAuth(). -/// -public sealed class UAuthOptions -{ - public bool AllowDirectCoreConfiguration { get; set; } = false; - - /// - /// Configuration settings for interactive login flows, - /// including lockout thresholds and failed-attempt policies. - /// - public UAuthLoginOptions Login { get; set; } = new(); - - /// - /// Settings that control session creation, refresh behavior, - /// sliding expiration, idle timeouts, device limits, and chain rules. - /// - public UAuthSessionOptions Session { get; set; } = new(); - - /// - /// Token issuance configuration, including JWT and opaque token - /// generation, lifetimes, signing keys, and audience/issuer values. - /// - public UAuthTokenOptions Token { get; set; } = new(); - - /// - /// PKCE (Proof Key for Code Exchange) configuration used for - /// browser-based login flows and WASM authentication. - /// - public UAuthPkceOptions Pkce { get; set; } = new(); - - /// - /// Event hooks raised during authentication lifecycle events - /// such as login, logout, session creation, refresh, or revocation. - /// - public UAuthEvents Events { get; set; } = new(); - - /// - /// Multi-tenancy configuration controlling how tenants are resolved, - /// validated, and optionally enforced. - /// - public UAuthMultiTenantOptions MultiTenant { get; set; } = new(); - - /// - /// Pagination configuration for user queries, role listings, and other paged endpoints. - /// - public UAuthPaginationOptions Pagination { get; set; } = new(); -} diff --git a/src/CodeBeam.UltimateAuth.Core/Options/UAuthOptionsPostConfigureGuard.cs b/src/CodeBeam.UltimateAuth.Core/Options/UAuthOptionsPostConfigureGuard.cs deleted file mode 100644 index c6951f8d..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Options/UAuthOptionsPostConfigureGuard.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Runtime; -using Microsoft.Extensions.Options; - -namespace CodeBeam.UltimateAuth.Core.Options; - -internal sealed class UAuthOptionsPostConfigureGuard : IPostConfigureOptions -{ - private readonly DirectCoreConfigurationMarker _directConfigMarker; - private readonly IEnumerable _runtimeMarkers; - - public UAuthOptionsPostConfigureGuard(DirectCoreConfigurationMarker directConfigMarker, IEnumerable runtimeMarkers) - { - _directConfigMarker = directConfigMarker; - _runtimeMarkers = runtimeMarkers; - } - - public void PostConfigure(string? name, UAuthOptions options) - { - var hasServerRuntime = _runtimeMarkers.Any(); - - if (!_directConfigMarker.IsConfigured) - { - return; - } - - if (hasServerRuntime) - { - throw new InvalidOperationException("Direct core configuration is not allowed in server-hosted applications. " + - "Configure authentication policies via AddUltimateAuthServer instead."); - } - - if (!options.AllowDirectCoreConfiguration) - { - throw new InvalidOperationException("Direct core configuration is not allowed. " + - "Set AllowDirectCoreConfiguration = true only for advanced, non-server scenarios."); - } - } -} diff --git a/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthLoginOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthLoginOptionsValidator.cs deleted file mode 100644 index 727dcd1c..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthLoginOptionsValidator.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Microsoft.Extensions.Options; - -namespace CodeBeam.UltimateAuth.Core.Options; - -internal sealed class UAuthLoginOptionsValidator : IValidateOptions -{ - public ValidateOptionsResult Validate(string? name, UAuthLoginOptions options) - { - var errors = new List(); - - if (options.MaxFailedAttempts < 0) - errors.Add("Login.MaxFailedAttempts cannot be negative."); - - if (options.MaxFailedAttempts > 100) - errors.Add("Login.MaxFailedAttempts cannot exceed 100. Use 0 to disable lockout."); - - if (options.MaxFailedAttempts > 0 && options.LockoutDuration <= TimeSpan.Zero) - errors.Add("Login.LockoutMinutes must be greater than zero when lockout is enabled."); - - return errors.Count == 0 - ? ValidateOptionsResult.Success - : ValidateOptionsResult.Fail(errors); - } -} diff --git a/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthMultiTenantOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthMultiTenantOptionsValidator.cs deleted file mode 100644 index 762564d4..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthMultiTenantOptionsValidator.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.Extensions.Options; - -namespace CodeBeam.UltimateAuth.Core.Options; - -internal sealed class UAuthMultiTenantOptionsValidator : IValidateOptions -{ - public ValidateOptionsResult Validate(string? name, UAuthMultiTenantOptions options) - { - var errors = new List(); - - if (!options.Enabled) - { - if (options.EnableRoute || options.EnableHeader || options.EnableDomain) - { - errors.Add("Multi-tenancy is disabled, but one or more tenant resolvers are enabled. " + - "Either enable multi-tenancy or disable all tenant resolvers."); - } - - return errors.Count == 0 - ? ValidateOptionsResult.Success - : ValidateOptionsResult.Fail(errors); - } - - if (!options.EnableRoute && !options.EnableHeader && !options.EnableDomain) - { - errors.Add("Multi-tenancy is enabled but no tenant resolver is active. " + - "Enable at least one of: route, header or domain."); - } - - if (options.EnableHeader) - { - if (string.IsNullOrWhiteSpace(options.HeaderName)) - { - errors.Add("MultiTenant.HeaderName must be specified when header-based tenant resolution is enabled."); - } - } - - return errors.Count == 0 - ? ValidateOptionsResult.Success - : ValidateOptionsResult.Fail(errors); - } -} diff --git a/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthOptionsValidator.cs deleted file mode 100644 index 12119bb6..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthOptionsValidator.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.Extensions.Options; - -namespace CodeBeam.UltimateAuth.Core.Options; - -internal sealed class UAuthOptionsValidator : IValidateOptions -{ - public ValidateOptionsResult Validate(string? name, UAuthOptions options) - { - var errors = new List(); - - - if (options.Login is null) - errors.Add("UltimateAuth.Login configuration section is missing."); - - if (options.Session is null) - errors.Add("UltimateAuth.Session configuration section is missing."); - - if (options.Token is null) - errors.Add("UltimateAuth.Token configuration section is missing."); - - if (options.Pkce is null) - errors.Add("UltimateAuth.Pkce configuration section is missing."); - - if (options.Events is null) - errors.Add("UltimateAuth.Events configuration section is missing."); - - if (options.MultiTenant is null) - errors.Add("UltimateAuth.MultiTenant configuration section is missing."); - - if (errors.Count > 0) - return ValidateOptionsResult.Fail(errors); - - - // Only add cross-option validation beyond this point, individual options should validate in their own validators. - if (options.Token!.AccessTokenLifetime > options.Session!.MaxLifetime) - { - errors.Add("Token.AccessTokenLifetime cannot exceed Session.MaxLifetime."); - } - - if (options.Token.RefreshTokenLifetime > options.Session.MaxLifetime) - { - errors.Add("Token.RefreshTokenLifetime cannot exceed Session.MaxLifetime."); - } - - return errors.Count == 0 - ? ValidateOptionsResult.Success - : ValidateOptionsResult.Fail(errors); - } -} diff --git a/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthPkceOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthPkceOptionsValidator.cs deleted file mode 100644 index 4ee9c2ab..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthPkceOptionsValidator.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Extensions.Options; - -namespace CodeBeam.UltimateAuth.Core.Options; - -internal sealed class UAuthPkceOptionsValidator : IValidateOptions -{ - public ValidateOptionsResult Validate(string? name, UAuthPkceOptions options) - { - var errors = new List(); - - if (options.AuthorizationCodeLifetimeSeconds <= 0) - { - errors.Add("Pkce.AuthorizationCodeLifetimeSeconds must be > 0."); - } - - return errors.Count == 0 - ? ValidateOptionsResult.Success - : ValidateOptionsResult.Fail(errors); - } -} diff --git a/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthSessionOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthSessionOptionsValidator.cs deleted file mode 100644 index 657def36..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthSessionOptionsValidator.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Microsoft.Extensions.Options; - -namespace CodeBeam.UltimateAuth.Core.Options; - -internal sealed class UAuthSessionOptionsValidator : IValidateOptions -{ - public ValidateOptionsResult Validate(string? name, UAuthSessionOptions options) - { - var errors = new List(); - - if (options.Lifetime <= TimeSpan.Zero) - errors.Add("Session.Lifetime must be greater than zero."); - - if (options.MaxLifetime < options.Lifetime) - errors.Add("Session.MaxLifetime must be greater than or equal to Session.Lifetime."); - - if (options.IdleTimeout.HasValue && options.IdleTimeout < TimeSpan.Zero) - errors.Add("Session.IdleTimeout cannot be negative."); - - if (options.IdleTimeout.HasValue && options.IdleTimeout > TimeSpan.Zero && options.IdleTimeout > options.MaxLifetime) - { - errors.Add("Session.IdleTimeout cannot exceed Session.MaxLifetime."); - } - - //if (options.MaxChainsPerUser <= 0) - // errors.Add("Session.MaxChainsPerUser must be at least 1."); - - //if (options.MaxSessionsPerChain <= 0) - // errors.Add("Session.MaxSessionsPerChain must be at least 1."); - - //if (options.MaxChainsPerPlatform != null) - //{ - // foreach (var kv in options.MaxChainsPerPlatform) - // { - // if (string.IsNullOrWhiteSpace(kv.Key)) - // errors.Add("Session.MaxChainsPerPlatform contains an empty platform key."); - - // if (kv.Value <= 0) - // errors.Add($"Session.MaxChainsPerPlatform['{kv.Key}'] must be >= 1."); - // } - //} - - //if (options.PlatformCategories != null) - //{ - // foreach (var cat in options.PlatformCategories) - // { - // var categoryName = cat.Key; - // var platforms = cat.Value; - - // if (string.IsNullOrWhiteSpace(categoryName)) - // errors.Add("Session.PlatformCategories contains an empty category name."); - - // if (platforms == null || platforms.Length == 0) - // errors.Add($"Session.PlatformCategories['{categoryName}'] must contain at least one platform."); - - // var duplicates = platforms? - // .GroupBy(p => p) - // .Where(g => g.Count() > 1) - // .Select(g => g.Key); - // if (duplicates?.Any() == true) - // { - // errors.Add($"Session.PlatformCategories['{categoryName}'] contains duplicate platforms: {string.Join(", ", duplicates)}"); - // } - // } - //} - - //if (options.MaxChainsPerCategory != null) - //{ - // foreach (var kv in options.MaxChainsPerCategory) - // { - // if (string.IsNullOrWhiteSpace(kv.Key)) - // errors.Add("Session.MaxChainsPerCategory contains an empty category key."); - - // if (kv.Value <= 0) - // errors.Add($"Session.MaxChainsPerCategory['{kv.Key}'] must be >= 1."); - // } - //} - - //if (options.PlatformCategories != null && options.MaxChainsPerCategory != null) - //{ - // foreach (var category in options.PlatformCategories.Keys) - // { - // if (!options.MaxChainsPerCategory.ContainsKey(category)) - // { - // errors.Add( - // $"Session.MaxChainsPerCategory must define a limit for category '{category}' " + - // "because it exists in Session.PlatformCategories."); - // } - // } - //} - - if (errors.Count == 0) - return ValidateOptionsResult.Success; - - return ValidateOptionsResult.Fail(errors); - } -} diff --git a/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthTokenOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthTokenOptionsValidator.cs deleted file mode 100644 index 8b211b4a..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Options/Validators/UAuthTokenOptionsValidator.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.Extensions.Options; - -namespace CodeBeam.UltimateAuth.Core.Options; - -internal sealed class UAuthTokenOptionsValidator : IValidateOptions -{ - public ValidateOptionsResult Validate(string? name, UAuthTokenOptions options) - { - var errors = new List(); - - if (!options.IssueJwt && !options.IssueOpaque) - errors.Add("Token: At least one of IssueJwt or IssueOpaque must be enabled."); - - if (options.AccessTokenLifetime <= TimeSpan.Zero) - errors.Add("Token.AccessTokenLifetime must be greater than zero."); - - if (options.IssueRefresh) - { - if (options.RefreshTokenLifetime <= TimeSpan.Zero) - errors.Add("Token.RefreshTokenLifetime must be greater than zero when IssueRefresh is enabled."); - - if (options.RefreshTokenLifetime <= options.AccessTokenLifetime) - errors.Add("Token.RefreshTokenLifetime must be greater than Token.AccessTokenLifetime."); - } - - if (options.IssueJwt) - { - if (string.IsNullOrWhiteSpace(options.Issuer) || options.Issuer.Trim().Length < 3) - errors.Add("Token.Issuer must be at least 3 characters when IssueJwt is enabled."); - - if (string.IsNullOrWhiteSpace(options.Audience) || options.Audience.Trim().Length < 3) - errors.Add("Token.Audience must be at least 3 characters when IssueJwt is enabled."); - } - - if (options.IssueOpaque) - { - if (options.OpaqueIdBytes < 24) - errors.Add("Token.OpaqueIdBytes must be at least 24 bytes (192-bit entropy)."); - - if (options.OpaqueIdBytes > 128) - errors.Add("Token.OpaqueIdBytes must not exceed 128 bytes."); - } - - return errors.Count == 0 - ? ValidateOptionsResult.Success - : ValidateOptionsResult.Fail(errors); - } -} diff --git a/src/CodeBeam.UltimateAuth.Core/Runtime/DirectCoreConfigurationMarker.cs b/src/CodeBeam.UltimateAuth.Core/Runtime/DirectCoreConfigurationMarker.cs deleted file mode 100644 index c65c789d..00000000 --- a/src/CodeBeam.UltimateAuth.Core/Runtime/DirectCoreConfigurationMarker.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace CodeBeam.UltimateAuth.Core.Runtime; - -/// -/// Internal marker indicating that UAuthOptions -/// were configured directly by the application. -/// -internal sealed class DirectCoreConfigurationMarker -{ - public bool IsConfigured { get; private set; } - - public void MarkConfigured() - { - IsConfigured = true; - } -} diff --git a/src/CodeBeam.UltimateAuth.Core/Runtime/UAuthProductInfoProvider.cs b/src/CodeBeam.UltimateAuth.Core/Runtime/UAuthProductInfoProvider.cs index 99f027c2..d90a6f12 100644 --- a/src/CodeBeam.UltimateAuth.Core/Runtime/UAuthProductInfoProvider.cs +++ b/src/CodeBeam.UltimateAuth.Core/Runtime/UAuthProductInfoProvider.cs @@ -1,6 +1,4 @@ -using CodeBeam.UltimateAuth.Core.Options; -using Microsoft.Extensions.Options; -using System.Reflection; +using System.Reflection; namespace CodeBeam.UltimateAuth.Core.Runtime; @@ -8,7 +6,7 @@ internal sealed class UAuthProductInfoProvider : IUAuthProductInfoProvider { private readonly UAuthProductInfo _info; - public UAuthProductInfoProvider(IOptions options) + public UAuthProductInfoProvider() { var asm = typeof(UAuthProductInfoProvider).Assembly; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/IEffectiveServerOptionsProvider.cs b/src/CodeBeam.UltimateAuth.Server/Abstractions/IEffectiveServerOptionsProvider.cs similarity index 83% rename from src/CodeBeam.UltimateAuth.Server/Options/IEffectiveServerOptionsProvider.cs rename to src/CodeBeam.UltimateAuth.Server/Abstractions/IEffectiveServerOptionsProvider.cs index ff65d8c9..e4f1221b 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/IEffectiveServerOptionsProvider.cs +++ b/src/CodeBeam.UltimateAuth.Server/Abstractions/IEffectiveServerOptionsProvider.cs @@ -1,10 +1,10 @@ using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; +using CodeBeam.UltimateAuth.Server.Options; using Microsoft.AspNetCore.Http; -namespace CodeBeam.UltimateAuth.Server.Options; +namespace CodeBeam.UltimateAuth.Server.Abstractions; public interface IEffectiveServerOptionsProvider { diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContext.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContext.cs index 0ddfb246..6fa0d95b 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContext.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContext.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -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; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs index b7845168..1bc012d2 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Context/AuthFlowContextFactory.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Infrastructure; @@ -7,7 +6,6 @@ using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Extensions; using CodeBeam.UltimateAuth.Server.Infrastructure; -using CodeBeam.UltimateAuth.Server.Options; using Microsoft.AspNetCore.Http; namespace CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/EffectiveServerOptionsProvider.cs b/src/CodeBeam.UltimateAuth.Server/Auth/EffectiveServerOptionsProvider.cs index 4a4818cc..e2e1c0b5 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/EffectiveServerOptionsProvider.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/EffectiveServerOptionsProvider.cs @@ -1,7 +1,7 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +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.Extensions; using Microsoft.AspNetCore.Http; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/EffectiveUAuthServerOptions.cs b/src/CodeBeam.UltimateAuth.Server/Auth/EffectiveUAuthServerOptions.cs index 5ddb0666..9715f7bc 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/EffectiveUAuthServerOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/EffectiveUAuthServerOptions.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Options; namespace CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/IPrimaryTokenResolver.cs b/src/CodeBeam.UltimateAuth.Server/Auth/IPrimaryTokenResolver.cs index ba50be05..07a03b27 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/IPrimaryTokenResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/IPrimaryTokenResolver.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/PrimaryTokenResolver.cs b/src/CodeBeam.UltimateAuth.Server/Auth/PrimaryTokenResolver.cs index 5daee211..4f3fd31f 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/PrimaryTokenResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/PrimaryTokenResolver.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseResolver.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseResolver.cs index e97acce7..5bfe525a 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/AuthResponseResolver.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveAuthModeResolver.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveAuthModeResolver.cs index 076d86c2..2ad730b8 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveAuthModeResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/EffectiveAuthModeResolver.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/IAuthResponseResolver.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/IAuthResponseResolver.cs index 50c73c19..fbe7d3fa 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/IAuthResponseResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/IAuthResponseResolver.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; namespace CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Auth/Response/IEffectiveAuthModeResolver.cs b/src/CodeBeam.UltimateAuth.Server/Auth/Response/IEffectiveAuthModeResolver.cs index ad7550ba..2bc15cdc 100644 --- a/src/CodeBeam.UltimateAuth.Server/Auth/Response/IEffectiveAuthModeResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Auth/Response/IEffectiveAuthModeResolver.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; namespace CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs index dc4333f4..b62d6e9d 100644 --- a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthAuthenticationHandler.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; diff --git a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs index 50f2f4af..3d465f41 100644 --- a/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Authentication/AspNetCore/UAuthResourceAuthenticationHandler.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; diff --git a/src/CodeBeam.UltimateAuth.Server/Authorization/AspNetCore/UAuthStatusAuthorizationResultHandler.cs b/src/CodeBeam.UltimateAuth.Server/Authorization/AspNetCore/UAuthStatusAuthorizationResultHandler.cs index 8a79b227..ed92157b 100644 --- a/src/CodeBeam.UltimateAuth.Server/Authorization/AspNetCore/UAuthStatusAuthorizationResultHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Authorization/AspNetCore/UAuthStatusAuthorizationResultHandler.cs @@ -1,12 +1,11 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Runtime; +using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Extensions; -using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Server.ResourceApi; using CodeBeam.UltimateAuth.Server.Runtime; using Microsoft.AspNetCore.Authentication; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/DeviceLimitBehavior.cs b/src/CodeBeam.UltimateAuth.Server/Domain/DeviceLimitBehavior.cs similarity index 85% rename from src/CodeBeam.UltimateAuth.Server/Options/DeviceLimitBehavior.cs rename to src/CodeBeam.UltimateAuth.Server/Domain/DeviceLimitBehavior.cs index 8313c917..e7ff206e 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/DeviceLimitBehavior.cs +++ b/src/CodeBeam.UltimateAuth.Server/Domain/DeviceLimitBehavior.cs @@ -1,4 +1,4 @@ -namespace CodeBeam.UltimateAuth.Server.Options; +namespace CodeBeam.UltimateAuth.Server.Domain; /// /// Determines how a new device is handled when a device limit is reached. @@ -13,5 +13,5 @@ public enum DeviceLimitBehavior /// /// Revokes the oldest eligible device sessions to make room for the new device. /// - RevokeOldest = 1 + RevokeOldest = 10 } diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthHubDeploymentMode.cs b/src/CodeBeam.UltimateAuth.Server/Domain/UAuthHubDeploymentMode.cs similarity index 93% rename from src/CodeBeam.UltimateAuth.Server/Options/UAuthHubDeploymentMode.cs rename to src/CodeBeam.UltimateAuth.Server/Domain/UAuthHubDeploymentMode.cs index 7fe26afd..e6e33a91 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthHubDeploymentMode.cs +++ b/src/CodeBeam.UltimateAuth.Server/Domain/UAuthHubDeploymentMode.cs @@ -1,4 +1,4 @@ -namespace CodeBeam.UltimateAuth.Server.Options; +namespace CodeBeam.UltimateAuth.Server.Domain; /// /// Describes how UAuthHub is deployed relative to the application. diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs index 92335de3..93663610 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/LogoutEndpointHandler.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs b/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs index 03ee5b2e..1573959e 100644 --- a/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs +++ b/src/CodeBeam.UltimateAuth.Server/Endpoints/ValidateEndpointHandler.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; diff --git a/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs b/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs index 1f4d8b31..14190aa6 100644 --- a/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Extensions/ServiceCollectionExtensions.cs @@ -19,6 +19,7 @@ using CodeBeam.UltimateAuth.Server.Authentication; using CodeBeam.UltimateAuth.Server.Authorization; using CodeBeam.UltimateAuth.Server.ConcurrencyLimiting; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Endpoints; using CodeBeam.UltimateAuth.Server.Flows; using CodeBeam.UltimateAuth.Server.Infrastructure; diff --git a/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthServerOptionsExtensions.cs b/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthServerOptionsExtensions.cs index 07c268da..55341f15 100644 --- a/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthServerOptionsExtensions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Extensions/UAuthServerOptionsExtensions.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Options; namespace CodeBeam.UltimateAuth.Server.Extensions; diff --git a/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshResponsePolicy.cs b/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshResponsePolicy.cs index 374cae6e..4b8c24e6 100644 --- a/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshResponsePolicy.cs +++ b/src/CodeBeam.UltimateAuth.Server/Flows/Refresh/RefreshResponsePolicy.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/UAuthCookiePolicyBuilder.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/UAuthCookiePolicyBuilder.cs index 822ed714..3247858e 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/UAuthCookiePolicyBuilder.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Cookies/UAuthCookiePolicyBuilder.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/ITransportCredentialResolver.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/ITransportCredentialResolver.cs index ca59d1ba..a8eb9f14 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/ITransportCredentialResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/ITransportCredentialResolver.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Auth; using Microsoft.AspNetCore.Http; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredentialResolver.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredentialResolver.cs index 7527711f..164c764b 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredentialResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Credentials/AspNetCore/TransportCredentialResolver.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Extensions; using Microsoft.AspNetCore.Http; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs index 449d9772..1a8e31a0 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthSessionIssuer.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Errors; @@ -7,6 +6,7 @@ using CodeBeam.UltimateAuth.Server.Options; using System.Security; using Microsoft.Extensions.Options; +using CodeBeam.UltimateAuth.Server.Domain; namespace CodeBeam.UltimateAuth.Server.Infrastructure; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthTokenIssuer.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthTokenIssuer.cs index 19a9e771..48e8f79d 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthTokenIssuer.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/Issuers/UAuthTokenIssuer.cs @@ -1,11 +1,10 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; 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; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/SessionId/SessionIdResolver.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/SessionId/SessionIdResolver.cs index b09796f0..7d5e432a 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/SessionId/SessionIdResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/SessionId/SessionIdResolver.cs @@ -1,7 +1,6 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; -using CodeBeam.UltimateAuth.Server.Options; using Microsoft.AspNetCore.Http; namespace CodeBeam.UltimateAuth.Server.Infrastructure; diff --git a/src/CodeBeam.UltimateAuth.Server/Infrastructure/User/UAuthUserAccessor.cs b/src/CodeBeam.UltimateAuth.Server/Infrastructure/User/UAuthUserAccessor.cs index e43ede53..95771ab7 100644 --- a/src/CodeBeam.UltimateAuth.Server/Infrastructure/User/UAuthUserAccessor.cs +++ b/src/CodeBeam.UltimateAuth.Server/Infrastructure/User/UAuthUserAccessor.cs @@ -1,12 +1,12 @@ using System.Security.Claims; -using CodeBeam.UltimateAuth.Core; 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.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Extensions; -using CodeBeam.UltimateAuth.Server.Options; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs b/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs index ae71315b..5bbe055c 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Defaults/ConfigureDefaults.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; namespace CodeBeam.UltimateAuth.Server.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthDeviceLimitOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthDeviceLimitOptions.cs index 9cace739..3ae8b3dc 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthDeviceLimitOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthDeviceLimitOptions.cs @@ -1,4 +1,6 @@ -namespace CodeBeam.UltimateAuth.Server.Options; +using CodeBeam.UltimateAuth.Server.Domain; + +namespace CodeBeam.UltimateAuth.Server.Options; /// /// Configures global and per-type limits for active devices. diff --git a/src/CodeBeam.UltimateAuth.Core/Options/UAuthLoginOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthLoginOptions.cs similarity index 96% rename from src/CodeBeam.UltimateAuth.Core/Options/UAuthLoginOptions.cs rename to src/CodeBeam.UltimateAuth.Server/Options/UAuthLoginOptions.cs index cfcbb601..b2b029d6 100644 --- a/src/CodeBeam.UltimateAuth.Core/Options/UAuthLoginOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthLoginOptions.cs @@ -1,6 +1,4 @@ -using CodeBeam.UltimateAuth.Core.Contracts; - -namespace CodeBeam.UltimateAuth.Core.Options; +namespace CodeBeam.UltimateAuth.Server.Options; /// /// Configuration settings related to interactive user login behavior, including lockout policies and failed-attempt thresholds. diff --git a/src/CodeBeam.UltimateAuth.Core/Options/UAuthPkceOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthPkceOptions.cs similarity index 76% rename from src/CodeBeam.UltimateAuth.Core/Options/UAuthPkceOptions.cs rename to src/CodeBeam.UltimateAuth.Server/Options/UAuthPkceOptions.cs index 6549acc4..54afbdb1 100644 --- a/src/CodeBeam.UltimateAuth.Core/Options/UAuthPkceOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthPkceOptions.cs @@ -1,4 +1,4 @@ -namespace CodeBeam.UltimateAuth.Core.Options; +namespace CodeBeam.UltimateAuth.Server.Options; /// /// Configuration settings for PKCE (Proof Key for Code Exchange) @@ -9,8 +9,7 @@ public sealed class UAuthPkceOptions { /// /// Lifetime of a PKCE authorization code in seconds. - /// Shorter values provide stronger replay protection, - /// while longer values allow more tolerance for slow clients. + /// Shorter values provide stronger replay protection, while longer values allow more tolerance for slow clients. /// public int AuthorizationCodeLifetimeSeconds { get; set; } = 120; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs index e37af318..e21fb79e 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthResourceApiOptions.cs @@ -1,5 +1,5 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Domain; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs index e5204efd..531ca7dc 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs @@ -1,8 +1,8 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Events; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Credentials.Options; +using CodeBeam.UltimateAuth.Server.Domain; using Microsoft.AspNetCore.Routing; namespace CodeBeam.UltimateAuth.Server.Options; diff --git a/src/CodeBeam.UltimateAuth.Core/Options/UAuthTokenOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthTokenOptions.cs similarity index 98% rename from src/CodeBeam.UltimateAuth.Core/Options/UAuthTokenOptions.cs rename to src/CodeBeam.UltimateAuth.Server/Options/UAuthTokenOptions.cs index 25725ac3..84b5e583 100644 --- a/src/CodeBeam.UltimateAuth.Core/Options/UAuthTokenOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthTokenOptions.cs @@ -1,4 +1,4 @@ -namespace CodeBeam.UltimateAuth.Core.Options; +namespace CodeBeam.UltimateAuth.Server.Options; /// /// Configuration settings for access and refresh token behavior diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs index 96e797d6..91cf0a45 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthResourceApiOptionsValidator.cs @@ -1,5 +1,5 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.ResourceApi; using Microsoft.Extensions.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerMultiTenantOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerMultiTenantOptionsValidator.cs index ec3afed5..0e002128 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerMultiTenantOptionsValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerMultiTenantOptionsValidator.cs @@ -1,7 +1,6 @@ -using CodeBeam.UltimateAuth.Server.Options; -using Microsoft.Extensions.Options; +using Microsoft.Extensions.Options; -namespace CodeBeam.UltimateAuth.Core.Options; +namespace CodeBeam.UltimateAuth.Server.Options; internal sealed class UAuthServerMultiTenantOptionsValidator : IValidateOptions { diff --git a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerOptionsValidator.cs b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerOptionsValidator.cs index 1a0bc785..2940b71f 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerOptionsValidator.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/Validators/UAuthServerOptionsValidator.cs @@ -1,5 +1,4 @@ - -using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; using Microsoft.Extensions.Options; namespace CodeBeam.UltimateAuth.Server.Options; diff --git a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceApiAuthModeProvider.cs b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceApiAuthModeProvider.cs index 7321b6ed..156d10c1 100644 --- a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceApiAuthModeProvider.cs +++ b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceApiAuthModeProvider.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSessionIdResolver.cs b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSessionIdResolver.cs index 63b302fc..515aabb8 100644 --- a/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSessionIdResolver.cs +++ b/src/CodeBeam.UltimateAuth.Server/ResourceApi/ResourceSessionIdResolver.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Domain; diff --git a/src/CodeBeam.UltimateAuth.Server/Runtime/UAuthServerProductInfo.cs b/src/CodeBeam.UltimateAuth.Server/Runtime/UAuthServerProductInfo.cs index f26afa1a..ddf518dd 100644 --- a/src/CodeBeam.UltimateAuth.Server/Runtime/UAuthServerProductInfo.cs +++ b/src/CodeBeam.UltimateAuth.Server/Runtime/UAuthServerProductInfo.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Server.Options; +using CodeBeam.UltimateAuth.Server.Domain; namespace CodeBeam.UltimateAuth.Server.Runtime; diff --git a/src/CodeBeam.UltimateAuth.Server/Services/PureJwtLogoutService.cs b/src/CodeBeam.UltimateAuth.Server/Services/PureJwtLogoutService.cs index 5125f40c..93714dd3 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/PureJwtLogoutService.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/PureJwtLogoutService.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Abstractions; diff --git a/src/CodeBeam.UltimateAuth.Server/Services/RefreshFlowService.cs b/src/CodeBeam.UltimateAuth.Server/Services/RefreshFlowService.cs index 4538578b..62597a33 100644 --- a/src/CodeBeam.UltimateAuth.Server/Services/RefreshFlowService.cs +++ b/src/CodeBeam.UltimateAuth.Server/Services/RefreshFlowService.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Auth; diff --git a/src/client/CodeBeam.UltimateAuth.Client/CodeBeam.UltimateAuth.Client.csproj b/src/client/CodeBeam.UltimateAuth.Client/CodeBeam.UltimateAuth.Client.csproj index 7f13e4e3..50e82f05 100644 --- a/src/client/CodeBeam.UltimateAuth.Client/CodeBeam.UltimateAuth.Client.csproj +++ b/src/client/CodeBeam.UltimateAuth.Client/CodeBeam.UltimateAuth.Client.csproj @@ -11,6 +11,26 @@ README.md + + + + + + + + + + + + + + + + + + + + @@ -23,5 +43,4 @@ - diff --git a/src/client/CodeBeam.UltimateAuth.Client/Options/ClientConfigurationMarker.cs b/src/client/CodeBeam.UltimateAuth.Client/Infrastructure/ClientConfigurationMarker.cs similarity index 87% rename from src/client/CodeBeam.UltimateAuth.Client/Options/ClientConfigurationMarker.cs rename to src/client/CodeBeam.UltimateAuth.Client/Infrastructure/ClientConfigurationMarker.cs index 8d2b8f93..a4720ee9 100644 --- a/src/client/CodeBeam.UltimateAuth.Client/Options/ClientConfigurationMarker.cs +++ b/src/client/CodeBeam.UltimateAuth.Client/Infrastructure/ClientConfigurationMarker.cs @@ -1,4 +1,4 @@ -namespace CodeBeam.UltimateAuth.Client.Options; +namespace CodeBeam.UltimateAuth.Client.Infrastructure; internal sealed class ClientConfigurationMarker { diff --git a/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthApplicationProfileDetector.cs b/src/client/CodeBeam.UltimateAuth.Client/Infrastructure/UAuthApplicationProfileDetector.cs similarity index 96% rename from src/client/CodeBeam.UltimateAuth.Client/Options/UAuthApplicationProfileDetector.cs rename to src/client/CodeBeam.UltimateAuth.Client/Infrastructure/UAuthApplicationProfileDetector.cs index 75cf5e4c..5bb6f614 100644 --- a/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthApplicationProfileDetector.cs +++ b/src/client/CodeBeam.UltimateAuth.Client/Infrastructure/UAuthApplicationProfileDetector.cs @@ -3,7 +3,7 @@ using CodeBeam.UltimateAuth.Core.Runtime; using Microsoft.Extensions.DependencyInjection; -namespace CodeBeam.UltimateAuth.Client.Options; +namespace CodeBeam.UltimateAuth.Client.Infrastructure; internal sealed class UAuthApplicationProfileDetector : IApplicationProfileDetector { diff --git a/src/client/CodeBeam.UltimateAuth.Client/Options/UAuthOptionsPostConfigure.cs b/src/client/CodeBeam.UltimateAuth.Client/Infrastructure/UAuthOptionsPostConfigure.cs similarity index 100% rename from src/client/CodeBeam.UltimateAuth.Client/Options/UAuthOptionsPostConfigure.cs rename to src/client/CodeBeam.UltimateAuth.Client/Infrastructure/UAuthOptionsPostConfigure.cs diff --git a/src/credentials/CodeBeam.UltimateAuth.Credentials.Reference/Infrastructure/PasswordUserLifecycleIntegration.cs b/src/credentials/CodeBeam.UltimateAuth.Credentials.Reference/Infrastructure/PasswordUserLifecycleIntegration.cs index 3d2d460e..310c7aef 100644 --- a/src/credentials/CodeBeam.UltimateAuth.Credentials.Reference/Infrastructure/PasswordUserLifecycleIntegration.cs +++ b/src/credentials/CodeBeam.UltimateAuth.Credentials.Reference/Infrastructure/PasswordUserLifecycleIntegration.cs @@ -6,7 +6,7 @@ using CodeBeam.UltimateAuth.Credentials.Contracts; using CodeBeam.UltimateAuth.Credentials.Options; using CodeBeam.UltimateAuth.Credentials.Policies; -using CodeBeam.UltimateAuth.Server.Options; +using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Users; using CodeBeam.UltimateAuth.Users.Contracts; diff --git a/src/credentials/CodeBeam.UltimateAuth.Credentials.Reference/Services/CredentialManagementService.cs b/src/credentials/CodeBeam.UltimateAuth.Credentials.Reference/Services/CredentialManagementService.cs index 532c45e0..df44b24d 100644 --- a/src/credentials/CodeBeam.UltimateAuth.Credentials.Reference/Services/CredentialManagementService.cs +++ b/src/credentials/CodeBeam.UltimateAuth.Credentials.Reference/Services/CredentialManagementService.cs @@ -7,6 +7,7 @@ using CodeBeam.UltimateAuth.Credentials.Options; using CodeBeam.UltimateAuth.Credentials.Policies; using CodeBeam.UltimateAuth.Credentials.Reference.Internal; +using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.ConcurrencyLimiting; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; diff --git a/src/credentials/CodeBeam.UltimateAuth.Credentials/Extensions/PasswordPolicyServiceCollectionExtensions.cs b/src/credentials/CodeBeam.UltimateAuth.Credentials/Extensions/PasswordPolicyServiceCollectionExtensions.cs index 5dc76d34..e4393ac3 100644 --- a/src/credentials/CodeBeam.UltimateAuth.Credentials/Extensions/PasswordPolicyServiceCollectionExtensions.cs +++ b/src/credentials/CodeBeam.UltimateAuth.Credentials/Extensions/PasswordPolicyServiceCollectionExtensions.cs @@ -1,8 +1,6 @@ -using CodeBeam.UltimateAuth.Credentials.Options; -using CodeBeam.UltimateAuth.Credentials.Policies; +using CodeBeam.UltimateAuth.Credentials.Policies; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.Extensions.Options; namespace CodeBeam.UltimateAuth.Credentials.Extensions; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/DeviceLimitPostgresTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/DeviceLimitPostgresTests.cs index 2847306c..4b4537fa 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/DeviceLimitPostgresTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/DeviceLimitPostgresTests.cs @@ -1,10 +1,10 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.EntityFrameworkCore; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Sessions.EntityFrameworkCore.Extensions; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/LoginTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/LoginTests.cs index aef73e3d..de2dac52 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/LoginTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/LoginTests.cs @@ -1,5 +1,4 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs index fd510186..cbb3beb4 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/RefreshTests.cs @@ -1,5 +1,4 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/ResourceApi/ResourceApiTestHost.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/ResourceApi/ResourceApiTestHost.cs index 94f800d3..3e7eab37 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/ResourceApi/ResourceApiTestHost.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/ResourceApi/ResourceApiTestHost.cs @@ -1,9 +1,9 @@ -using CodeBeam.UltimateAuth.Core; -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.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Extensions; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/Security/AntiforgeryCookiePolicyTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/Security/AntiforgeryCookiePolicyTests.cs index 0d17113c..cd1eaa9f 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/Security/AntiforgeryCookiePolicyTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/Security/AntiforgeryCookiePolicyTests.cs @@ -1,7 +1,7 @@  using AwesomeAssertions; using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Server.Options; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Tests.Integration.Infrastructure; using Microsoft.AspNetCore.Antiforgery; using Microsoft.AspNetCore.Http; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/Server/UAuthServerStatusAuthorizationTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Integration/Server/UAuthServerStatusAuthorizationTests.cs index 94a75301..e1de8ee2 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/Server/UAuthServerStatusAuthorizationTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/Server/UAuthServerStatusAuthorizationTests.cs @@ -1,11 +1,11 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Core.Runtime; +using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Authorization; using CodeBeam.UltimateAuth.Server.Options; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/ClientOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/ClientOptionsValidatorTests.cs index 9621cb22..2b4441d2 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/ClientOptionsValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/ClientOptionsValidatorTests.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Client.Infrastructure; namespace CodeBeam.UltimateAuth.Tests.Unit; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/ConfigurationGuardsTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/ConfigurationGuardsTests.cs deleted file mode 100644 index 4c509fff..00000000 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/ConfigurationGuardsTests.cs +++ /dev/null @@ -1,166 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Extensions; -using CodeBeam.UltimateAuth.Core.Options; -using CodeBeam.UltimateAuth.Core.Runtime; -using CodeBeam.UltimateAuth.Server.Extensions; -using AwesomeAssertions; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; - -namespace CodeBeam.UltimateAuth.Tests.Unit.Core; - -public sealed class ConfigurationGuardsTests -{ - [Fact] - public void Default_No_Config_Passes() - { - var provider = Build(services => - { - services.AddUltimateAuth(); - services.AddSingleton(new ConfigurationBuilder().AddInMemoryCollection().Build()); - }); - - var _ = provider.GetRequiredService>().Value; - } - - [Fact] - public void Direct_Config_With_Allow_Passes() - { - var provider = Build(services => - { - services.AddUltimateAuth(o => - { - o.AllowDirectCoreConfiguration = true; - o.Session.IdleTimeout = TimeSpan.FromMinutes(5); - }); - }); - - var options = provider.GetRequiredService>().Value; - - Assert.Equal(TimeSpan.FromMinutes(5), options.Session.IdleTimeout); - } - - [Fact] - public void Direct_Config_Without_Allow_Fails() - { - Assert.Throws(() => - { - var provider = Build(services => - { - services.AddUltimateAuth(o => - { - o.Session.IdleTimeout = TimeSpan.FromMinutes(5); - }); - }); - - var _ = provider.GetRequiredService>().Value; - }); - } - - [Fact] - public void Server_Without_Core_Config_Passes() - { - var provider = Build(services => - { - services.AddUltimateAuth(); - services.AddSingleton(); - }); - - var _ = provider.GetRequiredService>().Value; - } - - [Fact] - public void Server_With_Core_Config_Fails() - { - Assert.Throws(() => - { - var provider = Build(services => - { - services.AddUltimateAuth(o => - { - o.Session.IdleTimeout = TimeSpan.FromMinutes(5); - }); - - services.AddSingleton(); - }); - - var _ = provider.GetRequiredService>().Value; - }); - } - - [Fact] - public void Server_With_Core_Config_Even_With_Allow_Fails() - { - Assert.Throws(() => - { - var provider = Build(services => - { - services.AddUltimateAuth(o => - { - o.AllowDirectCoreConfiguration = true; - o.Session.IdleTimeout = TimeSpan.FromMinutes(5); - }); - - services.AddSingleton(); - }); - - var _ = provider.GetRequiredService>().Value; - }); - } - - [Fact] - public void Core_configuration_is_blocked_when_server_is_present() - { - var dict = new Dictionary - { - ["UltimateAuth:Core:Session:IdleTimeout"] = "00:05:00" - }; - - var config = new ConfigurationBuilder().AddInMemoryCollection(dict).Build(); - - var provider = Build(services => - { - services.AddSingleton(config); - services.AddUltimateAuth(); - services.AddUltimateAuthServer(); - }); - - Action act = () => - { - _ = provider.GetRequiredService>().Value; - }; - - act.Should().Throw().WithMessage("*Direct core configuration is not allowed*"); - } - - [Fact] - public void Core_configuration_is_allowed_when_server_is_not_present() - { - var dict = new Dictionary - { - ["UltimateAuth:Core:AllowDirectCoreConfiguration"] = "true", - ["UltimateAuth:Core:Session:IdleTimeout"] = "00:05:00" - }; - - var config = new ConfigurationBuilder().AddInMemoryCollection(dict).Build(); - - var provider = Build(services => - { - services.AddSingleton(config); - services.AddUltimateAuth(); - }); - - var options = provider.GetRequiredService>().Value; - options.Session.IdleTimeout.Should().Be(TimeSpan.FromMinutes(5)); - } - - private sealed class FakeServerMarker : IUAuthRuntimeMarker { } - - private static IServiceProvider Build(Action configure) - { - var services = new ServiceCollection(); - services.AddSingleton(new ConfigurationBuilder().AddInMemoryCollection().Build()); - configure(services); - return services.BuildServiceProvider(); - } -} diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/CoreProductInfoTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/CoreProductInfoTests.cs index 9e23501c..9485193a 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/CoreProductInfoTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/CoreProductInfoTests.cs @@ -1,9 +1,7 @@ using CodeBeam.UltimateAuth.Core.Extensions; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Core.Runtime; using AwesomeAssertions; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; using System.Reflection; namespace CodeBeam.UltimateAuth.Tests.Unit; @@ -120,20 +118,6 @@ public void Different_providers_should_have_different_runtime_ids() first.RuntimeId.Should().NotBe(second.RuntimeId); } - [Fact] - public void Provider_should_not_depend_on_option_values() - { - var options = new UAuthOptions(); - - var provider = new UAuthProductInfoProvider( - Options.Create(options)); - - var info = provider.Get(); - - info.ProductName.Should().Be("UltimateAuth"); - info.Version.Should().NotBeNullOrWhiteSpace(); - } - [Fact] public void Core_registration_should_register_product_info_provider_as_singleton() { @@ -153,38 +137,8 @@ public void Core_registration_should_register_product_info_provider_as_singleton descriptors[0].Lifetime.Should().Be(ServiceLifetime.Singleton); } - [Fact] - public void Direct_configuration_marker_should_start_unconfigured() - { - var marker = new DirectCoreConfigurationMarker(); - - marker.IsConfigured.Should().BeFalse(); - } - - [Fact] - public void Direct_configuration_marker_should_become_configured() - { - var marker = new DirectCoreConfigurationMarker(); - - marker.MarkConfigured(); - - marker.IsConfigured.Should().BeTrue(); - } - - [Fact] - public void Direct_configuration_marker_should_remain_configured_after_multiple_calls() - { - var marker = new DirectCoreConfigurationMarker(); - - marker.MarkConfigured(); - marker.MarkConfigured(); - - marker.IsConfigured.Should().BeTrue(); - } - private static UAuthProductInfoProvider CreateProvider() { - return new UAuthProductInfoProvider( - Options.Create(new UAuthOptions())); + return new UAuthProductInfoProvider(); } } diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/CoreRegistrationTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/CoreRegistrationTests.cs new file mode 100644 index 00000000..ea1b08fe --- /dev/null +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/CoreRegistrationTests.cs @@ -0,0 +1,89 @@ +using AwesomeAssertions; +using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Extensions; +using CodeBeam.UltimateAuth.Core.Runtime; +using Microsoft.Extensions.DependencyInjection; + +namespace CodeBeam.UltimateAuth.Tests.Unit.Core; + +public sealed class CoreRegistrationTests +{ + [Fact] + public void AddUltimateAuth_ShouldRegisterCoreServices() + { + var services = new ServiceCollection(); + + services.AddUltimateAuth(); + + using var provider = services.BuildServiceProvider(); + + provider.GetRequiredService() + .Should().NotBeNull(); + + provider.GetRequiredService() + .Should().NotBeNull(); + + provider.GetRequiredService() + .Should().NotBeNull(); + } + + [Fact] + public void AddUltimateAuth_ShouldBeIdempotent() + { + var services = new ServiceCollection(); + + services.AddUltimateAuth(); + services.AddUltimateAuth(); + + using var provider = services.BuildServiceProvider(); + + provider.GetServices() + .Should().ContainSingle(); + + provider.GetServices() + .Should().ContainSingle(); + + provider.GetServices() + .Should().ContainSingle(); + } + + [Fact] + public void AddUltimateAuth_ShouldRegisterSingletonServices() + { + var services = new ServiceCollection(); + + services.AddUltimateAuth(); + + using var provider = services.BuildServiceProvider(); + using var firstScope = provider.CreateScope(); + using var secondScope = provider.CreateScope(); + + firstScope.ServiceProvider + .GetRequiredService() + .Should().BeSameAs( + secondScope.ServiceProvider + .GetRequiredService()); + + firstScope.ServiceProvider + .GetRequiredService() + .Should().BeSameAs( + secondScope.ServiceProvider + .GetRequiredService()); + + firstScope.ServiceProvider + .GetRequiredService() + .Should().BeSameAs( + secondScope.ServiceProvider + .GetRequiredService()); + } + + [Fact] + public void AddUltimateAuth_ShouldRejectNullServices() + { + IServiceCollection services = null!; + + Action act = () => services.AddUltimateAuth(); + + act.Should().Throw(); + } +} diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/OptionValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/OptionValidatorTests.cs deleted file mode 100644 index f9be1990..00000000 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Core/OptionValidatorTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -using CodeBeam.UltimateAuth.Core.Options; -using AwesomeAssertions; - -namespace CodeBeam.UltimateAuth.Tests.Unit; - -public class OptionValidatorTests -{ - [Fact] - public void Negative_max_failed_attempts_should_fail_validation() - { - var options = new UAuthLoginOptions - { - MaxFailedAttempts = -1 - }; - - var validator = new UAuthLoginOptionsValidator(); - - var result = validator.Validate(null, options); - - result.Succeeded.Should().BeFalse(); - } - - [Fact] - public void Excessive_max_failed_attempts_should_fail_validation() - { - var options = new UAuthLoginOptions - { - MaxFailedAttempts = 1000 - }; - - var validator = new UAuthLoginOptionsValidator(); - - var result = validator.Validate(null, options); - - result.Succeeded.Should().BeFalse(); - } - - [Fact] - public void Lockout_enabled_without_duration_should_fail() - { - var options = new UAuthLoginOptions - { - MaxFailedAttempts = 3, - LockoutDuration = TimeSpan.Zero - }; - - var validator = new UAuthLoginOptionsValidator(); - - var result = validator.Validate(null, options); - - result.Succeeded.Should().BeFalse(); - } - - [Fact] - public void Lockout_disabled_should_allow_zero_duration() - { - var options = new UAuthLoginOptions - { - MaxFailedAttempts = 0, - LockoutDuration = TimeSpan.Zero - }; - - var validator = new UAuthLoginOptionsValidator(); - - var result = validator.Validate(null, options); - - result.Succeeded.Should().BeTrue(); - } - -} diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Credentials/CredentialManagementServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Credentials/CredentialManagementServiceTests.cs index 20da1480..5cdf9e80 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Credentials/CredentialManagementServiceTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Credentials/CredentialManagementServiceTests.cs @@ -13,6 +13,7 @@ using CodeBeam.UltimateAuth.Credentials.Policies; using CodeBeam.UltimateAuth.Credentials.Reference; using CodeBeam.UltimateAuth.Credentials.Reference.Internal; +using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.ConcurrencyLimiting; using CodeBeam.UltimateAuth.Server.Infrastructure; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/AuthFlowTestFactory.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/AuthFlowTestFactory.cs index a067e2c4..daa76a8a 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/AuthFlowTestFactory.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/AuthFlowTestFactory.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -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; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestAuthModeResolver.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestAuthModeResolver.cs index 763b55c4..ad37a330 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestAuthModeResolver.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestAuthModeResolver.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestAuthRuntime.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestAuthRuntime.cs index 30adcbfc..eac6d4d6 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestAuthRuntime.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestAuthRuntime.cs @@ -1,11 +1,9 @@ -using CodeBeam.UltimateAuth.Authentication.InMemory; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Extensions; using CodeBeam.UltimateAuth.Core.Infrastructure; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Credentials.Contracts; using CodeBeam.UltimateAuth.Credentials.Reference; using CodeBeam.UltimateAuth.InMemory; @@ -29,7 +27,7 @@ internal sealed class TestAuthRuntime where TUserId : notnull public IServiceProvider Services { get; } public TestClock Clock { get; } - public TestAuthRuntime(Action? configureServer = null, Action? configureCore = null, Action? configureServices = null) + public TestAuthRuntime(Action? configureServer = null, Action? configureServices = null) { Clock = new TestClock(); var services = new ServiceCollection(); @@ -42,7 +40,7 @@ public TestAuthRuntime(Action? configureServer = null, Actio services.AddLogging(); - services.AddUltimateAuth(configureCore ?? (_ => { })); + services.AddUltimateAuth(); services.AddUltimateAuthServer(options => { configureServer?.Invoke(options); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestServerOptions.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestServerOptions.cs index 54f182c0..d31d6de2 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestServerOptions.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Helpers/TestServerOptions.cs @@ -1,4 +1,4 @@ -using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Options; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceApiAuthModeTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceApiAuthModeTests.cs index ad9e1af8..b9b5f5c8 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceApiAuthModeTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceApiAuthModeTests.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.MultiTenancy; +using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Extensions; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceSessionIdResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceSessionIdResolverTests.cs index 2cf6788f..e5efbfde 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceSessionIdResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/ResourceSessionIdResolverTests.cs @@ -1,5 +1,4 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs index 486f9a51..7f5322b9 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsTests.cs @@ -1,5 +1,5 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Options; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs index ed85ad4b..1d61d284 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiOptionsValidatorTests.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiRegistrationTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiRegistrationTests.cs index bbf0124a..1f679a85 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiRegistrationTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/ResourceApi/UAuthResourceApiRegistrationTests.cs @@ -1,5 +1,4 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs index 3d6d1966..13b4bc8c 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/AuthResponseResolverTests.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Options; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CookieInfrastructureTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CookieInfrastructureTests.cs index b64334e6..18e6024d 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CookieInfrastructureTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/CookieInfrastructureTests.cs @@ -1,5 +1,4 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/DeviceLimitOptionsTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/DeviceLimitOptionsTests.cs index a00c85af..2c2c53df 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/DeviceLimitOptionsTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/DeviceLimitOptionsTests.cs @@ -1,4 +1,5 @@ -using CodeBeam.UltimateAuth.Server.Options; +using CodeBeam.UltimateAuth.Server.Domain; +using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Server.Options.Validators; using Microsoft.Extensions.Options; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveAuthModeResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveAuthModeResolverTests.cs index 1045e300..c012f4a8 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveAuthModeResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveAuthModeResolverTests.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Domain; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Server.Auth; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs index 0d75edb6..9e57fa33 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/EffectiveServerOptionsProviderTests.cs @@ -1,5 +1,4 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginOrchestratorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginOrchestratorTests.cs index 088d3556..70b26d7b 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginOrchestratorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LoginOrchestratorTests.cs @@ -6,7 +6,6 @@ using CodeBeam.UltimateAuth.Core.Errors; using CodeBeam.UltimateAuth.Core.Events; using CodeBeam.UltimateAuth.Core.MultiTenancy; -using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Flows; using CodeBeam.UltimateAuth.Server.Infrastructure; @@ -57,7 +56,7 @@ public async Task Successful_login_should_create_session() [Fact] public async Task First_failed_login_should_record_attempt() { - var runtime = new TestAuthRuntime(configureCore: o => + var runtime = new TestAuthRuntime(configureServer: o => { o.Login.MaxFailedAttempts = 3; }); @@ -81,7 +80,7 @@ await orchestrator.LoginAsync(flow, [Fact] public async Task Successful_login_should_clear_failure_state() { - var runtime = new TestAuthRuntime(configureCore: o => + var runtime = new TestAuthRuntime(configureServer: o => { o.Login.MaxFailedAttempts = 3; }); diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LogoutEndpointHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LogoutEndpointHandlerTests.cs index 8155fb06..c133fa17 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LogoutEndpointHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/LogoutEndpointHandlerTests.cs @@ -1,5 +1,4 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RedirectTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RedirectTests.cs index a36c99a0..3d8b08bf 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RedirectTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RedirectTests.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; @@ -13,6 +12,7 @@ using Microsoft.Extensions.DependencyInjection; using System.Text; using System.Text.Json; +using CodeBeam.UltimateAuth.Server.Abstractions; namespace CodeBeam.UltimateAuth.Tests.Unit; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshFlowServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshFlowServiceTests.cs index 1c4ae899..c23c3554 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshFlowServiceTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshFlowServiceTests.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenResolverTests.cs index bddce4e1..d835baff 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/RefreshTokenResolverTests.cs @@ -1,5 +1,4 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ServerOptionsValidatorTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ServerOptionsValidatorTests.cs index 9a200926..b87a4575 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ServerOptionsValidatorTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ServerOptionsValidatorTests.cs @@ -1,5 +1,5 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; +using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Extensions; using CodeBeam.UltimateAuth.Core.Options; using CodeBeam.UltimateAuth.Server.Extensions; @@ -754,6 +754,7 @@ public void Server_unimplemented_mode_fails(UAuthMode mode) => [Theory] [InlineData(UAuthMode.Hybrid)] [InlineData(UAuthMode.PureOpaque)] + [InlineData(UAuthMode.PureJwt)] public void Server_implemented_modes_pass(UAuthMode mode) => ShouldAccept(o => { diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs index 4a8e7035..92fcf438 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/TransportCredentialResolverTests.cs @@ -1,5 +1,4 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; using CodeBeam.UltimateAuth.Core.Domain; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthFlowServiceTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthFlowServiceTests.cs index d4cabc19..5a7b9944 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthFlowServiceTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthFlowServiceTests.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Contracts; +using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Events; using CodeBeam.UltimateAuth.Core.MultiTenancy; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs index 5eb14b01..55c86c76 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthResourceAuthenticationHandlerTests.cs @@ -1,5 +1,4 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthServerProductInfoTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthServerProductInfoTests.cs index f9155e74..522e7767 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthServerProductInfoTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/UAuthServerProductInfoTests.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.Options; using System.Reflection; using System.Runtime.InteropServices; +using CodeBeam.UltimateAuth.Server.Domain; namespace CodeBeam.UltimateAuth.Tests.Unit; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs index 4a0dfb20..f3232233 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Server/ValidateEndpointHandlerTests.cs @@ -1,5 +1,4 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Defaults; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/DeviceLimitAdmissionTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/DeviceLimitAdmissionTests.cs index a10283e7..09c188e2 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/DeviceLimitAdmissionTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/DeviceLimitAdmissionTests.cs @@ -1,10 +1,10 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Errors; using CodeBeam.UltimateAuth.Core.MultiTenancy; using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; using CodeBeam.UltimateAuth.Server.Options; using CodeBeam.UltimateAuth.Sessions.InMemory; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/SessionIdResolverTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/SessionIdResolverTests.cs index e568f08c..95b18591 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/SessionIdResolverTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/SessionIdResolverTests.cs @@ -1,8 +1,8 @@ using AwesomeAssertions; -using CodeBeam.UltimateAuth.Core; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Options; +using CodeBeam.UltimateAuth.Server.Abstractions; using CodeBeam.UltimateAuth.Server.Auth; using CodeBeam.UltimateAuth.Server.Domain; using CodeBeam.UltimateAuth.Server.Infrastructure; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs index dedb1ca3..dd54a772 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Sessions/UAuthSessionIssuerTests.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.Errors; diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Tokens/UAuthTokenIssuerTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Tokens/UAuthTokenIssuerTests.cs index 4cde6d21..7dca927b 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Tokens/UAuthTokenIssuerTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Tokens/UAuthTokenIssuerTests.cs @@ -1,5 +1,4 @@ -using CodeBeam.UltimateAuth.Core; -using CodeBeam.UltimateAuth.Core.Abstractions; +using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Contracts; using CodeBeam.UltimateAuth.Core.Domain; using CodeBeam.UltimateAuth.Core.MultiTenancy; From 31b087d4f1d5a8ae962576eac775dd2ca56e4ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Can=20Karag=C3=B6z?= Date: Mon, 30 Nov 2026 22:56:35 +0300 Subject: [PATCH 3/3] Last Cleanup & Add XML Docs --- .../CodeBeam.UltimateAuth.Core.csproj | 25 +--------- .../Options/UAuthServerOptions.cs | 48 +++++++++++-------- 2 files changed, 30 insertions(+), 43 deletions(-) diff --git a/src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj b/src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj index db07fb60..40af8712 100644 --- a/src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj +++ b/src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj @@ -12,30 +12,6 @@ README.md - - @@ -47,6 +23,7 @@ + diff --git a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs index 531ca7dc..7f2e8b52 100644 --- a/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs +++ b/src/CodeBeam.UltimateAuth.Server/Options/UAuthServerOptions.cs @@ -10,7 +10,7 @@ namespace CodeBeam.UltimateAuth.Server.Options; /// /// Server-side configuration for UltimateAuth. /// Does NOT duplicate Core options. -/// Instead, it composes SessionOptions, TokenOptions, PkceOptions, MultiTenantOptions +/// Instead, it composes SessionOptions, MultiTenantOptions, PaginationOptions /// and adds server-only behaviors (routing, endpoint activation, policies). /// public sealed class UAuthServerOptions @@ -21,25 +21,11 @@ public sealed class UAuthServerOptions // (Server must NOT duplicate Core options) // ------------------------------------------------------- - public UAuthLoginOptions Login { get; set; } = new(); - /// /// Session behavior (lifetime, sliding expiration, etc.) Fully defined in Core. /// public UAuthSessionOptions Session { get; set; } = new(); - /// - /// Token issuing behavior (lifetimes, refresh policies). Fully defined in Core. - /// - public UAuthTokenOptions Token { get; set; } = new(); - - /// - /// PKCE configuration (required for WASM). Fully defined in Core. - /// - public UAuthPkceOptions Pkce { get; set; } = new(); - - public UAuthEvents Events { get; set; } = new(); - /// /// Multi-tenancy behavior (resolver, normalization, etc.) Fully defined in Core. /// @@ -50,10 +36,27 @@ public sealed class UAuthServerOptions /// public UAuthPaginationOptions Pagination { get; set; } = new(); + /// + /// Gets or sets the authentication events. + /// + public UAuthEvents Events { get; set; } = new(); + // ------------------------------------------------------- // SERVER-ONLY BEHAVIOR // ------------------------------------------------------- + public UAuthLoginOptions Login { get; set; } = new(); + + /// + /// Token issuing behavior (lifetimes, refresh policies). + /// + public UAuthTokenOptions Token { get; set; } = new(); + + /// + /// PKCE configuration (required for WASM). + /// + public UAuthPkceOptions Pkce { get; set; } = new(); + /// /// Gets or sets the authentication mode used for all application profiles when explicitly configured. /// @@ -91,6 +94,9 @@ public sealed class UAuthServerOptions /// public UAuthRateLimitingOptions RateLimiting { get; set; } = new(); + /// + /// Gets or sets the concurrency limiting options. + /// public UAuthConcurrencyLimitingOptions ConcurrencyLimiting { get; set; } = new(); /// @@ -120,11 +126,13 @@ public sealed class UAuthServerOptions /// public UAuthCookiePolicyOptions Cookie { get; set; } = new(); + /// + /// Gets or sets the diagnostic options. + /// public UAuthDiagnosticsOptions Diagnostics { get; set; } = new(); /// - /// Configures how authentication grants are delivered - /// to clients. + /// Configures how authentication grants are delivered to clients. /// public UAuthGrantDeliveryOptions GrantDelivery { get; set; } = new(); @@ -133,6 +141,9 @@ public sealed class UAuthServerOptions /// public UAuthRedirectOptions Redirect { get; set; } = new(); + /// + /// Gets or initializes the credential reset options. + /// public UAuthResetOptions ResetCredential { get; init; } = new(); /// @@ -141,8 +152,7 @@ public sealed class UAuthServerOptions public UAuthCredentialSessionPolicyOptions CredentialSessionPolicy { get; init; } = new(); /// - /// Controls password strength, common-password detection, - /// user similarity checks, and password reuse history. + /// Controls password strength, common-password detection, user similarity checks, and password reuse history. /// public PasswordPolicyOptions Password { get; set; } = new();