mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-11-05 16:08:21 +00:00
[Web] OIDC/LDAP: check the OAuth state, keep the mailbox on token refresh, require unique IdP users
This commit is contained in:
5 files changed
+56
-10
No files matched your search
@@ -19,8 +19,10 @@ if ($iam_provider){
|
||||
header('Location: ' . $redirect_uri);
|
||||
die();
|
||||
}
|
||||
} elseif ($_GET['code'] && $_GET['state'] === $_SESSION['oauth2state']) {
|
||||
// Check given state against previously stored one to mitigate CSRF attack
|
||||
} elseif (!empty($_GET['code']) && !empty($_SESSION['oauth2state']) && is_string($_GET['state'] ?? null)
|
||||
&& hash_equals((string)$_SESSION['oauth2state'], $_GET['state'])) {
|
||||
// Check given state against previously stored one to mitigate CSRF attack, a state is used once
|
||||
unset($_SESSION['oauth2state']);
|
||||
// Received access token in $_GET['code']
|
||||
// extract info and verify user
|
||||
identity_provider('verify-sso');
|
||||
|
||||
Reference in new issue
Block a user