Package netscape.ldap

Examples of netscape.ldap.LDAPConnection.connect()


    @Test
    public void testCompareWithoutAuthentication() throws LDAPException
    {
        getLdapServer().getDirectoryService().setAllowAnonymousAccess( false );
        LDAPConnection conn = new LDAPConnection();
        conn.connect( "localhost", getLdapServer().getPort() );
        LDAPAttribute attr = new LDAPAttribute( "uid", "admin" );

        try
        {
            conn.compare( "uid=admin,ou=system", attr );
View Full Code Here


        LDAPConnection conn = null;

        try
        {
            conn = new LDAPConnection();
            conn.connect( 100, "localhost", getLdapServer().getPort(), "uid=admin,ou=system", "secret" );
            fail( "try to connect with illegal version number should fail" );
        }
        catch ( LDAPException e )
        {
            assertEquals( "statuscode", LDAPException.PROTOCOL_ERROR, e.getLDAPResultCode() );
View Full Code Here

        constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
        conn.setConstraints( constraints );

        try
        {
            conn.connect( 3, "localhost", getLdapServer().getPort(),
                "uid=akarasuluref,ou=users,ou=system", "secret", constraints );
            fail( "try to connect with illegal version number should fail" );
        }
        catch ( LDAPException e )
        {
View Full Code Here

            assertEquals( "statuscode", LDAPException.INVALID_CREDENTIALS, e.getLDAPResultCode() );
        }

        try
        {
            conn.connect( 3, "localhost", getLdapServer().getPort(),
                "uid=akarasuluref,ou=users,ou=system", "secret" );
            fail( "try to connect with illegal version number should fail" );
        }
        catch ( LDAPException e )
        {
View Full Code Here

    env.put( Context.SECURITY_PRINCIPAL, args[ 2 ] );
    env.put( Context.SECURITY_CREDENTIALS, args[ 3 ] );
    ctx = new InitialDirContext( env );
      } else {
    conn = new LDAPConnection();
    conn.connect( args[ 1 ], LDAPv2.DEFAULT_PORT );
    conn.authenticate( args[ 2 ], args[ 3 ] );
      }

      if ( jndi ) {
    importer = new JNDIImporter( ctx );
View Full Code Here

    LDAPUsuario userLDAP = null;   
    String userNameLDAP = uid+ username;
   
    try {
     
      connection.connect(host,port);
            String[] filters = LDAPConstants.attrs;
           
      LDAPSearchResults results = connection.search(
      basedn, LDAPConnection.SCOPE_SUB,
      userNameLDAP, filters, false);
View Full Code Here

    }
   
    try{
     
      String userLDAP = uid+ username;
        connection.connect(host,port);
            LDAPSearchResults searchResult = connection.search(basedn,
            LDAPConnection.SCOPE_SUB, userLDAP, null, false);

            while(searchResult.hasMoreElements()){
                LDAPEntry entry = searchResult.next();
View Full Code Here

        connection.setConnectTimeout(connectionTimeout);
        int i = 0;
        while (i < connectionRetries) {
            try {
                this.getLog().info("Attempting to connect ot LDAP Server (" + host + ":" + port + ")");
                connection.connect(version, host, port, authDn, passwd);
                break;
            } catch (final LDAPException e) {
                i++;
                lastError = e;
                lastMessage = "Could not connect to LDAP Server (" + host + ":" + port + ")";
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.