1 28 29 package com.caucho.filters; 30 31 import javax.servlet.Filter ; 32 import javax.servlet.FilterChain ; 33 import javax.servlet.FilterConfig ; 34 import javax.servlet.ServletException ; 35 import javax.servlet.ServletRequest ; 36 import javax.servlet.ServletResponse ; 37 import javax.servlet.http.HttpServletRequest ; 38 import java.io.IOException ; 39 40 62 63 public class PasswordFilter implements Filter { 64 65 public void init(FilterConfig config) 66 { 67 } 68 69 public void doFilter(ServletRequest request, 70 ServletResponse response, 71 FilterChain next) 72 throws IOException , ServletException 73 { 74 HttpServletRequest req = (HttpServletRequest ) request; 75 76 String password = req.getParameter("j_password"); 77 req.getSession().setAttribute("java.naming.security.credentials", password); 78 79 next.doFilter(request, response); 80 } 81 82 public void destroy() 83 { 84 } 85 } 86 | Popular Tags |