Skip to content

Commit

Permalink
Merge pull request #1968 from hwi/stloyd-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
stloyd committed Nov 30, 2023
2 parents f1e6f17 + ea065cd commit c5651c0
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 22 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/ci.yaml
Expand Up @@ -2,12 +2,19 @@ name: CI

on:
push:
branches:
- master
pull_request:

# See https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
php-cs-fixer:
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 5
env:
PHP_CS_FIXER_FUTURE_MODE: '1'
steps:
Expand All @@ -29,7 +36,7 @@ jobs:

phpstan:
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -53,7 +60,7 @@ jobs:
phpunit:
name: PHPUnit (PHP ${{ matrix.php }} + ${{ matrix.symfony-version }})
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: 10
strategy:
matrix:
include:
Expand All @@ -64,14 +71,16 @@ jobs:
bc: true
- php: '8.0'
symfony-version: '^5.4'
- php: '8.1'
symfony-version: '^5.4'
- php: '8.1'
symfony-version: '^6.3'
- php: '8.2'
symfony-version: '^6.3'
- php: '8.2'
symfony-version: '^7.0'
- php: '8.3'
symfony-version: '^6.3'
- php: '8.3'
symfony-version: '^7.0'
fail-fast: false

steps:
Expand Down Expand Up @@ -108,7 +117,7 @@ jobs:
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: phpunit-logs-php${{ matrix.php }}
path: build/logs/phpunit
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,11 @@
Changelog
=========
## 2.1.0 (2023-11-30)
* BC Break: Dropped support for Symfony: `>6.0, <6.3`,
* Added: New Passage resource owner,
* Bugfix: Remove deprecations reported by Symfony 6.4,
* Chore: Added support for Symfony 7,

## 2.0.0 (2023-10-01)
* Bugfix: Prevent refreshing non-expired tokens
* Bugfix: Remove deprecations reported by Symfony 6.x
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -12,7 +12,7 @@ Installation

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

