From e8f3c3534c5ef009c8863cee7674df0aa604a913 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Mon, 25 Jan 2010 11:50:08 +0000 Subject: [PATCH] Some warning message to confirm that certificate authentication really took place --- .../securechat/SecureChatTrustManagerFactory.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jboss/netty/example/securechat/SecureChatTrustManagerFactory.java b/src/main/java/org/jboss/netty/example/securechat/SecureChatTrustManagerFactory.java index 8a6a5381df..adc7d9cec6 100644 --- a/src/main/java/org/jboss/netty/example/securechat/SecureChatTrustManagerFactory.java +++ b/src/main/java/org/jboss/netty/example/securechat/SecureChatTrustManagerFactory.java @@ -43,15 +43,20 @@ public class SecureChatTrustManagerFactory extends TrustManagerFactorySpi { } public void checkClientTrusted( - X509Certificate[] arg0, String arg1) throws CertificateException { + X509Certificate[] chain, String authType) throws CertificateException { // Always trust - it is an example. // You should do something in the real world. + // You will reach here only if you enabled client certificate auth. + System.err.println( + "UNKNOWN CLIENT CERTIFICATE: " + chain[0].getSubjectDN()); } public void checkServerTrusted( - X509Certificate[] arg0, String arg1) throws CertificateException { + X509Certificate[] chain, String authType) throws CertificateException { // Always trust - it is an example. // You should do something in the real world. + System.err.println( + "UNKNOWN SERVER CERTIFICATE: " + chain[0].getSubjectDN()); } };