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 8707443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:52:21+00:00 2026-06-13T03:52:21+00:00

I am trying to do LDAP authentication using spring security 2.0.3 Here is my

  • 0

I am trying to do LDAP authentication using spring security 2.0.3

Here is my configuration

<bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
        <constructor-arg value="ldap://IP:3268"/>
        <property name="base" value="dc=alliance",dc=com,OU=Users,OU=India"/>
        <property name="userDn" value="sAMAccountName=username" />
        <property name="password" value="password" />
    </bean>



    <bean id="ldapProvider" class="org.springframework.security.providers.ldap.LdapAuthenticationProvider">
        <sec:custom-authentication-provider/>
        <constructor-arg>
            <bean class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator">
                <constructor-arg ref="contextSource"/>
                <!--<property name="userSearch" ref="ldapSearchBean"/>-->
                <property name="userDnPatterns">
                   <list><value>sAMAccountName={0}</value></list>
                 </property>
            </bean>
        </constructor-arg>
        <constructor-arg>
            <bean class="org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator">
                <constructor-arg ref="contextSource"/>
                <constructor-arg value="ou=groups"/>
                <property name="groupSearchFilter" value="member={0}"/>
                <property name="groupRoleAttribute" value="ou"/>
                <property name="rolePrefix" value="ROLE_"/>
                <property name="searchSubtree" value="true"/>
                <property name="convertToUpperCase" value="true"/>
            </bean>
        </constructor-arg>
    </bean>

Maven entry set is as below

<dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>2.0.3</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
<dependency>
            <groupId>org.springframework.ldap</groupId>
            <artifactId>spring-ldap</artifactId>
            <version>1.2.1</version>
        </dependency>

Exception I am getting is

[BindAuthenticator,2329165@qtp-24103634-0] – Failed to bind as sAMAccountName=csepena: org.springframework.ldap.AuthenticationException: [LDAP: error code 49 – 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece

Where should i mention domain name?

  • 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-06-13T03:52:24+00:00Added an answer on June 13, 2026 at 3:52 am

    If you search online for the error message, you will find something like this page of Active Directory errors, which lists your error at the top:

    Common Active Directory LDAP bind errors:
    
    80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 525, v893
    HEX: 0×525 – user not found
    DEC: 1317 – ERROR_NO_SUCH_USER (The specified account does not exist.)
    NOTE: Returns when username is invalid.
    

    So according to AD, the user doesn’t exist. You’ve tried to use sAMAccountName attribute as part of a DN pattern, which won’t work as it is an LDAP attribute. You need to use a search to first locate a user by the value of this attribute. There are examples on how to do that elsewhere on this site and on the web. It looks like you already tried, since you commented out a search bean. If that didn’t work you should have explained what went wrong in your question.

    In fact, it seems likely that it failed because there are some things wrong with your context source. The value for the userDn property is wrong. It needs to be a valid distinguished name in the directory, which “sAMAccountName=username” is not. The “base” property also looks incorrect. It should generally be a tree where the root (dc=mycompany,dc=com is at the end). So it should probably be ou=mygroup,ou=mycountry,dc=mycompany,dc=com.

    Finally, you shouldn’t be using version 2.0.3. It has known security vulnerabilities. Always keep up to date with patches and new versions of libraries you are using – number 6 in the OWASP “top ten”. It also makes sense to check the latest version in case you’re encountering a bug which has been fixed.

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

Sidebar

Related Questions

I am using Spring Security 3.1RC2 and I am using the org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider object: <security:authentication-manager>
Following the spring-security documentation: http://static.springsource.org/spring-security/site/docs/3.0.x/reference/ldap.html I am trying to set up ldap authentication (very
i am trying to integrate spring security with struts1.2 (using LDAP) in a simple
I'm trying to use a authenticate with an Active directory using Spring Security 3.1.
I am trying to get a Java app using spring-security to talk to a
I am trying to authenticate users to an Active Directory Instance using spring security,
I am trying to use LDAP for authentication. I am using the OpenLDAP library
I have problem with LDAP Spring Security, I'm trying to authorise against the LDAP
I'm trying to set up the LDAP Spring Security. And I've stucked with some
I'm trying to develop a web application with Novell LDAP Authentication . I have

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.