-
1. Re: filter for j_security_check action
dmitry_ame Aug 13, 2002 7:35 PM (in response to dmitry_ame)As I already said before, the filter does not work for j_security_check action. But I've tried to implement servlet that redirects the request to the j_security_check.
So the way it works:
in login.jsp form action I specify my servlet instead of j_security_check (along with j_password and j_username ),
the servlets doPost method does some custom logic and redirects the request to j_security_check action.
Not exactly perfect, but works. I'd rather had a hook after the systems authentication done. Oh well...
Folks, please let me know if there is something really wrong with what I'm trying to do.
Dmitry A. -
2. Re: filter for j_security_check action
dmitry_ame Aug 14, 2002 1:20 AM (in response to dmitry_ame)To reiterate what I wrote before:
1. the filters do work as well as the servlets (I was using bad filter url)
2. In order to redirect properly to the j_security_check, j_username and j_password must be passed from the request object to the responce, here is the code for the doFilter method:
public void doFilter(ServletRequest request,
ServletResponse response, FilterChain chain)
throws IOException, ServletException {
if (filterConfig == null)
return;
HttpServletResponse httpResponse = (HttpServletResponse)response;
HttpServletRequest httpRequest = (HttpServletRequest) request;
String redirectString = "j_security_check";
logger.debug( "Sending redirect to: " + redirectString);
String username = httpRequest.getParameter("j_username");
String password = httpRequest.getParameter("j_password");
logger.debug("j_username:" + username );
logger.debug("j_password:" + password );
httpResponse.sendRedirect( redirectString +"?j_username="+username+"&j_password="+password );
chain.doFilter(httpRequest, httpResponse);
} -
3. Re: filter for j_security_check action
steverich Aug 28, 2002 1:46 PM (in response to dmitry_ame)Hi, what was the filter you specified? I tried the filter mapping below and the authentication occurs without the filter ever being invoked. Any ideas?
<filter-mapping>
<filter-name>security-check-filter</filter-name>
<url-pattern>/j_security_check</url-pattern>
</filter-mapping> -
4. Re: filter for j_security_check action
gt Sep 11, 2002 10:03 PM (in response to dmitry_ame)use something else than /j_security_check for example /login
-
5. Re: filter for j_security_check action
gt Sep 11, 2002 10:05 PM (in response to dmitry_ame)Use something else than /j_security_check for example /login
Do not forget to change also the form action