Skip to content

Commit 9468f33

Browse files
yoshzchalasr
authored andcommitted
Make sure token is always authenticated
1 parent 23bf59f commit 9468f33

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

.github/workflows/unit-tests.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
#Stable supported versions
13-
php: ['7.3', '7.4', '8.0']
14-
symfony: ['5.3.*']
13+
php: ['7.3', '7.4', '8.0', '8.1']
14+
symfony: ['5.3.*', '5.4.*']
1515
composer-flags: ['--prefer-stable']
1616
can-fail: [false]
1717
include:
@@ -20,13 +20,18 @@ jobs:
2020
symfony: '5.3.*'
2121
composer-flags: '--prefer-stable --prefer-lowest'
2222
can-fail: false
23-
# Development versions
24-
- php: '8.1-rc'
25-
symfony: '5.4.x-dev'
26-
composer-flags: ''
23+
# Symfony 6
24+
- php: '8.0'
25+
symfony: '6.0.*'
26+
composer-flags: '--prefer-stable'
2727
can-fail: false
28+
- php: '8.1'
29+
symfony: '6.0.*'
30+
composer-flags: '--prefer-stable'
31+
can-fail: false
32+
# Development versions
2833
- php: '8.1-rc'
29-
symfony: '6.0.x-dev'
34+
symfony: '6.1.x-dev'
3035
composer-flags: ''
3136
can-fail: false
3237

src/Security/Authenticator/OAuth2Authenticator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ public function createToken(Passport $passport, string $firewallName): TokenInte
157157
$oauthClientId = $passport->getAttribute('oauthClientId', '');
158158

159159
$token = new OAuth2Token($passport->getUser(), $accessTokenId, $oauthClientId, $scopeBadge->getScopes(), $this->rolePrefix);
160+
if (method_exists(AuthenticatorInterface::class, 'createAuthenticatedToken') && !method_exists(AuthenticatorInterface::class, 'createToken')) {
161+
// symfony 5.4 only
162+
/** @psalm-suppress TooManyArguments */
163+
$token->setAuthenticated(true, false);
164+
}
160165

161166
return $token;
162167
}

0 commit comments

Comments
 (0)