File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -306,7 +306,15 @@ public function authenticate(): bool
306
306
307
307
// If we have an authorization code then proceed to request a token
308
308
if (isset ($ _REQUEST ['code ' ])) {
309
+ // Do an OpenID Connect session check
310
+ if (!isset ($ _REQUEST ['state ' ]) || ($ _REQUEST ['state ' ] !== $ this ->getState ())) {
311
+ throw new OpenIDConnectClientException ('Unable to determine state ' );
312
+ }
309
313
314
+ // Cleanup state
315
+ $ this ->unsetState ();
316
+
317
+ // Request ID Token
310
318
$ code = $ _REQUEST ['code ' ];
311
319
$ token_json = $ this ->requestTokens ($ code );
312
320
@@ -318,14 +326,6 @@ public function authenticate(): bool
318
326
throw new OpenIDConnectClientException ('Got response: ' . $ token_json ->error );
319
327
}
320
328
321
- // Do an OpenID Connect session check
322
- if (!isset ($ _REQUEST ['state ' ]) || ($ _REQUEST ['state ' ] !== $ this ->getState ())) {
323
- throw new OpenIDConnectClientException ('Unable to determine state ' );
324
- }
325
-
326
- // Cleanup state
327
- $ this ->unsetState ();
328
-
329
329
if (!property_exists ($ token_json , 'id_token ' )) {
330
330
throw new OpenIDConnectClientException ('User did not authorize openid scope. ' );
331
331
}
@@ -379,7 +379,7 @@ public function authenticate(): bool
379
379
$ accessToken = $ _REQUEST ['access_token ' ] ?? null ;
380
380
381
381
// Do an OpenID Connect session check
382
- if (!isset ($ _REQUEST ['state ' ]) || ($ _REQUEST ['state ' ] !== $ this ->getState ())) {
382
+ if (!isset ($ _REQUEST ['state ' ]) || ($ _REQUEST ['state ' ] !== $ this ->getState ())) {
383
383
throw new OpenIDConnectClientException ('Unable to determine state ' );
384
384
}
385
385
You can’t perform that action at this time.
0 commit comments