Exemplo n.º 1
0
 /**
  * Set up an OAuth2 Authorization Server.
  */
 protected function setAuthorizationServer()
 {
     $this->authorisationServer = new AuthorizationServer();
     // Storage
     $this->authorisationServer->setSessionStorage(new Storage\SessionStorage());
     $this->authorisationServer->setAccessTokenStorage(new Storage\AccessTokenStorage());
     $this->authorisationServer->setClientStorage(new Storage\ClientStorage());
     $this->authorisationServer->setScopeStorage(new Storage\ScopeStorage());
     $this->authorisationServer->setRefreshTokenStorage(new Storage\RefreshTokenStorage());
     // Grants
     $this->authorisationServer->addGrantType(new RefreshTokenGrant());
     // Events
     $this->authorisationServer->addEventListener('error.auth.client', [$this, 'eventErrorAuthClient']);
     $this->authorisationServer->addEventListener('error.auth.user', [$this, 'eventErrorAuthUser']);
     $this->authorisationServer->addEventListener('session.owner', [$this, 'eventSessionOwner']);
 }