Skip to content

Commit

Permalink
Fix deprecations on 6.4/7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chalasr authored and Ninos committed Nov 27, 2023
1 parent 4723dd5 commit 1e560c0
Show file tree
Hide file tree
Showing 14 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
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.*' || matrix.symfony == '6.4.*@dev' || matrix.symfony == '7.0.*@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
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

0 comments on commit 1e560c0

Please sign in to comment.