Jump to content

Recommended Posts

Posted

 

Hi,

      Can some one check the code to see what is wrong with the LDAP code with the diagram that i provided: 

 

applicationContext-security.xml:

<!-- AuthenticationManger -->   

<bean id="authenticationManager" class="org.springframework.security.providers.ProviderManager">

       <property name="providers">

            <list> 

                <ref local="ldapAuthenticationProvider"/>

                <ref bean="${bean.daoAuthenticationProvider}"/>

                <ref bean="anonymousAuthenticationProvider"/>

            </list>

        </property>

</bean>    

 

<!--AnonymousAuthenticationProvider -->

<bean id="anonymousAuthenticationProvider" class="org.springframework.security.providers.anonymous.AnonymousAuthenticationProvider">

        <property name="key"><value>foobar</value></property>

</bean>

 

<!-- login Authentication --> 

<bean id="ldapContextSource"         

    class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">

     <constructor-arg value="ldap://xxxxxxxxxxxxx:389/dc=comcast,dc=com"/>

 

<property name="userDn"><value>cn=Manager,ou=clients,ou=employees,dc=comcast,dc=com</value></property>

     <property name="password"><value>secret</value></property>

     <property name="referral" value="follow" />

 </bean>

 

<!--userSearch_ALL -->    

<bean id="userSearch_ALL" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">

                                    <constructor-arg index="0" value=""/>

                                    <constructor-arg index="1" value="(&(sAMAccountName={0})(|(memberOf=cn=Manager,ou=clients,dc=comcast,dc=com)(memberOf=cn=Manager,ou=employees,dc=comcast,dc=com)))" />

<constructor-arg index="2" ref=" ldapContextSource " />                                                                                           

</bean>

 

<!-- ldapAuthenticationProvider and userDnPatterns -->

<bean id="ldapAuthenticationProvider" class="org.springframework.security.providers.ldap.LdapAuthenticationProvider">

                                    <constructor-arg>

<bean class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator">

                                    <constructor-arg ref=" ldapContextSource "/>

                                    <property name="userDnPatterns" value="ou=clients" />

                                    <property name="userSearch" ref=" userSearch_ALL "/>                                                                          

</bean>

 

< !--DefaultLdapAuthoritiesPopulator-->

<bean class="org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator">

                                    <constructor-arg ref=" ldapContextSource" />

                                    <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>

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...