* [__2.0__](https://github.com/hwi/HWIOAuthBundle/blob/master/docs/1-setting_up_the_bundle.md) (current) - with support for Symfony: `^5.4` & `^6.1` (PHP: `^7.4`, `^8.0`),
* [__2.x__](https://github.com/hwi/HWIOAuthBundle/blob/master/docs/1-setting_up_the_bundle.md) (current) - with support for Symfony: `^5.4`, `^6.3` & `^7.0` (PHP: `^7.4`, `^8.0`),

* [__1.4__](https://github.com/hwi/HWIOAuthBundle/blob/1.4/Resources/doc/1-setting_up_the_bundle.md) (unsupported) - with support for Symfony: `^4.4` & `^5.1` (PHP: `^7.3` & `^8.0`),

Expand All @@ -22,7 +22,7 @@ Documentation
The bulk of the documentation is stored in the `Resources/doc/index.md`
file in this bundle. Read the documentation for version:

* [__2.0__](https://github.com/hwi/HWIOAuthBundle/blob/master/docs/index.md)
* [__2.x__](https://github.com/hwi/HWIOAuthBundle/blob/master/docs/index.md)
* [__1.4__](https://github.com/hwi/HWIOAuthBundle/blob/1.4/Resources/doc/index.md) (unsupported)

This bundle contains support for 58 different providers:
Expand Down
28 changes: 14 additions & 14 deletions composer.json
Expand Up @@ -95,25 +95,25 @@
"require": {
"php": "^7.4 || ^8.0",
"symfony/deprecation-contracts": "^2.5 || ^3.0",
"symfony/framework-bundle": "^5.4 || ^6.1",
"symfony/security-bundle": "^5.4 || ^6.1",
"symfony/options-resolver": "^5.4 || ^6.1",
"symfony/form": "^5.4 || ^6.1",
"symfony/http-client": "^5.4 || ^6.1"
"symfony/framework-bundle": "^5.4 || ^6.3 || ^7.0",
"symfony/security-bundle": "^5.4 || ^6.3 || ^7.0",
"symfony/options-resolver": "^5.4 || ^6.3 || ^7.0",
"symfony/form": "^5.4 || ^6.3 || ^7.0",
"symfony/http-client": "^5.4 || ^6.3 || ^7.0"
},

"require-dev": {
"doctrine/doctrine-bundle": "^2.4",
"doctrine/orm": "^2.9",
"symfony/browser-kit": "^5.4 || ^6.1",
"symfony/css-selector": "^5.4 || ^6.1",
"symfony/phpunit-bridge": "^5.4 || ^6.1",
"symfony/property-access": "^5.4 || ^6.1",
"symfony/validator": "^5.4 || ^6.1",
"symfony/twig-bundle": "^5.4 || ^6.1",
"symfony/stopwatch": "^5.4 || ^6.1",
"symfony/translation": "^5.4 || ^6.1",
"symfony/yaml": "^5.4 || ^6.1",
"symfony/browser-kit": "^5.4 || ^6.3 || ^7.0",
"symfony/css-selector": "^5.4 || ^6.3 || ^7.0",
"symfony/phpunit-bridge": "^5.4 || ^6.3 || ^7.0",
"symfony/property-access": "^5.4 || ^6.3 || ^7.0",
"symfony/validator": "^5.4 || ^6.3 || ^7.0",
"symfony/twig-bundle": "^5.4 || ^6.3 || ^7.0",
"symfony/stopwatch": "^5.4 || ^6.3 || ^7.0",
"symfony/translation": "^5.4 || ^6.3 || ^7.0",
"symfony/yaml": "^5.4 || ^6.3 || ^7.0",
"phpunit/phpunit": "^9.6.11",
"friendsofphp/php-cs-fixer": "^3.23",
"symfony/monolog-bundle": "^3.4",
Expand Down
6 changes: 6 additions & 0 deletions tests/App/config/config_v6.yaml
Expand Up @@ -10,7 +10,12 @@ framework:
csrf_protection: ~
session:
handler_id: 'session.handler.native'
cookie_secure: auto
cookie_samesite: lax
http_method_override: false
handle_all_throwables: true
php_errors:
log: false

monolog:
handlers:
Expand Down Expand Up @@ -57,6 +62,7 @@ doctrine:
orm:
auto_generate_proxy_classes: '%kernel.debug%'
auto_mapping: true
enable_lazy_ghost_objects: true

hwi_oauth:
connect:
Expand Down
7 changes: 7 additions & 0 deletions tests/Controller/LoginControllerTest.php
Expand Up @@ -26,6 +26,7 @@
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Security as DeprecatedSecurity;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Symfony\Component\Security\Http\SecurityRequestAttributes;
use Twig\Environment;

final class LoginControllerTest extends TestCase
Expand Down Expand Up @@ -211,6 +212,12 @@ private function createController(): LoginController

private function getSecurityErrorKey(): string
{
// Symfony 6.4+ compatibility
if (class_exists(SecurityRequestAttributes::class)) {
return SecurityRequestAttributes::AUTHENTICATION_ERROR;
}

// Symfony 5.4 & <6.4 compatibility
return class_exists(Security::class) ? Security::AUTHENTICATION_ERROR : DeprecatedSecurity::AUTHENTICATION_ERROR;
}
}
7 changes: 7 additions & 0 deletions tests/Functional/Controller/LoginControllerTest.php
Expand Up @@ -20,6 +20,7 @@
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Core\Security as DeprecatedSecurity;
use Symfony\Component\Security\Http\SecurityRequestAttributes;
use Symfony\Contracts\HttpClient\HttpClientInterface;

final class LoginControllerTest extends WebTestCase
Expand Down Expand Up @@ -84,6 +85,12 @@ public function testLoginPageWithError(): void

private function getSecurityErrorKey(): string
{
// Symfony 6.4+ compatibility
if (class_exists(SecurityRequestAttributes::class)) {
return SecurityRequestAttributes::AUTHENTICATION_ERROR;
}

// Symfony 5.4 & <6.4 compatibility
return class_exists(Security::class) ? Security::AUTHENTICATION_ERROR : DeprecatedSecurity::AUTHENTICATION_ERROR;
}
}

0 comments on commit c5651c0

Please sign in to comment.