Skip to content

Commit 4046c22

Browse files
Merge pull request #326 from jumbojett/fix/cleanup-back-channel
chore: code cleanup of back-channel PR #302
2 parents 31354e8 + db9a25c commit 4046c22

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/OpenIDConnectClient.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ public function authenticate() {
378378

379379
// Success!
380380
return true;
381-
382381
}
383382

384383
throw new OpenIDConnectClientException ('Unable to verify JWT claims');
@@ -479,8 +478,8 @@ public function signOut($idToken, $redirect) {
479478
* back-channel logout flows.
480479
*
481480
* This function should be evaluated as a boolean check
482-
* in your route that receives the POST request for back-
483-
* channel logout executed from the OP.
481+
* in your route that receives the POST request for back-channel
482+
* logout executed from the OP.
484483
*
485484
* @return bool
486485
* @throws OpenIDConnectClientException
@@ -506,18 +505,15 @@ public function verifyLogoutToken()
506505
}
507506

508507
// Verify Logout Token Claims
509-
if ($this->verifyLogoutTokenClaims($claims, $logout_token)) {
510-
$this->logoutToken = $logout_token;
508+
if ($this->verifyLogoutTokenClaims($claims)) {
511509
$this->verifiedClaims = $claims;
512510
return true;
513511
}
514-
else {
515-
return false;
516-
}
517-
}
518-
else {
519-
throw new OpenIDConnectClientException('Back-channel logout: There was no logout_token in the request');
512+
513+
return false;
520514
}
515+
516+
throw new OpenIDConnectClientException('Back-channel logout: There was no logout_token in the request');
521517
}
522518

523519
/**
@@ -526,6 +522,7 @@ public function verifyLogoutToken()
526522
*
527523
* @param object $claims
528524
* @return bool
525+
* @throws OpenIDConnectClientException
529526
*/
530527
public function verifyLogoutTokenClaims($claims)
531528
{
@@ -572,11 +569,11 @@ public function verifyLogoutTokenClaims($claims)
572569
return false;
573570
}
574571
// Validate the iat. At this point we can return true if it is ok
575-
if (isset($claims->iat) && ((gettype($claims->iat) === 'integer') && ($claims->iat <= time() + $this->leeway))) {
572+
if (isset($claims->iat) && ((is_int($claims->iat)) && ($claims->iat <= time() + $this->leeway))) {
576573
return true;
577-
} else {
578-
return false;
579574
}
575+
576+
return false;
580577
}
581578

582579
/**
@@ -770,6 +767,7 @@ protected function generateRandString() {
770767
* Start Here
771768
* @return void
772769
* @throws OpenIDConnectClientException
770+
* @throws \Exception
773771
*/
774772
private function requestAuthorization() {
775773

0 commit comments

Comments
 (0)