From 6ed9cbf70162cdcef7a0647e0c06a01afe7aaf75 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sun, 17 Apr 2016 12:54:49 +0100 Subject: [PATCH] Class rename fixes --- examples/public/api.php | 5 ++--- examples/public/auth_code.php | 15 +++++++-------- examples/public/implicit.php | 10 +++++----- examples/public/middleware_use.php | 17 +++++++---------- examples/public/password.php | 10 +++++----- examples/public/refresh_token.php | 10 +++++----- 6 files changed, 31 insertions(+), 36 deletions(-) diff --git a/examples/public/api.php b/examples/public/api.php index c82ac5b3..26474f0d 100644 --- a/examples/public/api.php +++ b/examples/public/api.php @@ -1,7 +1,6 @@ [ 'displayErrorDetails' => true, ], - Server::class => function () { + ResourceServer::class => function () { // Setup the authorization server $server = new ResourceServer( new AccessTokenRepository(), @@ -26,7 +25,7 @@ $app = new App([ $app->add( new \League\OAuth2\Server\Middleware\ResourceServerMiddleware( - $app->getContainer()->get(Server::class) + $app->getContainer()->get(ResourceServer::class) ) ); diff --git a/examples/public/auth_code.php b/examples/public/auth_code.php index 88ea114f..2a0b4c41 100644 --- a/examples/public/auth_code.php +++ b/examples/public/auth_code.php @@ -2,8 +2,7 @@ use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Grant\AuthCodeGrant; -use League\OAuth2\Server\RequestTypes\AuthorizationRequest; -use League\OAuth2\Server\Server; +use League\OAuth2\Server\AuthorizationServer; use OAuth2ServerExamples\Entities\UserEntity; use OAuth2ServerExamples\Repositories\AccessTokenRepository; use OAuth2ServerExamples\Repositories\AuthCodeRepository; @@ -21,7 +20,7 @@ $app = new App([ 'settings' => [ 'displayErrorDetails' => true, ], - Server::class => function () { + AuthorizationServer::class => function () { // Init our repositories $clientRepository = new ClientRepository(); $scopeRepository = new ScopeRepository(); @@ -33,7 +32,7 @@ $app = new App([ $publicKeyPath = 'file://' . __DIR__ . '/../public.key'; // Setup the authorization server - $server = new Server( + $server = new AuthorizationServer( $clientRepository, $accessTokenRepository, $scopeRepository, @@ -56,8 +55,8 @@ $app = new App([ ]); $app->get('/authorize', function (ServerRequestInterface $request, ResponseInterface $response) use ($app) { - /* @var \League\OAuth2\Server\Server $server */ - $server = $app->getContainer()->get(Server::class); + /* @var \League\OAuth2\Server\AuthorizationServer $server */ + $server = $app->getContainer()->get(AuthorizationServer::class); try { // Validate the HTTP request and return an AuthorizationRequest object. @@ -84,8 +83,8 @@ $app->get('/authorize', function (ServerRequestInterface $request, ResponseInter }); $app->post('/access_token', function (ServerRequestInterface $request, ResponseInterface $response) use ($app) { - /* @var \League\OAuth2\Server\Server $server */ - $server = $app->getContainer()->get(Server::class); + /* @var \League\OAuth2\Server\AuthorizationServer $server */ + $server = $app->getContainer()->get(AuthorizationServer::class); try { return $server->respondToAccessTokenRequest($request, $response); diff --git a/examples/public/implicit.php b/examples/public/implicit.php index a7c441cc..eee6abb3 100644 --- a/examples/public/implicit.php +++ b/examples/public/implicit.php @@ -2,7 +2,7 @@ use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Grant\ImplicitGrant; -use League\OAuth2\Server\Server; +use League\OAuth2\Server\AuthorizationServer; use OAuth2ServerExamples\Entities\UserEntity; use OAuth2ServerExamples\Repositories\AccessTokenRepository; use OAuth2ServerExamples\Repositories\ClientRepository; @@ -18,7 +18,7 @@ $app = new App([ 'settings' => [ 'displayErrorDetails' => true, ], - Server::class => function () { + AuthorizationServer::class => function () { // Init our repositories $clientRepository = new ClientRepository(); $scopeRepository = new ScopeRepository(); @@ -28,7 +28,7 @@ $app = new App([ $publicKeyPath = 'file://' . __DIR__ . '/../public.key'; // Setup the authorization server - $server = new Server( + $server = new AuthorizationServer( $clientRepository, $accessTokenRepository, $scopeRepository, @@ -44,8 +44,8 @@ $app = new App([ ]); $app->get('/authorize', function (ServerRequestInterface $request, ResponseInterface $response) use ($app) { - /* @var \League\OAuth2\Server\Server $server */ - $server = $app->getContainer()->get(Server::class); + /* @var \League\OAuth2\Server\AuthorizationServer $server */ + $server = $app->getContainer()->get(AuthorizationServer::class); try { // Validate the HTTP request and return an AuthorizationRequest object. diff --git a/examples/public/middleware_use.php b/examples/public/middleware_use.php index 9b8e0991..ae8b6f05 100644 --- a/examples/public/middleware_use.php +++ b/examples/public/middleware_use.php @@ -2,15 +2,14 @@ use League\OAuth2\Server\Grant\AuthCodeGrant; use League\OAuth2\Server\Grant\RefreshTokenGrant; -use League\OAuth2\Server\Middleware\AuthenticationServerMiddleware; +use League\OAuth2\Server\Middleware\AuthorizationServerMiddleware; use League\OAuth2\Server\Middleware\ResourceServerMiddleware; -use League\OAuth2\Server\Server; +use League\OAuth2\Server\AuthorizationServer; use OAuth2ServerExamples\Repositories\AccessTokenRepository; use OAuth2ServerExamples\Repositories\AuthCodeRepository; use OAuth2ServerExamples\Repositories\ClientRepository; use OAuth2ServerExamples\Repositories\RefreshTokenRepository; use OAuth2ServerExamples\Repositories\ScopeRepository; -use OAuth2ServerExamples\Repositories\UserRepository; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Slim\App; @@ -19,23 +18,22 @@ use Zend\Diactoros\Stream; include __DIR__ . '/../vendor/autoload.php'; $app = new App([ - 'settings' => [ + 'settings' => [ 'displayErrorDetails' => true, ], - Server::class => function () { + AuthorizationServer::class => function () { // Init our repositories $clientRepository = new ClientRepository(); $accessTokenRepository = new AccessTokenRepository(); $scopeRepository = new ScopeRepository(); $authCodeRepository = new AuthCodeRepository(); $refreshTokenRepository = new RefreshTokenRepository(); - $userRepository = new UserRepository(); $privateKeyPath = 'file://' . __DIR__ . '/../private.key'; $publicKeyPath = 'file://' . __DIR__ . '/../public.key'; // Setup the authorization server - $server = new Server( + $server = new AuthorizationServer( $clientRepository, $accessTokenRepository, $scopeRepository, @@ -48,7 +46,6 @@ $app = new App([ new AuthCodeGrant( $authCodeRepository, $refreshTokenRepository, - $userRepository, new \DateInterval('PT10M') ), new \DateInterval('PT1H') @@ -66,7 +63,7 @@ $app = new App([ // Access token issuer $app->post('/access_token', function () { -})->add(new AuthenticationServerMiddleware($app->getContainer()->get(Server::class))); +})->add(new AuthorizationServerMiddleware($app->getContainer()->get(AuthorizationServer::class))); // Secured API $app->group('/api', function () { @@ -90,6 +87,6 @@ $app->group('/api', function () { return $response->withBody($body); }); -})->add(new ResourceServerMiddleware($app->getContainer()->get(Server::class))); +})->add(new ResourceServerMiddleware($app->getContainer()->get(AuthorizationServer::class))); $app->run(); diff --git a/examples/public/password.php b/examples/public/password.php index d8145050..f588def6 100644 --- a/examples/public/password.php +++ b/examples/public/password.php @@ -2,7 +2,7 @@ use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Grant\PasswordGrant; -use League\OAuth2\Server\Server; +use League\OAuth2\Server\AuthorizationServer; use OAuth2ServerExamples\Repositories\AccessTokenRepository; use OAuth2ServerExamples\Repositories\ClientRepository; use OAuth2ServerExamples\Repositories\RefreshTokenRepository; @@ -19,7 +19,7 @@ $app = new App([ 'settings' => [ 'displayErrorDetails' => true, ], - Server::class => function () { + AuthorizationServer::class => function () { // Init our repositories $clientRepository = new ClientRepository(); $accessTokenRepository = new AccessTokenRepository(); @@ -31,7 +31,7 @@ $app = new App([ $publicKeyPath = 'file://' . __DIR__ . '/../public.key'; // Setup the authorization server - $server = new Server( + $server = new AuthorizationServer( $clientRepository, $accessTokenRepository, $scopeRepository, @@ -50,8 +50,8 @@ $app = new App([ ]); $app->post('/access_token', function (ServerRequestInterface $request, ResponseInterface $response) use ($app) { - /* @var \League\OAuth2\Server\Server $server */ - $server = $app->getContainer()->get(Server::class); + /* @var \League\OAuth2\Server\AuthorizationServer $server */ + $server = $app->getContainer()->get(AuthorizationServer::class); try { return $server->respondToAccessTokenRequest($request, $response); diff --git a/examples/public/refresh_token.php b/examples/public/refresh_token.php index 643431c8..85912e3d 100644 --- a/examples/public/refresh_token.php +++ b/examples/public/refresh_token.php @@ -2,7 +2,7 @@ use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Grant\RefreshTokenGrant; -use League\OAuth2\Server\Server; +use League\OAuth2\Server\AuthorizationServer; use OAuth2ServerExamples\Repositories\AccessTokenRepository; use OAuth2ServerExamples\Repositories\ClientRepository; use OAuth2ServerExamples\Repositories\RefreshTokenRepository; @@ -18,7 +18,7 @@ $app = new App([ 'settings' => [ 'displayErrorDetails' => true, ], - Server::class => function () { + AuthorizationServer::class => function () { // Init our repositories $clientRepository = new ClientRepository(); $accessTokenRepository = new AccessTokenRepository(); @@ -29,7 +29,7 @@ $app = new App([ $publicKeyPath = 'file://' . __DIR__ . '/../public.key'; // Setup the authorization server - $server = new Server( + $server = new AuthorizationServer( $clientRepository, $accessTokenRepository, $scopeRepository, @@ -51,8 +51,8 @@ $app = new App([ ]); $app->post('/access_token', function (ServerRequestInterface $request, ResponseInterface $response) use ($app) { - /* @var \League\OAuth2\Server\Server $server */ - $server = $app->getContainer()->get(Server::class); + /* @var \League\OAuth2\Server\AuthorizationServer $server */ + $server = $app->getContainer()->get(AuthorizationServer::class); try { return $server->respondToAccessTokenRequest($request, $response);