Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Symfony 7 #1165

Merged
merged 4 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,17 @@ jobs:
symfony: 6.2.*
composer-flags: '--prefer-stable'
can-fail: false
- php: 8.2
symfony: 6.3.*
composer-flags: '--prefer-stable'
can-fail: false
# Development Symfony branches
- php: 8.2
symfony: 6.3.*@dev
symfony: 6.4.*@dev
composer-flags: ''
can-fail: false
- php: 8.2
symfony: 7.0.*@dev
composer-flags: ''
can-fail: false

Expand All @@ -63,15 +71,15 @@ jobs:
tools: "composer:v2,flex"

- name: "Set Composer stability"
if: "matrix.symfony == '6.3.*@dev'"
if: "matrix.symfony == '6.4.*@dev' || matrix.symfony == '7.0.*@dev'"
run: "composer config minimum-stability dev"

- name: "Remove symfony/security-guard"
if: "matrix.symfony == '6.0.*' || matrix.symfony == '6.1.*' || matrix.symfony == '6.2.*' || matrix.symfony == '6.3.*@dev'"
if: "matrix.symfony == '6.0.*' || matrix.symfony == '6.1.*' || matrix.symfony == '6.2.*' || matrix.symfony == '6.3.*' || matrix.symfony == '6.4.*@dev' || matrix.symfony == '7.0.*@dev'"
run: "composer remove --dev --no-update symfony/security-guard"

- name: "Install api-platform/core"
if: "matrix.symfony == '6.1.*' || matrix.symfony == '6.2.*' || matrix.symfony == '6.3.*@dev'"
if: "matrix.symfony == '6.1.*' || matrix.symfony == '6.2.*' || matrix.symfony == '6.3.*' || matrix.symfony == '6.4.*@dev'"
run: "composer require --dev --no-update api-platform/core:^3.0"

- name: "Install dependencies"
Expand Down
2 changes: 1 addition & 1 deletion Exception/ExpiredTokenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ExpiredTokenException extends AuthenticationException
*
* @return string
*/
public function getMessageKey()
public function getMessageKey(): string
{
return 'Expired JWT Token';
}
Expand Down
2 changes: 1 addition & 1 deletion Exception/InvalidPayloadException.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(string $invalidKey)
*
* @return string
*/
public function getMessageKey()
public function getMessageKey(): string
{
return sprintf('Unable to find key "%s" in the token payload.', $this->invalidKey);
}
Expand Down
2 changes: 1 addition & 1 deletion Exception/InvalidTokenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class InvalidTokenException extends AuthenticationException
*
* @return string
*/
public function getMessageKey()
public function getMessageKey(): string
{
return 'Invalid JWT Token';
}
Expand Down
2 changes: 1 addition & 1 deletion Exception/MissingTokenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MissingTokenException extends AuthenticationException
*
* @return string
*/
public function getMessageKey()
public function getMessageKey(): string
{
return 'JWT Token not found';
}
Expand Down
2 changes: 1 addition & 1 deletion Exception/UserNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct(string $userIdentityField, string $identity)
/**
* {@inheritdoc}
*/
public function getMessageKey()
public function getMessageKey(): string
{
return sprintf('Unable to load an user with property "%s" = "%s". If the user identity has changed, you must renew the token. Otherwise, verify that the "lexik_jwt_authentication.user_identity_field" config option is correctly set.', $this->userIdentityField, $this->identity);
}
Expand Down
3 changes: 2 additions & 1 deletion Security/Http/EntryPoint/JWTEntryPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Lexik\Bundle\JWTAuthenticationBundle\Response\JWTAuthenticationFailureResponse;
use Lexik\Bundle\JWTAuthenticationBundle\Security\Authenticator\JWTAuthenticator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;

