Skip to content

Commit 597f698

Browse files
Merge pull request #8608 from ecamp/renovate/knpuniversity-oauth2-client-bundle-2.x
fix(deps): update dependency knpuniversity/oauth2-client-bundle to v2.20.0
2 parents e4ce1fa + fd87612 commit 597f698

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

api/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"gesdinet/jwt-refresh-token-bundle": "1.5.0",
3030
"google/recaptcha": "1.3.1",
3131
"guzzlehttp/guzzle": "7.10.0",
32-
"knpuniversity/oauth2-client-bundle": "2.19.0",
32+
"knpuniversity/oauth2-client-bundle": "2.20.0",
3333
"league/oauth2-google": "4.0.1",
3434
"lexik/jwt-authentication-bundle": "3.1.1",
3535
"nelmio/cors-bundle": "2.6.0",

api/composer.lock

Lines changed: 15 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/src/OAuth/JWTStateOAuth2Client.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,13 @@ public function redirect(array $scopes = [], array $options = []): RedirectRespo
110110
*/
111111
#[\Override]
112112
public function getAccessToken(array $options = []): AccessTokenInterface {
113-
$jwt = $this->getCurrentRequest()->cookies->get(static::getCookieName($this->cookiePrefix));
113+
$request = $this->getCurrentRequest();
114+
$jwt = $request->cookies->get(static::getCookieName($this->cookiePrefix));
114115
if (null === $jwt) {
115116
throw new InvalidStateException('Expired state');
116117
}
117118

118-
$actualState = $this->getCurrentRequest()->get('state');
119+
$actualState = $request->query->get('state');
119120

120121
try {
121122
if ($this->decodeStateJWT($jwt) !== $actualState) {

api/tests/OAuth/JWTStateOAuth2ClientTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function testGetAccessToken() {
130130
$cookieBag = new InputBag();
131131
$cookieBag->set('test_prefix_oauth_state_jwt', 'test jwt value');
132132
$requestMock->cookies = $cookieBag;
133-
$requestMock->method('get')->willReturn($state);
133+
$requestMock->query = new InputBag(['state' => $state, 'code' => $state]);
134134

135135
$jwtEncoderMock = $this->createMock(JWTEncoderInterface::class);
136136
$jwtEncoderMock->expects($this->once())
@@ -175,7 +175,7 @@ public function testGetAccessTokenThrowsIfJWTCannotBeDecoded() {
175175
$cookieBag = new InputBag();
176176
$cookieBag->set('test_prefix_oauth_state_jwt', 'test jwt value');
177177
$requestMock->cookies = $cookieBag;
178-
$requestMock->method('get')->willReturn($state);
178+
$requestMock->query = new InputBag(['state' => $state, 'code' => $state]);
179179

180180
$jwtEncoderMock = $this->createMock(JWTEncoderInterface::class);
181181
$jwtEncoderMock->expects($this->once())
@@ -220,7 +220,7 @@ public function testGetAccessTokenThrowsIfJWTStateDoesNotMatch() {
220220
$cookieBag = new InputBag();
221221
$cookieBag->set('test_prefix_oauth_state_jwt', 'test jwt value');
222222
$requestMock->cookies = $cookieBag;
223-
$requestMock->method('get')->willReturn($state);
223+
$requestMock->query = new InputBag(['state' => $state, 'code' => $state]);
224224

225225
$jwtEncoderMock = $this->createMock(JWTEncoderInterface::class);
226226
$jwtEncoderMock->expects($this->once())
@@ -265,7 +265,7 @@ public function testGetAccessTokenThrowsIfNoMatchingStateEntryInTheDatabase() {
265265
$cookieBag = new InputBag();
266266
$cookieBag->set('test_prefix_oauth_state_jwt', 'test jwt value');
267267
$requestMock->cookies = $cookieBag;
268-
$requestMock->method('get')->willReturn($state);
268+
$requestMock->query = new InputBag(['state' => $state, 'code' => $state]);
269269

270270
$jwtEncoderMock = $this->createMock(JWTEncoderInterface::class);
271271
$jwtEncoderMock->expects($this->once())
@@ -311,7 +311,7 @@ public function testGetAccessTokenThrowsIfMultipleMatchingStateEntriesInTheDatab
311311
$cookieBag = new InputBag();
312312
$cookieBag->set('test_prefix_oauth_state_jwt', 'test jwt value');
313313
$requestMock->cookies = $cookieBag;
314-
$requestMock->method('get')->willReturn($state);
314+
$requestMock->query = new InputBag(['state' => $state, 'code' => $state]);
315315

316316
$jwtEncoderMock = $this->createMock(JWTEncoderInterface::class);
317317
$jwtEncoderMock->expects($this->once())
@@ -357,7 +357,7 @@ public function testGetAccessTokenRemovesSavedStateFromDatabase() {
357357
$cookieBag = new InputBag();
358358
$cookieBag->set('test_prefix_oauth_state_jwt', 'test jwt value');
359359
$requestMock->cookies = $cookieBag;
360-
$requestMock->method('get')->willReturn($state);
360+
$requestMock->query = new InputBag(['state' => $state, 'code' => $state]);
361361

362362
$jwtEncoderMock = $this->createMock(JWTEncoderInterface::class);
363363
$jwtEncoderMock->expects($this->once())

0 commit comments

Comments
 (0)