--- a/server/pom.xml Fri Apr 05 14:39:59 2013 +0200
+++ b/server/pom.xml Fri Apr 05 18:40:31 2013 +0200
@@ -254,21 +254,6 @@
<artifactId>spring-web</artifactId>
<version>${spring-version}</version>
</dependency>
- <!--dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-core</artifactId>
- <version>${spring-version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-web</artifactId>
- <version>${spring-version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-config</artifactId>
- <version>${spring-version}</version>
- </dependency-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
--- a/server/src/main/webapp/WEB-INF/applicationContext.xml Fri Apr 05 14:39:59 2013 +0200
+++ b/server/src/main/webapp/WEB-INF/applicationContext.xml Fri Apr 05 18:40:31 2013 +0200
@@ -5,7 +5,7 @@
xmlns:util="http://www.springframework.org/schema/util"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
- http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/main/webapp/WEB-INF/renkan_users.properties Fri Apr 05 18:40:31 2013 +0200
@@ -0,0 +1,3 @@
+user.admin.name = admin
+#user.admin.password = admin
+user.admin.password = 8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/main/webapp/WEB-INF/spring-security.xml Fri Apr 05 18:40:31 2013 +0200
@@ -0,0 +1,46 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:security="http://www.springframework.org/schema/security"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/security
+ http://www.springframework.org/schema/security/spring-security-3.1.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util-3.0.xsd"
+>
+
+ <util:properties id="userPropsLocations">
+ <prop key="servletContextUserProps">WEB-INF/renkan_users.properties</prop>
+ <prop key="classpathUserProps">classpath:renkan_users_run.properties</prop>
+ </util:properties>
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="order" value="1000"/>
+ <property name="location" value="#{userPropsLocations.servletContextUserProps}"/>
+ <property name="ignoreUnresolvablePlaceholders" value="true"/>
+ <property name="IgnoreResourceNotFound" value="false"/>
+ </bean>
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="order" value="1"/>
+ <property name="location" value="#{userPropsLocations.classpathUserProps}"/>
+ <property name="ignoreUnresolvablePlaceholders" value="true"/>
+ <property name="IgnoreResourceNotFound" value="true"/>
+ </bean>
+
+ <security:http>
+ <security:intercept-url pattern="/admin/*" access="ROLE_ADMIN" />
+ <security:http-basic />
+ </security:http>
+
+ <security:authentication-manager>
+ <security:authentication-provider>
+ <security:password-encoder hash="sha-256"/>
+ <security:user-service>
+ <security:user name="${user.admin.name}" password="${user.admin.password}" authorities="ROLE_ADMIN, ROLE_USER"/>
+ </security:user-service>
+ </security:authentication-provider>
+ </security:authentication-manager>
+
+</beans>
\ No newline at end of file
--- a/server/src/main/webapp/WEB-INF/web.xml Fri Apr 05 14:39:59 2013 +0200
+++ b/server/src/main/webapp/WEB-INF/web.xml Fri Apr 05 18:40:31 2013 +0200
@@ -13,7 +13,7 @@
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/applicationContext.xml</param-value>
+ <param-value>/WEB-INF/applicationContext.xml, /WEB-INF/spring-security.xml</param-value>
</context-param>
<servlet>
<servlet-name>cometd</servlet-name>
@@ -91,4 +91,12 @@
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
+ <filter>
+ <filter-name>springSecurityFilterChain</filter-name>
+ <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>springSecurityFilterChain</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
</web-app>
\ No newline at end of file