Interface MetadataProvider

All Superinterfaces:
Component, DestructableComponent, InitializableComponent
All Known Implementing Classes:
AbstractMetadataProvider, CompositeMetadataProvider, FilesystemMetadataProvider, HTTPMetadataProvider, MDQMetadataProvider, ProxyMetadataProvider, StaticMetadataProvider

public interface MetadataProvider extends InitializableComponent, DestructableComponent
An interface that offers methods that operate on one or several metadata sources.

A MetadataProvider instance encapsulates OpenSAML:s MetadataResolver and adds easy to use methods and configuration.

Author:
Martin Lindström (martin@idsec.se)
  • Method Details

    • getID

      String getID()
      Returns the identifier for the provider.
      Returns:
      the identifier
    • getMetadata

      XMLObject getMetadata() throws ResolverException
      Returns the XML element making up the metadata for the federation. This element is either an EntityDescriptor or an EntitiesDescriptor.
      Returns:
      an XML element
      Throws:
      ResolverException - for metadata resolving errors
    • getMetadataDOM

      Element getMetadataDOM() throws MarshallingException
      Returns the DOM element making up the metadata for the federation.
      Returns:
      a DOM element
      Throws:
      MarshallingException - for XML marshalling errors
    • getLastUpdate

      Instant getLastUpdate()
      Returns the time the currently available metadata was last updated.
      Returns:
      time when the currently metadata was last updated, or null if no metadata has been successfully loaded
    • refresh

      void refresh() throws ResolverException
      Refresh the metadata handled by the provider.

      An implementation that does not support refresh should implement this operation as a no-op. Implementations that do support refresh of metadata should typically be either synchronized or make use other locking mechanisms to protect against concurrent access.

      Throws:
      ResolverException - if the refresh operation was unsuccessful
    • iterator

      Returns an iterator for all entity descriptors held by the provider.
      Returns:
      an iterator for all entity descriptors
    • iterator

      Iterable<EntityDescriptor> iterator(QName role)
      Returns an iterator for all entity descriptors having the given role.

      To list all IdP:s and SP:s do:

       
       idps = provider.iterator(IDPSSODescriptor.DEFAULT_ELEMENT_NAME);
       sps = provider.iterator(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
       
       
      Parameters:
      role - role descriptor
      Returns:
      an iterator for all matching entity descriptors
      See Also:
    • getEntityDescriptor

      EntityDescriptor getEntityDescriptor(String entityID) throws ResolverException
      Returns the entity descriptor identified by the given entityID.
      Parameters:
      entityID - the unique entityID for the entry
      Returns:
      an entity descriptor or null if no entry is found
      Throws:
      ResolverException - for underlying metadata errors
    • getEntityDescriptor

      EntityDescriptor getEntityDescriptor(String entityID, QName role) throws ResolverException
      Returns the entity descriptor identified by the given entityID and given role.
      Parameters:
      entityID - the entity ID
      role - the role descriptor
      Returns:
      an entity descriptor or null if no matching entry is found
      Throws:
      ResolverException - for underlying metadata errors
    • getIdentityProviders

      List<EntityDescriptor> getIdentityProviders() throws ResolverException
      Utility method that returns a list of entity descriptors for Identity Providers found in the metadata.
      Returns:
      a list of entity descriptors
      Throws:
      ResolverException - for metadata errors
    • getServiceProviders

      List<EntityDescriptor> getServiceProviders() throws ResolverException
      Utility method that returns a list of entity descriptors for Service Providers found in the metadata.
      Returns:
      a list of entity descriptors
      Throws:
      ResolverException - for metadata errors
    • getMetadataResolver

      MetadataResolver getMetadataResolver()
      Returns the underlying OpenSAML metadata resolver.
      Returns:
      OpenSAML metadata resolver