Package org.eclipse.jetty.server.ssl

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


        return servlet;
    }

    public synchronized SslSocketConnector getSslSocketConnector() {
        if (sslSocketConnector == null) {
            sslSocketConnector = new SslSocketConnector();
            // 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) {
View Full Code Here


                SslContextFactory factory = new SslContextFactory();
                factory.setKeyStorePath(keyStorePath);
                factory.setKeyStorePassword(keyStorePassword);

                connector = new SslSocketConnector(factory);
            }
            else
            {
                throw new IllegalArgumentException("Unexpected transport on port " + port.getName() + ":" + transports);
            }
View Full Code Here

                }
                catch (GeneralSecurityException e)
                {
                    throw new ServerScopedRuntimeException("Cannot configure port " + port.getName() + " for transport " + Transport.SSL, e);
                }
                connector = new SslSocketConnector(factory);

            }
            else
            {
                throw new IllegalArgumentException("Unexpected transport on port " + port.getName() + ":" + transports);
View Full Code Here


    @Test
    public void testSetConnector() throws Exception {
        JettyHTTPServerEngine engine = new JettyHTTPServerEngine();
        Connector conn = new SslSocketConnector();
        engine.setConnector(conn);
        engine.setPort(9000);
        try {
            engine.finalizeConfig();
            fail("We should get the connector not set with TSLServerParameter exception.");
        } catch (Exception ex) {
            // expect the excepion
        }

        engine = new JettyHTTPServerEngine();
        conn = new SelectChannelConnector();
        conn.setPort(9002);
        engine.setConnector(conn);
        engine.setPort(9000);
        try {
            engine.finalizeConfig();
            fail("We should get the connector not set right port exception.");
        } catch (Exception ex) {
            // expect the exception
        }

        engine = new JettyHTTPServerEngine();
        conn = new SslSocketConnector();
        conn.setPort(9003);
        engine.setConnector(conn);
        engine.setPort(9003);
        engine.setTlsServerParameters(new TLSServerParameters());
        engine.finalizeConfig();
    }
View Full Code Here

      final String password = commandLineArgs.get(CommandLineIntepreter.OPTION_KEYPASS);
      final String keystorePath = commandLineArgs.get(CommandLineIntepreter.OPTION_KEYSTORE);
      final int port = getSslPort(commandLineArgs);

      final SslContextFactory sslContextFactory = constructSslContextFactory(password, keystorePath);
      final SslSocketConnector sslConnector = new SslSocketConnector(sslContextFactory);
      sslConnector.setPort(port);
      sslConnector.setName(SSL_CONNECTOR_NAME);
      sslConnector.setHost(DEFAULT_HOST);

      final String status = String.format("Stubs portal configured with SSL at https://%s:%s",
            sslConnector.getHost(), sslConnector.getPort());
      ANSITerminal.status(status);

      return sslConnector;
   }
View Full Code Here


    @Test
    public void testSetConnector() throws Exception {
        JettyHTTPServerEngine engine = new JettyHTTPServerEngine();
        Connector conn = new SslSocketConnector();
        engine.setConnector(conn);
        engine.setPort(9000);
        try {
            engine.finalizeConfig();
            fail("We should get the connector not set with TSLServerParameter exception.");
        } catch (Exception ex) {
            // expect the excepion
        }

        engine = new JettyHTTPServerEngine();
        conn = new SelectChannelConnector();
        conn.setPort(9002);
        engine.setConnector(conn);
        engine.setPort(9000);
        try {
            engine.finalizeConfig();
            fail("We should get the connector not set right port exception.");
        } catch (Exception ex) {
            // expect the exception
        }

        engine = new JettyHTTPServerEngine();
        conn = new SslSocketConnector();
        conn.setPort(9003);
        engine.setConnector(conn);
        engine.setPort(9003);
        engine.setTlsServerParameters(new TLSServerParameters());
        engine.finalizeConfig();
    }
