Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Java: Mehrere User aus AD-Gruppe holen

Empfohlene Antworten

Veröffentlicht

Hallo,

ich greife über LDAP auf ActiveDirectory zu. Die Connection passt. Allerdings habe ich Schwierigkeiten. Momentan sieht's so aus:

public String[] findMembers(String groupDn) throws NamingException {

SearchControls ctls = new SearchControls();

String[] users = new String[50];

ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);

String filter = ("(&(memberOf=" + groupDn + ")(CN=*))");

try {

// Initialisierung des LDAP-Zugriffes:

DirContext ctx = ldap.createBrowseContext();

NamingEnumeration answer = ctx.search("dc='blah', dc='blah'" filter, ctls);

ctx.close();

Und genau bei der Formulierung von 'filter' habe ich Schwierigkeiten. Grob gesagt sollen mir alle User die in der AD-Gruppe(übergebe ich als Parameter groupDN an meine Methode) drin sind, der Arrayvariablen 'users' übergeben werden. Für jeden Denkanstoß/Hilfe wäre ich dankbar!

Hi ich arbeite auch mit Java und LDAP.

Ich hatte bisher immer Probleme eine Verbindung von Java mittels Ldap auf eine Active Directory Lightweight Service herzustellen (ADAM).

Könntest du vielleicht mal dein Connection Code posten :)

Danke

Gruß Chollay

Connection:

SearchControls ctls = new SearchControls();

ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);

ctls.setReturningAttributes(new String[]{"distinguishedName"});

LDAPAccess ldap = new LDAPAccess("Host"

, 389

, "OU=Firmenname,DC=NETZ,DC=Firmenname"

, "CN=User,OU=Appl,OU=Firmenname,DC=NETZ,DC=Firmenname"

, "Anmeldepasswort");

SearchResult[] result = ldap.doSearch(ctls, "DC=netz,DC=Firmenname", "(&(objectClass=group)(cn=" + groupDn + "))");

String ergebnis = (String) result[0].getAttributes().get("distinguishedName").get();

Ich hoffe du kannst damit was anfangen. Die connection Ist momentan noch hart reingecodet, wird aber später noch in xml ausgelagert.

Grüßle

Bearbeitet von C#_Rookie

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.