Added null checks before calling set functions

This commit is contained in:
Andrew Millington 2018-04-21 21:29:21 +01:00
parent 143afc9561
commit 80bc291c51
No known key found for this signature in database
GPG Key ID: 815DE090877B53F3
5 changed files with 16 additions and 5 deletions

View File

@ -17,7 +17,7 @@ interface AuthCodeEntityInterface extends TokenInterface
public function getRedirectUri();
/**
* @param string|null $uri
* @param string $uri
*/
public function setRedirectUri($uri);
}

View File

@ -407,7 +407,10 @@ abstract class AbstractGrant implements GrantTypeInterface
$authCode->setExpiryDateTime((new \DateTime())->add($authCodeTTL));
$authCode->setClient($client);
$authCode->setUserIdentifier($userIdentifier);
if ($redirectUri !== null) {
$authCode->setRedirectUri($redirectUri);
}
foreach ($scopes as $scope) {
$authCode->addScope($scope);

View File

@ -270,7 +270,11 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
$authorizationRequest->setGrantTypeId($this->getIdentifier());
$authorizationRequest->setClient($client);
$authorizationRequest->setRedirectUri($redirectUri);
if ($stateParameter !== null) {
$authorizationRequest->setState($stateParameter);
}
$authorizationRequest->setScopes($scopes);
if ($this->enableCodeExchangeProof === true) {

View File

@ -177,7 +177,11 @@ class ImplicitGrant extends AbstractAuthorizeGrant
$authorizationRequest->setGrantTypeId($this->getIdentifier());
$authorizationRequest->setClient($client);
$authorizationRequest->setRedirectUri($redirectUri);
if ($stateParameter !== null) {
$authorizationRequest->setState($stateParameter);
}
$authorizationRequest->setScopes($finalizedScopes);
return $authorizationRequest;

View File

@ -183,7 +183,7 @@ class AuthorizationRequest
}
/**
* @param string|null $state
* @param string $state
*/
public function setState($state)
{