40 lines
2.3 KiB
XML
Raw Normal View History

2014-10-16 20:53:24 -05:00
<?xml version="1.0" encoding="UTF-8"?>
2015-07-23 16:54:23 +03:00
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
2016-01-09 13:01:30 +02:00
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
2014-10-16 20:53:24 -05:00
http://www.springframework.org/schema/mvc
2016-01-09 13:01:30 +02:00
http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd"
2015-07-23 16:54:23 +03:00
>
<http use-expressions="true">
<intercept-url pattern="/login*" access="permitAll"/>
<intercept-url pattern="/logout*" access="permitAll"/>
<intercept-url pattern="/home*" access="permitAll"/>
<intercept-url pattern="/files/**" access="permitAll"/>
<intercept-url pattern="/resources/**" access="permitAll"/>
<intercept-url pattern="/js/**" access="permitAll"/>
<intercept-url pattern="/other-files/**" access="permitAll"/>
<intercept-url pattern="/invalidSession*" access="isAnonymous()"/>
<intercept-url pattern="/**" access="isAuthenticated()"/>
2014-10-16 20:53:24 -05:00
2015-07-23 16:54:23 +03:00
<form-login login-page='/login.html' authentication-failure-url="/login.html?error=true" authentication-success-handler-ref="myAuthenticationSuccessHandler"
default-target-url="home.html"/>
<session-management invalid-session-url="/invalidSession.html" session-fixation-protection="none"/>
2016-01-09 13:01:30 +02:00
<logout invalidate-session="false" logout-success-url="/logout.html?logSucc=true" delete-cookies="JSESSIONID"/>
2014-10-16 20:53:24 -05:00
2015-07-23 16:54:23 +03:00
</http>
2014-10-16 20:53:24 -05:00
2015-07-23 16:54:23 +03:00
<!-- for XML static resource confguration- comment out for java based config -->
<!-- -<mvc:resources mapping="/resources/**" location="/resources/" /> -->
<beans:bean id="myAuthenticationSuccessHandler" class="org.baeldung.security.MySimpleUrlAuthenticationSuccessHandler"/>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="user1" password="user1Pass" authorities="ROLE_USER"/>
<user name="admin1" password="admin1Pass" authorities="ROLE_ADMIN"/>
</user-service>
</authentication-provider>
</authentication-manager>
2014-10-16 20:53:24 -05:00
</beans:beans>