Skip to content

Commit

Permalink
#1138 Bring logout from azure to microsoft (#1202)
Browse files Browse the repository at this point in the history
Co-authored-by: Vuong V <[email protected]>
  • Loading branch information
kinekt4 and Vuong V authored May 13, 2024
1 parent 74c91c4 commit 6244cf2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Microsoft/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ protected function getTokenUrl()
return sprintf('https://login.microsoftonline.com/%s/oauth2/v2.0/token', $this->getConfig('tenant', 'common'));
}

/**
* Return the logout endpoint with an optional post_logout_redirect_uri query parameter.
*
* @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);
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit 6244cf2

Please sign in to comment.