Skip to content

Commit

Permalink
Revert the Passkey prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Feb 18, 2025
1 parent 6863373 commit 7d7224e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions api/Security/WebauthnAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function authenticate(Request $request): Passport
throw new BadRequestException();
}

$username = substr($authenticatorAssertionResponse->userHandle, strlen('contao-manager.'));
$username = $authenticatorAssertionResponse->userHandle;
$userBadge = new UserBadge($username, $this->userProvider->loadUserByIdentifier(...));

$credentials = new CustomCredentials(
Expand Down Expand Up @@ -173,12 +173,11 @@ public function getCredentialOptions(string $host, string|null $username): strin
$challenge,
$rpEntity->id,
userVerification: PublicKeyCredentialRequestOptions::USER_VERIFICATION_REQUIREMENT_REQUIRED,
timeout: 5 * 60 * 1000,
);
} else {
$options = new PublicKeyCredentialCreationOptions(
$rpEntity,
new PublicKeyCredentialUserEntity($username, 'contao-manager.'.$username, $username),
new PublicKeyCredentialUserEntity($username, $username, $username),
$challenge,
[
PublicKeyCredentialParameters::create('public-key', Algorithms::COSE_ALGORITHM_ES256K), // More interesting algorithm
Expand All @@ -188,7 +187,6 @@ public function getCredentialOptions(string $host, string|null $username): strin
PublicKeyCredentialParameters::create('public-key', Algorithms::COSE_ALGORITHM_ED256), // Less interesting algorithm
],
new AuthenticatorSelectionCriteria(userVerification: AuthenticatorSelectionCriteria::USER_VERIFICATION_REQUIREMENT_REQUIRED),
timeout: 5 * 60 * 1000,
);
}

Expand Down

0 comments on commit 7d7224e

Please sign in to comment.