~ubuntu-branches/ubuntu/raring/eucalyptus/raring

« back to all changes in this revision

Viewing changes to clc/modules/authentication/src/main/java/com/eucalyptus/auth/ldap/LdapClientTest.java

  • Committer: Package Import Robot
  • Author(s): Brian Thomason
  • Date: 2011-11-29 13:17:52 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 185.
  • Revision ID: package-import@ubuntu.com-20111129131752-rq31al3ntutv2vvl
Tags: upstream-3.0.999beta1
ImportĀ upstreamĀ versionĀ 3.0.999beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.eucalyptus.auth.ldap;
 
2
 
 
3
import javax.naming.NamingEnumeration;
 
4
import javax.naming.directory.SearchResult;
 
5
 
 
6
public class LdapClientTest {
 
7
 
 
8
  public static void main( String[] args ) throws Exception {
 
9
    LdapIntegrationConfiguration lic = new LdapIntegrationConfiguration( );
 
10
    lic.setServerUrl( "" );
 
11
    lic.setAuthMethod( "GSSAPI" );
 
12
    //lic.setAuthPrincipal( "cn=admin,dc=test-eucalyptus,dc=com" );
 
13
    lic.setAuthPrincipal( "peter" );
 
14
    lic.setAuthCredentials( "" );
 
15
    lic.setUseSsl( false );
 
16
    lic.setIgnoreSslCertValidation( true );
 
17
    lic.setKrb5Conf( "/home/wenye/workspace/jndi-gssapi/src/krb5.conf" );
 
18
    lic.setGroupBaseDn( "ou=Groups,dc=test-eucalyptus,dc=com" );
 
19
    lic.setUserBaseDn( "ou=People,dc=test-eucalyptus,dc=com" );
 
20
    
 
21
    LdapClient client = LdapClient.authenticateClient( lic );
 
22
    NamingEnumeration<SearchResult> results = client.search( "dc=test-eucalyptus,dc=com", "objectClass=inetOrgPerson", new String[]{ "displayName" } );
 
23
    while ( results.hasMore( ) ) {
 
24
      SearchResult r = results.next( );
 
25
      System.out.println( r.getName( ) + " " + r.getNameInNamespace( ) + " -- " + r.getAttributes( ) );
 
26
    }
 
27
  }
 
28
  
 
29
}