Browse Source

SEC-2966: Fix preauth-xml sample config attributes

Rob Winch 10 years ago
parent
commit
7b158d0525

+ 9 - 3
samples/preauth-xml/pom.xml

@@ -3,7 +3,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.springframework.security</groupId>
   <artifactId>spring-security-samples-preauth-xml</artifactId>
-  <version>4.0.1.CI-SNAPSHOT</version>
+  <version>4.0.2.CI-SNAPSHOT</version>
   <packaging>war</packaging>
   <name>spring-security-samples-preauth-xml</name>
   <description>spring-security-samples-preauth-xml</description>
@@ -45,6 +45,12 @@
       <scope>compile</scope>
       <optional>true</optional>
     </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>javax.servlet-api</artifactId>
+      <version>3.0.1</version>
+      <scope>provided</scope>
+    </dependency>
     <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
@@ -60,13 +66,13 @@
     <dependency>
       <groupId>org.springframework.security</groupId>
       <artifactId>spring-security-config</artifactId>
-      <version>4.0.1.CI-SNAPSHOT</version>
+      <version>4.0.2.CI-SNAPSHOT</version>
       <scope>runtime</scope>
     </dependency>
     <dependency>
       <groupId>org.springframework.security</groupId>
       <artifactId>spring-security-web</artifactId>
-      <version>4.0.1.CI-SNAPSHOT</version>
+      <version>4.0.2.CI-SNAPSHOT</version>
       <scope>runtime</scope>
     </dependency>
     <dependency>

+ 4 - 0
samples/preauth-xml/preauth.gradle

@@ -16,11 +16,15 @@ configurations {
 }
 
 dependencies {
+	providedCompile "javax.servlet:javax.servlet-api:3.0.1"
 
 	runtime project(':spring-security-web'),
 			project(':spring-security-config'),
 			"org.slf4j:jcl-over-slf4j:$slf4jVersion",
 			"ch.qos.logback:logback-classic:$logbackVersion"
+
+	testCompile project(':spring-security-web'),
+			project(':spring-security-config')
 }
 
 jettyRun {

+ 1 - 1
samples/preauth-xml/src/main/webapp/WEB-INF/applicationContext-security.xml

@@ -75,7 +75,7 @@
 		<property name="authenticationManager" ref="authenticationManager"/>
 		<property name="accessDecisionManager" ref="httpRequestAccessDecisionManager"/>
 		<property name="securityMetadataSource">
-			<sec:filter-security-metadata-source>
+			<sec:filter-security-metadata-source use-expressions="false">
 				<sec:intercept-url pattern="/secure/extreme/**" access="ROLE_SUPERVISOR"/>
 				<sec:intercept-url pattern="/secure/**" access="ROLE_USER"/>
 				<sec:intercept-url pattern="/**" access="ROLE_USER"/>

+ 38 - 0
samples/preauth-xml/src/test/java/sample/PreAuthXmlTests.java

@@ -0,0 +1,38 @@
+/*
+ * Copyright 2002-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package sample;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.web.FilterChainProxy;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+/**
+ * @author Rob Winch
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("file:src/main/webapp/WEB-INF/applicationContext-security.xml")
+@WebAppConfiguration
+public class PreAuthXmlTests {
+	@Autowired
+	FilterChainProxy filterChainProxy;
+
+	@Test
+	public void configLoads() {}
+}