Fix method calls

This commit is contained in:
Nicolas Le Goff
2014-03-06 17:14:57 +01:00
parent 0cd4bb6e6a
commit d91cba1e8e

View File

@@ -15,7 +15,7 @@ use Alchemy\Phrasea\Authentication\Exception\AccountLockedException;
use Alchemy\Phrasea\Authentication\Exception\RequireCaptchaException; use Alchemy\Phrasea\Authentication\Exception\RequireCaptchaException;
use Alchemy\Phrasea\Exception\RuntimeException; use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\Model\Entities\ApiApplication; use Alchemy\Phrasea\Model\Entities\ApiApplication;
use Alchemy\Phrasea\Model\Entities\Session; use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class API_OAuth2_Adapter extends OAuth2 class API_OAuth2_Adapter extends OAuth2
@@ -198,9 +198,9 @@ class API_OAuth2_Adapter extends OAuth2
return [ return [
'scope' => $token->getScope(), 'scope' => $token->getScope(),
'expires' => $token->getExpire()->getTimestamp(), 'expires' => null !== $token->getExpires() ? $token->getExpires()->getTimestamp() : null,
'client_id' => $token->getAccount()->getApplication()->getClientId(), 'client_id' => $token->getAccount()->getApplication()->getClientId(),
'session_id' => null === $token->getSession() ? null : $token->getSession()->getId(), 'session_id' => $token->getSessionId(),
'revoked' => (int) $token->getAccount()->isRevoked(), 'revoked' => (int) $token->getAccount()->isRevoked(),
'usr_id' => $token->getAccount()->getUser()->getId(), 'usr_id' => $token->getAccount()->getUser()->getId(),
'oauth_token' => $token->getOauthToken(), 'oauth_token' => $token->getOauthToken(),
@@ -270,7 +270,7 @@ class API_OAuth2_Adapter extends OAuth2
return [ return [
'redirect_uri' => $code->getRedirectUri(), 'redirect_uri' => $code->getRedirectUri(),
'client_id' => $code->getAccount()->getApplication()->getClientId(), 'client_id' => $code->getAccount()->getApplication()->getClientId(),
'expires' => $code->getExpires()->getTimestamp(), 'expires' => null !== $code->getExpires() ? $code->getExpires()->getTimestamp() : null,
'account_id' => $code->getAccount()->getId(), 'account_id' => $code->getAccount()->getId(),
]; ];
} }
@@ -338,7 +338,7 @@ class API_OAuth2_Adapter extends OAuth2
return [ return [
'token' => $token->getRefreshToken(), 'token' => $token->getRefreshToken(),
'expires' => $token->getExpires()->getTimestamp(), 'expires' => null !== $token->getExpires() ? $token->getExpires()->getTimestamp() : null,
'client_id' => $token->getAccount()->getApplication()->getClientId() 'client_id' => $token->getAccount()->getApplication()->getClientId()
]; ];
} }
@@ -553,7 +553,7 @@ class API_OAuth2_Adapter extends OAuth2
public function rememberSession(Session $session) public function rememberSession(Session $session)
{ {
if (null !== $token = $this->app['repo.api-oauth-tokens']->find($this->token)) { if (null !== $token = $this->app['repo.api-oauth-tokens']->find($this->token)) {
$token->setSession($session); $this->app['manipulator.api-oauth-token']->rememberSessionId($token, $session->getId());
} }
} }