I'm creating a POC based on the Spring Security LDAP sample, but want to externalize my LDAP config settings (url, manager-DN, manager-password) into JNDI environment entries. The only way I can see this being possible is by going from a config this:
to something like this:Code:<s:ldap-server ldif="classpath:users.ldif" port="33389"/> <s:authentication-manager> <s:ldap-authentication-provider group-search-filter="member={0}" group-search-base="ou=groups" user-search-base="ou=people" user-search-filter="uid={0}" /> </s:authentication-manager>
But is all this extra setup necessary? Is there no way to simply wire the <ldap-server> tag with the appropriate settings? I see that the tag has "url", "manager-dn", and "manager-password" attributes, but can JNDI values be injected into attribute values?Code:<beans:bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource"> <beans:constructor-arg> <jee:jndi-lookup jndi-name="jndi/common/ldap/providerUrl"/> </beans:constructor-arg> <beans:property name="userDn"> <jee:jndi-lookup jndi-name="jndi/common/ldap/principal"/> </beans:property> <beans:property name="password"> <jee:jndi-lookup jndi-name="jndi/common/ldap/credentials"/> </beans:property> </beans:bean> <beans:bean id="ldapProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider"> <beans:constructor-arg> <beans:bean class="org.springframework.security.ldap.authentication.BindAuthenticator"> <beans:constructor-arg ref="contextSource"/> <beans:property name="userDnPatterns"> <beans:list> <beans:value>uid={0},cn=users</beans:value> </beans:list> </beans:property> </beans:bean> </beans:constructor-arg> <beans:constructor-arg> <beans:bean class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator"> <beans:constructor-arg ref="contextSource"/> <beans:constructor-arg value="cn=groups"/> </beans:bean> </beans:constructor-arg> </beans:bean>
This JIRA request is similar to what I'm lookin for, sans the part about using Tomcat realms:
https://jira.springsource.org/browse/SEC-871


Reply With Quote
