You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2010/02/26 14:42:01 UTC
svn commit: r916677 -
/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/security/http/ssl/HTTPSPolicyProvider.java
Author: slaws
Date: Fri Feb 26 13:42:00 2010
New Revision: 916677
URL: http://svn.apache.org/viewvc?rev=916677&view=rev
Log:
Set the JVM trust/key store so the client side is able to pick up the servers public certificate. Not sure this is actually the way to way to do it as need more investigation into client side configuration.
Modified:
tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/security/http/ssl/HTTPSPolicyProvider.java
Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/security/http/ssl/HTTPSPolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/security/http/ssl/HTTPSPolicyProvider.java?rev=916677&r1=916676&r2=916677&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/security/http/ssl/HTTPSPolicyProvider.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/security/http/ssl/HTTPSPolicyProvider.java Fri Feb 26 13:42:00 2010
@@ -19,6 +19,9 @@
package org.apache.tuscany.sca.binding.ws.axis2.policy.security.http.ssl;
+import java.security.KeyStore;
+import java.util.logging.Logger;
+
import org.apache.tuscany.sca.binding.ws.axis2.Axis2BaseBindingProvider;
import org.apache.tuscany.sca.host.http.SecurityContext;
import org.apache.tuscany.sca.policy.PolicySubject;
@@ -29,6 +32,7 @@
* @version $Rev$ $Date$
*/
public class HTTPSPolicyProvider extends BasePolicyProvider<HTTPSPolicy> {
+ private final Logger logger = Logger.getLogger(HTTPSPolicyProvider.class.getName());
public HTTPSPolicyProvider(PolicySubject subject) {
super(HTTPSPolicy.class, subject);
@@ -39,8 +43,24 @@
for (Object policy : findPolicies()) {
if (policy instanceof HTTPSPolicy) {
+ HTTPSPolicy httpsPolicy = (HTTPSPolicy)policy;
+
securityContext.setSSLEnabled(true);
- securityContext.setSSLProperties(((HTTPSPolicy)policy).toProperties());
+ 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;
}
}
}