Skip to content

Commit

Permalink
logout back to PREVIOUS_ADMINISTRATOR
Browse files Browse the repository at this point in the history
  • Loading branch information
hvle committed Jun 16, 2014
1 parent 4497430 commit 625bb8d
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/main/webapp/WEB-INF/view/hello.jsp
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<html>
<body>
<h1>Title : ${title}</h1>
<h1>Message : ${message}</h1>

<c:if test="${pageContext.request.userPrincipal.name != null}">
<h2>Welcome : ${pageContext.request.userPrincipal.name}</h2>
<p><a href="<c:url value="/j_spring_security_logout" />" >Logout</a></p>
<sec:authorize access="hasRole('ROLE_ADMINISTRATOR')">
<form action="j_spring_security_switch_user" method="POST">
Switch to user: <input type="text" name="j_username" /><br/>
<input type="submit" value="Switch"/>
</form>
</sec:authorize>
<h2>Welcome : ${pageContext.request.userPrincipal.name}</h2>

<sec:authorize var="IS_PREVIOUS_ADMINISTRATOR" access="hasRole('ROLE_PREVIOUS_ADMINISTRATOR')" />
<c:choose>
<c:when test="${IS_PREVIOUS_ADMINISTRATOR}">
<p><a href="<c:url value="/j_spring_security_exit_user" />">Logout</a></p>
</c:when>
<c:otherwise>
<p><a href="<c:url value="/j_spring_security_logout" />">Logout</a></p>
<sec:authorize access="hasRole('ROLE_ADMINISTRATOR')">
<form action="j_spring_security_switch_user" method="POST">
Switch to user: <input type="text" name="j_username" /><br />
<input type="submit" value="Switch" />
</form>
</sec:authorize>
</c:otherwise>
</c:choose>
</c:if>
</body>
</html>

0 comments on commit 625bb8d

Please sign in to comment.