Search in sources :

Example 1 with HTTPSProperties

use of com.sun.jersey.client.urlconnection.HTTPSProperties in project ORCID-Source by ORCID.

the class DevJerseyClientConfig method init.

public void init() {
    SSLContext ctx = createSslContext();
    HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
    getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new HTTPSProperties(new HostnameVerifier() {

        @Override
        public boolean verify(String hostname, SSLSession sslSession) {
            if (hostname.equals("localhost")) {
                return true;
            }
            return false;
        }
    }, ctx));
}
Also used : SSLSession(javax.net.ssl.SSLSession) SSLContext(javax.net.ssl.SSLContext) HTTPSProperties(com.sun.jersey.client.urlconnection.HTTPSProperties) HostnameVerifier(javax.net.ssl.HostnameVerifier)

Example 2 with HTTPSProperties

use of com.sun.jersey.client.urlconnection.HTTPSProperties in project ORCID-Source by ORCID.

the class OrcidJerseyT2ClientConfig method afterPropertiesSet.

/**
     * Invoked by a BeanFactory after it has set all bean properties supplied
     * (and satisfied BeanFactoryAware and ApplicationContextAware).
     * <p>
     * This method allows the bean instance to perform initialization only
     * possible when all bean properties have been set and to throw an exception
     * in the event of misconfiguration.
     * 
     * @throws Exception
     *             in the event of misconfiguration (such as failure to set an
     *             essential property) or if initialization fails.
     */
@Override
public void afterPropertiesSet() throws Exception {
    SSLContext ctx = createSslContext();
    HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
    getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new HTTPSProperties(new HostnameVerifier() {

        @Override
        public boolean verify(String s, SSLSession sslSession) {
            return true;
        }
    }, ctx));
}
Also used : SSLSession(javax.net.ssl.SSLSession) SSLContext(javax.net.ssl.SSLContext) HTTPSProperties(com.sun.jersey.client.urlconnection.HTTPSProperties) HostnameVerifier(javax.net.ssl.HostnameVerifier)

Example 3 with HTTPSProperties

use of com.sun.jersey.client.urlconnection.HTTPSProperties in project ORCID-Source by ORCID.

the class OrcidJerseyT2ClientOAuthConfig method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    SSLContext ctx = createSslContext();
    HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
    getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new HTTPSProperties(new HostnameVerifier() {

        @Override
        public boolean verify(String s, SSLSession sslSession) {
            return true;
        }
    }, ctx));
}
Also used : SSLSession(javax.net.ssl.SSLSession) SSLContext(javax.net.ssl.SSLContext) HTTPSProperties(com.sun.jersey.client.urlconnection.HTTPSProperties) HostnameVerifier(javax.net.ssl.HostnameVerifier)

Aggregations

HTTPSProperties (com.sun.jersey.client.urlconnection.HTTPSProperties)3 HostnameVerifier (javax.net.ssl.HostnameVerifier)3 SSLContext (javax.net.ssl.SSLContext)3 SSLSession (javax.net.ssl.SSLSession)3