Apply fixes from StyleCI

This commit is contained in:
Alex Bilbie 2017-07-01 16:19:23 +00:00 committed by StyleCI Bot
parent 09c167ac43
commit aee1779432
3 changed files with 4 additions and 3 deletions

View File

@ -8,11 +8,11 @@
*/ */
use League\OAuth2\Server\AuthorizationServer; use League\OAuth2\Server\AuthorizationServer;
use League\OAuth2\Server\ResourceServer;
use League\OAuth2\Server\Grant\AuthCodeGrant; use League\OAuth2\Server\Grant\AuthCodeGrant;
use League\OAuth2\Server\Grant\RefreshTokenGrant; use League\OAuth2\Server\Grant\RefreshTokenGrant;
use League\OAuth2\Server\Middleware\AuthorizationServerMiddleware; use League\OAuth2\Server\Middleware\AuthorizationServerMiddleware;
use League\OAuth2\Server\Middleware\ResourceServerMiddleware; use League\OAuth2\Server\Middleware\ResourceServerMiddleware;
use League\OAuth2\Server\ResourceServer;
use OAuth2ServerExamples\Repositories\AccessTokenRepository; use OAuth2ServerExamples\Repositories\AccessTokenRepository;
use OAuth2ServerExamples\Repositories\AuthCodeRepository; use OAuth2ServerExamples\Repositories\AuthCodeRepository;
use OAuth2ServerExamples\Repositories\ClientRepository; use OAuth2ServerExamples\Repositories\ClientRepository;
@ -75,6 +75,7 @@ $app = new App([
new AccessTokenRepository(), new AccessTokenRepository(),
$publicKeyPath $publicKeyPath
); );
return $server; return $server;
}, },
]); ]);

View File

@ -17,7 +17,6 @@ use OAuth2ServerExamples\Repositories\ScopeRepository;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Slim\App; use Slim\App;
use Zend\Diactoros\Stream;
include __DIR__ . '/../vendor/autoload.php'; include __DIR__ . '/../vendor/autoload.php';
@ -68,6 +67,7 @@ $app->post('/access_token', function (ServerRequestInterface $request, ResponseI
return $exception->generateHttpResponse($response); return $exception->generateHttpResponse($response);
} catch (\Exception $exception) { } catch (\Exception $exception) {
$response->getBody()->write($exception->getMessage()); $response->getBody()->write($exception->getMessage());
return $response->withStatus(500); return $response->withStatus(500);
} }
}); });

View File

@ -264,7 +264,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
throw OAuthServerException::invalidRequest('code_challenge'); 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( throw OAuthServerException::invalidRequest(
'code_challenge', 'code_challenge',
'The code_challenge must be between 43 and 128 characters' 'The code_challenge must be between 43 and 128 characters'