Package org.mortbay.jetty.security

Examples of org.mortbay.jetty.security.SslSocketConnector


    protected void addConnectors( Server server )
    {
        System.setProperty( "javax.net.ssl.trustStore",
                            getTestFile( "src/test/resources/ssl/keystore" ).getAbsolutePath() );

        SslSocketConnector connector = new SslSocketConnector();
        connector.setPort( server.getConnectors()[0].getPort() );
        connector.setKeystore( getTestPath( "src/test/resources/ssl/keystore" ) );
        connector.setPassword( "wagonhttp" );
        connector.setKeyPassword( "wagonhttp" );
        connector.setTruststore( getTestPath( "src/test/resources/ssl/keystore" ) );
        connector.setTrustPassword( "wagonhttp" );
        server.setConnectors( new Connector[]{ connector } );
    }
View Full Code Here


        throws URISyntaxException, IOException
    {
        server = new Server();
        if ( ssl )
        {
            SslSocketConnector connector = new SslSocketConnector();
            String keystore = getResource( SERVER_SSL_KEYSTORE_RESOURCE_PATH ).getAbsolutePath();

            Logger.getLogger( ServerFixture.class ).info( "TCK Keystore path: " + keystore );
            System.setProperty( "javax.net.ssl.keyStore", keystore );
            System.setProperty( "javax.net.ssl.trustStore", keystore );

            // connector.setHost( SERVER_HOST );
            //connector.setPort( port );
            connector.setKeystore( keystore );
            connector.setPassword( SERVER_SSL_KEYSTORE_PASSWORD );
            connector.setKeyPassword( SERVER_SSL_KEYSTORE_PASSWORD );

            server.addConnector( connector );
        }
        else
        {
            Connector connector = new SelectChannelConnector();
            connector.setHost( "localhost" );
            //connector.setPort( port );
            server.addConnector( connector );
        }

        Constraint constraint = new Constraint();
View Full Code Here

    protected void addConnectors( Server server )
    {
        System.setProperty( "javax.net.ssl.trustStore",
                            getTestFile( "src/test/resources/ssl/keystore" ).getAbsolutePath() );

        SslSocketConnector connector = new SslSocketConnector();
        connector.setPort( server.getConnectors()[0].getPort() );
        connector.setKeystore( getTestPath( "src/test/resources/ssl/keystore" ) );
        connector.setPassword( "wagonhttp" );
        connector.setKeyPassword( "wagonhttp" );
        connector.setTruststore( getTestPath( "src/test/resources/ssl/keystore" ) );
        connector.setTrustPassword( "wagonhttp" );
        server.setConnectors( new Connector[] { connector } );
    }
View Full Code Here

                sslConnector.setKeystore(keyFileName);
            }
            return sslConnector;
        }
        else {
            SslSocketConnector sslConnector = new SslSocketConnector();
            sslConnector.setPort(jettySSLPort);
            sslConnector.setMaxIdleTime(maxIdleTime);
            sslConnector.setKeyPassword(keyPassword);
            if (keyFileName != null && keyFileName.length() != 0 ) {
                sslConnector.setKeystore(keyFileName);
            }
            return sslConnector;
        }
    }
