/**
  * Enable support for a grant
  * @param  GrantTypeInterface $grantType  A grant class which conforms to Interface/GrantTypeInterface
  * @param  null|string        $identifier An identifier for the grant (autodetected if not passed)
  * @return self
  */
 public function addGrantType(GrantTypeInterface $grantType, $identifier = null)
 {
     if (is_null($identifier)) {
         $identifier = $grantType->getIdentifier();
     }
     // Inject server into grant
     $grantType->setAuthorizationServer($this);
     $this->grantTypes[$identifier] = $grantType;
     if (!is_null($grantType->getResponseType())) {
         $this->responseTypes[] = $grantType->getResponseType();
     }
     return $this;
 }
 /**
  * Enable a grant type on the server.
  *
  * @param GrantTypeInterface $grantType
  * @param null|\DateInterval $accessTokenTTL
  */
 public function enableGrantType(GrantTypeInterface $grantType, \DateInterval $accessTokenTTL = null)
 {
     if ($accessTokenTTL instanceof \DateInterval === false) {
         $accessTokenTTL = new \DateInterval('PT1H');
     }
     $grantType->setAccessTokenRepository($this->accessTokenRepository);
     $grantType->setClientRepository($this->clientRepository);
     $grantType->setScopeRepository($this->scopeRepository);
     $grantType->setPrivateKey($this->privateKey);
     $grantType->setPublicKey($this->publicKey);
     $grantType->setEmitter($this->getEmitter());
     $this->enabledGrantTypes[$grantType->getIdentifier()] = $grantType;
     $this->grantTypeAccessTokenTTL[$grantType->getIdentifier()] = $accessTokenTTL;
 }
Exemplo n.º 3
0
 /**
  * Enable support for a grant
  * @param GrantTypeInterface $grantType  A grant class which conforms to Interface/GrantTypeInterface
  * @param null|string        $identifier An identifier for the grant (autodetected if not passed)
  */
 public function addGrantType(GrantTypeInterface $grantType, $identifier = null)
 {
     if (is_null($identifier)) {
         $identifier = $grantType->getIdentifier();
     }
     $this->grantTypes[$identifier] = $grantType;
     if (!is_null($grantType->getResponseType())) {
         $this->responseTypes[] = $grantType->getResponseType();
     }
 }