Merge pull request #9700 from JakubOnderka/oidc-issuer-fix

fix: [oidc] Fix issuer if not set
pull/9717/head
Jakub Onderka 2024-04-26 13:40:38 +02:00 committed by GitHub
commit bbb5ee96ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -302,7 +302,7 @@ class Oidc
$providerUrl = $this->getConfig('provider_url');
$clientId = $this->getConfig('client_id');
$clientSecret = $this->getConfig('client_secret');
$issuer = $this->getConfig('issuer', $providerUrl);
$issuer = $this->getConfig('issuer', null, false);
if (class_exists("\JakubOnderka\OpenIDConnectClient")) {
$oidc = new \JakubOnderka\OpenIDConnectClient($providerUrl, $clientId, $clientSecret, $issuer);
@ -503,13 +503,15 @@ class Oidc
/**
* @param string $config
* @param mixed|null $default
* @param bool $required When true and variable is not set, RuntimeException will be thrown
* @return mixed
* @throws RuntimeException when config option is not set
*/
private function getConfig($config, $default = null)
private function getConfig($config, $default = null, $required = true)
{
$value = Configure::read("OidcAuth.$config");
if ($value === null) {
if ($default === null) {
if ($default === null && $required) {
throw new RuntimeException("Config option `OidcAuth.$config` is not set.");
}
return $default;