Examples of HTTPSProperties


Examples of com.sun.jersey.client.urlconnection.HTTPSProperties

            System.out.println("NoSuchAlgorithmException " + nae.getMessage());
        } catch (KeyManagementException kme) {
            System.out.println("KeyManagementException happened " + kme.getMessage());
        }

        HTTPSProperties prop = new HTTPSProperties(null, context);

        DefaultClientConfig dcc = new DefaultClientConfig();
        dcc.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, prop);

        Client c = Client.create(dcc);
View Full Code Here

Examples of com.sun.jersey.client.urlconnection.HTTPSProperties

  }

  private Client createIgnoreHttpsValidationClient() {
    ClientConfig config = new DefaultClientConfig();
    try {
      HTTPSProperties httpProperties = new HTTPSProperties( new HostnameVerifier() {
        @Override
        public boolean verify( String arg0, SSLSession arg1 ) {
          return true;
        }
      } );
View Full Code Here

Examples of com.sun.jersey.client.urlconnection.HTTPSProperties

      }
     
      ClientConfig config = new DefaultClientConfig();
      SSLContext ctx = SSLContext.getDefault();
     
        config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new HTTPSProperties(new HostnameVerifier() {
              @Override
              public boolean verify(String arg0, SSLSession arg1) {
                  return true;
              }}, ctx));
      Client http_client = Client.create(config);
View Full Code Here

Examples of com.sun.jersey.client.urlconnection.HTTPSProperties

            ClientConfig clientConfig = new DefaultClientConfig();

            // register an open trust manager to allow SSL connections to servers with self-signed certificates
            if ( config.isDisableSslValidation() ) {
                clientConfig.getProperties().put( HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
                                                  new HTTPSProperties( SslUtil.gullibleVerifier,
                                                                       SslUtil.createGullibleSslContext() ) );
            }

            addHandlers( clientConfig, readers, writers );
View Full Code Here

Examples of com.sun.jersey.client.urlconnection.HTTPSProperties

                builder = builder.setRealm(realm);
            }

            Object httpsPropertiesProperty = cc.getProperties().get(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES);
            if(httpsPropertiesProperty != null && httpsPropertiesProperty instanceof HTTPSProperties) {
                HTTPSProperties httpsProperties = (HTTPSProperties)httpsPropertiesProperty;
                final HostnameVerifier hostnameVerifier = httpsProperties.getHostnameVerifier();
                if(hostnameVerifier != null) {
                    builder = builder.setHostnameVerifier(hostnameVerifier);
                }
                builder = builder.setSSLContext(httpsProperties.getSSLContext());
            }

            Object requestFilters = cc.getProperties().get(NonBlockingClientConfig.PROPERTY_REQUEST_FILTERS);
            if(requestFilters != null) {
                if(requestFilters instanceof RequestFilter) {
View Full Code Here

Examples of com.sun.jersey.client.urlconnection.HTTPSProperties

            client = JERSEY_CLIENT;
        }
        try{
            Habitat habitat = SecurityServicesUtil.getInstance().getHabitat();
            SecureAdmin secureAdmin = habitat.getComponent(SecureAdmin.class);
            HTTPSProperties httpsProperties = new HTTPSProperties(new BasicHostnameVerifier(),
                habitat.getComponent(SSLUtils.class).getAdminSSLContext(SecureAdmin.Util.DASAlias(secureAdmin), null ));
            client.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, httpsProperties);
            client.addFilter(new CsrfProtectionFilter());
        }catch(Exception ex){
            GuiUtil.getLogger().warning("RestUtil.initialize() failed");
View Full Code Here

Examples of com.sun.jersey.client.urlconnection.HTTPSProperties

            ClientConfig clientConfig = new DefaultClientConfig();

            // register an open trust manager to allow SSL connections to servers with self-signed certificates
            if ( config.isDisableSslValidation() ) {
                clientConfig.getProperties().put( HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
                                                  new HTTPSProperties( SslUtil.gullibleVerifier,
                                                                       SslUtil.createGullibleSslContext() ) );
            }

            Client client = Client.create( clientConfig );
            configureClient( client, config );
View Full Code Here

Examples of com.sun.jersey.client.urlconnection.HTTPSProperties

            ClientConfig clientConfig = new DefaultClientConfig();

            // register an open trust manager to allow SSL connections to servers with self-signed certificates
            if ( config.isDisableSslValidation() ) {
                clientConfig.getProperties().put( HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
                                                  new HTTPSProperties( SslUtil.gullibleVerifier,
                                                                       SslUtil.createGullibleSslContext() ) );
            }

            addHandlers( clientConfig, readers, writers );
View Full Code Here

Examples of com.sun.jersey.client.urlconnection.HTTPSProperties

            ClientConfig clientConfig = new DefaultClientConfig();

            // register an open trust manager to allow SSL connections to servers with self-signed certificates
            if ( config.isDisableSslValidation() && "https".equals( config.getProto().toLowerCase() ) ) {
                clientConfig.getProperties().put( HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
                                                  new HTTPSProperties( SslUtil.gullibleVerifier,
                                                                       SslUtil.createGullibleSslContext() ) );
            }

            Client client = Client.create( clientConfig );
            configureClient( client, config );
View Full Code Here

Examples of com.sun.jersey.client.urlconnection.HTTPSProperties

     * Use SSL to authenticate
     */
    private void addAuthenticationInfo(Client client, WebResource.Builder resourceBuilder, Server server, Habitat habitat) {
        SecureAdmin secureAdmin = habitat.getComponent(SecureAdmin.class);
        //Instruct Jersey to use HostNameVerifier and SSLContext provided by us.
        HTTPSProperties httpsProperties = new HTTPSProperties(new BasicHostnameVerifier(server.getAdminHost()),
                habitat.getComponent(SSLUtils.class).getAdminSSLContext(SecureAdmin.Util.DASAlias(secureAdmin), "TLS" )); //TODO need to get hardcoded "TLS" from corresponding ServerRemoteAdminCommand constant
        client.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, httpsProperties);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.