diff --git a/oidc.php b/oidc.php index 980cefa105f627923fcac1e485c15bfab670383c..2d5e25f42251ed78128f9544376587d4478f1581 100644 --- a/oidc.php +++ b/oidc.php @@ -70,27 +70,28 @@ if (isset($_GET['code'])) { $response = curl_exec($ch); $tokens = json_decode($response, true); - // Note: You'd probably want to use a real JWT library - // but this will do in a pinch. This is only safe to do - // because the ID token came from the https connection - // from Google rather than an untrusted browser redirect + // Note : Il est préférable d'utiliser une vraie bibliothèque JWT, + // mais cette solution peut faire l'affaire en cas de besoin. + // L'opération n'est sûre que parce que le jeton d'identification + // provient de la connexion https d'AriseID Connect et non + // d'une redirection de navigateur non fiable. - // Split the JWT string into three parts + // Sépare la chaîne JWT en trois parties $jwt = explode('.', $tokens['id_token']); - // Extract the middle part, base64 decode it, then json_decode it + // Extrait la partie centrale, la décode en base64, puis la décode en json $userinfo = json_decode(base64_decode($jwt[1]), true); $_SESSION['user_id'] = $userinfo['sub']; $_SESSION['email'] = $userinfo['email']; - // While we're at it, let's store the access token and id token - // so we can use them later + // Stocke le jeton d'accès et le jeton d'identification + // pour pouvoir les utiliser ultérieurement $_SESSION['access_token'] = $tokens['access_token']; $_SESSION['id_token'] = $tokens['id_token']; $_SESSION['userinfo'] = $userinfo; - header('Location: ' . $baseURL); + header("Location: $baseURL"); die(); }