Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7598033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:18:29+00:00 2026-05-30T22:18:29+00:00

I am trying to authenticate users to an Active Directory Instance using spring security,

  • 0

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.

security-app-context

<authentication-manager erase-credentials="true">
        <authentication-provider>
            <user-service>
                <user name="admin@damien.com" authorities="ROLE_ADMINISTRATOR" password="123admin123" />
            </user-service>
        </authentication-provider>
        <authentication-provider ref="ldapActiveDirectoryAuthProvider"/>
</authentication-manager>

<bean id="ldapActiveDirectoryAuthProvider"
      class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider">
    <constructor-arg value="myDomain.com" />
    <constructor-arg value="ldap://ldapurl:389/" />
    <property name="convertSubErrorCodesToExceptions" value="true"/>
</bean>  

Error I am getting

 org.springframework.dao.IncorrectResultSizeDataAccessException: Incorrect result size: expected 1, actual 0        org.springframework.security.ldap.SpringSecurityLdapTemplate.searchForSingleEntryInternal(SpringSecurityLdapTemplate.java:239)

I am struggling to find examples and the documentation indicates I am working in the right direction.

This is from the logs

SpringSecurityLdapTemplate.java 213 - Searching for entry under DN '', base = 'dc=myDomain,dc=com', filter = '(&(objectClass=user)(userPrincipalName={0}))'

and this is what I would expect that to look like on a successful attempt from some scripts that work

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 = '(&(objectClass=user)(userPrincipalName={0}))'

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:18:30+00:00Added an answer on May 30, 2026 at 10:18 pm

    To solve this I used the default LDAP provider which enables user search base to be specified, specifying the user search base and user search filter.

    <ldap-authentication-provider
        user-search-base="OU=Users and Groups,DC=abc,DC=myDomain,DC=com"
        user-search-filter="userPrincipalName={0}" />
    

    A user would then be logging in with john.doe@myDomain.com but the usersearch base is more specific(abc.myDomain.com). I believe AD Spring was falling down due to this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use a authenticate with an Active directory using Spring Security 3.1.
I'm currently trying to authenticate via Active Directory Services using the PrincipalContext class. I
I'm trying to authenticate a user against Active Directory using the types in the
I'm trying to build a web service using Ruby on Rails. Users authenticate themselves
I'm getting a Message signature was incorrect exception when trying to authenticate with MyOpenID
I'm trying to connect to an Active Directory from Activiti, using Apache Directory's LDAP
I am trying to authenticate linkedin users for my site. I am using Scribe
I am using Devise in Rails to help authenticate users. I am trying to
I am very new to NTLM/LDAP and trying to authenticate using NTML running on
Im trying to create a iPhone Objective C login page using PHP/MySQL to authenticate.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.