com.yubico.fido.metadata.StatusReport Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of webauthn-server-attestation Show documentation
Show all versions of webauthn-server-attestation Show documentation
Yubico WebAuthn attestation subsystem
The newest version!
package com.yubico.fido.metadata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.cert.X509Certificate;
import java.time.LocalDate;
import java.util.Optional;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;
import lombok.Value;
import lombok.extern.jackson.Jacksonized;
/**
* Contains an {@link AuthenticatorStatus} and additional data associated with it, if any.
*
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
@Value
@Builder
@Jacksonized
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class StatusReport {
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
@NonNull AuthenticatorStatus status;
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
LocalDate effectiveDate;
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
Long authenticatorVersion;
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
@JsonDeserialize(converter = CertFromBase64Converter.class)
@JsonSerialize(converter = CertToBase64Converter.class)
X509Certificate certificate;
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
@JsonProperty("url")
@Getter(AccessLevel.NONE)
String url;
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
String certificationDescriptor;
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
String certificateNumber;
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
String certificationPolicyVersion;
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
String certificationRequirementsVersion;
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
public Optional getEffectiveDate() {
return Optional.ofNullable(effectiveDate);
}
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
public Optional getAuthenticatorVersion() {
return Optional.ofNullable(authenticatorVersion);
}
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
@JsonIgnore
public Optional getCertificate() {
return Optional.ofNullable(this.certificate);
}
/**
* Attempt to parse the {@link #getUrlAsString() url} property, if any, as a {@link URL}.
*
* @return A present value if and only if {@link #getUrlAsString()} is present and a valid URL.
*/
public Optional getUrl() {
try {
return Optional.of(new URL(url));
} catch (MalformedURLException e) {
return Optional.empty();
}
}
/**
* Get the raw url
property of this {@link StatusReport} object. This may or may not
* be a valid URL.
*
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
@JsonIgnore
public Optional getUrlAsString() {
return Optional.ofNullable(this.url);
}
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
public Optional getCertificationDescriptor() {
return Optional.ofNullable(this.certificationDescriptor);
}
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
public Optional getCertificateNumber() {
return Optional.ofNullable(this.certificateNumber);
}
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
public Optional getCertificationPolicyVersion() {
return Optional.ofNullable(this.certificationPolicyVersion);
}
/**
* @see FIDO
* Metadata Service §3.1.3. StatusReport dictionary
*/
public Optional getCertificationRequirementsVersion() {
return Optional.ofNullable(this.certificationRequirementsVersion);
}
}