View Full Code Here

    // Connector Array
    Connector[] connectors = new Connector[1];


    if (sslEnabled) {
      SslSocketConnector sslSocketConnector = new HTTPSourceSocketConnector(excludedProtocols);
      sslSocketConnector.setKeystore(keyStorePath);
      sslSocketConnector.setKeyPassword(keyStorePassword);
      sslSocketConnector.setReuseAddress(true);
      connectors[0] = sslSocketConnector;
    } else {
      SelectChannelConnector connector = new SelectChannelConnector();
      connector.setReuseAddress(true);
      connectors[0] = connector;
View Full Code Here

  public void addSslListener(InetSocketAddress addr, String keystore,
      String storPass, String keyPass) throws IOException {
    if (webServer.isStarted()) {
      throw new IOException("Failed to add ssl listener");
    }
    SslSocketConnector sslListener = new SslSocketConnector();
    sslListener.setHost(addr.getHostName());
    sslListener.setPort(addr.getPort());
    sslListener.setKeystore(keystore);
    sslListener.setPassword(storPass);
    sslListener.setKeyPassword(keyPass);
    webServer.addConnector(sslListener);
  }
View Full Code Here

    else if (!needCertsAuth && needKrbAuth)
      mode = MODE.KRB;
    else // Default to certificates
      mode = MODE.CERTS;

    SslSocketConnector sslListener = new Krb5AndCertsSslSocketConnector(mode);
    sslListener.setHost(addr.getHostName());
    sslListener.setPort(addr.getPort());
    sslListener.setKeystore(sslConf.get("ssl.server.keystore.location"));
    sslListener.setPassword(sslConf.get("ssl.server.keystore.password", ""));
    sslListener.setKeyPassword(sslConf.get("ssl.server.keystore.keypassword", ""));
    sslListener.setKeystoreType(sslConf.get("ssl.server.keystore.type", "jks"));
    sslListener.setNeedClientAuth(needCertsAuth);
    webServer.addConnector(sslListener);
  }
View Full Code Here

                OutputStream stream = new FileOutputStream( ksFile );
                ks.store( stream, password.toCharArray() );
                stream.close();

                SslSocketConnector httpsConnector = new SslSocketConnector();
                httpsConnector.setPort( httpsTransport.getPort() );
                httpsConnector.setHost( httpsTransport.getAddress() );
                httpsConnector.setKeystoreType( ks.getType() );
                httpsConnector.setKeystore( ksFile.getAbsolutePath() );
                httpsConnector.setPassword( password );
                httpsConnector.setKeyPassword( password );

                jetty.addConnector( httpsConnector );
            }

            List<Handler> handlers = new ArrayList<Handler>();
View Full Code Here

                    setConnectorOptions(connector, props);
                    server.addConnector(connector);

                } else if ("https".equals(props.getProperty("type").value)) {

                    SslSocketConnector connector = new SslSocketConnector();
                    setConnectorOptions(connector, props);

                    if (props.getProperty("keystore") != null) {
                        connector.setKeystore(props.getProperty("keystore").value);
                    }
                    if (props.getProperty("password") != null) {
                        connector.setPassword(props.getProperty("password").value);
                    }
                    if (props.getProperty("key-password") != null) {
                        connector.setKeyPassword(props.getProperty("key-password").value);
                    }
                    if (props.getProperty("client-auth") != null) {
                        if ("need".equals(props.getProperty("client-auth").value)) {
                            connector.setNeedClientAuth(true);
                        } else if ("want".equals(props.getProperty("client-auth").value)) {
                            connector.setWantClientAuth(true);
                        }
                    }

                    server.addConnector(connector);

                } else if ("nio-http".equals(props.getProperty("type").value)) {

                    AbstractConnector connector = new SelectChannelConnector();
                    setConnectorOptions(connector, props);
                    server.addConnector(connector);

                } else if ("nio-https".equals(props.getProperty("type").value)) {

                    SslSelectChannelConnector connector = new SslSelectChannelConnector();
                    setConnectorOptions(connector, props);

                    if (props.getProperty("keystore") != null) {
                        connector.setKeystore(props.getProperty("keystore").value);
                    }
                    if (props.getProperty("password") != null) {
                        connector.setPassword(props.getProperty("password").value);
                    }
                    if (props.getProperty("key-password") != null) {
                        connector.setKeyPassword(props.getProperty("key-password").value);
                    }
                    if (props.getProperty("need-client-auth") != null) {
                        boolean needClientAuth = "true".equalsIgnoreCase(props.getProperty("need-client-auth").value);
                        connector.setNeedClientAuth(needClientAuth);
                    }

                    server.addConnector(connector);

                } else if ("ajp13".equals(props.getProperty("type").value)) {
View Full Code Here

        synchronized (connectors) {
            ConnectorRef connectorRef = connectors.get(connectorKey);
            if (connectorRef == null) {
                Connector connector;
                if ("https".equals(endpoint.getProtocol())) {
                    connector = new SslSocketConnector();
                } else {
                    connector = new SelectChannelConnector();
                }
                connector.setPort(endpoint.getPort());
                server.addConnector(connector);
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.security.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.