Spring Security SAML

org.springframework.security.saml.metadata
Class MetadataGeneratorFilter

java.lang.Object
  extended by org.springframework.web.filter.GenericFilterBean
      extended by org.springframework.security.saml.metadata.MetadataGeneratorFilter
All Implemented Interfaces:
Filter, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.web.context.ServletContextAware

public class MetadataGeneratorFilter
extends org.springframework.web.filter.GenericFilterBean

The filter expects calls on configured URL and presents user with SAML2 metadata representing this application deployment. In case the application is configured to automatically generate metadata, the generation occurs upon first invocation of this filter (first request made to the server).

Author:
Vladimir Schäfer

Field Summary
protected  MetadataDisplayFilter displayFilter
          Metadata display filter.
protected  MetadataGenerator generator
          Class capable of generating new metadata.
protected static org.slf4j.Logger log
          Class logger.
protected  MetadataManager manager
          Class storing all SAML metadata documents
protected  boolean normalizeBaseUrl
          Flag indicates that in case generated base url is used (when value is not provided in the MetadataGenerator) it should be normalized.
 
Fields inherited from class org.springframework.web.filter.GenericFilterBean
logger
 
Constructor Summary
MetadataGeneratorFilter(MetadataGenerator generator)
          Default constructor.
 
Method Summary
 void afterPropertiesSet()
          Verifies that required entities were autowired or set.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
           
protected  String getDefaultBaseURL(HttpServletRequest request)
           
protected  String getDefaultEntityID(String entityBaseUrl, String alias)
           
 boolean isNormalizeBaseUrl()
           
protected  void processMetadataInitialization(HttpServletRequest request)
          Verifies whether generation is needed and if so the metadata document is created and stored in metadata manager.
 void setDisplayFilter(MetadataDisplayFilter displayFilter)
           
 void setManager(MetadataManager manager)
           
 void setNormalizeBaseUrl(boolean normalizeBaseUrl)
          When true flag indicates that in case generated base url is used (when value is not provided in the MetadataGenerator) it should be normalized.
 
Methods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setServletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.slf4j.Logger log
Class logger.


manager

protected MetadataManager manager
Class storing all SAML metadata documents


generator

protected MetadataGenerator generator
Class capable of generating new metadata.


displayFilter

protected MetadataDisplayFilter displayFilter
Metadata display filter.


normalizeBaseUrl

protected boolean normalizeBaseUrl
Flag indicates that in case generated base url is used (when value is not provided in the MetadataGenerator) it should be normalized. Normalization includes lower-casing of scheme and server name and removing standar ports of 80 for http and 443 for https schemes.

Constructor Detail

MetadataGeneratorFilter

public MetadataGeneratorFilter(MetadataGenerator generator)
Default constructor.

Parameters:
generator - generator
Method Detail

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain chain)
              throws IOException,
                     ServletException
Throws:
IOException
ServletException

processMetadataInitialization

protected void processMetadataInitialization(HttpServletRequest request)
                                      throws ServletException
Verifies whether generation is needed and if so the metadata document is created and stored in metadata manager.

Parameters:
request - request
Throws:
ServletException - error

getDefaultEntityID

protected String getDefaultEntityID(String entityBaseUrl,
                                    String alias)

getDefaultBaseURL

protected String getDefaultBaseURL(HttpServletRequest request)

setDisplayFilter

@Autowired(required=false)
public void setDisplayFilter(MetadataDisplayFilter displayFilter)

setManager

@Autowired
public void setManager(MetadataManager manager)

isNormalizeBaseUrl

public boolean isNormalizeBaseUrl()

setNormalizeBaseUrl

public void setNormalizeBaseUrl(boolean normalizeBaseUrl)
When true flag indicates that in case generated base url is used (when value is not provided in the MetadataGenerator) it should be normalized. Normalization includes lower-casing of scheme and server name and removing standar ports of 80 for http and 443 for https schemes.

Parameters:
normalizeBaseUrl - flag

afterPropertiesSet

public void afterPropertiesSet()
                        throws ServletException
Verifies that required entities were autowired or set.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Overrides:
afterPropertiesSet in class org.springframework.web.filter.GenericFilterBean
Throws:
ServletException

Spring Security SAML