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

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

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

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.net.URL;
import java.security.cert.X509Certificate;
import java.util.List;
import java.util.Optional;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
import lombok.extern.jackson.Jacksonized;

/**
 * The metadata BLOB is a JSON Web Token (see [JWT]
 * and [JWS]).
 *
 * 

This type represents the contents of the JWT header. * * @see FIDO * Metadata Service §3.1.7. Metadata BLOB * @see RFC 7519: JSON Web Token (JWT) */ @Value @Builder(toBuilder = true) @Jacksonized public class MetadataBLOBHeader { /** * @see RFC 7519 §5.1. "typ" * (Type) Header Parameter */ String typ; /** * @see RFC 7515 §4.1.1. * "alg" (Algorithm) Header Parameter */ @NonNull String alg; /** * @see RFC 7515 §4.1.5. * "x5u" (X.509 URL) Header Parameter */ URL x5u; /** * @see RFC 7515 §4.1.6. * "x5c" (X.509 Certificate Chain) Header Parameter */ @JsonDeserialize(contentConverter = CertFromBase64Converter.class) @JsonSerialize(contentConverter = CertToBase64Converter.class) List x5c; private MetadataBLOBHeader(String typ, @NonNull String alg, URL x5u, List x5c) { this.typ = typ; this.alg = alg; this.x5u = x5u; this.x5c = x5c; if (typ != null && !typ.equals("JWT")) { throw new IllegalArgumentException("Unsupported JWT type: " + typ); } } /** * @see RFC 7519 §5.1. "typ" * (Type) Header Parameter */ public Optional getTyp() { return Optional.ofNullable(typ); } /** * @see RFC 7515 §4.1.5. * "x5u" (X.509 URL) Header Parameter */ public Optional getX5u() { return Optional.ofNullable(x5u); } /** * @see RFC 7515 §4.1.6. * "x5c" (X.509 Certificate Chain) Header Parameter */ // @JsonIgnore needed because of: // https://github.com/FasterXML/jackson-databind/issues/4413#issuecomment-1977989776 @JsonIgnore public Optional> getX5c() { return Optional.ofNullable(x5c); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy