Author: dvaleri
Date: Wed Jun 20 19:16:21 2012
New Revision: 1352270
URL: http://svn.apache.org/viewvc?rev=1352270&view=rev
Log:
[CAMEL-5310] Added detailed logging to the configuration utility.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/FilterParameters.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/JsseParameters.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyManagersParameters.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyStoreParameters.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextServerParameters.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SecureRandomParameters.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/TrustManagersParameters.java
camel/trunk/camel-core/src/test/resources/log4j.properties
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java?rev=1352270&r1=1352269&r2=1352270&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java
Wed Jun 20 19:16:21 2012
@@ -242,15 +242,16 @@ public abstract class BaseSSLContextPara
* @throws GeneralSecurityException if there is an error configuring the
context
*/
protected void configureSSLContext(SSLContext context) throws
GeneralSecurityException {
- LOG.trace("Configuring client and server side SSLContext
parameters...");
+ LOG.trace("Configuring client and server side SSLContext parameters on
SSLContext [{}]...", context);
if (this.getSessionTimeout() != null) {
- LOG.debug("Configuring client and server side SSLContext session
timeout: {}", this.getSessionTimeout());
+ LOG.debug("Configuring client and server side SSLContext session
timeout on SSLContext [{}] to [{}]",
+ context, this.getSessionTimeout());
this.configureSessionContext(context.getClientSessionContext(),
this.getSessionTimeout());
this.configureSessionContext(context.getServerSessionContext(),
this.getSessionTimeout());
}
- LOG.trace("Configured client and server side SSLContext parameters.");
+ LOG.trace("Configured client and server side SSLContext parameters on
SSLContext [{}].", context);
}
protected FilterParameters getDefaultCipherSuitesFilter() {
@@ -325,7 +326,21 @@ public abstract class BaseSSLContextPara
enabledCipherSuitePatterns,
defaultEnabledCipherSuitePatterns,
!allowPassthrough);
- LOG.trace("Enabled ChiperSuites: {}", filteredCipherSuites);
+ LOG.debug("Configuring SSLEngine [{}] with "
+ + "\r\n\t explicitly set cipher suites [{}],"
+ + "\r\n\t cipher suite patterns [{}],"
+ + "\r\n\t available cipher suites [{}],"
+ + "\r\n\t currently enabled cipher suites [{}],"
+ + "\r\n\t and default cipher suite patterns [{}]."
+ + "\r\n\t Resulting enabled cipher suites are [{}].",
+ new Object[] {engine,
+ enabledCipherSuites,
+ enabledCipherSuitePatterns,
+
engine.getSSLParameters().getCipherSuites(),
+ engine.getEnabledCipherSuites(),
+ defaultEnabledCipherSuitePatterns,
+ filteredCipherSuites});
+
engine.setEnabledCipherSuites(filteredCipherSuites.toArray(new
String[filteredCipherSuites.size()]));
Collection<String> filteredSecureSocketProtocols =
BaseSSLContextParameters.this
@@ -334,9 +349,23 @@ public abstract class BaseSSLContextPara
enabledSecureSocketProtocolsPatterns,
defaultEnabledSecureSocketProtocolsPatterns,
!allowPassthrough);
+ LOG.debug("Configuring SSLEngine [{}] with "
+ + "\r\n\t explicitly set protocols [{}],"
+ + "\r\n\t protocol patterns [{}],"
+ + "\r\n\t available protocols [{}],"
+ + "\r\n\t currently enabled protocols [{}],"
+ + "\r\n\t and default protocol patterns [{}]."
+ + "\r\n\t Resulting enabled protocols are [{}].",
+ new Object[] {engine,
+ enabledSecureSocketProtocols,
+ enabledSecureSocketProtocolsPatterns,
+ engine.getSSLParameters().getProtocols(),
+ engine.getEnabledProtocols(),
+
defaultEnabledSecureSocketProtocolsPatterns,
+ filteredSecureSocketProtocols});
+
engine.setEnabledProtocols(filteredSecureSocketProtocols.toArray(new
String[filteredSecureSocketProtocols.size()]));
- LOG.trace("Enabled Protocols: {}",
filteredSecureSocketProtocols);
-
+
return engine;
}
};
@@ -482,6 +511,21 @@ public abstract class BaseSSLContextPara
Arrays.asList(socket.getEnabledCipherSuites()),
enabledCipherSuitePatterns,
defaultEnabledCipherSuitePatterns,
!allowPassthrough);
+
+ LOG.debug("Configuring SSLSocket [{}] with "
+ + "\r\n\t explicitly set cipher suites [{}],"
+ + "\r\n\t cipher suite patterns [{}],"
+ + "\r\n\t available cipher suites [{}],"
+ + "\r\n\t currently enabled cipher suites [{}],"
+ + "\r\n\t and default cipher suite patterns [{}]."
+ + "\r\n\t Resulting enabled cipher suites are [{}].",
+ new Object[] {socket,
+ enabledCipherSuites,
+ enabledCipherSuitePatterns,
+
socket.getSSLParameters().getCipherSuites(),
+ socket.getEnabledCipherSuites(),
+ defaultEnabledCipherSuitePatterns,
+ filteredCipherSuites});
socket.setEnabledCipherSuites(filteredCipherSuites.toArray(new
String[filteredCipherSuites.size()]));
@@ -491,6 +535,21 @@ public abstract class BaseSSLContextPara
enabledSecureSocketProtocolsPatterns,
defaultEnabledSecureSocketProtocolsPatterns,
!allowPassthrough);
+ LOG.debug("Configuring SSLSocket [{}] with "
+ + "\r\n\t explicitly set protocols [{}],"
+ + "\r\n\t protocol patterns [{}],"
+ + "\r\n\t available protocols [{}],"
+ + "\r\n\t currently enabled protocols [{}],"
+ + "\r\n\t and default protocol patterns [{}]."
+ + "\r\n\t Resulting enabled protocols are [{}].",
+ new Object[] {socket,
+ enabledSecureSocketProtocols,
+ enabledSecureSocketProtocolsPatterns,
+ socket.getSSLParameters().getProtocols(),
+ socket.getEnabledProtocols(),
+
defaultEnabledSecureSocketProtocolsPatterns,
+ filteredSecureSocketProtocols});
+
socket.setEnabledProtocols(filteredSecureSocketProtocols.toArray(new
String[filteredSecureSocketProtocols.size()]));
return socket;
}
@@ -561,6 +620,21 @@ public abstract class BaseSSLContextPara
enabledCipherSuitePatterns,
defaultEnabledCipherSuitePatterns,
!allowPassthrough);
+ LOG.debug("Configuring SSLServerSocket [{}] with "
+ + "\r\n\t explicitly set cipher suites [{}],"
+ + "\r\n\t cipher suite patterns [{}],"
+ + "\r\n\t available cipher suites [{}],"
+ + "\r\n\t currently enabled cipher suites [{}],"
+ + "\r\n\t and default cipher suite patterns [{}]."
+ + "\r\n\t Resulting enabled cipher suites are [{}].",
+ new Object[] {socket,
+ enabledCipherSuites,
+ enabledCipherSuitePatterns,
+ socket.getSupportedCipherSuites(),
+ socket.getEnabledCipherSuites(),
+ defaultEnabledCipherSuitePatterns,
+ filteredCipherSuites});
+
socket.setEnabledCipherSuites(filteredCipherSuites.toArray(new
String[filteredCipherSuites.size()]));
Collection<String> filteredSecureSocketProtocols =
BaseSSLContextParameters.this
@@ -568,6 +642,21 @@ public abstract class BaseSSLContextPara
Arrays.asList(socket.getEnabledProtocols()),
enabledSecureSocketProtocolsPatterns,
defaultEnabledSecureSocketProtocolsPatterns,
!allowPassthrough);
+
+ LOG.debug("Configuring SSLServerSocket [{}] with "
+ + "\r\n\t explicitly set protocols [{}],"
+ + "\r\n\t protocol patterns [{}],"
+ + "\r\n\t available protocols [{}],"
+ + "\r\n\t currently enabled protocols [{}],"
+ + "\r\n\t and default protocol patterns [{}]."
+ + "\r\n\t Resulting enabled protocols are [{}].",
+ new Object[] {socket,
+ enabledSecureSocketProtocols,
+ enabledSecureSocketProtocolsPatterns,
+ socket.getSupportedProtocols(),
+ socket.getEnabledProtocols(),
+
defaultEnabledSecureSocketProtocolsPatterns,
+ filteredSecureSocketProtocols});
socket.setEnabledProtocols(filteredSecureSocketProtocols.toArray(new
String[filteredSecureSocketProtocols.size()]));
return socket;
@@ -732,13 +821,14 @@ public abstract class BaseSSLContextPara
public SSLContextDecorator(SSLContextSpiDecorator decorator) {
super(decorator, decorator.getDelegate().getProvider(),
decorator.getDelegate().getProtocol());
+ LOG.debug("SSLContextDecorator [{}] decorating SSLContext [{}].",
this, decorator.getDelegate());
}
@Override
public String toString() {
- return String.format("SSLContext[provider=%s, protocol=%s,
needClientAuth=%s, "
+ return String.format("SSLContext[hash=%h, provider=%s,
protocol=%s, needClientAuth=%s, "
+
"wantClientAuth=%s\n\tdefaultProtocols=%s\n\tdefaultChiperSuites=%s\n\tsupportedProtocols=%s\n\tsupportedChiperSuites=%s\n]",
- getProvider(), getProtocol(),
getDefaultSSLParameters().getNeedClientAuth(),
getDefaultSSLParameters().getWantClientAuth(),
+ hashCode(), getProvider(), getProtocol(),
getDefaultSSLParameters().getNeedClientAuth(),
getDefaultSSLParameters().getWantClientAuth(),
collectionAsCommaDelimitedString(getDefaultSSLParameters().getProtocols()),
collectionAsCommaDelimitedString(getDefaultSSLParameters().getCipherSuites()),
collectionAsCommaDelimitedString(getSupportedSSLParameters().getProtocols()),
@@ -776,6 +866,7 @@ public abstract class BaseSSLContextPara
@Override
protected SSLEngine engineCreateSSLEngine() {
SSLEngine engine = this.context.createSSLEngine();
+ LOG.debug("SSLEngine [{}] created from SSLContext [{}].", engine,
context);
this.configureSSLEngine(engine);
return engine;
}
@@ -783,6 +874,7 @@ public abstract class BaseSSLContextPara
@Override
protected SSLEngine engineCreateSSLEngine(String peerHost, int
peerPort) {
SSLEngine engine = this.context.createSSLEngine(peerHost,
peerPort);
+ LOG.debug("SSLEngine [{}] created from SSLContext [{}].", engine,
context);
return this.configureSSLEngine(engine);
}
@@ -799,12 +891,14 @@ public abstract class BaseSSLContextPara
@Override
protected SSLServerSocketFactory engineGetServerSocketFactory() {
SSLServerSocketFactory factory =
this.context.getServerSocketFactory();
+ LOG.debug("SSLServerSocketFactoryEngine [{}] created from
SSLContext [{}].", factory, context);
return this.configureSSLServerSocketFactory(factory);
}
@Override
protected SSLSocketFactory engineGetSocketFactory() {
- SSLSocketFactory factory = this.context.getSocketFactory();
+ SSLSocketFactory factory = this.context.getSocketFactory();
+ LOG.debug("SSLSocketFactory [{}] created from SSLContext [{}].",
factory, context);
return this.configureSSLSocketFactory(factory);
}
@@ -932,6 +1026,8 @@ public abstract class BaseSSLContextPara
private ServerSocket configureSocket(ServerSocket s) {
SSLServerSocket workingSocket = (SSLServerSocket) s;
+
+ LOG.debug("Created ServerSocket [{}] from SslServerSocketFactory
[{}].", s, sslServerSocketFactory);
for (Configurer<SSLServerSocket> configurer :
this.sslServerSocketConfigurers) {
workingSocket = configurer.configure(workingSocket);
@@ -1006,6 +1102,8 @@ public abstract class BaseSSLContextPara
private Socket configureSocket(Socket s) {
SSLSocket workingSocket = (SSLSocket) s;
+
+ LOG.debug("Created Socket [{}] from SocketFactory [{}].", s,
sslSocketFactory);
for (Configurer<SSLSocket> configurer : this.sslSocketConfigurers)
{
workingSocket = configurer.configure(workingSocket);
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/FilterParameters.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/FilterParameters.java?rev=1352270&r1=1352269&r2=1352270&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/FilterParameters.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/FilterParameters.java
Wed Jun 20 19:16:21 2012
@@ -126,7 +126,18 @@ public class FilterParameters extends Js
public List<Pattern> getExcludes() {
return excludes;
- }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Patterns [includes=");
+ builder.append(includes);
+ builder.append(", excludes=");
+ builder.append(excludes);
+ builder.append("]");
+ return builder.toString();
+ }
}
@Override
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/JsseParameters.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/JsseParameters.java?rev=1352270&r1=1352269&r2=1352270&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/JsseParameters.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/JsseParameters.java
Wed Jun 20 19:16:21 2012
@@ -121,54 +121,60 @@ public class JsseParameters implements C
InputStream is = null;
try {
- LOG.trace("Trying to open resource as a file.");
+ LOG.trace("Trying to open resource [{}] as a file.", resource);
is = new FileInputStream(resource);
- LOG.debug("Loaded resource as file {}", resource);
+ LOG.debug("Opened resource [{}] as a file.", resource);
} catch (FileNotFoundException e) {
- LOG.trace("Could not open resource as a file.", e);
+ LOG.trace("Could not open resource [" + resource + "] as a file.",
e);
}
if (is == null && Thread.currentThread().getContextClassLoader() !=
null) {
- LOG.trace("Trying to open resource as a class path resource with
the TCCL {}.",
- Thread.currentThread().getContextClassLoader());
+ LOG.trace("Trying to open resource [{}] as a class path resource
with the TCCL [{}].",
+ resource,
Thread.currentThread().getContextClassLoader());
is =
Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
+
if (is == null) {
- LOG.trace("Could not open resource as a class path resource
using the TCCL {}.",
- Thread.currentThread().getContextClassLoader());
+ LOG.trace("Could not open resource [{}] as a class path
resource using the TCCL [{}].",
+ resource,
Thread.currentThread().getContextClassLoader());
} else {
- LOG.debug("Loaded resource from TCCL ClassLoader {}",
resource);
+ LOG.debug("Opened resource [{}] as a class path resource with
the TCCL [{}].",
+ resource,
Thread.currentThread().getContextClassLoader());
}
}
if (is == null) {
- LOG.trace("Trying to open resource as a class path resource using
the classloader {}.",
+ LOG.trace("Trying to open resource [{}] as a class path resource
using the classloader [{}].",
this.getClass().getClassLoader());
is = this.getClass().getResourceAsStream(resource);
+
if (is == null) {
- LOG.trace("Could not open resource as a class path resource
using the classloader {}.",
- this.getClass().getClassLoader());
+ LOG.trace("Could not open resource [{}] as a class path
resource using the classloader [{}].",
+ resource, this.getClass().getClassLoader());
} else {
- LOG.debug("Loaded resource from JsseParameter ClassLoader {}",
resource);
+ LOG.debug("Opened resource [{}] as a class path resource with
the classloader [{}].",
+ resource, this.getClass().getClassLoader());
}
}
if (is == null) {
try {
- LOG.trace("Trying to open resource as a URL.");
+ LOG.trace("Trying to open resource [{}] as a URL.", resource);
is = new URL(resource).openStream();
- LOG.debug("Loaded resource as URL {}", resource);
+ LOG.debug("Opened resource [{}] as a URL.", resource);
} catch (IOException e) {
- LOG.trace("Could not open resource as a URL", e);
+ LOG.trace("Could not open resource [" + resource + "] as a
URL.", e);
}
}
if (is == null && this.context != null) {
- LOG.trace("Trying to open resource using the CamelContext
ClassResolver {}", context.getClassResolver());
+ LOG.trace("Trying to open resource using the CamelContext
ClassResolver [{}].", context.getClassResolver());
is = context.getClassResolver().loadResourceAsStream(resource);
if (is == null) {
- LOG.trace("Could not to open resource using the CamelContext
ClassResolver {}.", context.getClassResolver());
+ LOG.trace("Could not to open resource [{}] using the
CamelContext ClassResolver [{}].",
+ resource, context.getClassResolver());
} else {
- LOG.debug("Loaded resource using the CamelContext
ClassResolver {}", resource);
+ LOG.debug("Opened resource [{}] using the CamelContext
ClassResolver [{}].",
+ resource, this.getClass().getClassLoader());
}
}
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyManagersParameters.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyManagersParameters.java?rev=1352270&r1=1352269&r2=1352270&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyManagersParameters.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyManagersParameters.java
Wed Jun 20 19:16:21 2012
@@ -81,10 +81,10 @@ public class KeyManagersParameters exten
*/
public KeyManager[] createKeyManagers() throws GeneralSecurityException,
IOException {
- LOG.debug("Creating KeyManager[] from KeyManagersParameters: {}",
this);
+ LOG.trace("Creating KeyManager[] from KeyManagersParameters [{}].",
this);
KeyManager[] keyManagers;
-
+
String kmfAlgorithm = this.parsePropertyValue(this.getAlgorithm());
if (kmfAlgorithm == null) {
kmfAlgorithm = KeyManagerFactory.getDefaultAlgorithm();
@@ -96,7 +96,9 @@ public class KeyManagersParameters exten
} else {
kmf = KeyManagerFactory.getInstance(kmfAlgorithm,
this.parsePropertyValue(this.getProvider()));
}
-
+
+ LOG.debug("KeyManagerFactory [{}], initialized from [{}], is using
provider [{}] and algorithm [{}].",
+ new Object[] {kmf, this, kmf.getProvider(),
kmf.getAlgorithm()});
char[] kmfPassword = null;
if (this.getKeyPassword() != null) {
@@ -108,6 +110,8 @@ public class KeyManagersParameters exten
kmf.init(ks, kmfPassword);
keyManagers = kmf.getKeyManagers();
+ LOG.debug("KeyManager[] [{}], initialized from KeyManagerFactory
[{}].", keyManagers, kmf);
+
return keyManagers;
}
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyStoreParameters.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyStoreParameters.java?rev=1352270&r1=1352269&r2=1352270&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyStoreParameters.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyStoreParameters.java
Wed Jun 20 19:16:21 2012
@@ -21,6 +21,9 @@ import java.io.InputStream;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.Security;
+import java.util.Enumeration;
+import java.util.LinkedList;
+import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -146,7 +149,7 @@ public class KeyStoreParameters extends
* resource to an input stream
*/
public KeyStore createKeyStore() throws GeneralSecurityException,
IOException {
- LOG.debug("Creating KeyStore instance from KeyStoreParameters: {}",
this);
+ LOG.trace("Creating KeyStore instance from KeyStoreParameters [{}].",
this);
String ksType = this.parsePropertyValue(this.type);
if (ksType == null) {
@@ -164,14 +167,26 @@ public class KeyStoreParameters extends
} else {
ks = KeyStore.getInstance(ksType,
this.parsePropertyValue(this.provider));
}
-
+
if (this.resource == null) {
ks.load(null, ksPassword);
} else {
InputStream is =
this.resolveResource(this.parsePropertyValue(this.resource));
ks.load(is, ksPassword);
}
-
+
+ if (LOG.isDebugEnabled()) {
+ List<String> aliases = new LinkedList<String>();
+
+ Enumeration<String> aliasEnum = ks.aliases();
+ while (aliasEnum.hasMoreElements()) {
+ aliases.add(aliasEnum.nextElement());
+ }
+
+ LOG.debug("KeyStore [{}], initialized from [{}], is using provider
[{}], has type [{}], and contains aliases {}.",
+ new Object[] {ks, this, ks.getProvider(), ks.getType(),
aliases});
+ }
+
return ks;
}
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java?rev=1352270&r1=1352269&r2=1352270&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java
Wed Jun 20 19:16:21 2012
@@ -41,12 +41,12 @@ public class SSLContextClientParameters
@Override
protected void configureSSLContext(SSLContext context) throws
GeneralSecurityException {
- LOG.trace("Configuring client-side SSLContext parameters...");
+ LOG.trace("Configuring client-side SSLContext parameters on SSLContext
[{}]...", context);
if (this.getSessionTimeout() != null) {
- LOG.debug("Configuring client-side SSLContext session timeout: " +
this.getSessionTimeout());
+ LOG.info("Configuring client-side SSLContext session timeout on
SSLContext [{}] to [{}].", context, this.getSessionTimeout());
this.configureSessionContext(context.getClientSessionContext(),
this.getSessionTimeout());
}
- LOG.trace("Configured client-side SSLContext parameters.");
+ LOG.trace("Configured client-side SSLContext parameters on SSLContext
[{}].", context);
}
/**
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java?rev=1352270&r1=1352269&r2=1352270&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java
Wed Jun 20 19:16:21 2012
@@ -229,7 +229,9 @@ public class SSLContextParameters extend
*/
public SSLContext createSSLContext() throws GeneralSecurityException,
IOException {
- LOG.trace("Creating SSLContext from SSLContextParameters: {}", this);
+ LOG.trace("Creating SSLContext from SSLContextParameters [{}].", this);
+
+ LOG.info("Available providers: {}.", Security.getProviders());
KeyManager[] keyManagers = this.keyManagers == null ? null :
this.keyManagers.createKeyManagers();
TrustManager[] trustManagers = this.trustManagers == null ? null :
this.trustManagers.createTrustManagers();
@@ -243,6 +245,9 @@ public class SSLContextParameters extend
this.parsePropertyValue(this.getProvider()));
}
+ LOG.debug("SSLContext [{}], initialized from [{}], is using provider
[{}], protocol [{}], key managers {}, trust managers {}, and secure random
[{}].",
+ new Object[] {context, this, context.getProvider(),
context.getProtocol(), keyManagers, trustManagers, secureRandom});
+
context.init(keyManagers, trustManagers, secureRandom);
this.configureSSLContext(context);
@@ -254,74 +259,80 @@ public class SSLContextParameters extend
this.getSSLEngineConfigurers(context),
this.getSSLSocketFactoryConfigurers(context),
this.getSSLServerSocketFactoryConfigurers(context)));
- LOG.debug("Created {}", context);
+
return context;
}
@Override
protected void configureSSLContext(SSLContext context) throws
GeneralSecurityException {
- LOG.trace("Configuring client and server side SSLContext
parameters...");
+ LOG.trace("Configuring client and server side SSLContext parameters on
SSLContext [{}]...", context);
super.configureSSLContext(context);
if (this.getClientParameters() != null) {
- LOG.trace("Overriding client-side SSLContext parameters with
configured client parameters.");
+ LOG.trace("Overriding client-side SSLContext parameters on
SSLContext [{}] with configured client parameters.",
+ context);
this.getClientParameters().configureSSLContext(context);
}
if (this.getServerParameters() != null) {
- LOG.trace("Overriding server-side SSLContext parameters with
configured server parameters.");
+ LOG.trace("Overriding server-side SSLContext parameters on
SSLContext [{}] with configured server parameters.",
+ context);
this.getServerParameters().configureSSLContext(context);
}
- LOG.trace("Configured client and server side SSLContext parameters.");
+ LOG.trace("Configured client and server side SSLContext parameters on
SSLContext [{}].", context);
}
@Override
protected List<Configurer<SSLEngine>> getSSLEngineConfigurers(SSLContext
context) {
- LOG.trace("Collecting client and server side SSLEngine
configurers...");
+ LOG.trace("Collecting client and server side SSLEngine configurers on
SSLContext [{}]...", context);
List<Configurer<SSLEngine>> configurers =
super.getSSLEngineConfigurers(context);
if (this.getClientParameters() != null) {
- LOG.trace("Augmenting SSLEngine configurers with configurers from
client parameters.");
+ LOG.trace("Augmenting SSLEngine configurers with configurers from
client parameters on SSLContext [{}].",
+ context);
configurers.addAll(this.getClientParameters().getSSLEngineConfigurers(context));
}
if (this.getServerParameters() != null) {
- LOG.trace("Augmenting SSLEngine configurers with configurers from
server parameters.");
+ LOG.trace("Augmenting SSLEngine configurers with configurers from
server parameters on SSLContext [{}].",
+ context);
configurers.addAll(this.getServerParameters().getSSLEngineConfigurers(context));
}
- LOG.trace("Collected client and server side SSLEngine configurers.");
+ LOG.trace("Collected client and server side SSLEngine configurers on
SSLContext [{}].", context);
return configurers;
}
@Override
protected List<Configurer<SSLSocketFactory>>
getSSLSocketFactoryConfigurers(SSLContext context) {
- LOG.trace("Collecting SSLSocketFactory configurers...");
+ LOG.trace("Collecting SSLSocketFactory configurers on SSLContext
[{}]...", context);
List<Configurer<SSLSocketFactory>> configurers =
super.getSSLSocketFactoryConfigurers(context);
if (this.getClientParameters() != null) {
- LOG.trace("Augmenting SSLSocketFactory configurers with
configurers from client parameters.");
+ LOG.trace("Augmenting SSLSocketFactory configurers with
configurers from client parameters on SSLContext [{}].",
+ context);
configurers.addAll(this.getClientParameters().getSSLSocketFactoryConfigurers(context));
}
- LOG.trace("Collected SSLSocketFactory configurers.");
+ LOG.trace("Collected SSLSocketFactory configurers on SSLContext
[{}].", context);
return configurers;
}
@Override
protected List<Configurer<SSLServerSocketFactory>>
getSSLServerSocketFactoryConfigurers(SSLContext context) {
- LOG.trace("Collecting SSLServerSocketFactory configurers...");
+ LOG.trace("Collecting SSLServerSocketFactory configurers for
SSLContext [{}]...", context);
List<Configurer<SSLServerSocketFactory>> configurers =
super.getSSLServerSocketFactoryConfigurers(context);
if (this.getServerParameters() != null) {
- LOG.trace("Augmenting SSLServerSocketFactory configurers with
configurers from server parameters.");
+ LOG.trace("Augmenting SSLServerSocketFactory configurers with
configurers from server parameters for SSLContext [{}].",
+ context);
configurers.addAll(this.getServerParameters().getSSLServerSocketFactoryConfigurers(context));
}
- LOG.trace("Collected client and server side SSLServerSocketFactory
configurers.");
+ LOG.trace("Collected client and server side SSLServerSocketFactory
configurers for SSLContext [{}].", context);
return configurers;
}
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextServerParameters.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextServerParameters.java?rev=1352270&r1=1352269&r2=1352270&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextServerParameters.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextServerParameters.java
Wed Jun 20 19:16:21 2012
@@ -63,12 +63,12 @@ public class SSLContextServerParameters
@Override
protected void configureSSLContext(SSLContext context) throws
GeneralSecurityException {
- LOG.trace("Configuring server-side SSLContext parameters...");
+ LOG.trace("Configuring server-side SSLContext parameters on SSLContext
[{}]...", context);
if (this.getSessionTimeout() != null) {
- LOG.debug("Configuring server-side SSLContext session timeout: " +
this.getSessionTimeout());
+ LOG.debug("Configuring server-side SSLContext session timeout on
SSLContext [{}] to [{}].", context, this.getSessionTimeout());
this.configureSessionContext(context.getServerSessionContext(),
this.getSessionTimeout());
}
- LOG.trace("Configured server-side SSLContext parameters.");
+ LOG.trace("Configured server-side SSLContext parameters on SSLContext
[{}].", context);
}
/**
@@ -97,6 +97,7 @@ public class SSLContextServerParameters
Configurer<SSLEngine> sslEngineConfigurer = new
Configurer<SSLEngine>() {
@Override
public SSLEngine configure(SSLEngine engine) {
+ LOG.info("Configuring client-auth on SSLEngine [{}] to
[{}].", engine, clientAuthValue);
switch (clientAuthValue) {
case NONE:
engine.setWantClientAuth(false);
@@ -135,6 +136,7 @@ public class SSLContextServerParameters
Configurer<SSLServerSocket> sslServerSocketConfigurer = new
Configurer<SSLServerSocket>() {
@Override
public SSLServerSocket configure(SSLServerSocket socket) {
+ LOG.info("Configuring client-auth on SSLServerSocket [{}]
to [{}].", socket, clientAuthValue);
switch (clientAuthValue) {
case NONE:
socket.setWantClientAuth(false);
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SecureRandomParameters.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SecureRandomParameters.java?rev=1352270&r1=1352269&r2=1352270&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SecureRandomParameters.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SecureRandomParameters.java
Wed Jun 20 19:16:21 2012
@@ -65,6 +65,9 @@ public class SecureRandomParameters exte
} else {
secureRandom =
SecureRandom.getInstance(this.parsePropertyValue(this.getAlgorithm()));
}
+
+ LOG.debug("SecureRandom [{}] is using provider [{}] and algorithm
[{}].",
+ new Object[] {secureRandom, secureRandom.getProvider(),
secureRandom.getAlgorithm()});
return secureRandom;
}
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/TrustManagersParameters.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/TrustManagersParameters.java?rev=1352270&r1=1352269&r2=1352270&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/TrustManagersParameters.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/TrustManagersParameters.java
Wed Jun 20 19:16:21 2012
@@ -71,7 +71,7 @@ public class TrustManagersParameters ext
*/
public TrustManager[] createTrustManagers() throws
GeneralSecurityException, IOException {
- LOG.trace("Creating TrustManager[] from TrustManagersParameters: {}",
this);
+ LOG.trace("Creating TrustManager[] from TrustManagersParameters [{}]",
this);
TrustManager[] trustManagers = null;
@@ -88,9 +88,14 @@ public class TrustManagersParameters ext
tmf = TrustManagerFactory.getInstance(tmfAlgorithm,
this.parsePropertyValue(this.getProvider()));
}
+ LOG.debug("TrustManagerFactory [{}] is using provider [{}] and
algorithm [{}].",
+ new Object[] {tmf, tmf.getProvider(),
tmf.getAlgorithm()});
+
KeyStore ks = this.getKeyStore() == null ? null :
this.getKeyStore().createKeyStore();
tmf.init(ks);
trustManagers = tmf.getTrustManagers();
+
+ LOG.debug("TrustManager[] [{}], initialized from
TrustManagerFactory [{}].", trustManagers, tmf);
}
return trustManagers;
Modified: camel/trunk/camel-core/src/test/resources/log4j.properties
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/resources/log4j.properties?rev=1352270&r1=1352269&r2=1352270&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/resources/log4j.properties (original)
+++ camel/trunk/camel-core/src/test/resources/log4j.properties Wed Jun 20
19:16:21 2012
@@ -50,6 +50,7 @@ log4j.logger.org.apache.camel.impl.Defau
#log4j.logger.org.apache.camel.util.FileUtil=TRACE
#log4j.logger.org.apache.camel.util.AsyncProcessorHelper=TRACE
#log4j.logger.org.apache.camel.util.ServiceHelper=TRACE
+#log4j.logger.org.apache.camel.util.jsse=TRACE
# CONSOLE appender not used by default
log4j.appender.out=org.apache.log4j.ConsoleAppender