Skip to content

Commit a8eb347

Browse files
committed
WebAuthn: fix authenticate when allowCredentials present
Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
1 parent b130e72 commit a8eb347

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

webauthn/src/main/java/org/springframework/security/web/webauthn/management/Webauthn4JRelyingPartyOperations.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.time.Duration;
2020
import java.time.Instant;
2121
import java.util.ArrayList;
22+
import java.util.Base64;
2223
import java.util.Collections;
2324
import java.util.HashSet;
2425
import java.util.List;
@@ -87,6 +88,8 @@
8788
*/
8889
public class Webauthn4JRelyingPartyOperations implements WebAuthnRelyingPartyOperations {
8990

91+
private static final Base64.Encoder ENCODER = Base64.getUrlEncoder().withoutPadding();
92+
9093
private final PublicKeyCredentialUserEntityRepository userEntities;
9194

9295
private final UserCredentialRepository userCredentials;
@@ -437,6 +440,7 @@ private static List<byte[]> convertAllowedCredentialsToWebauthn4j(
437440
.map(PublicKeyCredentialDescriptor::getId)
438441
.filter(Objects::nonNull)
439442
.map(Bytes::getBytes)
443+
.map(ENCODER::encode)
440444
.collect(Collectors.toList());
441445
}
442446

0 commit comments

Comments
 (0)