Not possible to register webauthn key on Firefox

Closes #10020
This commit is contained in:
Martin Bartoš 2022-02-07 09:43:28 +01:00 committed by Marek Posolda
parent de2c1fbb45
commit 5494848f3f
2 changed files with 11 additions and 7 deletions

View file

@ -26,6 +26,7 @@ import com.webauthn4j.data.attestation.authenticator.AttestedCredentialData;
import com.webauthn4j.data.attestation.authenticator.COSEKey; import com.webauthn4j.data.attestation.authenticator.COSEKey;
import com.webauthn4j.data.attestation.statement.AttestationStatement; import com.webauthn4j.data.attestation.statement.AttestationStatement;
import java.util.Collections;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -122,7 +123,7 @@ public class WebAuthnCredentialModelInput implements CredentialInput {
} }
public Set<AuthenticatorTransport> getTransports() { public Set<AuthenticatorTransport> getTransports() {
return transports; return transports != null ? transports : Collections.emptySet();
} }
public void setTransports(Set<AuthenticatorTransport> transports) { public void setTransports(Set<AuthenticatorTransport> transports) {
@ -170,8 +171,8 @@ public class WebAuthnCredentialModelInput implements CredentialInput {
.append(Base64.encodeBytes(authenticationRequest.getCredentialId())) .append(Base64.encodeBytes(authenticationRequest.getCredentialId()))
.append(","); .append(",");
} }
if (CollectionUtils.isNotEmpty(transports)) { if (CollectionUtils.isNotEmpty(getTransports())) {
final String transportsString = transports.stream() final String transportsString = getTransports().stream()
.map(AuthenticatorTransport::getValue) .map(AuthenticatorTransport::getValue)
.collect(Collectors.joining(",")); .collect(Collectors.joining(","));

View file

@ -104,10 +104,13 @@
$("#attestationObject").val(base64url.encode(new Uint8Array(attestationObject), {pad: false})); $("#attestationObject").val(base64url.encode(new Uint8Array(attestationObject), {pad: false}));
$("#publicKeyCredentialId").val(base64url.encode(new Uint8Array(publicKeyCredentialId), {pad: false})); $("#publicKeyCredentialId").val(base64url.encode(new Uint8Array(publicKeyCredentialId), {pad: false}));
if (typeof result.response.getTransports === "function") {
let transports = result.response.getTransports(); let transports = result.response.getTransports();
if (transports) { if (transports) {
$("#transports").val(getTransportsAsString(transports)); $("#transports").val(getTransportsAsString(transports));
}
} else {
console.log("Your browser is not able to recognize supported transport media for the authenticator.");
} }
let initLabel = "WebAuthn Authenticator (Default Label)"; let initLabel = "WebAuthn Authenticator (Default Label)";