/**
  * {@inheritDoc}
  */
 public function createConsumer($name, $callback = null)
 {
     $class = $this->getConsumerClass();
     /** @var \Bazinga\OAuthServerBundle\Model\ConsumerInterface $consumer */
     $consumer = new $class();
     $consumer->setName($name);
     $consumer->setConsumerKey(Random::generateToken());
     $consumer->setConsumerSecret(Random::generateToken());
     $consumer->setCallback($callback);
     $this->updateConsumer($consumer);
     return $consumer;
 }
Beispiel #2
0
 /**
  * {@inheritDoc}
  */
 public function createAccessToken(ConsumerInterface $consumer, UserInterface $user)
 {
     $class = $this->getAccessTokenClass();
     /** @var \Bazinga\OAuthServerBundle\Model\AccessTokenInterface $accessToken */
     $accessToken = new $class();
     $accessToken->setToken(Random::generateToken());
     $accessToken->setSecret(Random::generateToken());
     $accessToken->setConsumer($consumer);
     $accessToken->setUser($user);
     $this->updateToken($accessToken);
     return $accessToken;
 }
Beispiel #3
0
 /**
  * Create consumer keys
  */
 public function createConsumerKeys()
 {
     if (empty($this->consumerKey)) {
         $this->consumerKey = Random::generateToken();
         $this->consumerSecret = Random::generateToken();
     }
 }