org.jboss.aerogear.security.web.filter
Class PasswordHandler
java.lang.Object
org.jboss.aerogear.security.web.filter.PasswordHandler
- All Implemented Interfaces:
- javax.servlet.Filter
public class PasswordHandler
- extends Object
- implements javax.servlet.Filter
A filter that intercepts requests that matches the url-mapping defined in the web descriptor.
This filter can be used for "token-based" flows, i.e like password reset link creation
The filter does 2 checks :
- Checks if the token is valid by using the tokenId from the parameters
- Checks if the incoming method is a GET
If these 2 checks pass, then the Filter redirects the Request to the URL provided by the PasswordHandlerConfig object.
Be sure to configure correctly your filter in the web.xml :
<filter>
<filter-name>PasswordHandler</filter-name>
<filter-class>org.jboss.aerogear.security.web.filter.PasswordHandler</filter-class>
<init-param>
<param-name>url</param-name>
<param-value>http://myhost.com/</param-value>
</init-param>
<init-param>
<param-name>redirect-page</param-name>
<param-value>reset/update.html</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PasswordHandler</filter-name>
<url-pattern>/reset/*</url-pattern>
<url-pattern>/forgot/*</url-pattern>
</filter-mapping>
|
Method Summary |
void |
destroy()
|
void |
doFilter(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
javax.servlet.FilterChain filterChain)
|
void |
init(javax.servlet.FilterConfig config)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TOKEN_ID_PARAM
public static final String TOKEN_ID_PARAM
- See Also:
- Constant Field Values
PasswordHandler
@Inject
public PasswordHandler(javax.enterprise.inject.Instance<TokenService> tokenService)
init
public void init(javax.servlet.FilterConfig config)
throws javax.servlet.ServletException
- Specified by:
init in interface javax.servlet.Filter
- Throws:
javax.servlet.ServletException
doFilter
public void doFilter(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
javax.servlet.FilterChain filterChain)
throws IOException,
javax.servlet.ServletException
- Specified by:
doFilter in interface javax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
destroy
public void destroy()
- Specified by:
destroy in interface javax.servlet.Filter
Copyright © 2013 JBoss by Red Hat. All Rights Reserved.