Servus
Hat jemand Ahnung wie man mittels LDAP herausfinden kann, ob sich ein Benutzer ordnungsgemäß am System angemeldet hat?
Hab mich schon ein wenig im Inet schlau gemacht, aber so ganz funktioniert es noch nicht.
Alles anzeigen
Hoffe es findet sich jemand, der mir da weiterhelfen kann, bzw. sagen kann ich welcher Lektüre ich sowas finde
Greetings
Hat jemand Ahnung wie man mittels LDAP herausfinden kann, ob sich ein Benutzer ordnungsgemäß am System angemeldet hat?
Hab mich schon ein wenig im Inet schlau gemacht, aber so ganz funktioniert es noch nicht.
Quellcode
- private void ldap(){
- Hashtable props = new Hashtable();
- props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
- props.put(Context.SECURITY_AUTHENTICATION, "simple");
- // Benutzername
- props.put(Context.SECURITY_PRINCIPAL, "domain\ldap.user");
- // Passwort
- props.put(Context.SECURITY_CREDENTIALS, "password");
- // Der Server
- props.put(Context.PROVIDER_URL, "ldap://127.0.0.1:389");
- try {
- System.out.println("InitialDirContext start");
- InitialDirContext ctx = new InitialDirContext(props);
- System.out.println("InitialDirContext stop");
- System.out.println("NamingEnumeration start");
- NamingEnumeration ne = ctx.search("ldap://127.0.0.1:389/cn=users, dc=domain, dc=de"
- , "samaccountname=horschi", null);
- System.out.println("NamingEnumeration stop");
- SearchResult match = (SearchResult)ne.nextElement();
- ctx = null;
- System.out.println(match.getName());
- } catch (NamingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
Hoffe es findet sich jemand, der mir da weiterhelfen kann, bzw. sagen kann ich welcher Lektüre ich sowas finde
Greetings
Ubuntu Edgy * Kernel 2.6.17 * Gnome 2.16 * Beryl
2 x Athlon MP 1900 * MSI K7D Master-L * 1024 MB ECC DDR333
Hercules 9800XT 256 MB Ram * 1x 250 GB IDE
Wasserkühlung
2 x Athlon MP 1900 * MSI K7D Master-L * 1024 MB ECC DDR333
Hercules 9800XT 256 MB Ram * 1x 250 GB IDE
Wasserkühlung