Esempio n. 1
0
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     $includeRefreshToken = true;
     $config = get_option("wo_options");
     /*
     if ( isset( $this->authCode['id_token'] ) ) {
     
         // Issue a refresh token when "offline_access" is presented
         // http://openid.net/specs/openid-connect-core-1_0-17.html#OfflineAccess
         // 
         // The document states that a server "MAY" issue a refresh token outside of the "offline_access"
         // and since there is a paramter "always_issue_refresh_token" we can hook into that 
         $scopes = explode(' ', trim($scope));
         if(in_array('offline_access', $scopes) || $config['refresh_tokens_enabled']){
             $includeRefreshToken = true;
         }
     }
     */
     $token = $accessToken->createAccessToken($client_id, $user_id, $scope, $includeRefreshToken);
     if (isset($this->authCode['id_token'])) {
         $token['id_token'] = $this->authCode['id_token'];
     }
     $this->storage->expireAuthorizationCode($this->authCode['code']);
     return $token;
 }
Esempio n. 2
0
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     $token = $accessToken->createAccessToken($client_id, $user_id, $scope);
     //调用方法,删除了授权码
     //         $this->storage->expireAuthorizationCode($this->authCode['code']);
     return $token;
 }
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     $token = $accessToken->createAccessToken($client_id, $user_id, $scope);
     $this->storage->expireAuthorizationCode($this->authCode['code']);
     if (!empty($this->authCode['id_token'])) {
         $token['id_token'] = $this->authCode['id_token'];
     }
     return $token;
 }
Esempio n. 4
0
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     /*
      * Client Credentials Grant does NOT include a refresh token
      * @link http://tools.ietf.org/html/rfc6749#section-4.4.3
      */
     $includeRefreshToken = false;
     return $accessToken->createAccessToken($client_id, $user_id, $scope, $includeRefreshToken);
 }
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     /*
      * It is optional to force a new refresh token when a refresh token is used.
      * However, if a new refresh token is issued, the old one MUST be expired
      * @see http://tools.ietf.org/html/rfc6749#section-6
      */
     $issueNewRefreshToken = $this->config['always_issue_new_refresh_token'];
     $token = $accessToken->createAccessToken($client_id, $user_id, $scope, $issueNewRefreshToken);
     if ($issueNewRefreshToken) {
         $this->storage->unsetRefreshToken($this->refreshToken['refresh_token']);
     }
     return $token;
 }
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     $includeRefreshToken = true;
     if (isset($this->authCode['id_token'])) {
         $scopes = explode(' ', trim($scope));
         $includeRefreshToken = in_array('offline_access', $scopes);
     }
     $token = $accessToken->createAccessToken($client_id, $user_id, $scope, $includeRefreshToken);
     if (isset($this->authCode['id_token'])) {
         $token['id_token'] = $this->authCode['id_token'];
     }
     $this->storage->expireAuthorizationCode($this->authCode['code']);
     return $token;
 }
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     $includeRefreshToken = true;
     if (isset($this->authCode['id_token'])) {
         // OpenID Connect requests include the refresh token only if the
         // offline_access scope has been requested and granted.
         $scopes = explode(' ', trim($scope));
         $includeRefreshToken = in_array('offline_access', $scopes);
     }
     $token = $accessToken->createAccessToken($client_id, $user_id, $scope, $includeRefreshToken);
     if (isset($this->authCode['id_token'])) {
         $token['id_token'] = $this->authCode['id_token'];
     }
     $this->storage->expireAuthorizationCode($this->authCode['code']);
     return $token;
 }
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     return $accessToken->createAccessToken($client_id, $user_id, $scope);
 }
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     $includeRefreshToken = false;
     return $accessToken->createAccessToken($client_id, $user_id, $scope, $includeRefreshToken);
 }
Esempio n. 10
0
 /**
  * Create access token
  * 
  * @param   object  $accessToken  Access token object
  * @param   string  $client_id    Authorized client
  * @param   string  $user_id      User identifier
  * @param   string  $scope        Client application scope
  * @return  string  Access token
  */
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     // create access token
     // DONT CREATE REFRESH TOKEN
     return $accessToken->createAccessToken($client_id, $user_id, $scope, false);
 }
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     $token = $accessToken->createAccessToken($client_id, $user_id, $scope);
     $this->storage->setDeviceToToken($token, $user_id, $this->device_uid, $this->device_name);
     return $token;
 }
Esempio n. 12
0
 /**
  * Create access token
  * 
  * @param   object  $accessToken  Access token object
  * @param   string  $client_id    Authorized client
  * @param   string  $user_id      User identifier
  * @param   string  $scope        Client application scope
  * @return  string  Access token
  */
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     // create access token
     $token = $accessToken->createAccessToken($client_id, $user_id, $scope);
     // expire auth code
     $this->storage->expireAuthorizationCode($this->authCode['code']);
     // return token
     return $token;
 }
Esempio n. 13
0
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     $includeRefreshToken = true;
     $this->storage->expireDeviceCode($this->deviceCode['device_code'], $client_id);
     return $accessToken->createAccessToken($client_id, $user_id, $scope, $includeRefreshToken);
 }
 /**
  * @param AccessTokenFactory $accessTokenFactory
  * @param $client_id
  * @param $user_id
  * @param $scope
  *
  * @return mixed
  */
 public function createAccessToken(AccessTokenFactory $accessTokenFactory, $client_id, $user_id, $scope)
 {
     return $accessTokenFactory->createAccessToken($client_id, $user_id, $scope);
 }
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     //optimise array to return user object as oauth will return only access_token related data
     $userResponse = ['access_token' => $accessToken->createAccessToken($client_id, $user_id, $scope), 'user' => $this->userInfo];
     return $userResponse;
 }
Esempio n. 16
0
 /**
  * Create access token
  * 
  * @param   object  $accessToken  Access token object
  * @param   string  $client_id    Authorized client
  * @param   string  $user_id      User identifier
  * @param   string  $scope        Client application scope
  * @return  string  Access token
  */
 public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     // do we want to issue a new refresh token?
     $issueNewRefreshToken = $this->config['always_issue_new_refresh_token'];
     // create access token
     $token = $accessToken->createAccessToken($client_id, $user_id, $scope, $issueNewRefreshToken);
     // if we issued a new refresh token we must delete the old one
     if ($issueNewRefreshToken) {
         $this->storage->unsetRefreshToken($this->refreshToken['refresh_token']);
     }
     // return new access token
     return $token;
 }
 public function createAccessToken(\OAuth2\ResponseType\AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
 {
     return $accessToken->createAccessToken($client_id, $user_id, $scope);
 }
Esempio n. 18
0
 public function createAccessToken(AccessTokenInterface $deviceCode, $client_id, $user_id = null, $scope)
 {
     return $deviceCode->createDeviceCode($client_id, $scope);
 }