Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring security authentication using LDAP
    text
    copied!<p>I am new to spring security and i've tried to run a sample application based on the spring-security ldap example. Below is my configuration of the applicationContext-security.xml:</p> <pre><code>&lt;http&gt; &lt;intercept-url pattern="/Login.jsp" filters="none"&gt;&lt;/intercept-url&gt; &lt;intercept-url pattern="/nnn/**" access="ROLE_ADMIN" /&gt; &lt;intercept-url pattern="/common/**" access="ROLE_USER" /&gt; &lt;form-login login-page="/Login.jsp" authentication-failure-url="/Login.jsp?login_error=1" default-target-url="/common/home.jsp"/&gt; &lt;logout logout-success-url="/Login.jsp" invalidate-session="true"/&gt; &lt;/http&gt; &lt;authentication-manager&gt; &lt;ldap-authentication-provider group-search-filter="member={0}" group-search-base="ou=groups" user-search-base="ou=people" user-search-filter="uid={0}" /&gt; &lt;authentication-provider ref='secondLdapProvider' /&gt; &lt;/authentication-manager&gt; &lt;ldap-server ldif="classpath:users.ldif" port="33389"/&gt; &lt;b:bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource"&gt; &lt;b:constructor-arg value="ldap://localhost:33389/dc=springframework,dc=org"/&gt; &lt;/b:bean&gt; </code></pre> <p>I've used the user.ldif file as it is. The application runs successfully if I use the default values. But if I put any other value in place of springframework, say google, in the ldif file and in the contextSource bean in the applicationContext-security.xml, then I get the below error:</p> <pre><code>Your login attempt was not successful, try again. Reason: [LDAP: error code 32 - NO_SUCH_OBJECT: failed for SearchRequest baseDn : '2.5.4.11=people,0.9.2342.19200300.100.1.25=google,0.9.2342.19200300.100.1.25=org' filter : '(0.9.2342.19200300.100.1.1=rod)' scope :whole subtree typesOnly : false Size Limit : no limit Time Limit : no limit Deref Aliases : deref Always attributes : : Cannot find a partition for 2.5.4.11=people,0.9.2342.19200300.100.1.25=google,0.9.2342.19200300.100.1.25=org: org.apache.directory.shared.ldap.exception.LdapNameNotFoundException: Cannot find a partition for 2.5.4.11=people,0.9.2342.19200300.100.1.25=google,0.9.2342.19200300.100.1.25=org at org.apache.directory.server.core.partition.DefaultPartitionNexus.getPartition(DefaultPartitionNexus.java:1082) at org.apache.directory.server.core.partition.DefaultPartitionNexus.hasEntry(DefaultPartitionNexus.java:1037) at org.apache.directory.server.core.interceptor.InterceptorChain$1.hasEntry(InterceptorChain.java:167) at </code></pre> <p>Could someone please tell me why am I getting the above error...</p> <hr> <p>This is the ldif file:</p> <pre><code>dn: ou=groups,dc=google,dc=org objectclass: top objectclass: organizationalUnit ou: groups dn: ou=people,dc=google,dc=org objectclass: top objectclass: organizationalUnit ou: people dn: uid=rod,ou=people,dc=google,dc=org objectclass: top objectclass: person objectclass: organizationalPerson objectclass: inetOrgPerson cn: Rod Johnson sn: Johnson uid: rod userPassword: koala dn: uid=dianne,ou=people,dc=google,dc=org objectclass: top objectclass: person objectclass: organizationalPerson objectclass: inetOrgPerson cn: Dianne Emu sn: Emu uid: dianne userPassword: emu dn: uid=scott,ou=people,dc=google,dc=org objectclass: top objectclass: person objectclass: organizationalPerson objectclass: inetOrgPerson cn: Scott sn: Wombat uid: scott userPassword: wombat dn: cn=user,ou=groups,dc=google,dc=org objectclass: top objectclass: groupOfNames cn: user member: uid=rod,ou=people,dc=google,dc=org member: uid=dianne,ou=people,dc=google,dc=org member: uid=scott,ou=people,dc=google,dc=org dn: cn=teller,ou=groups,dc=google,dc=org objectclass: top objectclass: groupOfNames cn: USER member: uid=rod,ou=people,dc=google,dc=org member: dianne=rod,ou=people,dc=google,dc=org dn: cn=supervisor,ou=groups,dc=google,dc=org objectclass: top objectclass: groupOfNames cn: ADMIN member: uid=rod,ou=people,dc=google,dc=org </code></pre> <p>Instead of google, it was springframework in the original file from the sample application. Am I missing something in this...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload