Adds support for automatically granting all anonymous web requests a particular principal identity and a corresponding granted authority.
diff --git a/core/src/test/java/org/springframework/security/wrapper/SecurityContextHolderAwareRequestFilterTests.java b/core/src/test/java/org/springframework/security/wrapper/SecurityContextHolderAwareRequestFilterTests.java
index 9bd8227913..27cb2852b5 100644
--- a/core/src/test/java/org/springframework/security/wrapper/SecurityContextHolderAwareRequestFilterTests.java
+++ b/core/src/test/java/org/springframework/security/wrapper/SecurityContextHolderAwareRequestFilterTests.java
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
import org.springframework.security.MockFilterConfig;
import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
import java.io.IOException;
@@ -54,11 +55,11 @@ public class SecurityContextHolderAwareRequestFilterTests extends TestCase {
public void testCorrectOperation() throws Exception {
SecurityContextHolderAwareRequestFilter filter = new SecurityContextHolderAwareRequestFilter();
filter.init(new MockFilterConfig());
- filter.doFilter(new MockHttpServletRequest(null, null), null,
+ filter.doFilter(new MockHttpServletRequest(null, null), new MockHttpServletResponse(),
new MockFilterChain(SavedRequestAwareWrapper.class));
// Now re-execute the filter, ensuring our replacement wrapper is still used
- filter.doFilter(new MockHttpServletRequest(null, null), null,
+ filter.doFilter(new MockHttpServletRequest(null, null), new MockHttpServletResponse(),
new MockFilterChain(SavedRequestAwareWrapper.class));
filter.destroy();
diff --git a/samples/tutorial/src/main/webapp/WEB-INF/applicationContext-security-ns.xml b/samples/tutorial/src/main/webapp/WEB-INF/applicationContext-security-ns.xml
index 97527507c8..21c063e4c4 100644
--- a/samples/tutorial/src/main/webapp/WEB-INF/applicationContext-security-ns.xml
+++ b/samples/tutorial/src/main/webapp/WEB-INF/applicationContext-security-ns.xml
@@ -23,8 +23,9 @@
+
-->
-
+
diff --git a/samples/tutorial/src/main/webapp/index.jsp b/samples/tutorial/src/main/webapp/index.jsp
index b8c5668259..318c284d0e 100644
--- a/samples/tutorial/src/main/webapp/index.jsp
+++ b/samples/tutorial/src/main/webapp/index.jsp
@@ -1,7 +1,9 @@
Home Page
-Anyone can view this page.
+Anyone can view this page.
+
+Your principal object is....: <%= request.getUserPrincipal() %>
Secure page
Extremely secure page
diff --git a/samples/tutorial/src/main/webapp/secure/index.jsp b/samples/tutorial/src/main/webapp/secure/index.jsp
index 2c2608a720..b774c40ed8 100644
--- a/samples/tutorial/src/main/webapp/secure/index.jsp
+++ b/samples/tutorial/src/main/webapp/secure/index.jsp
@@ -2,7 +2,12 @@
Secure Page
This is a protected page. You can get to me if you've been remembered,
-or if you've authenticated this session.
+or if you've authenticated this session.
+
+<%if (request.isUserInRole("ROLE_SUPERVISOR")) { %>
+ You are a supervisor! You can therefore see the extremely secure page.
+<% } %>
+
Home
Logout