Class TocService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandownloadMdsFromServer(URL metadataUrl) voidvoidfetchMetadata(boolean retryWhenTocMissing) Fetches the MDS TOC blob, falling back to the copy cached injansDocumentwhen no fresh one could be published.com.fasterxml.jackson.databind.JsonNodegetAuthenticatorsMetadata(String aaguid) Why the most recent refresh failed, ornullwhen the last refresh succeeded.When metadata was last downloaded and parsed successfully, in UTC, ornullwhen no refresh has succeeded since startup.ThenextUpdatedeclared by the TOC blob currently loaded in memory, ornullwhen no blob has been parsed since startup.intNumber of authenticator metadata entries currently loaded in memory.voidLoads the MDS TOC at server startup.voidboolean
-
Constructor Details
-
TocService
public TocService()
-
-
Method Details
-
init
@Asynchronous public void init(@Observes @ApplicationInitialized(jakarta.enterprise.context.ApplicationScoped.class) Object init) Loads the MDS TOC at server startup.Runs asynchronously (via the
Asynchronousinterceptor, which the container applies when it dispatches this observer) so the potentially slow download — including the retry loop when the TOC blob is missing — never blocks application initialization. The FIDO2 server keeps starting up while the TOC is fetched in the background; requests that need it before it's ready are already handled defensively (seegetAuthenticatorsMetadata(String)). We retry the download a few times only when the TOC blob is missing, because without it the server can't validate attestations. -
refreshTOCEntries
public void refreshTOCEntries() -
fetchMetadata
public void fetchMetadata() -
fetchMetadata
public void fetchMetadata(boolean retryWhenTocMissing) Fetches the MDS TOC blob, falling back to the copy cached injansDocumentwhen no fresh one could be published.- Parameters:
retryWhenTocMissing- whentrue(server startup) and the MDS TOC blob is missing from the DB, the download is retried a few times before giving up. A missing TOC blob prevents the FIDO2 server from validating attestations, so it's worth a few extra attempts to recover from a transient outage of the FIDO Alliance metadata service. When the TOC is merely stale (present but past itsnextUpdate) a single attempt is made, matching the behaviour of the dailyMDS3UpdateTimer.
-
getAuthenticatorsMetadata
-
getDigester
-
getTocEntryCount
public int getTocEntryCount()Number of authenticator metadata entries currently loaded in memory. Zero means attestation has no metadata to validate against — a common cause of a previously valid authenticator suddenly being rejected. -
getLoadedTocNextUpdate
ThenextUpdatedeclared by the TOC blob currently loaded in memory, ornullwhen no blob has been parsed since startup.Unlike
getNextUpdateDate()this reads the in-memory value rather than the document store, so it neither performs I/O nor throwsDocumentException— which is what makes it usable from a health endpoint. -
getLastSuccessfulRefresh
When metadata was last downloaded and parsed successfully, in UTC, ornullwhen no refresh has succeeded since startup. -
getLastRefreshError
Why the most recent refresh failed, ornullwhen the last refresh succeeded. -
downloadMdsFromServer
-
saveNextUpdateDateOfTheMDS
public boolean saveNextUpdateDateOfTheMDS() -
getNextUpdateDate
-