mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-26 15:00:19 +05:30
Lazy set $accessTokenTTL
This commit is contained in:
parent
e24dff2723
commit
ba30e34511
@ -111,8 +111,12 @@ class Server implements EmitterAwareInterface
|
|||||||
* @param \League\OAuth2\Server\Grant\GrantTypeInterface $grantType
|
* @param \League\OAuth2\Server\Grant\GrantTypeInterface $grantType
|
||||||
* @param \DateInterval $accessTokenTTL
|
* @param \DateInterval $accessTokenTTL
|
||||||
*/
|
*/
|
||||||
public function enableGrantType(GrantTypeInterface $grantType, DateInterval $accessTokenTTL)
|
public function enableGrantType(GrantTypeInterface $grantType, DateInterval $accessTokenTTL = null)
|
||||||
{
|
{
|
||||||
|
if ($accessTokenTTL instanceof DateInterval === false) {
|
||||||
|
$accessTokenTTL = new \DateInterval('PT1H');
|
||||||
|
}
|
||||||
|
|
||||||
$grantType->setAccessTokenRepository($this->accessTokenRepository);
|
$grantType->setAccessTokenRepository($this->accessTokenRepository);
|
||||||
$grantType->setClientRepository($this->clientRepository);
|
$grantType->setClientRepository($this->clientRepository);
|
||||||
$grantType->setScopeRepository($this->scopeRepository);
|
$grantType->setScopeRepository($this->scopeRepository);
|
||||||
@ -121,7 +125,6 @@ class Server implements EmitterAwareInterface
|
|||||||
$grantType->setEmitter($this->getEmitter());
|
$grantType->setEmitter($this->getEmitter());
|
||||||
|
|
||||||
$this->enabledGrantTypes[$grantType->getIdentifier()] = $grantType;
|
$this->enabledGrantTypes[$grantType->getIdentifier()] = $grantType;
|
||||||
|
|
||||||
$this->grantTypeAccessTokenTTL[$grantType->getIdentifier()] = $accessTokenTTL;
|
$this->grantTypeAccessTokenTTL[$grantType->getIdentifier()] = $accessTokenTTL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user