Skip to content

Commit 1c77696

Browse files
authored
Merge pull request #2063 from willemverspyck/master
Support Symfony 8 and remove code of unsupported Symfony versions
2 parents 58224ad + 6cd2e01 commit 1c77696

File tree

16 files changed

+56
-459
lines changed

16 files changed

+56
-459
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,14 @@ jobs:
8282
symfony-version: '^6.4'
8383
- php: '8.4'
8484
symfony-version: '^7.4'
85+
- php: '8.4'
86+
symfony-version: '^8.0'
8587
- php: '8.5'
8688
symfony-version: '^6.4'
8789
- php: '8.5'
8890
symfony-version: '^7.4'
91+
- php: '8.5'
92+
symfony-version: '^8.0'
8993
fail-fast: false
9094

9195
steps:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Installation
1212

1313
All the installation instructions are located in the documentation, check it for a specific version:
1414

15-
* [__2.x__](https://github.com/hwi/HWIOAuthBundle/blob/master/docs/1-setting_up_the_bundle.md) (current) - with support for Symfony: `^6.4` & `^7.4` (PHP: `^8.3`),
15+
* [__2.x__](https://github.com/hwi/HWIOAuthBundle/blob/master/docs/1-setting_up_the_bundle.md) (current) - with support for Symfony: `^6.4`, `^7.4` and `^8.0` (PHP: `^8.3`),
1616

1717
Documentation
1818
-------------

composer.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,29 +95,29 @@
9595
"require": {
9696
"php": "^8.3",
9797
"symfony/deprecation-contracts": "^3.0",
98-
"symfony/framework-bundle": "^6.4 || ^7.4",
99-
"symfony/http-foundation": "^6.4 || ^7.4",
100-
"symfony/security-bundle": "^6.4 || ^7.4",
101-
"symfony/options-resolver": "^6.4 || ^7.4",
102-
"symfony/form": "^6.4 || ^7.4",
103-
"symfony/http-client": "^6.4 || ^7.4",
104-
"symfony/routing": "^6.4 || ^7.4",
105-
"symfony/twig-bundle": "^6.4 || ^7.4"
98+
"symfony/framework-bundle": "^6.4 || ^7.4 || ^8.0",
99+
"symfony/http-foundation": "^6.4 || ^7.4 || ^8.0",
100+
"symfony/security-bundle": "^6.4 || ^7.4 || ^8.0",
101+
"symfony/options-resolver": "^6.4 || ^7.4 || ^8.0",
102+
"symfony/form": "^6.4 || ^7.4 || ^8.0",
103+
"symfony/http-client": "^6.4 || ^7.4 || ^8.0",
104+
"symfony/routing": "^6.4 || ^7.4 || ^8.0",
105+
"symfony/twig-bundle": "^6.4 || ^7.4 || ^8.0"
106106
},
107107

108108
"require-dev": {
109-
"doctrine/doctrine-bundle": "^2.4",
110-
"doctrine/orm": "^2.9",
111-
"symfony/browser-kit": "^6.4 || ^7.4",
112-
"symfony/css-selector": "^6.4 || ^7.4",
113-
"symfony/property-access": "^6.4 || ^7.4",
114-
"symfony/validator": "^6.4 || ^7.4",
115-
"symfony/stopwatch": "^6.4 || ^7.4",
116-
"symfony/translation": "^6.4 || ^7.4",
117-
"symfony/yaml": "^6.4 || ^7.4",
109+
"doctrine/doctrine-bundle": "^2.4 || ^3.2",
110+
"doctrine/orm": "^2.9 || ^3.6",
111+
"symfony/browser-kit": "^6.4 || ^7.4 || ^8.0",
112+
"symfony/css-selector": "^6.4 || ^7.4 || ^8.0",
113+
"symfony/property-access": "^6.4 || ^7.4 || ^8.0",
114+
"symfony/validator": "^6.4 || ^7.4 || ^8.0",
115+
"symfony/stopwatch": "^6.4 || ^7.4 || ^8.0",
116+
"symfony/translation": "^6.4 || ^7.4 || ^8.0",
117+
"symfony/yaml": "^6.4 || ^7.4 || ^8.0",
118118
"phpunit/phpunit": "^12.3",
119119
"friendsofphp/php-cs-fixer": "^3.23",
120-
"symfony/monolog-bundle": "^3.4",
120+
"symfony/monolog-bundle": "^3.4 || ^4.0",
121121
"phpstan/phpstan": "^2.1",
122122
"phpstan/phpstan-symfony": "^2.0",
123123
"phpstan/extension-installer": "^1.3",

phpstan.neon

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,4 @@ parameters:
44
- src/
55
- tests/
66
excludePaths:
7-
- src/Security/Core/Exception/AccountNotLinkedException.php
8-
- src/Security/Core/User/OAuthAwareUserProviderInterface.php
9-
- src/Security/Http/Firewall/OAuthListener.php
10-
- tests/Security/Core/Authentication/Provider/OAuthProviderTest.php
11-
127
- vendor/*
13-
# Symfony <5.4 BC layer
14-
reportUnmatchedIgnoredErrors: false
15-
ignoreErrors:
16-
- '#Parameter \$event of method HWI\\Bundle\\OAuthBundle\\Controller\\Connect\\AbstractController::dispatch\(\) has invalid type Symfony\\Component\\EventDispatcher\\Event.#'
17-
- '#Parameter \#2 \$array of function implode expects array<string>, array<int, array\|string\|null> given.#'
18-
- '#PHPDoc type DOMNode of property HWI\\Bundle\\OAuthBundle\\OAuth\\Response\\SensioConnectUserResponse::\$data is not covariant with PHPDoc type array of overridden property HWI\\Bundle\\OAuthBundle\\OAuth\\Response\\AbstractUserResponse::\$data#'
19-
- '#Call to function method_exists\(\) with Symfony\\Component\\Security\\Http\\Authenticator\\Debug\\TraceableAuthenticator#'

src/Controller/RedirectToServiceController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use HWI\Bundle\OAuthBundle\Security\Http\ResourceOwnerMapLocator;
1515
use HWI\Bundle\OAuthBundle\Security\OAuthUtils;
1616
use HWI\Bundle\OAuthBundle\Util\DomainWhitelist;
17+
use HWI\Bundle\OAuthBundle\Util\Parameter;
1718
use RuntimeException;
1819
use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException;
1920
use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -68,7 +69,7 @@ private function storeReturnPath(Request $request, string $authorizationUrl): vo
6869
$sessionKey = '_security.'.$firewallName.'.target_path';
6970
$sessionKeyFailure = '_security.'.$firewallName.'.failed_target_path';
7071

71-
if (!empty($param) && $targetUrl = $request->get($param)) {
72+
if (!empty($param) && $targetUrl = Parameter::get($request, $param)) {
7273
if (!$this->domainWhitelist->isValidTargetUrl($targetUrl)) {
7374
throw new AccessDeniedHttpException('Not allowed to redirect to '.$targetUrl);
7475
}

src/DependencyInjection/Configuration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ public function getConfigTreeBuilder(): TreeBuilder
149149

150150
private function addResourceOwnersConfiguration(ArrayNodeDefinition $node): void
151151
{
152-
/* @phpstan-ignore-next-line */
153152
$node
154153
->fixXmlConfig('resource_owner')
155154
->children()

src/OAuth/Response/SensioConnectUserResponse.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ final class SensioConnectUserResponse extends AbstractUserResponse
2828
{
2929
/**
3030
* @var DOMNode
31+
*
32+
* @phpstan-ignore-next-line
3133
*/
3234
protected $data;
3335

src/Resources/config/oauth.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,11 @@
1919
use HWI\Bundle\OAuthBundle\Security\Http\Authentication\AuthenticationFailureHandler;
2020
use HWI\Bundle\OAuthBundle\Security\Http\EntryPoint\OAuthEntryPoint;
2121
use HWI\Bundle\OAuthBundle\Security\Http\Firewall\AbstractRefreshAccessTokenListener;
22-
use HWI\Bundle\OAuthBundle\Security\Http\Firewall\OAuthListener;
2322
use HWI\Bundle\OAuthBundle\Security\OAuthUtils;
2423

2524
return static function (ContainerConfigurator $containerConfigurator): void {
2625
$services = $containerConfigurator->services();
2726

28-
$services->set('hwi_oauth.authentication.listener.oauth', OAuthListener::class)
29-
->abstract()
30-
->parent('security.authentication.listener.abstract');
31-
3227
$services->set('hwi_oauth.authentication.entry_point.oauth', OAuthEntryPoint::class)
3328
->args([
3429
service('http_kernel'),

src/Security/Http/Authenticator/OAuthAuthenticator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use HWI\Bundle\OAuthBundle\Security\Core\User\OAuthAwareUserProviderInterface;
1919
use HWI\Bundle\OAuthBundle\Security\Http\Authenticator\Passport\Badge\OAuthTokenBadge;
2020
use HWI\Bundle\OAuthBundle\Security\Http\ResourceOwnerMapInterface;
21+
use HWI\Bundle\OAuthBundle\Util\Parameter;
2122
use LogicException;
2223
use Symfony\Component\HttpFoundation\RedirectResponse;
2324
use Symfony\Component\HttpFoundation\Request;
@@ -113,7 +114,7 @@ public function authenticate(Request $request): Passport
113114
}
114115

115116
$resourceOwner->isCsrfTokenValid(
116-
$this->extractCsrfTokenFromState($request->get('state'))
117+
$this->extractCsrfTokenFromState(Parameter::get($request, 'state'))
117118
);
118119

119120
$accessToken = $resourceOwner->getAccessToken(

src/Security/Http/Firewall/OAuthListener.php

Lines changed: 0 additions & 109 deletions
This file was deleted.

0 commit comments

Comments
 (0)