http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
+ <bean
+ class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
+ <property name="locations">
+ <value>osgibundle:ldap.properties
+ </value>
+ </property>
+ </bean>
+
<bean id="_authenticationManager" class="org.springframework.security.providers.ProviderManager">
<property name="providers">
<list>
+ <bean class="org.springframework.security.adapters.AuthByAdapterProvider">
+ <property name="key" value="${argeo.security.systemKey}" />
+ </bean>
+ <bean
+ class="org.springframework.security.providers.rememberme.RememberMeAuthenticationProvider">
+ <property name="key" value="${argeo.security.systemKey}" />
+ </bean>
<ref bean="authenticationProvider" />
</list>
</property>
<bean id="contextSource"
class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
- <constructor-arg value="ldap://localhost:10389/dc=demo,dc=argeo,dc=org" />
- <property name="userDn" value="uid=admin,ou=system" />
- <property name="password" value="secret" />
+ <constructor-arg
+ value="${argeo.ldap.protocol}://${argeo.ldap.host}:${argeo.ldap.port}/${argeo.ldap.rootdn}" />
+ <property name="userDn" value="${argeo.ldap.manager.userdn}" />
+ <property name="password" value="${argeo.ldap.manager.password}" />
</bean>
<bean id="authenticationProvider"
class="org.springframework.security.providers.ldap.LdapAuthenticationProvider">
+ <constructor-arg ref="ldapAuthenticator" />
<constructor-arg>
- <bean
- class="org.springframework.security.providers.ldap.authenticator.PasswordComparisonAuthenticator">
- <constructor-arg ref="contextSource" />
- <property name="userDnPatterns">
- <list>
- <value>uid={0},ou=users</value>
- </list>
- </property>
- <property name="passwordEncoder">
- <bean
- class="org.springframework.security.providers.ldap.authenticator.LdapShaPasswordEncoder"></bean>
- </property>
- </bean>
+ <bean factory-bean="securityDao" factory-method="getAuthoritiesPopulator" />
</constructor-arg>
- <constructor-arg ref="authoritiesPopulator" />
- <property name="userDetailsContextMapper" ref="userDetailsMapper" />
+ <property name="userDetailsContextMapper">
+ <bean factory-bean="securityDao" factory-method="getUserDetailsMapper" />
+ </property>
</bean>
- <bean id="authoritiesPopulator" class="org.argeo.security.ldap.ArgeoLdapAuthoritiesPopulator">
+ <bean id="securityDao" class="org.argeo.security.ldap.ArgeoSecurityDaoLdap">
<constructor-arg ref="contextSource" />
- <constructor-arg value="ou=groups" />
- <property name="defaultRole" value="ROLE_USER" />
- <property name="groupSearchFilter" value="uniqueMember={0}" />
+ <property name="userNatureMappers" ref="userNatureMappers" />
+ </bean>
+
+ <bean id="userDetailsService" factory-bean="securityDao"
+ factory-method="getUserDetailsService">
</bean>
- <bean id="userDetailsManager"
- class="org.springframework.security.userdetails.ldap.LdapUserDetailsManager">
+ <bean id="ldapAuthenticator"
+ class="org.springframework.security.providers.ldap.authenticator.PasswordComparisonAuthenticator">
<constructor-arg ref="contextSource" />
- <property name="userDetailsMapper" ref="userDetailsMapper" />
- <property name="groupSearchBase" value="ou=groups" />
- <property name="usernameMapper">
+ <property name="userDnPatterns">
+ <list>
+ <value>uid={0},ou=People</value>
+ </list>
+ </property>
+ <property name="passwordEncoder">
<bean
- class="org.springframework.security.ldap.DefaultLdapUsernameToDnMapper">
- <constructor-arg value="ou=users" />
- <constructor-arg value="uid" />
- </bean>
+ class="org.springframework.security.providers.ldap.authenticator.LdapShaPasswordEncoder" />
</property>
</bean>
-
- <bean id="userDetailsMapper" class="org.argeo.security.ldap.ArgeoUserDetailsContextMapper">
- <property name="userNatureMappers" ref="userNatureMappers" />
- </bean>
</beans>