mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-26 06:59:49 +05:30
Added null checks before calling set functions
This commit is contained in:
parent
143afc9561
commit
80bc291c51
@ -17,7 +17,7 @@ interface AuthCodeEntityInterface extends TokenInterface
|
|||||||
public function getRedirectUri();
|
public function getRedirectUri();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|null $uri
|
* @param string $uri
|
||||||
*/
|
*/
|
||||||
public function setRedirectUri($uri);
|
public function setRedirectUri($uri);
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,10 @@ abstract class AbstractGrant implements GrantTypeInterface
|
|||||||
$authCode->setExpiryDateTime((new \DateTime())->add($authCodeTTL));
|
$authCode->setExpiryDateTime((new \DateTime())->add($authCodeTTL));
|
||||||
$authCode->setClient($client);
|
$authCode->setClient($client);
|
||||||
$authCode->setUserIdentifier($userIdentifier);
|
$authCode->setUserIdentifier($userIdentifier);
|
||||||
|
|
||||||
|
if ($redirectUri !== null) {
|
||||||
$authCode->setRedirectUri($redirectUri);
|
$authCode->setRedirectUri($redirectUri);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($scopes as $scope) {
|
foreach ($scopes as $scope) {
|
||||||
$authCode->addScope($scope);
|
$authCode->addScope($scope);
|
||||||
|
@ -270,7 +270,11 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
|
|||||||
$authorizationRequest->setGrantTypeId($this->getIdentifier());
|
$authorizationRequest->setGrantTypeId($this->getIdentifier());
|
||||||
$authorizationRequest->setClient($client);
|
$authorizationRequest->setClient($client);
|
||||||
$authorizationRequest->setRedirectUri($redirectUri);
|
$authorizationRequest->setRedirectUri($redirectUri);
|
||||||
|
|
||||||
|
if ($stateParameter !== null) {
|
||||||
$authorizationRequest->setState($stateParameter);
|
$authorizationRequest->setState($stateParameter);
|
||||||
|
}
|
||||||
|
|
||||||
$authorizationRequest->setScopes($scopes);
|
$authorizationRequest->setScopes($scopes);
|
||||||
|
|
||||||
if ($this->enableCodeExchangeProof === true) {
|
if ($this->enableCodeExchangeProof === true) {
|
||||||
|
@ -177,7 +177,11 @@ class ImplicitGrant extends AbstractAuthorizeGrant
|
|||||||
$authorizationRequest->setGrantTypeId($this->getIdentifier());
|
$authorizationRequest->setGrantTypeId($this->getIdentifier());
|
||||||
$authorizationRequest->setClient($client);
|
$authorizationRequest->setClient($client);
|
||||||
$authorizationRequest->setRedirectUri($redirectUri);
|
$authorizationRequest->setRedirectUri($redirectUri);
|
||||||
|
|
||||||
|
if ($stateParameter !== null) {
|
||||||
$authorizationRequest->setState($stateParameter);
|
$authorizationRequest->setState($stateParameter);
|
||||||
|
}
|
||||||
|
|
||||||
$authorizationRequest->setScopes($finalizedScopes);
|
$authorizationRequest->setScopes($finalizedScopes);
|
||||||
|
|
||||||
return $authorizationRequest;
|
return $authorizationRequest;
|
||||||
|
@ -183,7 +183,7 @@ class AuthorizationRequest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|null $state
|
* @param string $state
|
||||||
*/
|
*/
|
||||||
public function setState($state)
|
public function setState($state)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user