apiTokenService ??= new ApiTokenService( $this->userServicesFactory->createUserReadRepository(), $this->authRepositoryFactory->createApiTokenRepository(), $this->authGatewayFactory->createAuthSettingsGateway(), $this->createAuthScopeGateway(), $this->databaseSessionRepository, $this->requestRuntime ); } public function createPasswordResetService(): PasswordResetService { return $this->passwordResetService ??= new PasswordResetService( $this->userServicesFactory->createUserReadRepository(), $this->authRepositoryFactory->createPasswordResetRepository(), $this->userServicesFactory->createUserPasswordService(), $this->createRememberMeService(), $this->mailServicesFactory->createMailService() ); } public function createEmailVerificationService(): EmailVerificationService { return $this->emailVerificationService ??= new EmailVerificationService( $this->userServicesFactory->createUserReadRepository(), $this->userServicesFactory->createUserWriteRepository(), $this->authRepositoryFactory->createEmailVerificationRepository(), $this->mailServicesFactory->createMailService() ); } public function createRememberMeService(): RememberMeService { return $this->rememberMeService ??= new RememberMeService( $this->userServicesFactory->createUserReadRepository(), $this->userServicesFactory->createUserWriteRepository(), $this->authRepositoryFactory->createRememberTokenRepository(), $this->authGatewayFactory->createAuthPermissionGateway(), $this->createAuthSessionTenantContextService(), $this->sessionStore, $this->cookieStore, $this->requestRuntime, $this->authGatewayFactory->createAuthSettingsGateway() ); } public function createAuthService(): AuthService { return $this->authService ??= new AuthService( $this->userServicesFactory->createUserReadRepository(), $this->userServicesFactory->createUserWriteRepository(), $this->userServicesFactory->createUserAccountService(), $this->userServicesFactory->createUserTenantContextService(), $this->createRememberMeService(), $this->createEmailVerificationService(), $this->authGatewayFactory->createAuthPermissionGateway(), $this->createAuthTenantSsoGateway(), $this->createAuthSessionTenantContextService(), $this->auditServicesFactory->createSystemAuditService(), $this->sessionStore ); } public function createSsoUserLinkService(): SsoUserLinkService { return $this->ssoUserLinkService ??= new SsoUserLinkService( $this->userServicesFactory->createUserReadRepository(), $this->userServicesFactory->createUserWriteRepository(), $this->userServicesFactory->createUserAssignmentService(), $this->userServicesFactory->createUserTenantRepository(), $this->authGatewayFactory->createAuthSettingsGateway(), $this->createAuthTenantSsoGateway(), $this->authGatewayFactory->createAuthAvatarGateway(), $this->authGatewayFactory->createAuthExternalIdentityGateway() ); } public function createTenantSsoService(): TenantSsoService { return $this->tenantSsoService ??= new TenantSsoService( $this->authGatewayFactory->createAuthTenantGateway(), $this->authRepositoryFactory->createTenantMicrosoftAuthRepository(), $this->authGatewayFactory->createAuthSettingsGateway(), $this->authGatewayFactory->createAuthCryptoGateway() ); } public function createMicrosoftOidcStateStore(): MicrosoftOidcStateStoreService { return $this->microsoftOidcStateStoreService ??= new MicrosoftOidcStateStoreService($this->sessionStore); } public function createMicrosoftOidcService(): MicrosoftOidcService { return $this->microsoftOidcService ??= new MicrosoftOidcService( $this->createTenantSsoService(), $this->authGatewayFactory->createAuthTenantGateway(), $this->createOidcHttpGateway(), $this->createMicrosoftOidcStateStore() ); } public function createAuthScopeGateway(): AuthScopeGateway { return $this->authGatewayFactory->createAuthScopeGateway(); } private function createAuthTenantSsoGateway(): AuthTenantSsoGateway { return $this->authGatewayFactory->createAuthTenantSsoGateway($this->createTenantSsoService()); } private function createOidcHttpGateway(): OidcHttpGateway { return new OidcHttpGateway(); } private function createAuthSessionTenantContextService(): AuthSessionTenantContextService { return $this->authSessionTenantContextService ??= new AuthSessionTenantContextService( $this->userServicesFactory->createUserTenantContextService(), $this->authGatewayFactory->createAuthSavedFilterGateway(), $this->sessionStore ); } }