Skip to content

Commit 717d53f

Browse files
committed
Correctly handle trust managers when no trust manager matching the SNI name can be found
This is particularly important when using RabbitMQ with the AMQP 1.0 connector as the vhost is used as SNI name.
1 parent 045aa4e commit 717d53f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

extensions/tls-registry/runtime/src/main/java/io/quarkus/tls/runtime/keystores/ExpiryTrustOptions.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ public TrustManager[] apply(String s) throws Exception {
8484
}
8585

8686
private TrustManager[] getWrappedTrustManagers(TrustManager[] tms) {
87+
// If we do not find any trust managers (for example in the SNI case, where we do not have a trust manager for
88+
// a given name), return `null` and not an empty array.
89+
if (tms == null) {
90+
return null;
91+
}
8792
var wrapped = new TrustManager[tms.length];
8893
for (int i = 0; i < tms.length; i++) {
8994
var manager = tms[i];
@@ -161,4 +166,10 @@ public boolean equals(Object obj) {
161166
}
162167
return false;
163168
}
169+
170+
public String toString() {
171+
return "ExpiryTrustOptions[" +
172+
"delegate=" + delegate + ", " +
173+
"policy=" + policy + ']';
174+
}
164175
}

0 commit comments

Comments
 (0)