Esempio n. 1
0
 /**
  * @param Client $client
  * @return array
  */
 public function getClientScope(Client $client)
 {
     $authorizations = $this->getAuthorizations();
     foreach ($authorizations as $auth) {
         $c = $auth->getClient();
         if ($c->getId() == $client->getId()) {
             return $auth->getScope();
         }
     }
     return null;
 }
Esempio n. 2
0
 /**
  * Checks if a given Client can access this Person's specified scope.
  * @param \PROCERGS\OAuthBundle\Entity\Client $client
  * @param mixed $scope can be a single scope or an array with several.
  * @return boolean
  */
 public function isAuthorizedClient(Client $client, $scope)
 {
     $authorizations = $this->getAuthorizations();
     foreach ($authorizations as $auth) {
         $c = $auth->getClient();
         if ($c->getId() == $client->getId()) {
             return $auth->hasScopes($scope);
         }
     }
     return false;
 }