public class SAMLDiscovery
extends org.springframework.web.filter.GenericFilterBean
Modifier and Type | Field and Description |
---|---|
protected SAMLContextProvider |
contextProvider
Context provider.
|
static String |
ENTITY_ID_PARAM
Unique identifier of the party performing the request.
|
static String |
FILTER_URL
Default name of path suffix which will invoke this filter.
|
protected String |
filterProcessesUrl
Url this filter should get activated on.
|
static String |
IDP_DISCO_PROTOCOL_SINGLE
Default profile of the discovery service.
|
protected String |
idpSelectionPath
In case this property is set to not null value the user will be redirected to this URL for selection
of IDP to use for login.
|
protected static org.slf4j.Logger |
log |
protected MetadataManager |
metadata
Metadata manager used to look up entity IDs and discovery URLs.
|
static String |
PASSIVE_PARAM
Request parameter indicating whether discovery service can interact with the user agent.
|
static String |
POLICY_PARAM
Policy to use in order to determine IDP.
|
static String |
RETURN_ID_PARAM
Request parameter specifying which response attribute to use for conveying the determined IDP name.
|
static String |
RETURN_PARAM
Used to store return parameter in the forwarded request object.
|
static String |
RETURN_URL
Used to store return URL in the forwarded request object.
|
static String |
RETURN_URL_PARAM
URL used by the discovery service to send the response.
|
protected SAMLEntryPoint |
samlEntryPoint
Entry point dependency for loading of correct URL.
|
Constructor and Description |
---|
SAMLDiscovery() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Verifies that required entities were autowired or set.
|
void |
doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain) |
protected String |
getDefaultReturnURL(SAMLMessageContext messageContext)
Provides default return URL based on metadata in case none was supplied in the request.
|
String |
getFilterProcessesUrl() |
String |
getIdpSelectionPath()
Path used to forward request in order to enable target IDP selection
|
protected String |
getPassiveIDP(HttpServletRequest request)
Returns IDP to be used in passive mode.
|
protected boolean |
isResponseURLValid(String returnURL,
SAMLMessageContext messageContext)
Verifies whether return URL supplied in the request is valid.
|
protected void |
processDiscoveryRequest(HttpServletRequest request,
HttpServletResponse response)
Method processes IDP Discovery request, validates it for conformity and either sends a passive response with
default IDP (when isPassive mode is requested) or forwards browser to the IDP selection.
|
protected boolean |
processFilter(HttpServletRequest request)
The filter will be used in case the URL of the request contains the FILTER_URL.
|
protected void |
sendIDPSelection(HttpServletRequest request,
HttpServletResponse response,
String responseURL,
String returnParam)
Forward the request to a page which renders IDP selection page for the user.
|
protected void |
sendPassiveResponse(HttpServletRequest request,
HttpServletResponse response,
String responseURL,
String returnParam,
String entityID)
Creates a URL to be used for returning of the selected IDP and sends a redirect.
|
void |
setContextProvider(SAMLContextProvider contextProvider)
Sets entity responsible for populating local entity context data.
|
void |
setFilterProcessesUrl(String filterProcessesUrl)
Custom filter URL which overrides the default.
|
void |
setIdpSelectionPath(String idpSelectionPath)
Sets path where request dispatcher will send user for IDP selection.
|
void |
setMetadata(MetadataManager metadata)
Metadata manager, cannot be null, must be set.
|
void |
setSamlEntryPoint(SAMLEntryPoint samlEntryPoint)
Dependency for loading of entry point URL
|
protected static final org.slf4j.Logger log
public static final String RETURN_URL
public static final String RETURN_PARAM
public static final String ENTITY_ID_PARAM
public static final String RETURN_URL_PARAM
public static final String RETURN_ID_PARAM
public static final String POLICY_PARAM
public static final String PASSIVE_PARAM
protected String idpSelectionPath
protected MetadataManager metadata
protected SAMLContextProvider contextProvider
protected SAMLEntryPoint samlEntryPoint
protected String filterProcessesUrl
public static final String FILTER_URL
public static final String IDP_DISCO_PROTOCOL_SINGLE
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
IOException
ServletException
protected boolean processFilter(HttpServletRequest request)
request
- request used to determine whether to enable this filterprotected void processDiscoveryRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
request
- requestresponse
- responseServletException
- errorIOException
- io errorprotected void sendPassiveResponse(HttpServletRequest request, HttpServletResponse response, String responseURL, String returnParam, String entityID) throws IOException, ServletException
request
- request objectresponse
- response objectresponseURL
- base for the return URLreturnParam
- parameter name to send the IDP entityId inentityID
- entity ID to send or null for fail stateIOException
- in case redirect sending failsServletException
- in case redirect sending failsprotected void sendIDPSelection(HttpServletRequest request, HttpServletResponse response, String responseURL, String returnParam) throws IOException, ServletException
request
- request objectresponse
- response objectresponseURL
- base for the return URLreturnParam
- parameter name to send the IDP entityId inIOException
- in case forwarding to the selection page failsServletException
- in case forwarding to the selection page failsprotected String getDefaultReturnURL(SAMLMessageContext messageContext)
messageContext
- context for the local SPorg.opensaml.common.SAMLRuntimeException
- in case entity is remote and doesn't contain URL in metadataprotected boolean isResponseURLValid(String returnURL, SAMLMessageContext messageContext)
returnURL
- URL from the requestmessageContext
- message context for current SPprotected String getPassiveIDP(HttpServletRequest request)
request
- IDP discovery requestpublic String getIdpSelectionPath()
public void setIdpSelectionPath(String idpSelectionPath)
idpSelectionPath
- selection path@Autowired public void setMetadata(MetadataManager metadata)
metadata
- metadata manager@Autowired(required=false) public void setSamlEntryPoint(SAMLEntryPoint samlEntryPoint)
samlEntryPoint
- entry point bean@Autowired public void setContextProvider(SAMLContextProvider contextProvider)
contextProvider
- provider implementationpublic String getFilterProcessesUrl()
public void setFilterProcessesUrl(String filterProcessesUrl)
filterProcessesUrl
- filter URLpublic void afterPropertiesSet() throws ServletException
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
in class org.springframework.web.filter.GenericFilterBean
ServletException