function it_issues_refresh_token_for_given_access_token(IRefreshTokenStorage $refreshTokenStorage, IAccessToken $accessToken, IRefreshToken $refreshToken, IUser $user, IClient $client, IScope $scope)
 {
     $accessToken->getUser()->willReturn($user)->shouldBeCalled();
     $accessToken->getClient()->willReturn($client)->shouldBeCalled();
     $accessToken->getScopes()->willReturn([$scope])->shouldBeCalled();
     $refreshTokenStorage->generate($user, $client, [$scope])->willReturn($refreshToken)->shouldBeCalled();
     $this->issueToken($accessToken)->shouldReturnAnInstanceOf('OAuth2\\Storage\\IRefreshToken');
 }
 /**
  * Issues refresh token for given access token
  *
  * @param IAccessToken $accessToken
  *
  * @return \OAuth2\Storage\IRefreshToken
  */
 public function issueToken(IAccessToken $accessToken)
 {
     $scopes = $accessToken->getScopes();
     // in case of doctrine collections, etc
     if ($scopes instanceof \Traversable) {
         $scopes = iterator_to_array($scopes);
     }
     return $this->refreshTokenStorage->generate($accessToken->getUser(), $accessToken->getClient(), $scopes);
 }
 /**
  * Gets user associated with access token
  *
  * @return \OAuth2\Storage\IUser
  */
 public function getUser()
 {
     return $this->accessToken->getUser();
 }
Exemplo n.º 4
0
 function it_returns_user_from_access_token(IAccessToken $accessToken, IUser $user)
 {
     $accessToken->getUser()->willReturn($user)->shouldBeCalled();
     $this->getUser()->shouldReturn($user);
 }