Access token TTL is now configured on a per grant basis

This commit is contained in:
Alex Bilbie 2016-01-17 13:54:39 +00:00
parent a4ce1e510e
commit e21a13c82c

View File

@ -43,15 +43,9 @@ class Server implements EmitterAwareInterface
*/ */
protected $defaultResponseType; protected $defaultResponseType;
/**
* @var DateInterval
*/
protected $defaultAccessTokenTTL;
/** /**
* @var string * @var string
*/ */
protected $scopeDelimiterString = ' ';
/** /**
* New server instance * New server instance
@ -90,29 +84,6 @@ class Server implements EmitterAwareInterface
} }
/** /**
* Set the default TTL of access tokens
*
* @param DateInterval $defaultAccessTokenTTL
*/
public function setDefaultAccessTokenTTL(DateInterval $defaultAccessTokenTTL)
{
$this->defaultAccessTokenTTL = $defaultAccessTokenTTL;
}
/**
* Get the default TTL of access tokens
*
* @return DateInterval
*/
protected function getDefaultAccessTokenTTL()
{
if (!$this->defaultAccessTokenTTL instanceof \DateInterval) {
$this->defaultAccessTokenTTL = new \DateInterval('PT01H'); // default token TTL of 1 hour
}
return $this->defaultAccessTokenTTL;
}
/** /**
* Enable a grant type on the server * Enable a grant type on the server
* *
@ -123,7 +94,7 @@ class Server implements EmitterAwareInterface
public function enableGrantType( public function enableGrantType(
GrantTypeInterface $grantType, GrantTypeInterface $grantType,
ResponseTypeInterface $responseType = null, ResponseTypeInterface $responseType = null,
\DateInterval $accessTokenTTL = null \DateInterval $accessTokenTTL
) { ) {
$grantType->setEmitter($this->getEmitter()); $grantType->setEmitter($this->getEmitter());
$this->enabledGrantTypes[$grantType->getIdentifier()] = $grantType; $this->enabledGrantTypes[$grantType->getIdentifier()] = $grantType;