public function createClient($identifier, array $redirect_uris = array(), array $grant_types = array(), array $scopes = array())
    {
        $client = new \OAuth2\ServerBundle\Entity\Client();
        $client->setClientId($identifier);
        $client->setClientSecret($this->generateSecret());
        $client->setRedirectUri($redirect_uris);
        $client->setGrantTypes($grant_types);

        // Verify scopes
        foreach ($scopes as $scope) {
            // Get Scope
            $scopeObject = $this->sm->findScopeByScope($scope);
            if (!$scopeObject) {
                throw new ScopeNotFoundException();
            }
        }

        $client->setScopes($scopes);

        // Store Client
        $this->em->persist($client);
        $this->em->flush();

        return $client;
    }
public function createClient($identifier, array $redirect_uris = array(), array $grant_types = array(), array $scopes = array())
    {
        $client = new \OAuth2\ServerBundle\Entity\Client();
        $client->setClientId($identifier);
        $client->setClientSecret($this->generateSecret());
        $client->setRedirectUri($redirect_uris);
        $client->setGrantTypes($grant_types);

        // Verify scopes
        foreach ($scopes as $scope) {
            // Get Scope
            $scopeObject = $this->sm->findScopeByScope($scope);
            if (!$scopeObject) {
                throw new ScopeNotFoundException();
            }
        }

        $client->setScopes($scopes);

        // Store Client
        $this->em->persist($client);
        $this->em->flush();

        return $client;
    }
public function createClient ( $ identifier , array $ redirect_uris = array ( ) , array $ grant_types = array ( ) , array $ scopes = array ( ) ) { $ client = new \ OAuth2 \ ServerBundle \ Entity \ Client ( ) ; $ client -> setClientId ( $ identifier ) ; $ client -> setClientSecret ( $ this -> generateSecret ( ) ) ; $ client -> setRedirectUri ( $ redirect_uris ) ; $ client -> setGrantTypes ( $ grant_types ) ; // Verify scopes foreach ( $ scopes as $ scope ) { // Get Scope $ scopeObject = $ this -> sm -> findScopeByScope ( $ scope ) ; if ( ! $ scopeObject ) { throw new ScopeNotFoundException ( ) ; } } $ client -> setScopes ( $ scopes ) ; // Store Client $ this -> em -> persist ( $ client ) ; $ this -> em -> flush ( ) ; return $ client ; }
Creates a new client

@param string $identifier

@param array $redirect_uris

@param array $grant_type

@param array $scopes

@return Client
Creates a new client