Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring Security 3.1 ActiveDirectoryLdapAuthenticationProvider returning partial result exception
    text
    copied!<p>I am trying to authenticate users to an Active Directory Instance using spring security, I am getting an Partial Results Exception. I am going around in circles trying to figure this out. Below is my config.</p> <p>security-app-context</p> <pre class="lang-xml prettyprint-override"><code>&lt;authentication-manager erase-credentials="true"&gt; &lt;authentication-provider&gt; &lt;user-service&gt; &lt;user name="admin@damien.com" authorities="ROLE_ADMINISTRATOR" password="123admin123" /&gt; &lt;/user-service&gt; &lt;/authentication-provider&gt; &lt;authentication-provider ref="ldapActiveDirectoryAuthProvider"/&gt; &lt;/authentication-manager&gt; &lt;bean id="ldapActiveDirectoryAuthProvider" class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider"&gt; &lt;constructor-arg value="myDomain.com" /&gt; &lt;constructor-arg value="ldap://ldapurl:389/" /&gt; &lt;property name="convertSubErrorCodesToExceptions" value="true"/&gt; &lt;/bean&gt; </code></pre> <p>Error I am getting</p> <pre><code> org.springframework.dao.IncorrectResultSizeDataAccessException: Incorrect result size: expected 1, actual 0 org.springframework.security.ldap.SpringSecurityLdapTemplate.searchForSingleEntryInternal(SpringSecurityLdapTemplate.java:239) </code></pre> <p>I am struggling to find examples and the documentation indicates I am working in the right direction. </p> <p>This is from the logs </p> <pre><code>SpringSecurityLdapTemplate.java 213 - Searching for entry under DN '', base = 'dc=myDomain,dc=com', filter = '(&amp;(objectClass=user)(userPrincipalName={0}))' </code></pre> <p>and this is what I would expect that to look like on a successful attempt from some scripts that work</p> <pre><code>Searching for entry under DN 'OU=Users and Groups,DC=one,DC=two,DC=myDomain,DC=com', base = 'OU=Users and Groups,DC=one,DC=two,DC=myDomain,DC=com', filter = '(&amp;(objectClass=user)(userPrincipalName={0}))' </code></pre> <p>Do I need to get the DN populated? How? I have looked through the ActiveDirectoryLdapAuthenticationProvider properties and don't see a way? Also the base is off but myDomain.com is the correct domain for users e.g john.doe@myDomain.com. Has anyone come across a similar problem?</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