Added method to set the auth token TTL

This commit is contained in:
Alex Bilbie 2013-05-07 15:20:32 -07:00
parent 8fd9e3f312
commit 9f90cd2635

View File

@ -48,6 +48,12 @@ class AuthCode implements GrantTypeInterface {
*/
protected $accessTokenTTL = null;
/**
* The TTL of the auth token
* @var integer
*/
protected $authTokenTTL = 600;
/**
* Constructor
* @param AuthServer $authServer AuthServer instance
@ -86,6 +92,16 @@ class AuthCode implements GrantTypeInterface {
$this->accessTokenTTL = $accessTokenTTL;
}
/**
* Override the default access token expire time
* @param int $authTokenTTL
* @return void
*/
public function setAuthTokenTTL($authTokenTTL)
{
$this->authTokenTTL = $authTokenTTL;
}
/**
* Check authorise parameters
*
@ -187,7 +203,7 @@ class AuthCode implements GrantTypeInterface {
$this->authServer->getStorage('session')->associateRedirectUri($sessionId, $authParams['redirect_uri']);
// Associate the auth code
$this->authServer->getStorage('session')->associateAuthCode($sessionId, $authCode, time()+600, implode(',', $scopeIds));
$this->authServer->getStorage('session')->associateAuthCode($sessionId, $authCode, time() + $this->authTokenTTL, implode(',', $scopeIds));
return $authCode;
}