Spring Security SAML

org.springframework.security.saml.metadata
Class MetadataDisplayFilter

java.lang.Object
  extended by org.springframework.web.filter.GenericFilterBean
      extended by org.springframework.security.saml.metadata.MetadataDisplayFilter
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 MetadataDisplayFilter
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  SAMLContextProvider contextProvider
          Provider for context based on URL
static String FILTER_URL
          Default name of path suffix which will invoke this filter.
protected  String filterProcessesUrl
          Url this filter should get activated on.
protected static org.slf4j.Logger log
          Class logger.
protected  MetadataManager manager
          Class storing all SAML metadata documents
 
Fields inherited from class org.springframework.web.filter.GenericFilterBean
logger
 
Constructor Summary
MetadataDisplayFilter()
           
 
Method Summary
 void afterPropertiesSet()
          Verifies that required entities were autowired or set.
protected  void displayMetadata(String spEntityName, PrintWriter writer)
          Method writes metadata document into given writer object.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
           
 String getFilterProcessesUrl()
           
protected  boolean processFilter(HttpServletRequest request)
          The filter will be used in case the URL of the request contains the FILTER_URL.
protected  void processMetadataDisplay(HttpServletRequest request, HttpServletResponse response)
          The filter attempts to generate application metadata (if configured so) and in case the call is made to the expected URL the metadata value is displayed and no further filters are invoked.
 void setContextProvider(SAMLContextProvider contextProvider)
           
 void setFilterProcessesUrl(String filterProcessesUrl)
          Custom filter URL which overrides the default.
 void setManager(MetadataManager manager)
           
 
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


contextProvider

protected SAMLContextProvider contextProvider
Provider for context based on URL


filterProcessesUrl

protected String filterProcessesUrl
Url this filter should get activated on.


FILTER_URL

public static final String FILTER_URL
Default name of path suffix which will invoke this filter.

See Also:
Constant Field Values
Constructor Detail

MetadataDisplayFilter

public MetadataDisplayFilter()
Method Detail

doFilter

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

processFilter

protected boolean processFilter(HttpServletRequest request)
The filter will be used in case the URL of the request contains the FILTER_URL.

Parameters:
request - request used to determine whether to enable this filter
Returns:
true if this filter should be used

processMetadataDisplay

protected void processMetadataDisplay(HttpServletRequest request,
                                      HttpServletResponse response)
                               throws IOException,
                                      ServletException
The filter attempts to generate application metadata (if configured so) and in case the call is made to the expected URL the metadata value is displayed and no further filters are invoked. Otherwise filter chain invocation continues.

Parameters:
request - request
response - response
Throws:
ServletException - error
IOException - io error

displayMetadata

protected void displayMetadata(String spEntityName,
                               PrintWriter writer)
                        throws ServletException
Method writes metadata document into given writer object.

Parameters:
spEntityName - id of entity to display metadata for
writer - output for metadata
Throws:
ServletException - error retrieving or writing the metadata

setManager

@Autowired
public void setManager(MetadataManager manager)

setContextProvider

@Autowired
public void setContextProvider(SAMLContextProvider contextProvider)

getFilterProcessesUrl

public String getFilterProcessesUrl()
Returns:
filter URL

setFilterProcessesUrl

public void setFilterProcessesUrl(String filterProcessesUrl)
Custom filter URL which overrides the default. Filter url determines URL where filter starts processing.

Parameters:
filterProcessesUrl - filter URL

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