Package javax.naming.ldap

Examples of javax.naming.ldap.InitialLdapContext.reconnect()


                ctx.addToEnvironment(Context.SECURITY_PRINCIPAL, userDN);
                ctx.addToEnvironment(Context.SECURITY_CREDENTIALS, inputPassword);
                ctx.addToEnvironment(Context.SECURITY_AUTHENTICATION, "simple");

                //if successful then verified that user and pw are valid ldap credentials
                ctx.reconnect(null);

                return true;
            }

            // If we try all the BaseDN's and have not found a match, return false
View Full Code Here


                ctx.addToEnvironment(Context.SECURITY_CREDENTIALS,testUserPassword);
                ctx.addToEnvironment(Context.SECURITY_AUTHENTICATION,"simple");

                // if successful then verified that user and pw
                // are valid ldap credentials
                ctx.reconnect(null);
                msg = "STEP-2:PASS: The user '"
                    + testUserName
                    + "' was succesfully authenticated using userDN '"
                    + userDN + "' and password provided.\n"
                    +"*Note: the loginProperty must match the loginProperty listed in dn: for the user. It is the DN that RHQ will lookup and use.";
View Full Code Here

        server.setResponseSeq(new LdapMessage[] { new LdapMessage(
                LdapASN1Constant.OP_BIND_RESPONSE, new BindResponse(), null) });

        expected = new Control[] { new SortControl("", Control.NONCRITICAL) };
        context.reconnect(expected);

        controls = context.getConnectControls();
        assertNotNull(controls);
        assertEquals(1, controls.length);
        c = controls[0];
View Full Code Here

        assertTrue(c instanceof SortControl);
        assertEquals(Control.NONCRITICAL, ((SortControl) c).isCritical());

        server.setResponseSeq(new LdapMessage[] { new LdapMessage(
                LdapASN1Constant.OP_BIND_RESPONSE, new BindResponse(), null) });
        context.reconnect(null);

        assertNull(context.getConnectControls());
    }

    public void testReconnect_share_connection() throws Exception {
View Full Code Here

        server.setResponseSeq(new LdapMessage[] { new LdapMessage(
                LdapASN1Constant.OP_BIND_RESPONSE, new BindResponse(), null) });

        // doesn't create new connection
        context.reconnect(null);

        server.setResponseSeq(new LdapMessage[] { new LdapMessage(
                LdapASN1Constant.OP_SEARCH_RESULT_DONE,
                new EncodableLdapResult(), null) });
        // another and context share the same connection now
View Full Code Here

        one.start();

        one.setResponseSeq(new LdapMessage[] { new LdapMessage(
                LdapASN1Constant.OP_BIND_RESPONSE, new BindResponse(), null) });
        // create new connection
        context.reconnect(null);

        server.setResponseSeq(new LdapMessage[] { new LdapMessage(
                LdapASN1Constant.OP_BIND_RESPONSE, new BindResponse(), null) });
        // use original connection
        another.reconnect(null);
View Full Code Here

     */
    public void testReconnect001() throws Exception {
        System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                        "org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
        InitialLdapContext ilc = new InitialLdapContext();
        ilc.reconnect(null);
        assertNull(ilc.getConnectControls());
        ilc.close();
    }

    /**
 
View Full Code Here

                        "org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
        Control[] cs = {
                new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }),
                new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
        InitialLdapContext ilc = new InitialLdapContext();
        ilc.reconnect(cs);
        assertEquals(cs, ilc.getConnectControls());
        ilc.close();
    }

    /**
 
View Full Code Here

                new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
        Control[] cs2 = {
                new MockControl("c2", false, new byte[] { 1, 2, 3, 4 }),
                new MockControl("c2", true, new byte[] { 'a', 'b', 'c', 'd' }), };
        InitialLdapContext ilc = new InitialLdapContext(null, cs);
        ilc.reconnect(cs2);
        assertEquals(cs2, ilc.getConnectControls());
        ilc.close();
    }

    /**
 
View Full Code Here

        server.setResponseSeq(new LdapMessage[] { new LdapMessage(
                LdapASN1Constant.OP_BIND_RESPONSE, new BindResponse(), null) });

        expected = new Control[] { new SortControl("", Control.NONCRITICAL) };
        context.reconnect(expected);

        controls = context.getConnectControls();
        assertNotNull(controls);
        assertEquals(1, controls.length);
        c = controls[0];
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.