Expand All @@ -26,7 +27,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
public function start(Request $request, AuthenticationException $authException = null)
public function start(Request $request, AuthenticationException $authException = null): Response
{
$response = new JWTAuthenticationFailureResponse();

Expand Down
2 changes: 1 addition & 1 deletion Security/User/JWTUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getSalt(): ?string
/**
* {@inheritdoc}
*/
public function eraseCredentials()
public function eraseCredentials(): void
{
}
}
1 change: 1 addition & 0 deletions Services/JWSProvider/DefaultJWSProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public function __construct(KeyLoaderInterface $keyLoader, $cryptoEngine, $signa
public function create(array $payload, array $header = [])
{
$header['alg'] = $this->signatureAlgorithm;

$jws = new JWS($header, $this->cryptoEngine);
$claims = ['iat' => time()];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testCheckOpenApiExportCommand()
$this->assertSame(0, $tester->execute([]));
$this->assertJsonStringEqualsJsonString(<<<JSON
{
"openapi": "3.0.0",
"openapi": "3.1.0",
"info": {
"description": "API Platform integration in LexikJWTAuthenticationBundle",
"title": "LexikJWTAuthenticationBundle",
Expand Down
1 change: 0 additions & 1 deletion Tests/Functional/app/config/security_in_memory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ security:
provider: in_memory
json_login:
check_path: login_check
require_previous_session: false
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure

Expand Down
1 change: 0 additions & 1 deletion Tests/Functional/app/config/security_in_memory_legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ security:
provider: in_memory
form_login:
check_path: /login_check
require_previous_session: false
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure

Expand Down
1 change: 0 additions & 1 deletion Tests/Functional/app/config/security_lexik_jwt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ security:
provider: in_memory
json_login:
check_path: login_check
require_previous_session: false
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure

Expand Down
1 change: 0 additions & 1 deletion Tests/Functional/app/config/security_lexik_jwt_legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ security:
provider: in_memory
form_login:
check_path: /login_check
require_previous_session: false
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure

Expand Down
2 changes: 1 addition & 1 deletion Tests/Stubs/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function getUserIdentifier(): string
/**
* {@inheritdoc}
*/
public function eraseCredentials()
public function eraseCredentials(): void
{
}

Expand Down
32 changes: 16 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,26 @@
"lcobucci/clock": "^1.2|^2.0|^3.0",
"lcobucci/jwt": "^3.4|^4.1|^5.0",
"namshi/jose": "^7.2",
"symfony/config": "^4.4|^5.3|^6.0",
"symfony/dependency-injection": "^4.4|^5.3|^6.0",
"symfony/config": "^4.4|^5.4|^6.0|^7.0",
"symfony/dependency-injection": "^4.4|^5.4|^6.0|^7.0",
"symfony/deprecation-contracts": "^2.4|^3.0",
"symfony/event-dispatcher": "^4.4|^5.3|^6.0",
"symfony/http-foundation": "^4.4|^5.3|^6.0",
"symfony/http-kernel": "^4.4|^5.3|^6.0",
"symfony/property-access": "^4.4|^5.3|^6.0",
"symfony/security-bundle": "^4.4|^5.3|^6.0",
"symfony/event-dispatcher": "^4.4|^5.4|^6.0|^7.0",
"symfony/http-foundation": "^4.4|^5.4|^6.0|^7.0",
"symfony/http-kernel": "^4.4|^5.4|^6.0|^7.0",
"symfony/property-access": "^4.4|^5.4|^6.0|^7.0",
"symfony/security-bundle": "^4.4|^5.4|^6.0|^7.0",
"symfony/translation-contracts": "^1.0|^2.0|^3.0"
},
"require-dev": {
"symfony/browser-kit": "^5.4|^6.0",
"symfony/console": "^4.4|^5.3|^6.0",
"symfony/dom-crawler": "^5.4|^6.0",
"symfony/filesystem": "^4.4|^5.3|^6.0",
"symfony/framework-bundle": "^4.4|^5.3|^6.0",
"symfony/phpunit-bridge": "^4.4|^5.3|^6.0",
"symfony/security-guard": "^4.4|^5.3",
"symfony/var-dumper": "^4.4|^5.3|^6.0",
"symfony/yaml": "^4.4|^5.3|^6.0"
"symfony/browser-kit": "^5.4|^6.0|^7.0",
"symfony/console": "^4.4|^5.4|^6.0|^7.0",
"symfony/dom-crawler": "^5.4|^6.0|^7.0",
"symfony/filesystem": "^4.4|^5.4|^6.0|^7.0",
"symfony/framework-bundle": "^4.4|^5.4|^6.0|^7.0",
"symfony/phpunit-bridge": "^4.4|^5.4|^6.0|^7.0",
"symfony/security-guard": "^4.4|^5.4|^6.0|^7.0",
"symfony/var-dumper": "^4.4|^5.4|^6.0|^7.0",
"symfony/yaml": "^4.4|^5.4|^6.0|^7.0"
},
"conflict": {
"symfony/console": "<4.4"
Expand Down
Loading