From aee1779432498dfc3db4677476b21ff44b524c65 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 1 Jul 2017 16:19:23 +0000 Subject: [PATCH] Apply fixes from StyleCI --- examples/public/middleware_use.php | 3 ++- examples/public/refresh_token.php | 2 +- src/Grant/AuthCodeGrant.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/public/middleware_use.php b/examples/public/middleware_use.php index 32b17aff..f6a7fcf9 100644 --- a/examples/public/middleware_use.php +++ b/examples/public/middleware_use.php @@ -8,11 +8,11 @@ */ use League\OAuth2\Server\AuthorizationServer; -use League\OAuth2\Server\ResourceServer; use League\OAuth2\Server\Grant\AuthCodeGrant; use League\OAuth2\Server\Grant\RefreshTokenGrant; use League\OAuth2\Server\Middleware\AuthorizationServerMiddleware; use League\OAuth2\Server\Middleware\ResourceServerMiddleware; +use League\OAuth2\Server\ResourceServer; use OAuth2ServerExamples\Repositories\AccessTokenRepository; use OAuth2ServerExamples\Repositories\AuthCodeRepository; use OAuth2ServerExamples\Repositories\ClientRepository; @@ -75,6 +75,7 @@ $app = new App([ new AccessTokenRepository(), $publicKeyPath ); + return $server; }, ]); diff --git a/examples/public/refresh_token.php b/examples/public/refresh_token.php index b4efd45b..25c32100 100644 --- a/examples/public/refresh_token.php +++ b/examples/public/refresh_token.php @@ -17,7 +17,6 @@ use OAuth2ServerExamples\Repositories\ScopeRepository; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Slim\App; -use Zend\Diactoros\Stream; include __DIR__ . '/../vendor/autoload.php'; @@ -68,6 +67,7 @@ $app->post('/access_token', function (ServerRequestInterface $request, ResponseI return $exception->generateHttpResponse($response); } catch (\Exception $exception) { $response->getBody()->write($exception->getMessage()); + return $response->withStatus(500); } }); diff --git a/src/Grant/AuthCodeGrant.php b/src/Grant/AuthCodeGrant.php index a8787a54..2a05355e 100644 --- a/src/Grant/AuthCodeGrant.php +++ b/src/Grant/AuthCodeGrant.php @@ -264,7 +264,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant throw OAuthServerException::invalidRequest('code_challenge'); } - if (preg_match("/^[A-Za-z0-9-._~]{43,128}$/", $codeChallenge) !== 1) { + if (preg_match('/^[A-Za-z0-9-._~]{43,128}$/', $codeChallenge) !== 1) { throw OAuthServerException::invalidRequest( 'code_challenge', 'The code_challenge must be between 43 and 128 characters'