_authServer === null) { $clientsRepo = new Repositories\ClientRepository(); $accessTokensRepo = new Repositories\AccessTokenRepository(); $scopesRepo = new Repositories\ScopeRepository(); $authCodesRepo = new Repositories\AuthCodeRepository(); $refreshTokensRepo = new Repositories\RefreshTokenRepository(); $accessTokenTTL = new DateInterval('P1D'); $authServer = new AuthorizationServer( $clientsRepo, $accessTokensRepo, $scopesRepo, new EmptyKey(), '123' // TODO: extract to the variable ); /** @noinspection PhpUnhandledExceptionInspection */ $authCodeGrant = new Grant\AuthCodeGrant($authCodesRepo, $refreshTokensRepo, new DateInterval('PT10M')); $authCodeGrant->disableRequireCodeChallengeForPublicClients(); $authServer->enableGrantType($authCodeGrant, $accessTokenTTL); $authServer->enableGrantType(new Grant\RefreshTokenGrant($refreshTokensRepo), $accessTokenTTL); $authServer->enableGrantType(new Grant\ClientCredentialsGrant(), $accessTokenTTL); $this->_authServer = $authServer; } return $this->_authServer; } }