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 for web-token 4.0 #602

Merged
merged 4 commits into from
Jun 29, 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
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"symfony-ux",
"bundle"
],
"minimum-stability": "dev",
"homepage": "https://github.com/web-auth/webauthn-framework",
"authors": [
{
Expand Down Expand Up @@ -72,7 +73,7 @@
"symfony/uid": "^6.1|^7.0",
"symfony/validator": "^6.1|^7.0",
"web-auth/cose-lib": "^4.2.3",
"web-token/jwt-library": "^3.3"
"web-token/jwt-library": "^3.3|^4.0"
},
"replace": {
"web-auth/webauthn-lib": "self.version",
Expand Down
51 changes: 33 additions & 18 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,6 @@ parameters:
count: 1
path: src/metadata-service/src/Statement/MetadataStatement.php

-
message: "#^Method Webauthn\\\\MetadataService\\\\Statement\\\\MetadataStatement\\:\\:getAlternativeDescriptions\\(\\) should return Webauthn\\\\MetadataService\\\\Statement\\\\AlternativeDescriptions but returns Webauthn\\\\MetadataService\\\\Statement\\\\AlternativeDescriptions\\|null\\.$#"
count: 1
path: src/metadata-service/src/Statement/MetadataStatement.php

-
message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(mixed\\)\\: mixed\\)\\|null, Closure\\(array\\)\\: Webauthn\\\\MetadataService\\\\Statement\\\\DisplayPNGCharacteristicsDescriptor given\\.$#"
count: 1
Expand Down Expand Up @@ -633,6 +628,11 @@ parameters:
count: 1
path: src/metadata-service/src/Statement/Version.php

-
message: "#^Cannot access offset 'FrameworkBundle' on array\\|bool\\|float\\|int\\|string\\|UnitEnum\\.$#"
count: 1
path: src/stimulus/src/DependencyInjection/WebauthnStimulusExtension.php

-
message: "#^Method Webauthn\\\\Stimulus\\\\WebauthnStimulusBundle\\:\\:getContainerExtension\\(\\) never returns null so it can be removed from the return type\\.$#"
count: 1
Expand Down Expand Up @@ -703,7 +703,7 @@ parameters:
path: src/symfony/src/Controller/AttestationResponseController.php

-
message: "#^Fetching class constant class of deprecated class Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
message: "#^Fetching class constant class of deprecated interface Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
count: 1
path: src/symfony/src/Controller/AttestationResponseController.php

Expand Down Expand Up @@ -765,7 +765,7 @@ parameters:
path: src/symfony/src/CredentialOptionsBuilder/ProfileBasedCreationOptionsBuilder.php

-
message: "#^Fetching class constant class of deprecated class Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
message: "#^Fetching class constant class of deprecated interface Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
count: 1
path: src/symfony/src/CredentialOptionsBuilder/ProfileBasedCreationOptionsBuilder.php

Expand Down Expand Up @@ -793,7 +793,7 @@ parameters:
path: src/symfony/src/CredentialOptionsBuilder/ProfileBasedRequestOptionsBuilder.php

-
message: "#^Fetching class constant class of deprecated class Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
message: "#^Fetching class constant class of deprecated interface Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
count: 1
path: src/symfony/src/CredentialOptionsBuilder/ProfileBasedRequestOptionsBuilder.php

Expand Down Expand Up @@ -1113,20 +1113,20 @@ parameters:

-
message: """
#^Fetching class constant class of deprecated class Webauthn\\\\Bundle\\\\Repository\\\\PublicKeyCredentialUserEntityRepository\\:
#^Fetching class constant class of deprecated interface Webauthn\\\\Bundle\\\\Repository\\\\PublicKeyCredentialUserEntityRepository\\:
since 4\\.6\\.0, to be removed in 5\\.0\\.0\\. Use \\{@link PublicKeyCredentialUserEntityRepositoryInterface\\} and \\{@link CanRegisterUserEntity\\} instead\\.$#
"""
count: 1
path: src/symfony/src/DependencyInjection/WebauthnExtension.php

-
message: "#^Fetching class constant class of deprecated class Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
message: "#^Fetching class constant class of deprecated interface Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
count: 1
path: src/symfony/src/DependencyInjection/WebauthnExtension.php

-
message: """
#^Fetching class constant class of deprecated class Webauthn\\\\TokenBinding\\\\TokenBindingHandler\\:
#^Fetching class constant class of deprecated interface Webauthn\\\\TokenBinding\\\\TokenBindingHandler\\:
Since 4\\.3\\.0 and will be removed in 5\\.0\\.0$#
"""
count: 1
Expand Down Expand Up @@ -1227,6 +1227,11 @@ parameters:
count: 1
path: src/symfony/src/Doctrine/Type/PublicKeyCredentialDescriptorCollection.php

-
message: "#^Parameter \\#2 \\$mode of function count expects 0\\|1, int given\\.$#"
count: 1
path: src/symfony/src/Doctrine/Type/PublicKeyCredentialDescriptorCollection.php

-
message: "#^Parameter \\#1 \\$data of static method Webauthn\\\\PublicKeyCredentialDescriptor\\:\\:createFromString\\(\\) expects string, mixed given\\.$#"
count: 1
Expand Down Expand Up @@ -1273,11 +1278,6 @@ parameters:
count: 1
path: src/symfony/src/Resources/config/services.php

-
message: "#^Fetching class constant class of deprecated class Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
count: 2
path: src/symfony/src/Resources/config/services.php

-
message: """
#^Fetching class constant class of deprecated class Webauthn\\\\TokenBinding\\\\IgnoreTokenBindingHandler\\:
Expand All @@ -1302,6 +1302,11 @@ parameters:
count: 1
path: src/symfony/src/Resources/config/services.php

-
message: "#^Fetching class constant class of deprecated interface Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
count: 2
path: src/symfony/src/Resources/config/services.php

-
message: """
#^Class Webauthn\\\\Bundle\\\\Security\\\\Authentication\\\\Token\\\\WebauthnToken implements deprecated interface Webauthn\\\\Bundle\\\\Security\\\\Authentication\\\\Token\\\\WebauthnTokenInterface\\:
Expand Down Expand Up @@ -1392,7 +1397,7 @@ parameters:

-
message: """
#^Call to deprecated method generateNextUserEntityId\\(\\) of class Webauthn\\\\Bundle\\\\Repository\\\\CanRegisterUserEntity\\:
#^Call to deprecated method generateNextUserEntityId\\(\\) of interface Webauthn\\\\Bundle\\\\Repository\\\\CanRegisterUserEntity\\:
since 4\\.7\\.0 and will be removed in 5\\.0\\.0\\. Please use Webauthn\\\\Bundle\\\\Repository\\\\CanGenerateUserEntity\\:\\:generateUserEntity\\(\\) instead\\.$#
"""
count: 1
Expand All @@ -1414,7 +1419,7 @@ parameters:
path: src/symfony/src/Security/Http/Authenticator/WebauthnAuthenticator.php

-
message: "#^Fetching class constant class of deprecated class Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
message: "#^Fetching class constant class of deprecated interface Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
count: 1
path: src/symfony/src/Security/Http/Authenticator/WebauthnAuthenticator.php

Expand Down Expand Up @@ -2176,6 +2181,11 @@ parameters:
count: 1
path: src/webauthn/src/AuthenticationExtensions/AuthenticationExtensions.php

-
message: "#^Parameter \\#2 \\$mode of function count expects 0\\|1, int given\\.$#"
count: 1
path: src/webauthn/src/AuthenticationExtensions/AuthenticationExtensions.php

-
message: "#^Class Webauthn\\\\AuthenticationExtensions\\\\AuthenticationExtensionsClientInputs extends @final class Webauthn\\\\AuthenticationExtensions\\\\AuthenticationExtensions\\.$#"
count: 1
Expand Down Expand Up @@ -3062,6 +3072,11 @@ parameters:
count: 1
path: src/webauthn/src/PublicKeyCredentialDescriptorCollection.php

-
message: "#^Parameter \\#2 \\$mode of function count expects 0\\|1, int given\\.$#"
count: 1
path: src/webauthn/src/PublicKeyCredentialDescriptorCollection.php

-
message: "#^Cannot call method load\\(\\) on Webauthn\\\\AttestationStatement\\\\AttestationObjectLoader\\|null\\.$#"
count: 1
Expand Down
4 changes: 0 additions & 4 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
use Rector\Set\ValueObject\SetList;
//use Rector\Symfony\Set\SymfonyLevelSetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\Symfony\Symfony42\Rector\New_\StringToArrayArgumentProcessRector;
use Rector\ValueObject\PhpVersion;

return static function (RectorConfig $config): void {
$config->import(SetList::DEAD_CODE);
$config->import(LevelSetList::UP_TO_PHP_81);
//$config->import(SymfonyLevelSetList::UP_TO_SYMFONY_60);
$config->import(SymfonySetList::SYMFONY_60);
$config->import(SymfonySetList::SYMFONY_50_TYPES);
$config->import(SymfonySetList::SYMFONY_52_VALIDATOR_ATTRIBUTES);
Expand All @@ -30,7 +28,6 @@
$config->import(DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES);
$config->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY);
$config->import(PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES);
//$config->import(PHPUnitLevelSetList::UP_TO_PHPUNIT_100);
$config->import(PHPUnitSetList::PHPUNIT_100);
$config->paths([__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/ecs.php', __DIR__ . '/rector.php']);
$config->skip([
Expand All @@ -42,7 +39,6 @@
],
ReadOnlyPropertyRector::class => [__DIR__ . '/src/metadata-service/src/Statement/MetadataStatement.php'],
PreferPHPUnitThisCallRector::class,
StringToArrayArgumentProcessRector::class => [__DIR__ . '/tests'],
]);
$config->phpVersion(PhpVersion::PHP_81);
$config->parallel();
Expand Down
2 changes: 1 addition & 1 deletion src/symfony/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"symfony/serializer": "^6.1|^7.0",
"symfony/validator": "^6.1|^7.0",
"web-auth/webauthn-lib": "self.version",
"web-token/jwt-library": "^3.3"
"web-token/jwt-library": "^3.3|^4.0"
},
"extra": {
"thanks": {
Expand Down
2 changes: 1 addition & 1 deletion tests/symfony/functional/MockClientCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class MockClientCallback
*/
private array $responses = [];

public function __invoke(string $method, string $url, array $options = []): ?ResponseInterface
public function __invoke(string $method, string $url): ?ResponseInterface
{
$key = $method . '-' . $url;
if (! isset($this->responses[$key])) {
Expand Down
Loading