Skip to content

Instantly share code, notes, and snippets.

@xdu
Last active October 2, 2015 13:08
Show Gist options
  • Save xdu/2248284 to your computer and use it in GitHub Desktop.
Save xdu/2248284 to your computer and use it in GitHub Desktop.
spring security basic configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
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.0.xsd ">
<global-method-security pre-post-annotations="enabled" />
<http>
<intercept-url pattern="/**" access="ROLE_USER" requires-channel="https"/>
<http-basic />
<logout invalidate-session="true"/>
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="admin" password="admin" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:context.xml classpath:security.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment