Package org.apache.mina.filter.ssl

Examples of org.apache.mina.filter.ssl.SslFilter


        try
        {
            SSLContext sslContext = SSLContext.getInstance( config.getSslProtocol() );
            sslContext.init( config.getKeyManagers(), config.getTrustManagers(), config.getSecureRandom() );

            SslFilter sslFilter = new SslFilter( sslContext, true );
            sslFilter.setUseClientMode( true );
            sslFilter.setEnabledCipherSuites( config.getEnabledCipherSuites() );

            // for LDAPS
            if ( ldapSession == null )
            {
                connector.getFilterChain().addFirst( SSL_FILTER_KEY, sslFilter );
View Full Code Here


                try
                {
                    SSLContext sslContext = SSLContext.getInstance( config.getSslProtocol() );
                    sslContext.init( config.getKeyManagers(), config.getTrustManagers(), config.getSecureRandom() );

                    SslFilter sslFilter = new SslFilter( sslContext );
                    sslFilter.setUseClientMode( true );
                    connector.getFilterChain().addFirst( "sslFilter", sslFilter );
                }
                catch ( Exception e )
                {
                    String msg = "Failed to initialize the SSL context";
View Full Code Here

    public void testMessageSentIsCalled_With_SSL() throws Exception {
        testMessageSentIsCalled(true);
    }

    private void testMessageSentIsCalled(boolean useSSL) throws Exception {
        SslFilter sslFilter = null;
        if (useSSL) {
            sslFilter = new SslFilter(BogusSslContextFactory.getInstance(true));
            acceptor.getFilterChain().addLast("sslFilter", sslFilter);
        }
        acceptor.getFilterChain().addLast(
                "codec",
                new ProtocolCodecFilter(new TextLineCodecFactory(Charset
View Full Code Here

            acceptor.getFilterChain().addLast("mdcFilter2", mdcFilter);
            acceptor.getFilterChain().addLast("logger", new FtpLoggingFilter());
   
            if (isImplicitSsl()) {
                SslConfiguration ssl = getSslConfiguration();
                SslFilter sslFilter;
                try {
                    sslFilter = new SslFilter(ssl.getSSLContext());
                } catch (GeneralSecurityException e) {
                    throw new FtpServerConfigurationException("SSL could not be initialized, check configuration");
                }
   
                if (ssl.getClientAuth() == ClientAuth.NEED) {
                    sslFilter.setNeedClientAuth(true);
                } else if (ssl.getClientAuth() == ClientAuth.WANT) {
                    sslFilter.setWantClientAuth(true);
                }
   
                if (ssl.getEnabledCipherSuites() != null) {
                    sslFilter.setEnabledCipherSuites(ssl.getEnabledCipherSuites());
                }
   
                acceptor.getFilterChain().addFirst("sslFilter", sslFilter);
            }
   
View Full Code Here

      acceptor.setHandler(handler);
    }
    acceptor.setReuseAddress(true);
    DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
    if(bSSL){
      SslFilter sslFilter = new SslFilter(BogusSslContextFactory.getInstance(true));
      chain.addLast("sslFilter", sslFilter);
    }

    if(!portList.contains(port)){
      portList.add(port);
View Full Code Here

//    connector.getSessionConfig().setUseReadOperation(true);
    connector.setConnectTimeoutMillis(3*1000);
   
    if(bSSL){
      try{
        SslFilter sslFilter = new SslFilter(BogusSslContextFactory.getInstance(false));
        sslFilter.setUseClientMode(true);
        connector.getFilterChain().addFirst("sslFilter", sslFilter);
      }catch(Exception e){
        e.printStackTrace();
      }
    }
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        handler = new EchoConnectorHandler();
        connectorSSLFilter = new SslFilter(BogusSslContextFactory
                .getInstance(false));
        connectorSSLFilter.setUseClientMode(true); // set client mode
    }
View Full Code Here

    public void testMessageSentIsCalled_With_SSL() throws Exception {
        testMessageSentIsCalled(true);
    }

    private void testMessageSentIsCalled(boolean useSSL) throws Exception {
        SslFilter sslFilter = null;
        if (useSSL) {
            sslFilter = new SslFilter(BogusSslContextFactory.getInstance(true));
            acceptor.getFilterChain().addLast("sslFilter", sslFilter);
        }
        acceptor.getFilterChain().addLast(
                "codec",
                new ProtocolCodecFilter(new TextLineCodecFactory(Charset
View Full Code Here

        }
    }

    private static void addSSLSupport(DefaultIoFilterChainBuilder chain)
            throws Exception {
        SslFilter sslFilter = new SslFilter(BogusSslContextFactory
                .getInstance(true));
        chain.addLast("sslFilter", sslFilter);
        System.out.println("SSL ON");
    }
View Full Code Here

        SslConfiguration ssl = session.getListener().getSslConfiguration();
       
        if(ssl != null) {
            session.setAttribute(SslFilter.DISABLE_ENCRYPTION_ONCE);
           
            SslFilter sslFilter = new SslFilter( ssl.getSSLContext() );
            if(ssl.getClientAuth() == ClientAuth.NEED) {
                sslFilter.setNeedClientAuth(true);
            } else if(ssl.getClientAuth() == ClientAuth.WANT) {
                sslFilter.setWantClientAuth(true);
            }
           
            if(ssl.getEnabledCipherSuites() != null) {
                sslFilter.setEnabledCipherSuites(ssl.getEnabledCipherSuites());
            }
            session.getFilterChain().addFirst("sslSessionFilter", sslFilter);

        } else {
            throw new FtpException("Socket factory SSL not configured");
View Full Code Here

TOP

Related Classes of org.apache.mina.filter.ssl.SslFilter

Copyright © 2018 www.massapicom. 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.