class */ public $grantMap = [ 'authorization_code' => Grant\AuthCodeGrant::class, 'client_credentials' => Grant\ClientCredentialsGrant::class, 'password' => Grant\PasswordGrant::class, 'refresh_token' => Grant\RefreshTokenGrant::class, ]; public function getAuthServer() { if ($this->_authServer === null) { $authServer = new AuthorizationServer(); $authServer ->setAccessTokenStorage(new AccessTokenStorage()) ->setClientStorage(new ClientStorage()) ->setScopeStorage(new ScopeStorage()) ->setSessionStorage(new SessionStorage()) ->setAuthCodeStorage(new AuthCodeStorage()) ->setRefreshTokenStorage(new RefreshTokenStorage()) ->setScopeDelimiter(','); $this->_authServer = $authServer; foreach ($this->grantTypes as $grantType) { if (!array_key_exists($grantType, $this->grantMap)) { throw new InvalidConfigException('Invalid grant type'); } $grant = new $this->grantMap[$grantType](); $this->_authServer->addGrantType($grant); } SecureKey::setAlgorithm(new UuidAlgorithm()); } return $this->_authServer; } }