aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-09-04 09:48:56 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-09-04 09:48:56 +0000
commitf03841d53ad301572dbb040b0c7b7e2a5e324f2e (patch)
tree9e0752c1e42ae46a3c9b4daa2ff68c6ccdd5acd7 /lib
parent778eea81574b3cba36250f83878fb279b549167e (diff)
add option to perform an oauth2 specific logout, re #4482, re #3624issue-4263-2issue-4263
Merge request studip/studip!3366
Diffstat (limited to 'lib')
-rw-r--r--lib/classes/auth_plugins/StudipAuthOAuth2.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/classes/auth_plugins/StudipAuthOAuth2.php b/lib/classes/auth_plugins/StudipAuthOAuth2.php
index aa90776..98ee90b 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();
+ }
+ }
}