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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:06:23+00:00 2026-06-18T06:06:23+00:00

I am working on implementing spring security into my project. I need to use

  • 0

I am working on implementing spring security into my project. I need to use the username which Spring Security extracts from the certificate CN as the uid on the LDAP server. I am not sure of the proper way to approach this problem. I am unsure how to pass the CN value from the x509 into the LDAP authenticator. Anyone done this before or have any ideas?

Note: I do not need to pass the entire certificate to the LDAP server as they aren’t stored there, only the username from the CN.

Edit: Here is some of the configuration in my spring security xml file:

<http>
    <intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
    <anonymous />
    <x509 subject-principal-regex="CN=(.*?)," /> <!-- user-service-ref needed? -->
</http>

<ldap-server id="ldapServer" url="ldap://localhost:389/dc=example,dc=com" manager-dn="cn=manager,dc=example,dc=com" manager-password="myPassword" />

<authentication-manager>
    <ldap-authentication-provider
       user-dn-pattern="uid={0},ou=people"
       user-search-filter="(uid={0})"
       user-search-base="ou=people,dc=example,dc=com"
       group-search-filter="(member={0})"
       group-search-base="ou=groups"
       group-role-attribute="cn" />        
</authentication-manager>
  • 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-18T06:06:24+00:00Added an answer on June 18, 2026 at 6:06 am

    You should use an ldap-user-service. Here’s an example configuration from the Spring Security test suite. Spring Security should then automatically substitute the username it extracts from the certificate CN in place of the {0} marker in the LDAP search filter.

    The ldap-authentication-provider element is intended for authenticating users with a username and password, which isn’t what you want with X.509, where the validation of the certificate by the container is regarded as performing the authentication.

    Spring Security’s X.509 authentication filter needs a UserDetailsService to load information for the user, so you need one in your configuration. As explained in the manual you don’t need to use the user-service-ref attribute if there is only one, so just adding an ldap-user-service declaration should be sufficient.

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

Sidebar

Related Questions

I am working with Flex and Spring on a project, where I need to
I am working on my first Java project implementing a class called HeartRates which
I am working on implementing BFSK algorithm on a DSP processor and need to
I'm working on implementing a hierarchy which deals with Comparator and the Comparable interface.
I am working on a project which consists of requirements for showing organization's twitter
I'm working on an assignment for my C++ programming class which involves implementing a
I'm working on a simple project to create tables and insert data into them,
I am working on implementing jplayer on my site and need to generate the
I'm working on implementing dynamic loading of Pages into a existing Silverlight application. So
I have used spring security 3.0.7 and I am implementing concurrency control in my

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.