Package org.eclipse.jetty.server.ssl

Examples of org.eclipse.jetty.server.ssl.SslSelectChannelConnector


    if (needClientAuth) {
      System.err.println("Enable NeedClientAuth.");
      sslcontextfactory.setNeedClientAuth(needClientAuth);
    }

    SslSelectChannelConnector sslConnector = new SslSelectChannelConnector(sslcontextfactory);
    sslConnector.setMaxIdleTime(30000);
    sslConnector.setPort(sslport);
    server.addConnector(sslConnector);
  }
View Full Code Here


      if ("http".equals(u.getScheme())) {
        defaultPort = 80;
        c = new SelectChannelConnector();
      } else if ("https".equals(u.getScheme())) {
        final SslSelectChannelConnector ssl = new SslSelectChannelConnector();
        final File keystore = getFile(cfg, "sslkeystore", "etc/keystore");
        String password = cfg.getString("httpd", null, "sslkeypassword");
        if (password == null) {
          password = "gerrit";
        }
        ssl.setKeystore(keystore.getAbsolutePath());
        ssl.setTruststore(keystore.getAbsolutePath());
        ssl.setKeyPassword(password);
        ssl.setTrustPassword(password);

        if (AuthType.CLIENT_SSL_CERT_LDAP.equals(authType)) {
          ssl.setNeedClientAuth(true);
        }

        defaultPort = 443;
        c = ssl;
View Full Code Here

        if (keyPassword != null && keyPassword.length() != 0) {
          sslContextFactory.setKeyManagerPassword(keyPassword);
        }
        // TODO Figure out how to pick a certificate from key store

        SslSelectChannelConnector sslConnector = new SslSelectChannelConnector(sslContextFactory);
        int sslPort = configuration.getInt(Constants.Security.AuthenticationServer.SSL_PORT);
        sslConnector.setHost(address.getCanonicalHostName());
        sslConnector.setPort(sslPort);
        server.setConnectors(new Connector[]{sslConnector});
      } else {
        server.setConnectors(new Connector[]{connector});
      }
View Full Code Here

    }
   
    final Connector connector;
    final QueuedThreadPool threadPool;
    if ("SelectChannel".equals(connectorName)) {
      final SelectChannelConnector c = useSsl ? new SslSelectChannelConnector(sslcontext) : new SelectChannelConnector();
      c.setReuseAddress(true);
      c.setLowResourcesMaxIdleTime(1500);
      connector = c;
      threadPool = (QueuedThreadPool) c.getThreadPool();
    } else if ("Socket".equals(connectorName)) {
View Full Code Here

        // SSL support
        File keystoreFile = new File(TapestryTestConstants.MODULE_BASE_DIR, "src/test/conf/keystore");

        if (keystoreFile.exists())
        {
            SslSelectChannelConnector sslConnector = new SslSelectChannelConnector();

            sslConnector.setPort(sslPort);

            sslConnector.setKeystore(keystoreFile.getPath());

            sslConnector.setPassword("tapestry");

            sslConnector.setKeyPassword("tapestry");

            jettyServer.addConnector(sslConnector);
        }

        jettyServer.setHandler(webapp);
View Full Code Here

        }
        if(portSsl < 0) {
          server.setConnectors(new Connector[]{ connector0 });
        }
        else {
          SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
          ssl_connector.setPort(portSsl);
          if(ipaddress != null) {
              ssl_connector.setHost(ipaddress);
            }
          SslContextFactory cf = ssl_connector.getSslContextFactory();
          cf.setKeyStore(ducc_web + File.separator+"etc"+File.separator+"keystore");
          cf.setKeyStorePassword(portSslPw);
          server.setConnectors(new Connector[]{ connector0, ssl_connector });
        }
        //
View Full Code Here

        SslConnector sslConnector;
        if (Krb5AndCertsSslSocketConnector.isKrb(auth)) {
            sslConnector = new Krb5AndCertsSslSocketConnector();
            ((Krb5AndCertsSslSocketConnector)sslConnector).setMode(auth);
        } else {
            sslConnector = new SslSelectChannelConnector();
        }

        SSLContext sslContext = context == null ? null : context.getSSLContext();

        // Get a reference to the current ssl context factory...
View Full Code Here

            }
        }
    }

    private SslConnector getSslSocketConnector(SSLContextParameters sslContextParameters) throws Exception {
        SslSelectChannelConnector sslSocketConnector = null;
        if (sslContextParameters != null) {
            SslContextFactory sslContextFactory = new WebSocketComponentSslContextFactory();
            sslContextFactory.setSslContext(sslContextParameters.createSSLContext());
            sslSocketConnector = new SslSelectChannelConnector(sslContextFactory);
        } else {
            sslSocketConnector = new SslSelectChannelConnector();
            // with default null values, jetty ssl system properties
            // and console will be read by jetty implementation
            sslSocketConnector.getSslContextFactory().setKeyManagerPassword(sslPassword);
            sslSocketConnector.getSslContextFactory().setKeyStorePassword(sslKeyPassword);
            if (sslKeystore != null) {
                sslSocketConnector.getSslContextFactory().setKeyStorePath(sslKeystore);
            }

        }
        return sslSocketConnector;
    }
View Full Code Here

    public String getKeystore() {
        return sslKeystore;
    }

    protected SslSelectChannelConnector getSslSocketConnector(JettyHttpEndpoint endpoint) throws Exception {
        SslSelectChannelConnector answer = null;
        if (sslSocketConnectors != null) {
            answer = sslSocketConnectors.get(endpoint.getPort());
        }
        if (answer == null) {
            answer = createSslSocketConnector(endpoint);
View Full Code Here

        }
        return answer;
    }
   
    protected SslSelectChannelConnector createSslSocketConnector(JettyHttpEndpoint endpoint) throws Exception {
        SslSelectChannelConnector answer = null;
       
        // Note that this was set on the endpoint when it was constructed.  It was
        // either explicitly set at the component or on the endpoint, but either way,
        // the value is already set.  We therefore do not need to look at the component
        // level SSLContextParameters again in this method.
        SSLContextParameters endpointSslContextParameters = endpoint.getSslContextParameters();
       
        if (endpointSslContextParameters != null) {
            SslContextFactory contextFact = new SslContextFactory() {

                // This method is for Jetty 7.0.x ~ 7.4.x
                @SuppressWarnings("unused")
                public boolean checkConfig() {
                    if (getSslContext() == null) {
                        return checkSSLContextFactoryConfig(this);
                    } else {
                        return true;
                    }
                }
                // This method is for Jetty 7.5.x
                public void checkKeyStore() {
                    // here we don't check the SslContext as it is already created
                }
               
            };
            contextFact.setSslContext(endpointSslContextParameters.createSSLContext());
            for (Constructor<?> c : SslSelectChannelConnector.class.getConstructors()) {
                if (c.getParameterTypes().length == 1
                    && c.getParameterTypes()[0].isInstance(contextFact)) {
                    answer = (SslSelectChannelConnector)c.newInstance(contextFact);
                }
            }
        } else {
            answer = new SslSelectChannelConnector();
            // with default null values, jetty ssl system properties
            // and console will be read by jetty implementation
   
            String keystoreProperty = System.getProperty(JETTY_SSL_KEYSTORE);
            if (keystoreProperty != null) {
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.server.ssl.SslSelectChannelConnector

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.