allow refresh token ttl assign

This commit is contained in:
Julián Gutiérrez
2016-01-20 12:21:44 +01:00
parent 1e1043c04f
commit 44155a8efc
6 changed files with 50 additions and 47 deletions

View File

@@ -283,15 +283,16 @@ abstract class AbstractGrant implements GrantTypeInterface
}
/**
* @param \DateInterval $tokenTTL
* @param \League\OAuth2\Server\Entities\AccessTokenEntity $accessToken
*
* @return \League\OAuth2\Server\Entities\RefreshTokenEntity
*/
protected function issueRefreshToken(AccessTokenEntity $accessToken)
protected function issueRefreshToken(\DateInterval $tokenTTL, AccessTokenEntity $accessToken)
{
$refreshToken = new RefreshTokenEntity();
$refreshToken->setIdentifier(SecureKey::generate());
$refreshToken->setExpiryDateTime((new \DateTime())->add(new \DateInterval('P1M')));
$refreshToken->setExpiryDateTime((new \DateTime())->add($tokenTTL));
$refreshToken->setAccessToken($accessToken);
return $refreshToken;