01: // Copyright © 2002-2005 Canoo Engineering AG, Switzerland.
02: package com.canoo.webtest.security;
03:
04: import com.canoo.webtest.engine.Configuration;
05:
06: /**
07: * Initializer for using https with full ssl authentication.
08: * Just like Basic Authentication but with client-side certification handling.
09: *
10: * @author Dierk Koenig
11: */
12: public class SunJsseClientAuthConnectionInitializer extends
13: SunJsseBaseConnectionInitializer {
14: protected static final String SECURITY_PROVIDER = "SunX509";
15: protected static final String KEYSTORE_TYPE = "JKS";
16: protected static final String SSL_TYPE = "TLS";
17:
18: protected void logProtocolConfiguration(final Configuration config) {
19: super .logProtocolConfiguration(config);
20: logProperty(config, PROPERTY_KEYSTORE_FILE);
21: logProperty(config, PROPERTY_KEYSTORE_PASSPHRASE);
22: logProperty(config, PROPERTY_KEYSTORE_ALIAS);
23: }
24:
25: protected void installTrustAndKeyManager(final Configuration config)
26: throws ConnectionInitializationException {
27: setSystemProperty("javax.net.ssl.keyStore",
28: getExternalProperty(config, PROPERTY_KEYSTORE_FILE));
29: setSystemProperty("javax.net.ssl.keyStorePassword",
30: getExternalProperty(config,
31: PROPERTY_KEYSTORE_PASSPHRASE));
32: setSystemProperty("javax.net.ssl.keyStoreType", KEYSTORE_TYPE);
33: }
34:
35: }
|