diff --git a/config/config_defaults.inc.php b/config/config_defaults.inc.php index d0f7d69acc13e399ceb17ee8c1cde99c2fa6463d..2f83fefc583fddad9474bc360b8cea3aed86a4dc 100644 --- a/config/config_defaults.inc.php +++ b/config/config_defaults.inc.php @@ -307,6 +307,7 @@ $STUDIP_AUTH_CONFIG_OAUTH2 = [ 'client_id' => '', 'client_secret' => '', 'redirect_uri' => '', + 'logout_url' => '', 'url_authorize' => '', 'url_access_token' => '', diff --git a/lib/classes/auth_plugins/StudipAuthOAuth2.php b/lib/classes/auth_plugins/StudipAuthOAuth2.php index aa9077633e8625ce3ac7c23b4983f96cd26d48e2..98ee90bed6d9d9b15c283447149c7ad8b84dd021 100644 --- a/lib/classes/auth_plugins/StudipAuthOAuth2.php +++ b/lib/classes/auth_plugins/StudipAuthOAuth2.php @@ -18,6 +18,8 @@ final class StudipAuthOAuth2 extends StudipAuthSSO protected string $url_access_token; protected string $url_resource_owner_details; + protected ?string $logout_url = null; + private GenericProvider $oauth2_provider; private ?array $user_data = null; @@ -110,4 +112,15 @@ final class StudipAuthOAuth2 extends StudipAuthSSO { return $this->user_data_mapping['map_args']['auth_user_md5.username'] ?? 'nickname'; } + + /** + * Perform logout if a logout url has been configured + */ + public function logout(): void + { + if (!empty($this->logout_url)) { + header('Location: ' . $this->logout_url); + exit(); + } + } }