The window.location trick worked! I only had to define the error page as "not protected".
This is my web.xml: | <?xml version="1.0" encoding="UTF-8"?> | | <!DOCTYPE web-app PUBLIC | "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" | "http://java.sun.com/dtd/web-app_2_3.dtd"> | | <web-app> | <security-constraint> | <web-resource-collection> | <web-resource-name>All the application</web-resource-name> | <url-pattern>/*</url-pattern> | <http-method>GET</http-method> | <http-method>POST</http-method> | </web-resource-collection> | <auth-constraint> | <role-name>admin</role-name> | </auth-constraint> | </security-constraint> | | <security-constraint> | <web-resource-collection> | <web-resource-name>Error Page</web-resource-name> | <url-pattern>/login-error.jsp</url-pattern> | <http-method>GET</http-method> | <http-method>POST</http-method> | </web-resource-collection> | </security-constraint> | | <login-config> | <auth-method>FORM</auth-method> | <form-login-config> | <form-login-page>/login.jsp</form-login-page> | <form-error-page>/login-error-redirect.jsp</form-error-page> | </form-login-config> | </login-config> | | <security-role> | <role-name>admin</role-name> | </security-role> | </web-app> | My login-error-redirect.jsp: | <%-- do an extra request/response roundtrip --%> | <body onLoad="window.location = 'login-error.jsp'"/> | An example login-error.jsp: | <h1>Login failed!</h1> | Exception: <%= session.getAttribute("j_exception") %> | In real life your LoginModule could throw a LoginException subtype (ie AccountExpiredException or CredentialExpiredException) and you could display a different message for each case in login-error.jsp, using instanceof. Ricardo View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3865631#3865631 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3865631 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ JBoss-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jboss-user
