Results 1 to 3 of 3

Thread: Querying LDAP for User Name

  1. #1
    Join Date
    Jul 2010
    Posts
    2

    Default Querying LDAP for User Name

    Hi -

    I am new to LDAP. I have an implementation working well using the DefaultSpringSecurityContextSource.

    I do have one issue, though - my application requires that the user who enters data into the application store their user ID, along with the data, in the DBMS. The application data is entered into a JSP form and ultimately saved via a servlet.

    Is there any way for the servlet to query LDAP, during the save process, to determine the user's LDAP user name? Or do I have to pass that information from form-to-form, starting with the log-in form?

  2. #2

    Default

    Tom,
    Assuming you are using Spring Security in your application, here is the code you can use in your Servlet to retrieve logged in user information:

    SecurityContextHolder.getContext().getAuthenticati on().getPrincipal();

  3. #3
    Join Date
    Jul 2010
    Posts
    2

    Default

    Great - worked perfectly. Thanks so much for your help!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •