2 changed files with 75 additions and 31 deletions
@ -1,32 +1,65 @@
@@ -1,32 +1,65 @@
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/security" |
||||
xmlns:beans="http://www.springframework.org/schema/beans" |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:s="http://www.springframework.org/schema/security" |
||||
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-2.0.xsd |
||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd"> |
||||
|
||||
<http> |
||||
<intercept-url pattern="/secure/extreme/**" access="ROLE_SUPERVISOR"/> |
||||
<intercept-url pattern="/secure/**" access="IS_AUTHENTICATED_REMEMBERED" /> |
||||
<intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" /> |
||||
|
||||
<form-login /> |
||||
<anonymous /> |
||||
<logout /> |
||||
</http> |
||||
|
||||
<!-- |
||||
Usernames/Passwords are |
||||
rod/koala |
||||
dianne/emu |
||||
scott/wombat |
||||
--> |
||||
<ldap-server ldif="classpath:users.ldif" /> |
||||
|
||||
<ldap-authentication-provider |
||||
group-search-filter="member={0}" |
||||
group-search-base="ou=groups" |
||||
user-search-base="ou=people" |
||||
user-search-filter="uid={0}" |
||||
/> |
||||
|
||||
</beans:beans> |
||||
<s:http> |
||||
<s:intercept-url pattern="/secure/extreme/**" access="ROLE_SUPERVISOR"/> |
||||
<s:intercept-url pattern="/secure/**" access="IS_AUTHENTICATED_REMEMBERED" /> |
||||
<s:intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" /> |
||||
|
||||
<s:form-login /> |
||||
<s:anonymous /> |
||||
<s:logout /> |
||||
</s:http> |
||||
|
||||
|
||||
<!-- Simple namespace-based configuration --> |
||||
|
||||
<s:ldap-server ldif="classpath:users.ldif" /> |
||||
|
||||
<s:ldap-authentication-provider |
||||
group-search-filter="member={0}" |
||||
group-search-base="ou=groups" |
||||
user-search-base="ou=people" |
||||
user-search-filter="uid={0}" |
||||
/> |
||||
|
||||
<!-- Traditional Bean version of the same configuration --> |
||||
|
||||
<!-- This bean points at the embedded directory server created by the ldap-server element above --> |
||||
<bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource"> |
||||
<constructor-arg value="ldap://localhost:389/dc=springframework,dc=org"/> |
||||
</bean> |
||||
|
||||
<bean id="secondLdapProvider" class="org.springframework.security.providers.ldap.LdapAuthenticationProvider"> |
||||
<s:custom-authentication-provider /> |
||||
<constructor-arg> |
||||
<bean class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator"> |
||||
<constructor-arg ref="contextSource" /> |
||||
<property name="userSearch"> |
||||
<bean id="userSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch"> |
||||
<constructor-arg index="0" value="ou=people"/> |
||||
<constructor-arg index="1" value="(uid={0})"/> |
||||
<constructor-arg index="2" ref="contextSource" /> |
||||
</bean> |
||||
</property> |
||||
</bean> |
||||
</constructor-arg> |
||||
<constructor-arg> |
||||
<bean class="org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator"> |
||||
<constructor-arg ref="contextSource" /> |
||||
<constructor-arg value="ou=groups" /> |
||||
<property name="groupSearchFilter" value="member={0}"/> |
||||
<property name="groupRoleAttribute" value="ou" /> |
||||
<property name="rolePrefix" value="ROLE_"/> |
||||
<property name="searchSubtree" value="true"/> |
||||
<property name="convertToUpperCase" value="true"/> |
||||
</bean> |
||||
</constructor-arg> |
||||
</bean> |
||||
|
||||
|
||||
|
||||
</beans> |
||||
Loading…
Reference in new issue