|
2 | 2 | <beans xmlns="http://www.springframework.org/schema/beans" |
3 | 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
4 | 4 | xmlns:security="http://www.springframework.org/schema/security" |
5 | | - xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.1.xsd |
| 5 | + xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd |
6 | 6 | http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> |
7 | 7 |
|
8 | 8 | <security:authentication-manager> |
|
14 | 14 | </security:authentication-provider> |
15 | 15 | </security:authentication-manager> |
16 | 16 |
|
17 | | - <security:http pattern="/user/**" use-expressions="true" auto-config="true"> |
18 | | - <security:intercept-url pattern="/**" access="hasRole('ROLE_USER')"/> |
19 | | - <security:form-login login-page="/userLogin" login-processing-url="/user/login" |
| 17 | + <security:http pattern="/user/general/**" use-expressions="true" auto-config="true" |
| 18 | + entry-point-ref="loginUrlAuthenticationEntryPoint"> |
| 19 | + <security:intercept-url pattern="/**" access="hasRole('ROLE_USER')" /> |
| 20 | + <security:form-login login-processing-url="/user/general/login" |
20 | 21 | authentication-failure-url="/userLogin?error=loginError" |
21 | 22 | default-target-url="/user/myUserPage"/> |
22 | 23 | <security:csrf disabled="true"/> |
23 | 24 | <security:access-denied-handler error-page="/403"/> |
24 | 25 | <security:logout logout-url="/user/logout" delete-cookies="JSESSIONID" logout-success-url="/multipleHttpLinks"/> |
25 | 26 | </security:http> |
26 | 27 |
|
| 28 | + <bean id="loginUrlAuthenticationEntryPoint" |
| 29 | + class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint"> |
| 30 | + <constructor-arg name="loginFormUrl" value="/userLogin" /> |
| 31 | + </bean> |
| 32 | + |
| 33 | + <security:http pattern="/user/private/**" use-expressions="true" auto-config="true" |
| 34 | + entry-point-ref="loginUrlAuthenticationEntryPointWithWarning"> |
| 35 | + <security:intercept-url pattern="/**" access="hasRole('ROLE_USER')"/> |
| 36 | + <security:form-login login-processing-url="/user/private/login" |
| 37 | + authentication-failure-url="/userLogin?error=loginError" |
| 38 | + default-target-url="/user/myUserPage" /> |
| 39 | + <security:csrf disabled="true"/> |
| 40 | + <security:access-denied-handler error-page="/403"/> |
| 41 | + <security:logout logout-url="/user/logout" delete-cookies="JSESSIONID" logout-success-url="/multipleHttpLinks"/> |
| 42 | + </security:http> |
| 43 | + |
| 44 | + <bean id="loginUrlAuthenticationEntryPointWithWarning" |
| 45 | + class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint"> |
| 46 | + <constructor-arg name="loginFormUrl" value="/userLoginWithWarning" /> |
| 47 | + </bean> |
| 48 | + |
27 | 49 | <security:http pattern="/admin/**" use-expressions="true" auto-config="true"> |
28 | 50 | <security:intercept-url pattern="/**" access="hasRole('ROLE_ADMIN')"/> |
29 | | - <security:http-basic/> |
| 51 | + <security:http-basic entry-point-ref="authenticationEntryPoint" /> |
30 | 52 | <security:access-denied-handler error-page="/403"/> |
31 | 53 | </security:http> |
| 54 | + |
| 55 | + <bean id="authenticationEntryPoint" |
| 56 | + class="org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint"> |
| 57 | + <property name="realmName" value="admin realm" /> |
| 58 | + </bean> |
32 | 59 |
|
33 | 60 | <security:http pattern="/**" use-expressions="true" auto-config="true"> |
34 | 61 | <security:intercept-url pattern="/guest/**" access="permitAll()"/> |
35 | 62 | </security:http> |
36 | 63 |
|
| 64 | + |
37 | 65 | </beans> |
0 commit comments