exitUser.jsp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <%@ taglib prefix='c' uri='http://java.sun.com/jstl/core' %>
  2. <%@ page import="org.springframework.security.core.context.SecurityContextHolder" %>
  3. <%@ page import="org.springframework.security.core.Authentication" %>
  4. <%@ page import="org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter" %>
  5. <%@ page import="org.springframework.security.core.AuthenticationException" %>
  6. <html>
  7. <head>
  8. <title>Exit User</title>
  9. </head>
  10. <body>
  11. <h1>Exit User</h1>
  12. <c:if test="${not empty param.login_error}">
  13. <font color="red">
  14. Your 'Exit User' attempt was not successful, try again.<br/><br/>
  15. Reason: <%= ((AuthenticationException) session.getAttribute(AbstractAuthenticationProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY)).getMessage() %>
  16. </font>
  17. </c:if>
  18. <form action="<c:url value='j_spring_security_exit_user'/>" method="POST">
  19. <table>
  20. <tr><td>Current User:</td><td>
  21. <%
  22. Authentication auth = SecurityContextHolder.getContext().getAuthentication();
  23. if (auth != null) { %>
  24. <%= auth.getPrincipal().toString() %>
  25. <% } %>
  26. </td></tr>
  27. <tr><td colspan='2'><input name="exit" type="submit" value="Exit"></td></tr>
  28. </table>
  29. </form>
  30. </body>
  31. </html>