Package org.glassfish.grizzly.ssl

Examples of org.glassfish.grizzly.ssl.SSLContextConfigurator


        }
        return this;
    }

    private SSLContextConfigurator getSslConfig() throws IOException {
        SSLContextConfigurator defaultConfig = SSLContextConfigurator.DEFAULT_CONFIG;
        String keystore_server = createCertificateStore("keystore_server");
        String truststore_server = createCertificateStore("truststore_server");
        defaultConfig.setKeyStoreFile(keystore_server);
        defaultConfig.setKeyStorePass("secret");
        defaultConfig.setTrustStoreFile(truststore_server);
        defaultConfig.setTrustStorePass("secret");
        return defaultConfig;
    }
View Full Code Here


    }

    protected static void startServer() {

        // Grizzly ssl configuration
        SSLContextConfigurator sslContext = new SSLContextConfigurator();

        // set up security context
        sslContext.setKeyStoreFile("./keystore_server"); // contains server keypair
        sslContext.setKeyStorePass("asdfgh");
        sslContext.setTrustStoreFile("./truststore_server"); // contains client certificate
        sslContext.setTrustStorePass("asdfgh");

        ResourceConfig rc = new ResourceConfig();
        rc.registerClasses(RootResource.class, SecurityFilter.class, AuthenticationExceptionMapper.class);

        try {
View Full Code Here

        // add security filter (which handles http basic authentication)
        registration.setInitParameter(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS,
                SecurityFilter.class.getName());

        // Grizzly ssl configuration
        SSLContextConfigurator sslContext = new SSLContextConfigurator();
       
        // set up security context
        sslContext.setKeyStoreFile("./keystore_server"); // contains server keypair
        sslContext.setKeyStorePass("asdfgh");
        sslContext.setTrustStoreFile("./truststore_server"); // contains client certificate
        sslContext.setTrustStorePass("asdfgh");

        try {

            webServer = GrizzlyServerFactory.createHttpServer(
                    getBaseURI(),
View Full Code Here

        SSLEngineConfigurator sslEngineConfigurator = (SSLEngineConfigurator) properties.get(ClientProperties.SSL_ENGINE_CONFIGURATOR);
        // if we are trying to access "wss" scheme and we don't have sslEngineConfigurator instance
        // we should try to create ssl connection using JVM properties.
        if (uri.getScheme().equalsIgnoreCase("wss") && sslEngineConfigurator == null) {
            SSLContextConfigurator defaultConfig = new SSLContextConfigurator();
            defaultConfig.retrieve(System.getProperties());
            sslEngineConfigurator = new SSLEngineConfigurator(defaultConfig, true, false, false);
        }

        try {
            this.clientSSLEngineConfigurator = sslEngineConfigurator;
View Full Code Here

        if (networkListenerConfig.getSslContext() == null) {
            throw new RuntimeException("Ursus Application Configuration error: secure set to true and SSLContext is null");
        }

        SSLContextConfigurator sslContext = new SSLContextConfigurator();
        sslContext.setKeyStoreFile(networkListenerConfig.getSslContext().getKeyStoreFile());
        sslContext.setKeyStorePass(networkListenerConfig.getSslContext().getKeyStorePass());
        sslContext.setTrustStoreFile(networkListenerConfig.getSslContext().getTrustStoreFile());
        sslContext.setTrustStorePass(networkListenerConfig.getSslContext().getTrustStorePass());

        listener.setSecure(true);

        if (networkListenerConfig.getSslEngine() == null) {
            // Use defaults
View Full Code Here

        if (networkListenerConfig.getSslContext() == null) {
            throw new RuntimeException("Ursus Application Configuration error: secure set to true and SSLContext is null");
        }

        SSLContextConfigurator sslContext = new SSLContextConfigurator();
        sslContext.setKeyStoreFile(networkListenerConfig.getSslContext().getKeyStoreFile());
        sslContext.setKeyStorePass(networkListenerConfig.getSslContext().getKeyStorePass());
        sslContext.setTrustStoreFile(networkListenerConfig.getSslContext().getTrustStoreFile());
        sslContext.setTrustStorePass(networkListenerConfig.getSslContext().getTrustStorePass());

        listener.setSecure(true);

        if (networkListenerConfig.getSslEngine() == null) {
            // Use defaults
View Full Code Here

        jerseyAdapter.addInitParameter(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS,
                SecurityFilter.class.getName());

        // Grizzly ssl configuration

        SSLContextConfigurator sslContext = new SSLContextConfigurator();
       
        // set up security context
        sslContext.setKeyStoreFile("./keystore_server"); // contains server keypair
        sslContext.setKeyStorePass("asdfgh");
        sslContext.setTrustStoreFile("./truststore_server"); // contains client certificate
        sslContext.setTrustStorePass("asdfgh");

        try {

            webServer = GrizzlyServerFactory.createHttpServer(
                    getBaseURI(),
View Full Code Here

        if (networkListenerConfig.getSslContext() == null) {
            throw new RuntimeException("Ursus Application Configuration error: secure set to true and SSLContext is null");
        }

        SSLContextConfigurator sslContext = new SSLContextConfigurator();
        sslContext.setKeyStoreFile(networkListenerConfig.getSslContext().getKeyStoreFile());
        sslContext.setKeyStorePass(networkListenerConfig.getSslContext().getKeyStorePass());
        sslContext.setTrustStoreFile(networkListenerConfig.getSslContext().getTrustStoreFile());
        sslContext.setTrustStorePass(networkListenerConfig.getSslContext().getTrustStorePass());

        listener.setSecure(true);

        if (networkListenerConfig.getSslEngine() == null) {
            // Use defaults
View Full Code Here

    protected static void startServer() throws IOException {
        final InputStream trustStore = Server.class.getResourceAsStream("/truststore_server");
        final InputStream keyStore = Server.class.getResourceAsStream("/keystore_server");

        // Grizzly ssl configuration
        SSLContextConfigurator sslContext = new SSLContextConfigurator();

        // set up security context
        sslContext.setKeyStoreBytes(ByteStreams.toByteArray(keyStore))// contains server keypair
        sslContext.setKeyStorePass("asdfgh");
        sslContext.setTrustStoreBytes(ByteStreams.toByteArray(trustStore)); // contains client certificate
        sslContext.setTrustStorePass("asdfgh");

        ResourceConfig rc = new ResourceConfig();
        rc.register(new LoggingFilter(LOGGER, true));
        rc.registerClasses(RootResource.class, SecurityFilter.class, AuthenticationExceptionMapper.class);
View Full Code Here

    }

    protected static void startServer() {

        // Grizzly ssl configuration
        SSLContextConfigurator sslContext = new SSLContextConfigurator();

        // set up security context
        sslContext.setKeyStoreFile(KEYSTORE_SERVER_FILE); // contains server keypair
        sslContext.setKeyStorePass(KEYSTORE_SERVER_PWD);
        sslContext.setTrustStoreFile(TRUSTORE_SERVER_FILE); // contains client certificate
        sslContext.setTrustStorePass(TRUSTORE_SERVER_PWD);

        ResourceConfig rc = new ResourceConfig();
        rc.registerClasses(RootResource.class, SecurityFilter.class, AuthenticationExceptionMapper.class);

        try {
View Full Code Here

TOP

Related Classes of org.glassfish.grizzly.ssl.SSLContextConfigurator

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.