TenantAtlas/app/Services/Providers/ProviderGateway.php
ahmido bab01f07a9 feat: standardize platform provider identity (#166)
## Summary
- standardize Microsoft provider connections around explicit platform vs dedicated identity modes
- centralize admin-consent URL and runtime identity resolution so platform flows no longer fall back to tenant-local credentials
- add migration classification, richer consent and verification state handling, dedicated override management, and focused regression coverage

## Validation
- focused repo test coverage was added across provider identity, onboarding, audit, policy, guard, and migration flows
- latest explicit passing run in the workspace: `vendor/bin/sail artisan test --compact tests/Feature/AdminConsentCallbackTest.php tests/Feature/Audit/ProviderConnectionConsentAuditTest.php`

## Notes
- branch includes the full Spec 137 artifact set under `specs/137-platform-provider-identity/`
- target base branch: `dev`

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #166
2026-03-13 16:29:08 +00:00

59 lines
2.0 KiB
PHP

<?php
namespace App\Services\Providers;
use App\Models\ProviderConnection;
use App\Services\Graph\GraphClientInterface;
use App\Services\Graph\GraphResponse;
final class ProviderGateway
{
public function __construct(
private readonly GraphClientInterface $graph,
private readonly ProviderIdentityResolver $identityResolver,
) {}
public function getOrganization(ProviderConnection $connection): GraphResponse
{
return $this->graph->getOrganization($this->graphOptions($connection));
}
public function getPolicy(ProviderConnection $connection, string $policyType, string $policyId, array $options = []): GraphResponse
{
return $this->graph->getPolicy($policyType, $policyId, $this->graphOptions($connection, $options));
}
public function listPolicies(ProviderConnection $connection, string $policyType, array $options = []): GraphResponse
{
return $this->graph->listPolicies($policyType, $this->graphOptions($connection, $options));
}
public function applyPolicy(
ProviderConnection $connection,
string $policyType,
string $policyId,
array $payload,
array $options = [],
): GraphResponse {
return $this->graph->applyPolicy($policyType, $policyId, $payload, $this->graphOptions($connection, $options));
}
public function getServicePrincipalPermissions(ProviderConnection $connection, array $options = []): GraphResponse
{
return $this->graph->getServicePrincipalPermissions($this->graphOptions($connection, $options));
}
public function request(ProviderConnection $connection, string $method, string $path, array $options = []): GraphResponse
{
return $this->graph->request($method, $path, $this->graphOptions($connection, $options));
}
/**
* @return array<string, mixed>
*/
public function graphOptions(ProviderConnection $connection, array $overrides = []): array
{
return $this->identityResolver->resolve($connection)->graphOptions($overrides);
}
}