com.caucho.filters
Class PasswordFilter

java.lang.Object
  extended by com.caucho.filters.PasswordFilter
All Implemented Interfaces:
Filter

public class PasswordFilter
extends java.lang.Object
implements Filter

Save a password that the user submits as the session attribute 'java.naming.security.credentials'.

Enable with:

 <filter  filter-name='password' 
          filter-class='com.caucho.filters.PasswordFilter'/>

 <filter-mapping filter-name='password'
                 url-pattern='j_security_check'/>
 
Test with this in a JSP:
 <% if (request.getUserPrincipal() != null) { %>
   username: <%= request.getRemoteUser() %> 
   password: <%= session.getAttribute("java.naming.security.credentials") %>
 <% } %>
 
This will work with a form based login.


Constructor Summary
PasswordFilter()
           
 
Method Summary
 void destroy()
          Cleanup the filter.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain next)
          doFilter performs the actual work of a filter, either modifying the request or the response.
 void init(FilterConfig config)
          Initialize the filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PasswordFilter

public PasswordFilter()
Method Detail

init

public void init(FilterConfig config)
Description copied from interface: Filter
Initialize the filter.

Specified by:
init in interface Filter

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain next)
              throws java.io.IOException,
                     ServletException
Description copied from interface: Filter
doFilter performs the actual work of a filter, either modifying the request or the response. It will typically call the chain.doFilter() to invoke the next filter in the chain.

Specified by:
doFilter in interface Filter
Parameters:
request - the servlet request
response - the servlet response
next - the next filter in the chain
Throws:
java.io.IOException
ServletException

destroy

public void destroy()
Description copied from interface: Filter
Cleanup the filter.

Specified by:
destroy in interface Filter