You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@apache.org on 2001/07/29 01:29:12 UTC

cvs commit: jakarta-tomcat-4.0/webapps/examples/jsp/security/protected index.jsp

craigmcc    01/07/28 16:29:12

  Modified:    webapps/examples/jsp/security/protected index.jsp
  Log:
  Add an option so that the user can request a logoff (which, with form
  based login configured, should cause a new session to be created and the
  user returned to the login page).
  
  Revision  Changes    Path
  1.4       +14 -1     jakarta-tomcat-4.0/webapps/examples/jsp/security/protected/index.jsp
  
  Index: index.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/examples/jsp/security/protected/index.jsp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- index.jsp	2001/07/26 19:42:44	1.3
  +++ index.jsp	2001/07/28 23:29:12	1.4
  @@ -1,10 +1,18 @@
  +<%
  +  if (request.getParameter("logoff") != null) {
  +    session.invalidate();
  +    response.sendRedirect("index.jsp");
  +    return;
  +  }
  +%>
   <html>
   <head>
   <title>Protected Page for Examples</title>
   </head>
   <body bgcolor="white">
   
  -You are logged in as remote user <b><%= request.getRemoteUser() %></b><br><br>
  +You are logged in as remote user <b><%= request.getRemoteUser() %></b>
  +in session <b><%= session.getId() %></b><br><br>
   
   <%
     if (request.getUserPrincipal() != null) {
  @@ -41,6 +49,11 @@
   <form method="GET" action="index.jsp">
   <input type="text" name="role" value="<%= role %>">
   </form>
  +<br><br>
  +
  +If you have configured this app for form-based authentication, you can log
  +off by clicking <a href="index.jsp?logoff=true">here</a>.  This should cause
  +you to be returned to the logon page after the redirect that is performed.
   
   </body>
   </html>