From 170ce2fd2d238a6c0cba46dbb4d27f28089f35b8 Mon Sep 17 00:00:00 2001 From: Diogo Oliveira de Melo Date: Fri, 30 Jun 2017 15:42:23 -0300 Subject: [PATCH 1/2] Replaces array_key_exists by isset, which is faster, on ImplicitGrant. --- src/Grant/ImplicitGrant.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Grant/ImplicitGrant.php b/src/Grant/ImplicitGrant.php index 62a48147..2ec9aed7 100644 --- a/src/Grant/ImplicitGrant.php +++ b/src/Grant/ImplicitGrant.php @@ -95,8 +95,8 @@ class ImplicitGrant extends AbstractAuthorizeGrant public function canRespondToAuthorizationRequest(ServerRequestInterface $request) { return ( - array_key_exists('response_type', $request->getQueryParams()) - && $request->getQueryParams()['response_type'] === 'token' + isset($request->getQueryParams()['response_type']) + && 'token' === $request->getQueryParams()['response_type'] && isset($request->getQueryParams()['client_id']) ); } From 203be5ca20de4a0a3520513b7507d7e2dc5fc0f8 Mon Sep 17 00:00:00 2001 From: Diogo Oliveira de Melo Date: Fri, 20 Oct 2017 09:23:36 -0200 Subject: [PATCH 2/2] Revert comparison order, as suggested by @Sephster --- src/Grant/ImplicitGrant.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Grant/ImplicitGrant.php b/src/Grant/ImplicitGrant.php index 2ec9aed7..693880b4 100644 --- a/src/Grant/ImplicitGrant.php +++ b/src/Grant/ImplicitGrant.php @@ -96,7 +96,7 @@ class ImplicitGrant extends AbstractAuthorizeGrant { return ( isset($request->getQueryParams()['response_type']) - && 'token' === $request->getQueryParams()['response_type'] + && $request->getQueryParams()['response_type'] === 'token' && isset($request->getQueryParams()['client_id']) ); }