Archive for the tag 'ldap'

Zivios: Consolidated management portal

Zivios [1] aims to be a consolidated management portal for providing core infrastructure services using opensource technologies. The long term goals of Zivios are:

  • Identity Management
  • Single Sign-on and Certificate authority
  • Package and Patch Management
  • Service Management
  • Network Monitoring
  • Backup provisioning
  • Core Infrastructure Services (NTP,DNS, etc)

Zivios is an n-tiered PHP-5 application. It uses MySQL and OpenLDAP as it’s datastore, with OpenLdap being the primary backend for identity management and application integration and MySQL being used for panel specific data.

Zend Framework is our framework of choice and Zivios implements its MVC design pattern.

[1] http://www.zivios.org/

LDAP Authentication using Java

Hier ist ein Stück Javacode mit dem man eine LDAP Authentifizierung realisieren kann:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import javax.naming.*;
import javax.naming.directory.*;
import java.util.Hashtable;
 
/**
 * Demonstrates how to create an initial context to an LDAP server
 * using simple authentication.
 */
 
class Simple {
    public static void main(String[] args) {
    	Hashtable authEnv = new Hashtable(11);
    	String userName = "johnlennon";
    	String passWord = "sushi974";
    	String base = "ou=People,dc=example,dc=com";
    	String dn = "uid=" + userName + "," + base;
    	String ldapURL = "ldap://ldap.example.com:389";
 
    	authEnv.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
   		authEnv.put(Context.PROVIDER_URL, ldapURL);
   		authEnv.put(Context.SECURITY_AUTHENTICATION, "simple");
   		authEnv.put(Context.SECURITY_PRINCIPAL, dn);
   		authEnv.put(Context.SECURITY_CREDENTIALS, passWord);
 
    	try {
    		DirContext authContext = new InitialDirContext(authEnv);
    		System.out.println("Authentication Success!");
    	} catch (AuthenticationException authEx) {
    		System.out.println("Authentication failed!");
 
    	} catch (NamingException namEx) {
    		System.out.println("Something went wrong!");
    		namEx.printStackTrace();
    	}
    }
}