jaldave Posted January 4, 2011 Share Posted January 4, 2011 Hi,Can anyone post sample here for LDAP Authentication in JasperServer 3.7? Sample on how to configure and edit the files applicationContext-security.xml and applicationContext-multiTenancy-security.xml. The sample I have seen doesn't match the new applicationContext-security.xml in JS 3.7. The applicationContext-security.xml in JS 3.7 doesn't have "initialDirContextFactory" bean and the property names "managerDn" and "managerPassword".Please, I badly need help on this. I still don't get any success. Thanks in advance. Link to comment Share on other sites More sharing options...
sasamad2004 Posted February 3, 2011 Share Posted February 3, 2011 I would like to see the same. Link to comment Share on other sites More sharing options...
mileidysg Posted February 3, 2011 Share Posted February 3, 2011 Here u have an example...Code: <!-- ldap provider 2 --> <bean id="contextSource-2" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource"> <constructor-arg value="ldap://127.0.0.1:389/DC=xxxx,DC=xx"/> <property name="userDn" value="CN=xxxxx,OU=xxxxx,OU=xxx,DC=xxxx,DC=xx" /> <property name="password" value="password"/> <property name="referral" value="follow" /> </bean> <bean id="userSearch_ALL-2" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch"> <constructor-arg index="0" value=""/> <constructor-arg index="1" value="(&(sAMAccountName={0})(|(memberOf=CN=xxxxx,OU=xxx,DC=xxxx,DC=xxx)(memberOf=CN=xxxxx,OU=xxx,DC=xxxx,DC=xxx)))" /> <constructor-arg index="2" ref="contextSource-2" /> </bean> <bean id="ldapAuthenticationProvider-2" class="org.springframework.security.providers.ldap.LdapAuthenticationProvider"> <constructor-arg> <bean class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator"> <constructor-arg ref="contextSource-2"/> <property name="userDnPatterns" value="OU=xxxxx" /> <property name="userSearch" ref="userSearch_ALL-2"/> </bean> </constructor-arg> <constructor-arg> <bean class="org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator"> <constructor-arg ref="contextSource-2" /> <constructor-arg value=""/> <property name="rolePrefix" value=""/> <property name="convertToUpperCase" value="true"/> <property name="searchSubtree" value="true"></property> <property name="groupRoleAttribute" value="cn" /> <property name="groupSearchFilter" value="(&(objectClass=group)(member={0}))" /> </bean> </constructor-arg> </bean> <bean id="authenticationManager" class="org.springframework.security.providers.ProviderManager"> <property name="providers"> <list> <ref local="ldapAuthenticationProvider-2"/> <ref local="anonymousAuthenticationProvider"/> <ref bean="${bean.daoAuthenticationProvider}"/> </list> </property> </bean> Link to comment Share on other sites More sharing options...
sasamad2004 Posted February 11, 2011 Share Posted February 11, 2011 Can you post your LDAP entries and structure? I think I have different structure and this search filter is wrong for me. Link to comment Share on other sites More sharing options...
mileidysg Posted February 11, 2011 Share Posted February 11, 2011 Post ur code please... Link to comment Share on other sites More sharing options...
sasamad2004 Posted February 11, 2011 Share Posted February 11, 2011 I used your code above. Link to comment Share on other sites More sharing options...
mileidysg Posted February 11, 2011 Share Posted February 11, 2011 I guess u replace xxxx for the values according to your settings, right?Maybe u should make it simple first, instead of use:<constructor-arg index="1" value="(&(sAMAccountName={0})(|(memberOf=CN=xxxxx,OU=xxx,DC=xxxx,DC=xxx)(memberOf=CN=xxxxx,OU=xxx,DC=xxxx,DC=xxx)))" /> replace it by: <constructor-arg index="1" value="(sAMAccountName={0})" /> Add an entry on ur log4j configuration to debug the ldap area:log4j.logger.org.springframework.security=DEBUG, stdout, fileoutlog4j.logger.org.springframework.security.ldap=DEBUG, stdout, fileout Link to comment Share on other sites More sharing options...
sasamad2004 Posted February 11, 2011 Share Posted February 11, 2011 Thanks for your efforts, mate!I was able to login as LDAP user, but role mapping didn't work.I had commented out "<property name="userDnPatterns"><list><value>uid={0}</value></list></property> " Stupid me!Also, I didn't have member=uid.... in my ldap configuration for that group.log4j.logger.org.springframework.security.ldap=DEBUG, stdout, fileout really helped!I searched forums and I could not find ONE decent example how users should be defined in LDAP/AD.Post Edited by sasamad2004 at 02/11/2011 12:19 Link to comment Share on other sites More sharing options...
mileidysg Posted February 11, 2011 Share Posted February 11, 2011 Glad to hear that its ok now. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now