fix: persistent sessiebeheer (remember-me), HTTPS-cookie herstel en Microsoft OAuth signed state flow

This commit is contained in:
2026-09-08 15:28:57 +02:00
parent e1f50740aa
commit acef94536d
12 changed files with 278 additions and 29 deletions
+3 -3
View File
@@ -31,10 +31,10 @@ if (empty($clientId)) {
// Bepaal de dynamische of geconfigureerde redirect URI
$redirectUri = rtrim(APP_URL, '/') . '/auth/callback_microsoft.php';
// Genereer unieke CSRF state
$state = bin2hex(random_bytes(16));
// Genereer cryptografisch ondertekende OAuth state waarin de user_id en timestamp veilig zijn opgeslagen
$state = generate_oauth_state((int)$user['id']);
$_SESSION['ms_oauth_state'] = $state;
$_SESSION['ms_oauth_user_id'] = $user['id'];
$_SESSION['ms_oauth_user_id'] = (int)$user['id'];
// Stuur gebruiker door naar Microsoft login
$authUrl = microsoft_get_auth_url($clientId, $redirectUri, $tenantId, $state);