|
20 | 20 | use League\OAuth2\Server\Exception\OAuthServerException; |
21 | 21 | use League\OAuth2\Server\Repositories\AuthCodeRepositoryInterface; |
22 | 22 | use League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface; |
| 23 | +use League\OAuth2\Server\RequestAccessTokenEvent; |
23 | 24 | use League\OAuth2\Server\RequestEvent; |
| 25 | +use League\OAuth2\Server\RequestRefreshTokenEvent; |
24 | 26 | use League\OAuth2\Server\RequestTypes\AuthorizationRequest; |
25 | 27 | use League\OAuth2\Server\ResponseTypes\RedirectResponse; |
26 | 28 | use League\OAuth2\Server\ResponseTypes\ResponseTypeInterface; |
@@ -106,7 +108,7 @@ public function respondToAccessTokenRequest( |
106 | 108 |
|
107 | 109 | $encryptedAuthCode = $this->getRequestParameter('code', $request, null); |
108 | 110 |
|
109 | | - if ($encryptedAuthCode === null) { |
| 111 | + if (!\is_string($encryptedAuthCode)) { |
110 | 112 | throw OAuthServerException::invalidRequest('code'); |
111 | 113 | } |
112 | 114 |
|
@@ -162,14 +164,14 @@ public function respondToAccessTokenRequest( |
162 | 164 |
|
163 | 165 | // Issue and persist new access token |
164 | 166 | $accessToken = $this->issueAccessToken($accessTokenTTL, $client, $authCodePayload->user_id, $scopes); |
165 | | - $this->getEmitter()->emit(new RequestEvent(RequestEvent::ACCESS_TOKEN_ISSUED, $request)); |
| 167 | + $this->getEmitter()->emit(new RequestAccessTokenEvent(RequestEvent::ACCESS_TOKEN_ISSUED, $request, $accessToken)); |
166 | 168 | $responseType->setAccessToken($accessToken); |
167 | 169 |
|
168 | 170 | // Issue and persist new refresh token if given |
169 | 171 | $refreshToken = $this->issueRefreshToken($accessToken); |
170 | 172 |
|
171 | 173 | if ($refreshToken !== null) { |
172 | | - $this->getEmitter()->emit(new RequestEvent(RequestEvent::REFRESH_TOKEN_ISSUED, $request)); |
| 174 | + $this->getEmitter()->emit(new RequestRefreshTokenEvent(RequestEvent::REFRESH_TOKEN_ISSUED, $request, $refreshToken)); |
173 | 175 | $responseType->setRefreshToken($refreshToken); |
174 | 176 | } |
175 | 177 |
|
@@ -260,6 +262,10 @@ public function validateAuthorizationRequest(ServerRequestInterface $request) |
260 | 262 | $redirectUri = $this->getQueryStringParameter('redirect_uri', $request); |
261 | 263 |
|
262 | 264 | if ($redirectUri !== null) { |
| 265 | + if (!\is_string($redirectUri)) { |
| 266 | + throw OAuthServerException::invalidRequest('redirect_uri'); |
| 267 | + } |
| 268 | + |
263 | 269 | $this->validateRedirectUri($redirectUri, $client, $request); |
264 | 270 | } elseif (empty($client->getRedirectUri()) || |
265 | 271 | (\is_array($client->getRedirectUri()) && \count($client->getRedirectUri()) !== 1)) { |
|
0 commit comments