Guest User

Untitled

a guest
Dec 11th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. <sec:authorize ifAnyGranted="ROLE_ANONYMOUS">
  2. <td><a href="<c:url value="/login.htm"/>">Login</a></td>
  3. </sec:authorize>
  4. <sec:authorize ifNotGranted="ROLE_ANONYMOUS">
  5. <td><a href="<c:url value="/j_spring_security_logout"/>">Logout</a></td>
  6. </sec:authorize>
  7.  
  8. <sec:authorize access="isAnonymous()">
  9. <form method="POST" action="<c:url value='j_spring_security_check'/>">
  10. Username: <input name="j_username" type="text" value="${SPRING_SECURITY_LAST_USERNAME}" />
  11. Password: <input name="j_password" type="password" />
  12. <input type="submit" value="Sign in" />
  13. </form>
  14. </sec:authorize>
  15. <sec:authorize access="isAuthenticated()">
  16. <a href="<c:url value="/j_spring_security_logout" />">Logout</a>
  17. </sec:authorize>
  18.  
  19. <sec:authorize var="loggedIn" access="isAuthenticated()" />
  20. <c:choose>
  21. <c:when test="${loggedIn}">
  22. You are loged in
  23. </c:when>
  24. <c:otherwise>
  25. You are logged out
  26. </c:otherwise>
  27. </c:choose>
  28.  
  29. <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
  30.  
  31. <sec:authorize access="isAuthenticated()">
  32. YES, you are logged in!
  33. </sec:authorize>
  34.  
  35. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
  36. <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
  37.  
  38. <security:authorize ifAllGranted="ROLE_USER">
  39. Welcome <%= request.getUserPrincipal().getName() %>
  40. <a href="<c:url value="/j_spring_security_logout"/>">Logout</a><br/>
  41. </security:authorize>
  42.  
  43. <%@ taglib uri="http://acegisecurity.org/authz" prefix="authz" %>
  44.  
  45. <c:set var="authenticated" value="${false}"/>
  46. <authz:authorize ifAllGranted="ROLE_USER">
  47. <c:set var="authenticated" value="${true}"/>
  48. </authz:authorize>
  49.  
  50. <c:if test="${authenticated}">
  51. <!-- your secure content here -->
  52. </c:if>
  53.  
  54. <%
  55. if (request.getRemoteUser()== null) {%>
  56. <!-- put public-only information-->
  57. <%}%>
  58.  
  59. <%@ page import="org.springframework.security.context.SecurityContextHolder" %>
  60.  
  61. <c:if test="<%=SecurityContextHolder.getContext().getAuthentication() != null %>">
  62. <!-- your secure content here -->
  63. </c:if>
Add Comment
Please, Sign In to add comment