use of com.webauthn4j.data.jws.JWAIdentifier in project webauthn4j by webauthn4j.
the class JWSHeaderDeserializer method deserialize.
@Override
public JWSHeader deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
JsonNode jsonNode = p.getCodec().readTree(p);
JWAIdentifier alg = p.getCodec().treeToValue(jsonNode.get("alg"), JWAIdentifier.class);
JsonNode x5cNode = jsonNode.get("x5c");
List<X509Certificate> certificates = new ArrayList<>();
for (JsonNode node : x5cNode) {
certificates.add(CertificateUtil.generateX509Certificate(Base64Util.decode(node.asText())));
}
CertPath x5c = CertificateUtil.generateCertPath(certificates);
return new JWSHeader(alg, x5c);
}
Aggregations