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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:01:10+00:00 2026-06-18T22:01:10+00:00

With the following code, I can bind/authenticate the user testu with password testp with

  • 0

With the following code, I can bind/authenticate the user testu with password testp with my local LDAP server. In my DIT, this user also belongs to a group, say Administrators. How can I get the name of the group he belongs to or vice versa check if that user belongs to that group?

public static void main(String[] args) 
{
    Properties properties = new Properties();
    properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
    properties.put(Context.PROVIDER_URL, "ldap://localhost:10389");

    // set properties for authentication
    properties.put(Context.SECURITY_AUTHENTICATION, "simple");
    properties.put(Context.SECURITY_PRINCIPAL, "cn=testu,ou=users,ou=system");
    properties.put(Context.SECURITY_CREDENTIALS, "testp");

    try {
        InitialLdapContext ctx = new InitialLdapContext(properties, null);          
    } catch (NamingException e) {
        e.printStackTrace();
    }
}

In my LDAP browser, in the Tree structure, I have the user testu

cn=testu,ou=users,ou=system

while the Administrators group is under

cn=Administrators,ou=groups,ou=system

Now I don’t even think I’ve gotten the user in that group, but assuming I did how would you look for it? I’m basically asking how do I do a search query through LDAP relative to the user authenticated.

Given the following group:

cn=operations,ou=groups,ou=system
objectClass:groupOfNames (structural)
objectClass:top (abstract)
cn:operations
member:cn=soto,ou=users,ou=system
member:cn=testu,ou=users,ou=system

And this user:

cn=testu,ou=users,ou=system
objectClass:organizationalPerson (structural)
objectClass:person (structural)
objectClass:top (abstract)
cn:testu
sn:some name
userPassword:SHA hashed password    [testp]

How would I get the group from this user?

  • 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-18T22:01:12+00:00Added an answer on June 18, 2026 at 10:01 pm

    If you performed a bind, then you know the DN of the user and you could do a search request like:

    Base Search DN: ou=system

    (member=cn=testu,ou=users,ou=system)
    

    This would, if you have permission, return all the groups the user is a DIRECT member.
    It would not include any nested group memberships.

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

Sidebar

Related Questions

My problem can be easily defined with the following code: self.Bind(wx.EVT_MENU_OPEN, self.OnAbout) This will
Can someone explain the following code snippet for me? // Bind base object so
I can't bind the Escape and Return keys in my Tcl/Tk code. The following
I have the following code in my server side: // Bind to a specific
Let say I have the following code $(p).bind(click, function(){ alert( $(this).text() ); }); When
I have the following code: $(#scheduleLink).trigger(click); alert(text) This is the click handler: $(#scheduleLink).bind(click, (function
I have the following code: $(#Table1 tbody).children().each(function(e){ $(this).bind('click', function(){ // Do something here },
The following code can be found in the NHibernate.Id.GuidCombGenerator class. The algorithm creates sequential
I think the following code can be used to create manipulators. #include<iostream> ostream &
I'm not sure if the following code can cause redundant calculations, or is it

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.