- Introduced a detailed view for OIDC apps (`show` page) with client credentials and sign-out URI management. - Added functionality to toggle app status, generate new client secrets, and display OAuth scopes. - Implemented service methods for handling OIDC app data, including `getPassportClient`, `generateNewSecret`, and `toggleStatus`. - Enhanced feature tests for role-based access and validation of client secret generation.
47 lines
1.0 KiB
PHP
47 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Services\Applications\OIDC;
|
|
|
|
use App\Enums\ApplicationTypeEnum;
|
|
|
|
class OidcConfigResolver
|
|
{
|
|
private ?ApplicationTypeEnum $applicationType = null;
|
|
|
|
public function for(ApplicationTypeEnum $applicationType): OidcConfigResolver
|
|
{
|
|
$this->applicationType = $applicationType;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function hasClientSecret(): bool
|
|
{
|
|
return ApplicationTypeEnum::SPA !== $this->applicationType;
|
|
}
|
|
|
|
public function needSignInUris(): bool
|
|
{
|
|
return true;
|
|
// return ApplicationTypeEnum::Machine !== $this->applicationType;
|
|
}
|
|
|
|
public function needSignOutUris(): bool
|
|
{
|
|
return true;
|
|
// return ApplicationTypeEnum::Machine !== $this->applicationType;
|
|
}
|
|
|
|
public function isConfidential(\Laravel\Passport\Client $client): bool
|
|
{
|
|
return $client->confidential();
|
|
}
|
|
|
|
public function requiresPkce(\Laravel\Passport\Client $client): bool
|
|
{
|
|
return ! $client->confidential();
|
|
}
|
|
}
|