Class FidoMetadataServiceFactory
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.plugin.authn.webauthn.metadata.impl.FidoMetadataServiceFactory
- All Implemented Interfaces:
Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent,FactoryBean<com.yubico.fido.metadata.FidoMetadataService>
public class FidoMetadataServiceFactory
extends AbstractIdentifiableInitializableComponent
implements FactoryBean<com.yubico.fido.metadata.FidoMetadataService>
Spring factory bean for creating a
FidoMetadataService. Only downloads or loads FIDO metadata on
creation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ResourceWhere to cache the metadata blob.A List of CRLs to check the revocation status of the metadata signature.private String[]The expected set of legal headers on the FIDO metadata blob.private final org.slf4j.LoggerClass logger.private ResourceThe File location of the metadata blob.private ResourceThe HTTPS location of the metadata blob to download.The locations of the trust roots that verify the downloaded metadata's signature.private booleanOnly verify the signature in the blob file from a fresh download.Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Set<TrustAnchor>convertTrustRoots(List<Resource> trustRootFiles) Convert the list of trust root files into JavaTrustAnchors.protected voidprivate ResourceGet where to cache the metadata blob.getCrls()Get the CRLs to use to check the revocation status of the metadata signature.private String[]Get the expected legal headers on the FIDO metadata blob.private ResourceGet the metadata blob file.private ResourceGet the URL of the metadata blob file to fetch.com.yubico.fido.metadata.FidoMetadataServiceClass<?>Get the trust root files.booleanOnly verify the signature in the blob file from a fresh download?private Collection<CRL>loadCrls()Load CRLs from the given set of CRL resources into a collection of CRL objects.private StringloadMetadataJwt(Resource file) Load the given metadata blob file into a String.voidsetCacheFile(String file) Set where to cache the metadata blob.voidSet the CRLs to use to check the revocation status of the metadata signature.voidsetExpectedLegalHeaders(String[] headers) Set the expected legal headers on the FIDO metadata blob.voidsetMetadataBlobFile(Resource file) Set the location of the local metadata blob file.voidSet the URL of the metadata blob file to fetch.voidsetTrustRootFile(Resource file) Deprecated, for removal: This API element is subject to removal in a future version.voidsetTrustRootFiles(List<Resource> roots) Set the trust roots.voidsetVerifyDownloadOnly(boolean downloadOnly) Set if signatures are only verified in the blob file from a fresh download.Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.FactoryBean
isSingletonMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getId
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
trustRootFiles
The locations of the trust roots that verify the downloaded metadata's signature. -
cacheFile
Where to cache the metadata blob. -
metadataBlobUrl
The HTTPS location of the metadata blob to download. -
metadataBlobFile
The File location of the metadata blob. If this file is specified, metadata will never be downloaded over HTTP. -
verifyDownloadOnly
private boolean verifyDownloadOnlyOnly verify the signature in the blob file from a fresh download. -
expectedLegalHeaders
The expected set of legal headers on the FIDO metadata blob. -
crls
A List of CRLs to check the revocation status of the metadata signature.
-
-
Constructor Details
-
FidoMetadataServiceFactory
public FidoMetadataServiceFactory()Constructor.
-
-
Method Details
-
getObject
- Specified by:
getObjectin interfaceFactoryBean<com.yubico.fido.metadata.FidoMetadataService>- Throws:
Exception
-
convertTrustRoots
Convert the list of trust root files into JavaTrustAnchors. Any that fail to be converted throw a fatal bean exception.- Parameters:
trustRootFiles- the list of files to use as trust roots- Returns:
- a set of converted
TrustAnchors. - Throws:
FatalBeanException- if a trust root file does not exist or cannot be converted to aTrustAnchor- Since:
- 1.4.3
-
loadCrls
Load CRLs from the given set of CRL resources into a collection of CRL objects.- Returns:
- the loaded CRL collection
-
doInitialize
- Overrides:
doInitializein classAbstractIdentifiedInitializableComponent- Throws:
ComponentInitializationException
-
setCacheFile
Set where to cache the metadata blob. As the cachefile does not need to exist before the metadata is downloaded, we restrict the file to be aFileSystemResourcetype.- Parameters:
file- The cacheFile to set.
-
getCacheFile
Get where to cache the metadata blob.- Returns:
- where to cache the metadata blob.
-
getTrustRootFiles
Get the trust root files.- Returns:
- the list of trust root files.
- Since:
- 1.4.3
-
setTrustRootFiles
Set the trust roots.- Parameters:
roots- the trust roots- Since:
- 1.4.3
-
getMetadataBlobUrl
Get the URL of the metadata blob file to fetch.- Returns:
- the metadata blob file URL.
-
getMetadataBlobFile
Get the metadata blob file.- Returns:
- the metadata blob file.
-
setExpectedLegalHeaders
Set the expected legal headers on the FIDO metadata blob.- Parameters:
headers- The expected legal headers to set.
-
getExpectedLegalHeaders
Get the expected legal headers on the FIDO metadata blob.- Returns:
- the expected legal headers.
-
setCrls
Set the CRLs to use to check the revocation status of the metadata signature.- Parameters:
revocationLists- The crls to set.
-
getCrls
Get the CRLs to use to check the revocation status of the metadata signature.- Returns:
- the crls.
-
setVerifyDownloadOnly
public void setVerifyDownloadOnly(boolean downloadOnly) Set if signatures are only verified in the blob file from a fresh download.- Parameters:
downloadOnly- should we verify only newly downloaded metadata.
-
isVerifyDownloadOnly
public boolean isVerifyDownloadOnly()Only verify the signature in the blob file from a fresh download?- Returns:
- true if signatures are only verified in a new blob file download (i.e. ignored from a cache file), false if they are always verified, no matter where the blob is loaded from.
-
getObjectType
- Specified by:
getObjectTypein interfaceFactoryBean<com.yubico.fido.metadata.FidoMetadataService>
-
setTrustRootFiles(List)