View Full Code Here

      TreeLogger sslLogger = logger.branch(TreeLogger.INFO,
          "Listening for SSL connections");
      if (sslLogger.isLoggable(TreeLogger.TRACE)) {
        sslLogger.log(TreeLogger.TRACE, "Using keystore " + keyStore);
      }
      SslSocketConnector conn = new SslSocketConnector();
      if (clientAuth != null) {
        switch (clientAuth) {
          case NONE:
            conn.setWantClientAuth(false);
            conn.setNeedClientAuth(false);
            break;
          case WANT:
            sslLogger.log(TreeLogger.TRACE, "Requesting client certificates");
            conn.setWantClientAuth(true);
            conn.setNeedClientAuth(false);
            break;
          case REQUIRE:
            sslLogger.log(TreeLogger.TRACE, "Requiring client certificates");
            conn.setWantClientAuth(true);
            conn.setNeedClientAuth(true);
            break;
        }
      }
      conn.setKeystore(keyStore);
      conn.setTruststore(keyStore);
      conn.setKeyPassword(keyStorePassword);
      conn.setTrustPassword(keyStorePassword);
      return conn;
    }
    return new SelectChannelConnector();
  }
View Full Code Here

            SslContextFactory factory = new SslContextFactory();
            factory.setKeyStoreResource(keystore);
            factory.setKeyStorePassword("wicket");
            factory.setTrustStore(keystore);
            factory.setKeyManagerPassword("wicket");
            SslSocketConnector sslConnector = new SslSocketConnector(factory);
            sslConnector.setMaxIdleTime(timeout);
            sslConnector.setPort(8443);
            sslConnector.setAcceptors(4);
            server.addConnector(sslConnector);

            System.out.println("SSL access to the quickstart has been enabled on port 8443");
            System.out.println("You can access the application using SSL on https://localhost:8443");
            System.out.println();
View Full Code Here

         password = commandLineArgs.get(CommandLineIntepreter.OPTION_KEYPASS);
         keystorePath = commandLineArgs.get(CommandLineIntepreter.OPTION_KEYSTORE);
      }

      final SslContextFactory sslContextFactory = constructSslContextFactory(password, keystorePath);
      final SslSocketConnector sslConnector = new SslSocketConnector(sslContextFactory);
      sslConnector.setPort(DEFAULT_SSL_PORT);
      sslConnector.setName(SSL_CONNECTOR_NAME);
      sslConnector.setHost(DEFAULT_HOST);

      if (commandLineArgs.containsKey(CommandLineIntepreter.OPTION_ADDRESS)) {
         sslConnector.setHost(commandLineArgs.get(CommandLineIntepreter.OPTION_ADDRESS));
      }

      final String status = String.format("Stubs portal configured with SSL at https://%s:%s using %s keystore",
            sslConnector.getHost(), sslConnector.getPort(), (keystorePath == null ? "internal" : "provided " + keystorePath));
      ANSITerminal.status(status);


      return sslConnector;
   }
View Full Code Here

         password = commandLineArgs.get(CommandLineIntepreter.OPTION_KEYPASS);
         keystorePath = commandLineArgs.get(CommandLineIntepreter.OPTION_KEYSTORE);
      }

      final SslContextFactory sslContextFactory = constructSslContextFactory(password, keystorePath);
      final SslSocketConnector sslConnector = new SslSocketConnector(sslContextFactory);
      sslConnector.setPort(getStubsSslPort(commandLineArgs));
      sslConnector.setName(SSL_CONNECTOR_NAME);
      sslConnector.setHost(DEFAULT_HOST);

      if (commandLineArgs.containsKey(CommandLineIntepreter.OPTION_ADDRESS)) {
         sslConnector.setHost(commandLineArgs.get(CommandLineIntepreter.OPTION_ADDRESS));
      }

      final String status = String.format("Stubs portal configured with SSL at https://%s:%s using %s keystore",
            sslConnector.getHost(), sslConnector.getPort(), (keystorePath == null ? "internal" : "provided " + keystorePath));
      ANSITerminal.status(status);

      currentStubsSslPort = sslConnector.getPort();

      return sslConnector;
   }
View Full Code Here

TOP

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

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.