8000 Emit a warning in NullTrustManager · xingly/rabbitmq-java-client@aa93b13 · GitHub
[go: up one dir, main page]

Skip to content

Commit aa93b13

Browse files
committed
Emit a warning in NullTrustManager
Fixes rabbitmq#230
1 parent 11f3668 commit aa93b13

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/java/com/rabbitmq/client/NullTrustManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.rabbitmq.client;
1818

19+
import org.slf4j.LoggerFactory;
20+
1921
import java.security.cert.X509Certificate;
2022

2123
import javax.net.ssl.X509TrustManager;
@@ -25,6 +27,15 @@
2527
* Trusts every single certificate presented to it.
2628
*/
2729
public class NullTrustManager implements X509TrustManager {
30+
31+
public NullTrustManager() {
32+
LoggerFactory.getLogger(NullTrustManager.class).warn(
33+
"This trust manager trusts every certificate, making peer hostname verification disabled. " +
34+
"This is convenient for local development but prone to man-in-the-middle attacks. " +
35+
"Please see http://www.rabbitmq.com/ssl.html#validating-cerficates to validate server certificates."
36+
);
37+
}
38+
2839
/**
2940
* Doesn't even bother looking at its arguments, simply returns,
3041
* which makes the check succeed.

0 commit comments

Comments
 (0)
0