Skip to content

Commit

Permalink
CS early return
Browse files Browse the repository at this point in the history
  • Loading branch information
bartgloudemans committed Sep 16, 2024
1 parent 03fe304 commit 60866f9
Showing 1 changed file with 26 additions and 29 deletions.
55 changes: 26 additions & 29 deletions src/OpenIDConnectClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,27 +376,26 @@ public function handleCode(string $code, string $state = null): bool
$this->accessToken = $token_json->access_token;

// If this is a valid claim
if ($this->verifyJWTClaims($claims, $token_json->access_token)) {

// Clean up the session a little
$this->unsetNonce();
if (!$this->verifyJWTClaims($claims, $token_json->access_token)) {
throw new OpenIDConnectClientException ('Unable to verify JWT claims');
}

// Save the full response
$this->tokenResponse = $token_json;
// Clean up the session a little
$this->unsetNonce();

// Save the verified claims
$this->verifiedClaims = $claims;
// Save the full response
$this->tokenResponse = $token_json;

// Save the refresh token, if we got one
if (isset($token_json->refresh_token)) {
$this->refreshToken = $token_json->refresh_token;
}
// Save the verified claims
$this->verifiedClaims = $claims;

// Success!
return true;
// Save the refresh token, if we got one
if (isset($token_json->refresh_token)) {
$this->refreshToken = $token_json->refresh_token;
}

throw new OpenIDConnectClientException ('Unable to verify JWT claims');
// Success!
return true;
}

/**
Expand All @@ -421,25 +420,23 @@ public function handleClaims(string $id_token, string $accessToken = null, strin
$this->idToken = $id_token;

// If this is a valid claim
if ($this->verifyJWTClaims($claims, $accessToken)) {

// Clean up the session a little
$this->unsetNonce();
if (!$this->verifyJWTClaims($claims, $accessToken)) {
throw new OpenIDConnectClientException ('Unable to verify JWT claims');
}

// Save the verified claims
$this->verifiedClaims = $claims;
// Clean up the session a little
$this->unsetNonce();

// Save the access token
if ($accessToken) {
$this->accessToken = $accessToken;
}

// Success!
return true;
// Save the verified claims
$this->verifiedClaims = $claims;

// Save the access token
if ($accessToken) {
$this->accessToken = $accessToken;
}

throw new OpenIDConnectClientException ('Unable to verify JWT claims');
// Success!
return true;
}

/**
Expand Down

0 comments on commit 60866f9

Please sign in to comment.