From be848418e101f08f30fac605d17e6e4ce795bb84 Mon Sep 17 00:00:00 2001 From: koizu-mkII Date: Thu, 30 Jan 2025 11:01:05 +0900 Subject: [PATCH] feat(ssl): Support Single logout. --- MicrosoftGraphProvider.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/MicrosoftGraphProvider.php b/MicrosoftGraphProvider.php index 482edcb..bcdb086 100644 --- a/MicrosoftGraphProvider.php +++ b/MicrosoftGraphProvider.php @@ -37,4 +37,21 @@ public function getAvatar($token = null){ } return null; } + + /** + * Return the logout endpoint with an optional post_logout_redirect_uri query parameter. + * ( Copy from socialiteproviders/microsoft/Provider.php ) + * + * @param string|null $redirectUri The URI to redirect to after logout, if provided. + * If not provided, no post_logout_redirect_uri parameter will be included. + * @return string The logout endpoint URL. + */ + public function getLogoutUrl(?string $redirectUri = null) + { + $logoutUrl = sprintf('https://login.microsoftonline.com/%s/oauth2/logout', $this->getConfig('tenant', 'common')); + + return $redirectUri === null ? + $logoutUrl : + $logoutUrl.'?'.http_build_query(['post_logout_redirect_uri' => $redirectUri], '', '&', $this->encodingType); + } } \ No newline at end of file