Package javax.naming.ldap

Examples of javax.naming.ldap.LdapContext.extendedOperation()


        env.put( "java.naming.provider.url", "ldap://localhost:" + getLdapServer().getPort() );
        env.put( "java.naming.security.principal", "uid=admin,ou=system" );
        env.put( "java.naming.security.credentials", "secret" );
        env.put( "java.naming.security.authentication", "simple" );
        LdapContext ctx = new InitialLdapContext( env, null );
        StartTlsResponse tls = ( StartTlsResponse ) ctx.extendedOperation( new StartTlsRequest() );
        tls.setHostnameVerifier( new HostnameVerifier() {
            public boolean verify( String hostname, SSLSession session )
            {
                return true;
            }
View Full Code Here


        getLdapServer().reloadSslContext();
       
        // create a new secure connection
        ctx = new InitialLdapContext( env, null );
        tls = ( StartTlsResponse ) ctx.extendedOperation( new StartTlsRequest() );
        tls.setHostnameVerifier( new HostnameVerifier() {
            public boolean verify( String hostname, SSLSession session )
            {
                return true;
            }
View Full Code Here

        LOG.debug( "About to get initial context" );
        LdapContext ctx = new InitialLdapContext( env, null );

        // Start TLS
        LOG.debug( "About send startTls extended operation" );
        StartTlsResponse tls = ( StartTlsResponse ) ctx.extendedOperation( new StartTlsRequest() );
        LOG.debug( "Extended operation issued" );
        tls.setHostnameVerifier( new HostnameVerifier() {
            public boolean verify( String hostname, SSLSession session )
            {
                return true;
View Full Code Here

    public void testUnknownExtendedOperation() throws Exception
    {
        LdapContext ctx = ( LdapContext ) getWiredContext( getLdapServer() ).lookup( "ou=system" );
        try
        {
            ctx.extendedOperation( new UnknownExtendedOperationRequest() );
            fail( "Calling an unknown extended operation should fail." );
        }
        catch ( CommunicationException ce )
        {
            // expected behaviour
View Full Code Here

            LOG.debug( "About to get initial context" );
            LdapContext ctx = new InitialLdapContext( env, null );
   
            // Start TLS
            LOG.debug( "About send startTls extended operation" );
            StartTlsResponse tls = ( StartTlsResponse ) ctx.extendedOperation( new StartTlsRequest() );
            LOG.debug( "Extended operation issued" );
            tls.setHostnameVerifier( new HostnameVerifier() {
                public boolean verify( String hostname, SSLSession session )
                {
                    return true;
View Full Code Here

        server
                .setResponseSeq(new LdapMessage[] { new LdapMessage(
                        LdapASN1Constant.OP_EXTENDED_RESPONSE,
                        encodableResponse, null) });

        ExtendedResponse response = context
                .extendedOperation(new MockExtendedRequest());
        assertTrue(response instanceof MockExtendedResponse);
        assertEquals("It's my id", response.getID());
        assertEquals(4, response.getEncodedValue().length);
        assertEquals(0, response.getEncodedValue()[0]);
View Full Code Here

                .setResponseSeq(new LdapMessage[] { new LdapMessage(
                        LdapASN1Constant.OP_EXTENDED_RESPONSE,
                        encodableResponse, null) });

        try {
            context.extendedOperation(new MockExtendedRequest());
            fail("Should throw NamingException");
        } catch (NamingException e) {
            // expected
            assertEquals("exception", e.getMessage());
        }
View Full Code Here

        try {
            doBasicOperation(op);
        } catch (ReferralException e) {
            if (isFollowReferral(e)) {
                LdapContext referralContext = (LdapContext) getReferralContext(e);
                return referralContext.extendedOperation(request);
            }
            throw e;
        }
        ExtendedResponse response = op.getExtendedResponse();
        // set existing underlying socket to startTls extended response
View Full Code Here

        try {
            doBasicOperation(op);
        } catch (ReferralException e) {
            if (isFollowReferral(e)) {
                LdapContext referralContext = (LdapContext) getReferralContext(e);
                return referralContext.extendedOperation(request);
            }
            throw e;
        }
        ExtendedResponse response = op.getExtendedResponse();
        // set existing underlying socket to startTls extended response
View Full Code Here

        LdapContext ctx = new InitialLdapContext( env, null );
        if ( isDebugEnabled() )
        {
            System.out.println( "Connection to the server established.\n" + "Sending extended request ... " );
        }
        ctx.extendedOperation( JndiUtils.toJndiExtendedRequest( new LaunchDiagnosticUiRequest( 3 ) ) );
        ctx.close();
    }


    private void processOptions( CommandLine cmd )
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.