public void configureBinding(Object context) {
SecurityContext securityContext = ((Axis2BaseBindingProvider)context).getHttpSecurityContext();
for (Object policy : findPolicies()) {
if (policy instanceof HTTPSPolicy) {
HTTPSPolicy httpsPolicy = (HTTPSPolicy)policy;
securityContext.setSSLEnabled(true);
securityContext.setSSLProperties(httpsPolicy.toProperties());
// TODO - what is the right way to set trust/key store on client side?
logger.info("HTTPSPolicyProvider: Setting JVM trust store to " + httpsPolicy.getTrustStore());
System.setProperty("javax.net.ssl.trustStore", httpsPolicy.getTrustStore());
System.setProperty("javax.net.ssl.trustStorePassword", httpsPolicy.getTrustStorePassword());
System.setProperty("javax.net.ssl.trustStoreType", httpsPolicy.getTrustStoreType());
logger.info("HTTPSPolicyProvider: Setting JVM key store to " + httpsPolicy.getKeyStore());
System.setProperty("javax.net.ssl.keyStore", httpsPolicy.getKeyStore());
System.setProperty("javax.net.ssl.keyStorePassword", httpsPolicy.getKeyStorePassword());
System.setProperty("javax.net.ssl.keyStoreType", httpsPolicy.getKeyStoreType());
return;
}
}
}