Skip to content
Snippets Groups Projects
Commit f03841d5 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

add option to perform an oauth2 specific logout, re #4482, re #3624

Merge request studip/studip!3366
parent 778eea81
No related branches found
No related tags found
No related merge requests found
...@@ -307,6 +307,7 @@ $STUDIP_AUTH_CONFIG_OAUTH2 = [ ...@@ -307,6 +307,7 @@ $STUDIP_AUTH_CONFIG_OAUTH2 = [
'client_id' => '', 'client_id' => '',
'client_secret' => '', 'client_secret' => '',
'redirect_uri' => '', 'redirect_uri' => '',
'logout_url' => '',
'url_authorize' => '', 'url_authorize' => '',
'url_access_token' => '', 'url_access_token' => '',
......
...@@ -18,6 +18,8 @@ final class StudipAuthOAuth2 extends StudipAuthSSO ...@@ -18,6 +18,8 @@ final class StudipAuthOAuth2 extends StudipAuthSSO
protected string $url_access_token; protected string $url_access_token;
protected string $url_resource_owner_details; protected string $url_resource_owner_details;
protected ?string $logout_url = null;
private GenericProvider $oauth2_provider; private GenericProvider $oauth2_provider;
private ?array $user_data = null; private ?array $user_data = null;
...@@ -110,4 +112,15 @@ final class StudipAuthOAuth2 extends StudipAuthSSO ...@@ -110,4 +112,15 @@ final class StudipAuthOAuth2 extends StudipAuthSSO
{ {
return $this->user_data_mapping['map_args']['auth_user_md5.username'] ?? 'nickname'; 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();
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment