Skip to content

Commit 19ce54e

Browse files
author
Rob Winch
committed
SEC-2653: ldap-xml logout is post with CSRF token
1 parent f7d09c6 commit 19ce54e

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

samples/ldap-xml/ldap.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ configurations {
1212
}
1313

1414
dependencies {
15+
compile project(':spring-security-taglibs'),
16+
jstlDependencies
1517

1618
runtime project(':spring-security-web'),
1719
project(':spring-security-config'),
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
2+
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
13

24
<html>
35
<body>
46
<h1>VERY Secure Page</h1>
57
This is a protected page. You can only see me if you are a supervisor.
68

79
<p><a href="../../">Home</a>
8-
<p><a href="../../j_spring_security_logout">Logout</a>
10+
<form action="<c:url value="/j_spring_security_logout"/>" method="post">
11+
<input type="submit" value="Logoff"/>
12+
<security:csrfInput/>
13+
</form>
914
</body>
1015
</html>

samples/ldap-xml/src/main/webapp/secure/index.jsp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
2+
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
13
<html>
4+
<head><title>Secure Page</title></head>
25
<body>
36
<h1>Secure Page</h1>
47
This is a protected page. You can get to me if you've been remembered,
@@ -10,6 +13,9 @@ or if you've authenticated this session.<br><br>
1013

1114

1215
<p><a href="../">Home</a>
13-
<p><a href="../j_spring_security_logout">Logout</a>
16+
<form action="<c:url value="/j_spring_security_logout"/>" method="post">
17+
<input type="submit" value="Logoff"/> (also clears any remember-me cookie)
18+
<security:csrfInput/>
19+
</form>
1420
</body>
1521
</html>

0 commit comments

Comments
 (0)