Skip to content

Commit

Permalink
resolv conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
piuma committed Nov 8, 2023
2 parents 1bc3dc7 + 7070331 commit 15c2510
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/OpenIDConnectClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,11 @@ public function authenticate() {
throw new OpenIDConnectClientException('Got response: ' . $token_json->error);
}

// Sometime getState() return an empty string
// Sometime getState() return an empty string
// and the authentication process fail
if ($this->getState() == "")
$this->setState($_REQUEST['state']);

// Do an OpenID Connect session check
if ($_REQUEST['state'] !== $this->getState()) {
throw new OpenIDConnectClientException('Unable to determine state');
Expand Down Expand Up @@ -344,6 +344,13 @@ public function authenticate() {
// Save the access token
$this->accessToken = $token_json->access_token;

// During verifyJWTclaims sometime return an empty string (probably caused by the session timeout between KC and Client)
// Which cause issue in the *_auth.php, this should "patch" the randomic emptiness.
if ($this->getNonce() == "") {
$this->setNonce($claims->nonce);
user_error('Warning: Function getNonce return empty, setting in the session!');
};

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

Expand Down

0 comments on commit 15c2510

Please sign in to comment.