Skip to content

Commit 07fe8cb

Browse files
committed
Support sf6 - drop sf4
1 parent cafadc0 commit 07fe8cb

5 files changed

Lines changed: 21 additions & 13 deletions

File tree

DependencyInjection/FOSOAuthServerExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function load(array $configs, ContainerBuilder $container)
104104
/**
105105
* {@inheritdoc}
106106
*/
107-
public function getAlias()
107+
public function getAlias(): string
108108
{
109109
return 'fos_oauth_server';
110110
}

DependencyInjection/Security/Factory/OAuthFactory.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
2727
*/
28-
class OAuthFactory implements AuthenticatorFactoryInterface, SecurityFactoryInterface
28+
class OAuthFactory implements AuthenticatorFactoryInterface
2929
{
3030
/**
3131
* {@inheritdoc}
@@ -83,4 +83,9 @@ public function getKey(): string
8383
public function addConfiguration(NodeDefinition $node)
8484
{
8585
}
86+
87+
public function getPriority(): int
88+
{
89+
return 0;
90+
}
8691
}

FOSOAuthServerBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function build(ContainerBuilder $container)
3434

3535
/** @var SecurityExtension $extension */
3636
$extension = $container->getExtension('security');
37-
$extension->addSecurityListenerFactory(new OAuthFactory());
37+
$extension->addAuthenticatorFactory(new OAuthFactory());
3838

3939
$container->addCompilerPass(new GrantExtensionsCompilerPass());
4040
$container->addCompilerPass(new RequestStackCompilerPass());

Security/Authentication/Authenticator/OAuthAuthenticator.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
3232
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
3333
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
34-
use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface;
35-
use Symfony\Component\Security\Http\Authenticator\Passport\UserPassportInterface;
3634

3735
/**
3836
* OAuthAuthenticator class.
@@ -69,7 +67,7 @@ public function __construct(
6967
/**
7068
* {@inheritdoc}
7169
*/
72-
public function authenticate(Request $request): PassportInterface
70+
public function authenticate(Request $request): Passport
7371
{
7472
// remove the authorization header from the request on this check
7573
$tokenString = $this->serverService->getBearerToken($request, true);
@@ -126,7 +124,7 @@ public function authenticate(Request $request): PassportInterface
126124
/**
127125
* {@inheritdoc}
128126
*/
129-
public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface
127+
public function createToken(Passport $passport, string $firewallName): TokenInterface
130128
{
131129
try {
132130
// expect the badges in the passport from authenticate method above
@@ -163,7 +161,6 @@ public function createAuthenticatedToken(PassportInterface $passport, string $fi
163161
}
164162

165163
$token = new OAuthToken($credentials->getRoles($user));
166-
$token->setAuthenticated(true);
167164
$token->setToken($credentials->getTokenString());
168165
$token->setUser($user);
169166

composer.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
],
2222
"require": {
2323
"php": "^7.2 || ^8.0",
24-
"friendsofsymfony/oauth2-php": "~1.1",
25-
"symfony/dependency-injection": "^4.4 || ^5.1",
26-
"symfony/framework-bundle": "^4.4 || ^5.1",
27-
"symfony/security-bundle": "^4.4 || ^5.1",
28-
"symfony/twig-bundle": "^4.4 || ^5.1"
24+
"friendsofsymfony/oauth2-php": "dev-sf6",
25+
"symfony/dependency-injection": "~5.3|~6.0",
26+
"symfony/framework-bundle": "~5.3|~6.0",
27+
"symfony/security-bundle": "~5.3|~6.0",
28+
"symfony/twig-bundle": "~5.3|~6.0"
2929
},
3030
"conflict": {
3131
"twig/twig": "<1.40 || >=2.0,<2.9"
@@ -46,6 +46,12 @@
4646
"symfony/yaml": "^4.4 || ^5.1",
4747
"willdurand/propel-typehintable-behavior": "~1.0"
4848
},
49+
"repositories": [
50+
{
51+
"type": "vcs",
52+
"url": "https://github.com/Pushappy/oauth2-php.git"
53+
}
54+
],
4955
"suggest": {
5056
"doctrine/doctrine-bundle": "*",
5157
"doctrine/mongodb-odm-bundle": "*",

0 commit comments

Comments
 (0)