Files
breadcrumb-the-shire/core/Service/Auth/AuthGatewayFactory.php
fs 0e86925464 refactor: rename lib/ to core/ for clearer core-module separation
Rename the top-level lib/ directory to core/ so the project root
immediately communicates which code is core platform and which lives
in modules/. PHP namespaces (MintyPHP\*) are unchanged — only the
Composer PSR-4 path mapping moves from lib/ to core/.

Module-internal lib/ directories (modules/*/lib/) are untouched.

Updated across the full stack:
- composer.json PSR-4 mapping
- bootstrap entry points (web/index.php, bin/*, tests/bootstrap.php)
- tooling configs (phpstan.neon, phpunit.xml, php-cs-fixer)
- 26 architecture contract tests
- enforcement-policy, guard-catalog, quality-gates
- all documentation (CLAUDE.md, README, 25 docs/, .agents/skills/)
- bin/qa-extended.sh search paths
- .claude/settings.local.json permission paths

Workflow: .agents/runs/CORE-LIB-RENAME-001/ (Analyst → Planner →
Executor → Code Review (4 findings fixed) → Security Review →
Acceptance Test → Finalizer)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 23:20:42 +02:00

101 lines
3.9 KiB
PHP

<?php
namespace MintyPHP\Service\Auth;
use MintyPHP\Service\Access\AccessServicesFactory;
use MintyPHP\Service\Access\PermissionService;
use MintyPHP\Service\Settings\SettingsApiPolicyGateway;
use MintyPHP\Service\Settings\SettingsAppGateway;
use MintyPHP\Service\Settings\SettingsDefaultsGateway;
use MintyPHP\Service\Settings\SettingServicesFactory;
use MintyPHP\Service\Settings\SettingsLoginPersistenceGateway;
use MintyPHP\Service\Settings\SettingsMicrosoftGateway;
use MintyPHP\Service\Tenant\TenantScopeService;
class AuthGatewayFactory
{
private ?SettingsMicrosoftGateway $settingsMicrosoftGateway = null;
private ?SettingsApiPolicyGateway $settingsApiPolicyGateway = null;
private ?SettingsDefaultsGateway $settingsDefaultsGateway = null;
private ?SettingsAppGateway $settingsAppGateway = null;
private ?SettingsLoginPersistenceGateway $settingsLoginPersistenceGateway = null;
private ?PermissionService $permissionService = null;
private ?AuthSettingsGateway $authSettingsGateway = null;
private ?AuthTenantGateway $authTenantGateway = null;
private ?AuthCryptoGateway $authCryptoGateway = null;
private ?AuthExternalIdentityGateway $authExternalIdentityGateway = null;
public function __construct(
private readonly AuthRepositoryFactory $authRepositoryFactory,
private readonly AccessServicesFactory $accessServicesFactory,
private readonly SettingServicesFactory $settingServicesFactory,
private readonly TenantScopeService $tenantScopeService
) {
}
public function createAuthSettingsGateway(): AuthSettingsGateway
{
return $this->authSettingsGateway ??= new AuthSettingsGateway(
$this->createSettingsMicrosoftGateway(),
$this->createSettingsApiPolicyGateway(),
$this->createSettingsDefaultsGateway(),
$this->createSettingsAppGateway(),
$this->createSettingsLoginPersistenceGateway()
);
}
public function getTenantScopeService(): TenantScopeService
{
return $this->tenantScopeService;
}
public function createPermissionService(): PermissionService
{
return $this->permissionService ??= $this->accessServicesFactory->createPermissionService();
}
public function createAuthTenantGateway(): AuthTenantGateway
{
return $this->authTenantGateway ??= new AuthTenantGateway(
$this->authRepositoryFactory->createTenantRepository()
);
}
public function createAuthCryptoGateway(): AuthCryptoGateway
{
return $this->authCryptoGateway ??= new AuthCryptoGateway();
}
public function createAuthExternalIdentityGateway(): AuthExternalIdentityGateway
{
return $this->authExternalIdentityGateway ??= new AuthExternalIdentityGateway(
$this->authRepositoryFactory->createUserExternalIdentityRepository()
);
}
private function createSettingsMicrosoftGateway(): SettingsMicrosoftGateway
{
return $this->settingsMicrosoftGateway ??= $this->settingServicesFactory->createSettingsMicrosoftGateway();
}
private function createSettingsApiPolicyGateway(): SettingsApiPolicyGateway
{
return $this->settingsApiPolicyGateway ??= $this->settingServicesFactory->createSettingsApiPolicyGateway();
}
private function createSettingsDefaultsGateway(): SettingsDefaultsGateway
{
return $this->settingsDefaultsGateway ??= $this->settingServicesFactory->createSettingsDefaultsGateway();
}
private function createSettingsAppGateway(): SettingsAppGateway
{
return $this->settingsAppGateway ??= $this->settingServicesFactory->createSettingsAppGateway();
}
private function createSettingsLoginPersistenceGateway(): SettingsLoginPersistenceGateway
{
return $this->settingsLoginPersistenceGateway ??= $this->settingServicesFactory->createSettingsLoginPersistenceGateway();
}
}