aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2025-05-21 15:50:22 +0200
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2025-05-22 08:57:41 +0200
commit0bc9250e65bba84a79c746e3757f3c3637bcd9e3 (patch)
treed9ae23b4603f335eb2ac0de02b1e47462f64be0c /lib
parent11c3d3ebe8726aa69edddd50eab9e54037603e0b (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.php19
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);
}