Some checks are pending
Main Confidence / confidence (push) Waiting to run
## Summary - add a shared provider target-scope descriptor, normalizer, identity-context metadata, and surface-summary layer - update provider connection list, detail, create, edit, and onboarding surfaces to use neutral target-scope vocabulary while keeping Microsoft identity contextual - align provider connection audit and resolver output with the neutral target-scope contract and add focused guard/unit/feature coverage for regressions ## Validation - browser smoke: opened the tenant-scoped provider connection list, drilled into detail, and verified the edit/create surfaces in local admin context ## Notes - this PR comes from the session branch created for the active feature work - no additional runtime or persistence layer was introduced in this slice Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #274
92 lines
2.5 KiB
PHP
92 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Support\Providers\TargetScope;
|
|
|
|
final class ProviderIdentityContextMetadata
|
|
{
|
|
public const string VISIBILITY_CONTEXTUAL_ONLY = 'contextual_only';
|
|
|
|
public const string VISIBILITY_AUDIT_ONLY = 'audit_only';
|
|
|
|
public const string VISIBILITY_TROUBLESHOOTING_ONLY = 'troubleshooting_only';
|
|
|
|
public function __construct(
|
|
public readonly string $provider,
|
|
public readonly string $detailKey,
|
|
public readonly string $detailLabel,
|
|
public readonly string $detailValue,
|
|
public readonly string $visibility = self::VISIBILITY_CONTEXTUAL_ONLY,
|
|
) {}
|
|
|
|
public static function microsoftTenantId(?string $value, string $visibility = self::VISIBILITY_CONTEXTUAL_ONLY): ?self
|
|
{
|
|
$value = trim((string) $value);
|
|
|
|
if ($value === '') {
|
|
return null;
|
|
}
|
|
|
|
return new self(
|
|
provider: 'microsoft',
|
|
detailKey: 'microsoft_tenant_id',
|
|
detailLabel: 'Microsoft tenant ID',
|
|
detailValue: $value,
|
|
visibility: $visibility,
|
|
);
|
|
}
|
|
|
|
public static function authorityTenant(?string $value, string $visibility = self::VISIBILITY_TROUBLESHOOTING_ONLY): ?self
|
|
{
|
|
$value = trim((string) $value);
|
|
|
|
if ($value === '') {
|
|
return null;
|
|
}
|
|
|
|
return new self(
|
|
provider: 'microsoft',
|
|
detailKey: 'authority_tenant',
|
|
detailLabel: 'Authority tenant',
|
|
detailValue: $value,
|
|
visibility: $visibility,
|
|
);
|
|
}
|
|
|
|
public static function redirectUri(?string $value, string $visibility = self::VISIBILITY_TROUBLESHOOTING_ONLY): ?self
|
|
{
|
|
$value = trim((string) $value);
|
|
|
|
if ($value === '') {
|
|
return null;
|
|
}
|
|
|
|
return new self(
|
|
provider: 'microsoft',
|
|
detailKey: 'redirect_uri',
|
|
detailLabel: 'Redirect URI',
|
|
detailValue: $value,
|
|
visibility: $visibility,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @return array{
|
|
* provider: string,
|
|
* detail_key: string,
|
|
* detail_label: string,
|
|
* detail_value: string,
|
|
* visibility: string
|
|
* }
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'provider' => $this->provider,
|
|
'detail_key' => $this->detailKey,
|
|
'detail_label' => $this->detailLabel,
|
|
'detail_value' => $this->detailValue,
|
|
'visibility' => $this->visibility,
|
|
];
|
|
}
|
|
}
|