All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yubico.fido.metadata.AuthenticatorGetInfo Maven / Gradle / Ivy

The newest version!
package com.yubico.fido.metadata;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yubico.webauthn.data.AuthenticatorTransport;
import com.yubico.webauthn.data.PublicKeyCredentialParameters;
import com.yubico.webauthn.extension.uvm.UserVerificationMethod;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
import lombok.extern.jackson.Jacksonized;

/**
 * This dictionary describes supported versions, extensions, AAGUID of the device and its
 * capabilities.
 *
 * 

See: Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) * * @see FIDO * Metadata Statement §3.12. AuthenticatorGetInfo dictionary * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ @Value @Builder(toBuilder = true) @Jacksonized @JsonIgnoreProperties({ "maxAuthenticatorConfigLength", "defaultCredProtect" }) // Present in example but not defined public class AuthenticatorGetInfo { /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ @NonNull Set versions; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Set extensions; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ AAGUID aaguid; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ SupportedCtapOptions options; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Integer maxMsgSize; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Set pinUvAuthProtocols; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Integer maxCredentialCountInList; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Integer maxCredentialIdLength; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Set transports; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ List algorithms; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Integer maxSerializedLargeBlobArray; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Boolean forcePINChange; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Integer minPINLength; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Integer firmwareVersion; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Integer maxCredBlobLength; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Integer maxRPIDsForSetMinPINLength; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ Integer preferredPlatformUvAttempts; @JsonDeserialize(using = SetFromIntJsonDeserializer.class) @JsonSerialize(contentUsing = IntFromSetJsonSerializer.class) Set uvModality; Map certifications; Integer remainingDiscoverableCredentials; Set vendorPrototypeConfigCommands; /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional> getExtensions() { return Optional.ofNullable(extensions); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getAaguid() { return Optional.ofNullable(aaguid); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getOptions() { return Optional.ofNullable(options); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getMaxMsgSize() { return Optional.ofNullable(maxMsgSize); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional> getPinUvAuthProtocols() { return Optional.ofNullable(pinUvAuthProtocols); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getMaxCredentialCountInList() { return Optional.ofNullable(maxCredentialCountInList); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getMaxCredentialIdLength() { return Optional.ofNullable(maxCredentialIdLength); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional> getTransports() { return Optional.ofNullable(transports); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional> getAlgorithms() { return Optional.ofNullable(algorithms); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getMaxSerializedLargeBlobArray() { return Optional.ofNullable(maxSerializedLargeBlobArray); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getForcePINChange() { return Optional.ofNullable(forcePINChange); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getMinPINLength() { return Optional.ofNullable(minPINLength); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getFirmwareVersion() { return Optional.ofNullable(firmwareVersion); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getMaxCredBlobLength() { return Optional.ofNullable(maxCredBlobLength); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getMaxRPIDsForSetMinPINLength() { return Optional.ofNullable(maxRPIDsForSetMinPINLength); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getPreferredPlatformUvAttempts() { return Optional.ofNullable(preferredPlatformUvAttempts); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional> getUvModality() { return Optional.ofNullable(uvModality); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional> getCertifications() { return Optional.ofNullable(certifications); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional getRemainingDiscoverableCredentials() { return Optional.ofNullable(remainingDiscoverableCredentials); } /** * @see Client * to Authenticator Protocol (CTAP) §6.4. authenticatorGetInfo (0x04) */ public Optional> getVendorPrototypeConfigCommands() { return Optional.ofNullable(vendorPrototypeConfigCommands); } private static class SetFromIntJsonDeserializer extends JsonDeserializer> { @Override public Set deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { final int bitset = p.getNumberValue().intValue(); return Arrays.stream(UserVerificationMethod.values()) .filter(uvm -> (uvm.getValue() & bitset) != 0) .collect(Collectors.toSet()); } } private static class IntFromSetJsonSerializer extends JsonSerializer> { @Override public void serialize( Set value, JsonGenerator gen, SerializerProvider serializers) throws IOException { gen.writeNumber( value.stream().reduce(0, (acc, next) -> acc | next.getValue(), (a, b) -> a | b)); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy