Re: Trying to logout with JAAS Form based authentication
Posted By:
Vincenzo_Sorrentino
Posted On:
Monday, July 19, 2004 04:13 AM
Consider two page login.jsp and index.jsp
- login.jsp is the page containing a form with login and password
- index.jsp is your main page
I've resolved a problem adding this code in the login page:
<%
//not authenticated
if( request.getUserPrincipal()==null ) {
String requestURL = request.getRequestURL().toString();
if (!requestURL.endsWith("/index.jsp")) {
String redirectURL = request.getContextPath().concat("/index.jsp");
System.out.println("redirect URL: " + redirectURL);
response.sendRedirect( redirectURL );
}
}
%>
If I click on logout link I invalidate a session and redirect the control on index.jsp
If instead I click on another link and the session was expired automatically a control go on login page and the code above redirect on login page
try it
Good Luck
Vincenzo