Skip to content

Commit

Permalink
Add excludeCredentials field to various test cases
Browse files Browse the repository at this point in the history
The "excludeCredentials" field has been added to PublicKeyCredentialCreationOptionsTest.php, SerializerTest.php, and AdditionalAuthenticatorTest.php. This change ensures these tests are accurately testing all elements of authenticator credentials, including the 'excludeCredentials' field.
  • Loading branch information
Spomky committed Jul 12, 2024
1 parent 5b1db1e commit 611f380
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function anPublicKeyCredentialCreationOptionsWithoutExcludeCredentialsCan
AbstractObjectNormalizer::SKIP_NULL_VALUES => true,
]);
static::assertJsonStringEqualsJsonString(
'{"rp":{"name":"RP"},"user":{"name":"USER","id":"aWQ","displayName":"FOO BAR"},"challenge":"Y2hhbGxlbmdl","pubKeyCredParams":[{"type":"type","alg":-100}],"timeout":1000,"attestation":"indirect"}',
'{"rp":{"name":"RP"},"user":{"name":"USER","id":"aWQ","displayName":"FOO BAR"},"excludeCredentials": [],"challenge":"Y2hhbGxlbmdl","pubKeyCredParams":[{"type":"type","alg":-100}],"timeout":1000,"attestation":"indirect"}',
$json
);

Expand Down
1 change: 1 addition & 0 deletions tests/library/Unit/SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function theCredentialCanBeDeserialized(): void
"authenticatorAttachment": "cross-platform",
"userVerification": "required"
},
"excludeCredentials": [],
"attestation": "none"
}',
$json,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ public function anExistingUserCanAskForOptionsUsingTheDedicatedController(): voi
'attestation',
'user',
'authenticatorSelection',
'excludeCredentials',
];
foreach ($expectedKeys as $expectedKey) {
static::assertArrayHasKey($expectedKey, $data);
}
static::assertSame('ok', $data['status']);
static::assertArrayNotHasKey('excludeCredentials', $data); // username enumeration prevention is enabled
static::assertSame($data['excludeCredentials'], []); // username enumeration prevention is enabled
}

#[Test]
Expand Down

0 comments on commit 611f380

Please sign in to comment.