2026-02-23 12:58:19 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MintyPHP\Service\Auth;
|
|
|
|
|
|
2026-03-06 00:44:52 +01:00
|
|
|
use MintyPHP\Service\Settings\SettingsApiPolicyGateway;
|
|
|
|
|
use MintyPHP\Service\Settings\SettingsAppGateway;
|
|
|
|
|
use MintyPHP\Service\Settings\SettingsDefaultsGateway;
|
2026-03-10 22:48:10 +01:00
|
|
|
use MintyPHP\Service\Settings\SettingsLoginPersistenceGateway;
|
2026-03-06 00:44:52 +01:00
|
|
|
use MintyPHP\Service\Settings\SettingsMicrosoftGateway;
|
2026-02-23 12:58:19 +01:00
|
|
|
|
|
|
|
|
class AuthSettingsGateway
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
public function __construct(
|
|
|
|
|
private readonly SettingsMicrosoftGateway $settingsMicrosoftGateway,
|
|
|
|
|
private readonly SettingsApiPolicyGateway $settingsApiPolicyGateway,
|
|
|
|
|
private readonly SettingsDefaultsGateway $settingsDefaultsGateway,
|
2026-03-10 22:48:10 +01:00
|
|
|
private readonly SettingsAppGateway $settingsAppGateway,
|
|
|
|
|
private readonly SettingsLoginPersistenceGateway $settingsLoginPersistenceGateway
|
2026-03-06 00:44:52 +01:00
|
|
|
) {
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getMicrosoftSharedClientId(): string
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return (string) $this->settingsMicrosoftGateway->getMicrosoftSharedClientId();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getMicrosoftSharedClientSecret(): string
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return (string) $this->settingsMicrosoftGateway->getMicrosoftSharedClientSecret();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getMicrosoftAuthority(): string
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return (string) $this->settingsMicrosoftGateway->getMicrosoftAuthority();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getApiTokenMaxTtlDays(): int
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return $this->settingsApiPolicyGateway->getApiTokenMaxTtlDays();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getApiTokenDefaultTtlDays(): int
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return $this->settingsApiPolicyGateway->getApiTokenDefaultTtlDays();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getAppTheme(): string
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return (string) $this->settingsAppGateway->getAppTheme();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-19 08:23:14 +01:00
|
|
|
public function defaultTheme(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsAppGateway->resolveDefaultTheme();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function normalizeTheme(?string $theme): string
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsAppGateway->normalizeTheme($theme);
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-23 12:58:19 +01:00
|
|
|
public function getDefaultRoleId(): int
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return (int) $this->settingsDefaultsGateway->getDefaultRoleId();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDefaultDepartmentId(): int
|
|
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return (int) $this->settingsDefaultsGateway->getDefaultDepartmentId();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
2026-03-10 22:48:10 +01:00
|
|
|
|
|
|
|
|
public function isMicrosoftAutoRememberDefault(): bool
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsLoginPersistenceGateway->isMicrosoftAutoRememberDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getRememberTokenLifetimeDays(): int
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsLoginPersistenceGateway->getRememberTokenLifetimeDays();
|
|
|
|
|
}
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|