configured) { return; } $tenant = $this->tenantService->fetchByDomain($domain); if ($tenant) { $this->domain = $domain; $this->tenant = $tenant; $this->configured = true; } else { $this->domain = null; $this->tenant = null; $this->configured = false; } } /** * Is the tenant configured */ public function configured(): bool { return $this->configured; } /** * Is the tenant enabled */ public function enabled(): bool { return $this->tenant?->getEnabled() ?? false; } /** * Current tenant domain */ public function domain(): ?string { return $this->domain; } /** * Current tenant identifier */ public function identifier(): ?string { return $this->tenant?->getIdentifier(); } /** * Current tenant label */ public function label(): ?string { return $this->tenant?->getLabel(); } /** * Current tenant configuration */ public function configuration(): TenantConfiguration { return $this->tenant?->getConfiguration(); } /** * Current tenant settings */ public function settings(): array { return $this->tenant?->getSettings() ?? []; } /** * Get all identity providers configuration for this tenant * @return array Map of provider ID to provider config */ public function identityProviders(): array { return $this->tenant?->getConfiguration()['identity']['providers'] ?? []; } /** * Get configuration for a specific identity provider * * @param string $providerId Provider identifier (e.g., 'default', 'oidc') * @return array|null Provider configuration or null if not found */ public function identityProviderConfig(string $providerId): ?array { $providers = $this->identityProviders(); return $providers[$providerId] ?? null; } /** * Check if an identity provider is enabled for this tenant */ public function isIdentityProviderEnabled(string $providerId): bool { $config = $this->identityProviderConfig($providerId); return $config !== null && ($config['enabled'] ?? false); } }