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

Fix #82: Replace web-token/* with web-token/jwt-library and update min version of PHP to 8.1 #82

Merged
merged 6 commits into from
Aug 19, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/bc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0']
['8.1']
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
os: >-
['ubuntu-latest', 'windows-latest']
php: >-
['8.0', '8.1', '8.2']
['8.1', '8.2', '8.3']
2 changes: 1 addition & 1 deletion .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1', '8.2']
['8.1', '8.2', '8.3']
2 changes: 1 addition & 1 deletion .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.2']
['8.3']
secrets:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
8 changes: 0 additions & 8 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,3 @@ jobs:
['ubuntu-latest']
php: >-
['8.1', '8.2', '8.3']
psalm80:
uses: yiisoft/actions/.github/workflows/psalm.yml@master
with:
psalm-config: psalm80.xml
os: >-
['ubuntu-latest']
php: >-
['8.0']
35 changes: 0 additions & 35 deletions .scrutinizer.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## 2.1.0 under development

- Chg #67: Bump required PHP version to 8.0 (@rustamwin)
- Enh #75: Add support for `psr/http-message` version `^2.0` (@vjik)
- Chg #82: Replace `web-token/*` with `web-token/jwt-library` and update min version of PHP to 8.1 (@rustamwin)

## 2.0.1 September 19, 2023

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The package provides [JWT authentication](https://tools.ietf.org/html/rfc7519) m

## Requirements

- PHP 8.0 or higher.
- PHP 8.1 or higher.

## Installation

Expand Down
10 changes: 2 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,9 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.1",
"psr/http-message": "^1.0|^2.0",
"web-token/jwt-checker": "~2.2|~3.0",
"web-token/jwt-core": "~2.2|~3.0",
"web-token/jwt-key-mgmt": "~2.2|~3.0",
"web-token/jwt-signature": "~2.2|~3.0",
"web-token/jwt-signature-algorithm-ecdsa": "~2.2|~3.0",
"web-token/jwt-signature-algorithm-hmac": "~2.2|~3.0",
"web-token/jwt-signature-algorithm-rsa": "~2.2|~3.0",
"web-token/jwt-library": "^3.3",
"yiisoft/auth": "^3.0",
"yiisoft/http": "^1.2",
"yiisoft/json": "^1.0"
Expand Down
19 changes: 0 additions & 19 deletions psalm80.xml

This file was deleted.

2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
LevelSetList::UP_TO_PHP_81,
]);
};
2 changes: 1 addition & 1 deletion src/KeyFactory/FromCertificateFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
final class FromCertificateFile implements KeyFactoryInterface
{
public function __construct(private string $file)
public function __construct(private readonly string $file)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/KeyFactory/FromKeyFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
final class FromKeyFile implements KeyFactoryInterface
{
public function __construct(private string $file, private string $password)
public function __construct(private readonly string $file, private readonly string $password)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/KeyFactory/FromPKCS12CertificateFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
final class FromPKCS12CertificateFile implements KeyFactoryInterface
{
public function __construct(private string $file, private string $secret)
public function __construct(private readonly string $file, private readonly string $secret)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/KeyFactory/FromSecret.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
final class FromSecret implements KeyFactoryInterface
{
public function __construct(private string $secret)
public function __construct(private readonly string $secret)
{
}

Expand Down
6 changes: 3 additions & 3 deletions src/TokenFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ final class TokenFactory implements TokenFactoryInterface
* @see https://tools.ietf.org/html/rfc7515
*/
public function __construct(
private KeyFactoryInterface $keyFactory,
private AlgorithmManager $algorithmManager,
private JWSSerializerManager $serializerManager
private readonly KeyFactoryInterface $keyFactory,
private readonly AlgorithmManager $algorithmManager,
private readonly JWSSerializerManager $serializerManager
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/TokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
* @see https://tools.ietf.org/html/rfc7515
*/
public function __construct(
private KeyFactoryInterface $keyFactory,
private AlgorithmManager $algorithmManager,
private JWSSerializerManager $serializerManager
private readonly KeyFactoryInterface $keyFactory,
private readonly AlgorithmManager $algorithmManager,
private readonly JWSSerializerManager $serializerManager
) {
}

Expand All @@ -51,7 +51,7 @@
return null;
}

private function verifyToken(JWS $jws, JWK $jwk, int $signature = 0): bool

Check warning on line 54 in src/TokenRepository.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ } return null; } - private function verifyToken(JWS $jws, JWK $jwk, int $signature = 0) : bool + private function verifyToken(JWS $jws, JWK $jwk, int $signature = -1) : bool { return (new JWSVerifier($this->algorithmManager))->verifyWithKey($jws, $jwk, $signature); } }

Check warning on line 54 in src/TokenRepository.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.3-ubuntu-latest

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ } return null; } - private function verifyToken(JWS $jws, JWK $jwk, int $signature = 0) : bool + private function verifyToken(JWS $jws, JWK $jwk, int $signature = 1) : bool { return (new JWSVerifier($this->algorithmManager))->verifyWithKey($jws, $jwk, $signature); } }
{
return (new JWSVerifier($this->algorithmManager))->verifyWithKey($jws, $jwk, $signature);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Stub/FakeIdentity.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

final class FakeIdentity implements IdentityInterface
{
public function __construct(private ?string $id)
public function __construct(private readonly ?string $id)
{
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Stub/FakeIdentityRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class FakeIdentityRepository implements IdentityRepositoryInterface
{
public function __construct(private ?IdentityInterface $returnIdentity)
public function __construct(private readonly ?IdentityInterface $returnIdentity)
{
}

Expand Down
Loading