Spring Security SAML

org.springframework.security.saml.metadata
Class CachingMetadataManager

java.lang.Object
  extended by org.opensaml.saml2.metadata.provider.BaseMetadataProvider
      extended by org.opensaml.saml2.metadata.provider.ChainingMetadataProvider
          extended by org.springframework.security.saml.metadata.MetadataManager
              extended by org.springframework.security.saml.metadata.CachingMetadataManager
All Implemented Interfaces:
org.opensaml.saml2.metadata.provider.MetadataProvider, org.opensaml.saml2.metadata.provider.ObservableMetadataProvider, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, ExtendedMetadataProvider

public class CachingMetadataManager
extends MetadataManager

Metadata manager caches all results of EntityDescriptors loaded from the providers. Cache is cleaned whenever some of the providers published an observed message.

The class is synchronized using the superclass ReentrantReadWriteLock.

Author:
Vladimir Schaefer

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.opensaml.saml2.metadata.provider.ObservableMetadataProvider
org.opensaml.saml2.metadata.provider.ObservableMetadataProvider.Observer
 
Field Summary
 
Fields inherited from class org.springframework.security.saml.metadata.MetadataManager
keyManager, log
 
Fields inherited from class org.opensaml.saml2.metadata.provider.BaseMetadataProvider
unmarshallerFactory
 
Constructor Summary
CachingMetadataManager(List<org.opensaml.saml2.metadata.provider.MetadataProvider> providers)
          Creates caching metadata provider.
 
Method Summary
 org.opensaml.saml2.metadata.EntityDescriptor getEntityDescriptor(byte[] hash)
          Locates entity descriptor whose entityId SHA-1 hash equals the one in the parameter.
 org.opensaml.saml2.metadata.EntityDescriptor getEntityDescriptor(String entityID)
          In case entity exists in the cache it is returned, otherwise mechanism from the super class is used to locate it.
 String getEntityIdForAlias(String entityAlias)
          Locates name of the entity for the given alias.
 ExtendedMetadata getExtendedMetadata(String entityID)
          In case entity exists in the cache it is returned, otherwise mechanism from the super class is used to locate it.
 void refreshMetadata()
          Guaranteed to be called by the superclass as part of the initialization.
 
Methods inherited from class org.springframework.security.saml.metadata.MetadataManager
addMetadataProvider, afterPropertiesSet, destroy, getAvailableProviders, getDefaultExtendedMetadata, getDefaultIDP, getHostedSPName, getIDPEntityNames, getPKIXResolver, getProviders, getSPEntityNames, getTrustEngine, initializeProvider, initializeProviderData, initializeProviderFilters, isIDPValid, isRefreshRequired, isSPValid, parseProvider, removeMetadataProvider, setDefaultExtendedMetadata, setDefaultIDP, setHostedSPName, setKeyManager, setProviders, setRefreshCheckInterval, setRefreshRequired
 
Methods inherited from class org.opensaml.saml2.metadata.provider.ChainingMetadataProvider
doAddMetadataProvider, emitChangeEvent, getEntitiesDescriptor, getMetadata, getMetadataFilter, getObservers, getRole, getRole, setMetadataFilter, setRequireValidMetadata
 
Methods inherited from class org.opensaml.saml2.metadata.provider.BaseMetadataProvider
requireValidMetadata
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensaml.saml2.metadata.provider.MetadataProvider
requireValidMetadata
 

Constructor Detail

CachingMetadataManager

public CachingMetadataManager(List<org.opensaml.saml2.metadata.provider.MetadataProvider> providers)
                       throws org.opensaml.saml2.metadata.provider.MetadataProviderException
Creates caching metadata provider.

Parameters:
providers - providers to include
Throws:
org.opensaml.saml2.metadata.provider.MetadataProviderException - error initializing
Method Detail

refreshMetadata

public void refreshMetadata()
Guaranteed to be called by the superclass as part of the initialization.

Overrides:
refreshMetadata in class MetadataManager

getEntityIdForAlias

public String getEntityIdForAlias(String entityAlias)
                           throws org.opensaml.saml2.metadata.provider.MetadataProviderException
Locates name of the entity for the given alias.

Overrides:
getEntityIdForAlias in class MetadataManager
Parameters:
entityAlias - to load entityId for
Returns:
entityId or null if not found
Throws:
org.opensaml.saml2.metadata.provider.MetadataProviderException - provider in case alias is not unique or missing

getEntityDescriptor

public org.opensaml.saml2.metadata.EntityDescriptor getEntityDescriptor(String entityID)
                                                                 throws org.opensaml.saml2.metadata.provider.MetadataProviderException
In case entity exists in the cache it is returned, otherwise mechanism from the super class is used to locate it.

Specified by:
getEntityDescriptor in interface org.opensaml.saml2.metadata.provider.MetadataProvider
Overrides:
getEntityDescriptor in class org.opensaml.saml2.metadata.provider.ChainingMetadataProvider
Parameters:
entityID - id to load descriptor for
Returns:
entity descriptor or null if not found
Throws:
org.opensaml.saml2.metadata.provider.MetadataProviderException - provider

getEntityDescriptor

public org.opensaml.saml2.metadata.EntityDescriptor getEntityDescriptor(byte[] hash)
                                                                 throws org.opensaml.saml2.metadata.provider.MetadataProviderException
Locates entity descriptor whose entityId SHA-1 hash equals the one in the parameter.

Overrides:
getEntityDescriptor in class MetadataManager
Parameters:
hash - hash of the entity descriptor
Returns:
found descriptor or null
Throws:
org.opensaml.saml2.metadata.provider.MetadataProviderException - in case metadata required for processing can't be loaded

getExtendedMetadata

public ExtendedMetadata getExtendedMetadata(String entityID)
                                     throws org.opensaml.saml2.metadata.provider.MetadataProviderException
In case entity exists in the cache it is returned, otherwise mechanism from the super class is used to locate it.

Specified by:
getExtendedMetadata in interface ExtendedMetadataProvider
Overrides:
getExtendedMetadata in class MetadataManager
Parameters:
entityID - id to load extended metadata for
Returns:
entity descriptor or null if not found
Throws:
org.opensaml.saml2.metadata.provider.MetadataProviderException - provider

Spring Security SAML