diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-05-21 15:50:22 +0200 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-05-22 08:57:21 +0200 |
| commit | a1af0876336811e591f07267266ea2ec82be98e2 (patch) | |
| tree | 50e8048610a8a6f8721cfe246d4fc10969a03d2a /lib | |
| parent | 30fe49644edb370ab5647a5feb4615aa712d7ea5 (diff) | |
allow setting the redirect uri of oidc auth plugin and open the oidc and oauth2 auth plugins for derivations, fixes #5625
Closes #5625
Merge request studip/studip!4239
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/classes/auth_plugins/StudipAuthOIDC.class.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/classes/auth_plugins/StudipAuthOIDC.class.php b/lib/classes/auth_plugins/StudipAuthOIDC.class.php index 57d176a..383824f 100644 --- a/lib/classes/auth_plugins/StudipAuthOIDC.class.php +++ b/lib/classes/auth_plugins/StudipAuthOIDC.class.php @@ -34,12 +34,26 @@ class StudipAuthOIDC extends StudipAuthSSO */ public $client_secret; + public ?string $redirect_uri = null; + /** * @var string[] */ public $scopes = ['openid', 'email', 'profile']; - private function getClient(): OpenIDConnectClient + public function __construct($config = []) + { + parent::__construct($config); + + if (!isset($this->redirect_uri)) { + $this->redirect_uri = URLHelper::getURL($GLOBALS['ABSOLUTE_URI_STUDIP'] . 'index.php', ['sso' => $this->plugin_name, 'again' => 'yes'], true); + } + } + + /** + * Returns the configured OpenID Connect client. + */ + protected function getClient(): OpenIDConnectClient { if ($this->oidc === null) { $this->oidc = new OpenIDConnectClient($this->provider_url, $this->client_id, $this->client_secret); @@ -55,8 +69,7 @@ class StudipAuthOIDC extends StudipAuthSSO $this->oidc->setHttpProxy(Config::get()->HTTP_PROXY); } - $return_url = URLHelper::getScriptURL($GLOBALS['ABSOLUTE_URI_STUDIP'] . 'index.php', ['sso' => $this->plugin_name, 'again' => 'yes']); - $this->oidc->setRedirectURL($return_url); + $this->oidc->setRedirectURL($this->redirect_uri); $this->oidc->addScope($this->scopes); } |
