parent
de2c1fbb45
commit
5494848f3f
2 changed files with 11 additions and 7 deletions
|
@ -26,6 +26,7 @@ import com.webauthn4j.data.attestation.authenticator.AttestedCredentialData;
|
|||
import com.webauthn4j.data.attestation.authenticator.COSEKey;
|
||||
import com.webauthn4j.data.attestation.statement.AttestationStatement;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -122,7 +123,7 @@ public class WebAuthnCredentialModelInput implements CredentialInput {
|
|||
}
|
||||
|
||||
public Set<AuthenticatorTransport> getTransports() {
|
||||
return transports;
|
||||
return transports != null ? transports : Collections.emptySet();
|
||||
}
|
||||
|
||||
public void setTransports(Set<AuthenticatorTransport> transports) {
|
||||
|
@ -170,8 +171,8 @@ public class WebAuthnCredentialModelInput implements CredentialInput {
|
|||
.append(Base64.encodeBytes(authenticationRequest.getCredentialId()))
|
||||
.append(",");
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(transports)) {
|
||||
final String transportsString = transports.stream()
|
||||
if (CollectionUtils.isNotEmpty(getTransports())) {
|
||||
final String transportsString = getTransports().stream()
|
||||
.map(AuthenticatorTransport::getValue)
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
|
|
|
@ -104,11 +104,14 @@
|
|||
$("#attestationObject").val(base64url.encode(new Uint8Array(attestationObject), {pad: false}));
|
||||
$("#publicKeyCredentialId").val(base64url.encode(new Uint8Array(publicKeyCredentialId), {pad: false}));
|
||||
|
||||
|
||||
if (typeof result.response.getTransports === "function") {
|
||||
let transports = result.response.getTransports();
|
||||
if (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 labelResult = window.prompt("Please input your registered authenticator's label", initLabel);
|
||||
|
|
Loading…
Reference in a new issue