Search in sources :

Example 1 with MetadataTOCPayload

use of com.webauthn4j.metadata.legacy.data.toc.MetadataTOCPayload in project webauthn4j by webauthn4j.

the class FidoMdsMetadataItemsProvider method refresh.

private void refresh() {
    MetadataTOCPayload tocPayload = fetchMetadataTOCPayload(false);
    cachedMetadataItemMap = tocPayload.getEntries().parallelStream().map(entry -> {
        try {
            return fetchFidoMdsMetadataItem(entry);
        } catch (RuntimeException e) {
            logger.warn("Failed to fetch MetadataTOCPayLoad", e);
            return null;
        }
    }).filter(Objects::nonNull).distinct().collect(Collectors.groupingBy(MetadataItem::getAaguid)).entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> Collections.unmodifiableSet(new HashSet<>(entry.getValue()))));
    nextUpdate = tocPayload.getNextUpdate().atStartOfDay().atOffset(ZoneOffset.UTC);
    lastRefresh = OffsetDateTime.now(ZoneOffset.UTC);
}
Also used : JWSFactory(com.webauthn4j.data.jws.JWSFactory) java.util(java.util) URISyntaxException(java.net.URISyntaxException) LoggerFactory(org.slf4j.LoggerFactory) HttpClient(com.webauthn4j.metadata.HttpClient) Base64UrlUtil(com.webauthn4j.util.Base64UrlUtil) java.security.cert(java.security.cert) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) JWS(com.webauthn4j.data.jws.JWS) ObjectConverter(com.webauthn4j.converter.util.ObjectConverter) URI(java.net.URI) ZoneOffset(java.time.ZoneOffset) Path(java.nio.file.Path) MDSException(com.webauthn4j.metadata.exception.MDSException) MetadataTOCPayload(com.webauthn4j.metadata.legacy.data.toc.MetadataTOCPayload) JsonConverter(com.webauthn4j.converter.util.JsonConverter) Logger(org.slf4j.Logger) Files(java.nio.file.Files) AAGUID(com.webauthn4j.data.attestation.authenticator.AAGUID) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) MessageDigestUtil(com.webauthn4j.util.MessageDigestUtil) StandardCharsets(java.nio.charset.StandardCharsets) UncheckedIOException(java.io.UncheckedIOException) SimpleHttpClient(com.webauthn4j.metadata.SimpleHttpClient) OffsetDateTime(java.time.OffsetDateTime) MetadataStatement(com.webauthn4j.metadata.legacy.data.statement.MetadataStatement) MetadataItemImpl(com.webauthn4j.metadata.legacy.data.MetadataItemImpl) MetadataItem(com.webauthn4j.metadata.legacy.data.MetadataItem) CertificateUtil(com.webauthn4j.util.CertificateUtil) MetadataTOCPayloadEntry(com.webauthn4j.metadata.legacy.data.toc.MetadataTOCPayloadEntry) MetadataStatementValidator(com.webauthn4j.metadata.legacy.validator.MetadataStatementValidator) InputStream(java.io.InputStream) MetadataTOCPayloadEntry(com.webauthn4j.metadata.legacy.data.toc.MetadataTOCPayloadEntry) MetadataTOCPayload(com.webauthn4j.metadata.legacy.data.toc.MetadataTOCPayload)

Aggregations

JsonConverter (com.webauthn4j.converter.util.JsonConverter)1 ObjectConverter (com.webauthn4j.converter.util.ObjectConverter)1 AAGUID (com.webauthn4j.data.attestation.authenticator.AAGUID)1 JWS (com.webauthn4j.data.jws.JWS)1 JWSFactory (com.webauthn4j.data.jws.JWSFactory)1 HttpClient (com.webauthn4j.metadata.HttpClient)1 SimpleHttpClient (com.webauthn4j.metadata.SimpleHttpClient)1 MDSException (com.webauthn4j.metadata.exception.MDSException)1 MetadataItem (com.webauthn4j.metadata.legacy.data.MetadataItem)1 MetadataItemImpl (com.webauthn4j.metadata.legacy.data.MetadataItemImpl)1 MetadataStatement (com.webauthn4j.metadata.legacy.data.statement.MetadataStatement)1 MetadataTOCPayload (com.webauthn4j.metadata.legacy.data.toc.MetadataTOCPayload)1 MetadataTOCPayloadEntry (com.webauthn4j.metadata.legacy.data.toc.MetadataTOCPayloadEntry)1 MetadataStatementValidator (com.webauthn4j.metadata.legacy.validator.MetadataStatementValidator)1 Base64UrlUtil (com.webauthn4j.util.Base64UrlUtil)1 CertificateUtil (com.webauthn4j.util.CertificateUtil)1 MessageDigestUtil (com.webauthn4j.util.MessageDigestUtil)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 UncheckedIOException (java.io.UncheckedIOException)1