public class DuoHttpSecurityFilter extends DuoHttpSecurityService implements javax.servlet.Filter
The behavior of this Filter is identical to that of the regular jespa.http.HttpSecurityFilter but extends the DuoHttpSecurityService to add the Duo functionality.
See the DuoHttpSecurityService
API documentation for details.
To configure this Filter, provide DuoHttpSecurityService properties using init-params or indirectly using the properties.path property to load properties from a properties file.
The following web.xml fragment illustrates how to use the properties.path property to load DuoHttpSecurityService properties:
<filter> <filter-name>DuoHttpSecurityFilter</filter-name> <filter-class>jespa.http.DuoHttpSecurityFilter</filter-class> <init-param> <param-name>properties.path</param-name> <param-value>file://path/to/jetty/base/etc/ntlm_duo.prp</param-value> </init-param> </filter> <filter-mapping> <filter-name>DuoHttpSecurityFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
file:/
(one slash) followed by the host specific path like file:/C:\path\to\tomcat\base\conf\ntlm_duo.prp
.
A non-absolute properties.path property is relative to the webapp context root like /WEB-INF/ntlm_duo.prp
.
See the HSS description of the properties.path property for details.
ntlm_duo.prp
file in this example might look something like the following:
# HttpSecurityService Properties provider.classname = jespa.ntlm.NtlmSecurityProvider http.parameter.username.name = username http.parameter.password.name = password http.parameter.logout.name = logout fallback.location = /mctrl/login excludes = /login groups.allowed = BUSICORP\\MCTRL Dashboard, BUSICORP\\MCTRL Agents # NtlmSecurityProvider Properties jespa.log.path = /path/to/jetty/base/logs/jespa.log jespa.log.level = 4 jespa.account.canonicalForm = 3 jespa.bindstr = busi.corp jespa.dns.servers = 192.168.15.110,192.168.15.115 jespa.dns.site = USNY jespa.service.acctname = mctrl$@busi.corp jespa.service.password = koM~9-DUt$00yUw # DuoHttpSecurityService Properties duo.clientId = DIRSJWINVALIDK72JSU2 duo.clientSecret = kSKf93kInValidPDfKNdI2lsLmVUiT90011sMCn duo.api.host = api-1234abcd.duosecurity.com duo.redirect.uri = https://apps1.busi.corp:8443/mctrl/duo-callback duo.failmode = OPEN duo.excludes = /api/v1/userctrl,/api/v1/bindings/*.sch
See the Installation section in the Jespa Operator's Manual for details.
The complete DuoHttpSecurityFilter code is simply the following:
package jespa.http; import java.util.Map; import java.util.HashMap; import java.util.Enumeration; import javax.servlet.Filter; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import jespa.security.SecurityProviderException; public class DuoHttpSecurityFilter extends DuoHttpSecurityService implements Filter { public void init(FilterConfig config) throws ServletException { Map<String,String> properties = new HashMap(); Enumeration<String> e = config.getInitParameterNames(); while (e.hasMoreElements()) { String name = e.nextElement(); properties.put(name, config.getInitParameter(name)); } try { super.init(config.getFilterName(), config.getServletContext(), properties); } catch (SecurityProviderException spe) { throw new ServletException(spe); } } }
The above code listing shows that this class converts all init-params into a Map of properties which it then passes to the DuoHttpSecurityService.init(java.lang.String, javax.servlet.ServletContext, java.util.Map)
method.
This code might be used as a template to create your own custom Filter that extends DuoHttpSecurityService and potentially override functionality of that class.
DUO_TOKEN_FAILED_OPEN
Constructor and Description |
---|
DuoHttpSecurityFilter() |
Modifier and Type | Method and Description |
---|---|
void |
init(javax.servlet.FilterConfig config)
This method just converts all init-params into a Map of properties
which it then passes to DuoHttpSecurityService.init().
|
doFilter, init, isDuoProtected, isLogout, onDuoException, onDuoResult, onException, onPropertiesUpdate
destroy, getBindingsCertHashPolicy, getBindingsTargetSpnsPolicy, getConnectionId, getRequestCredential, getRequestPath, getServletContext, init, isAllowedAccess, isAnonymous, isProtected, matchWildcard, toString
public void init(javax.servlet.FilterConfig config) throws javax.servlet.ServletException
DuoHttpSecurityService
.init
in interface javax.servlet.Filter
javax.servlet.ServletException