Skip to content

Commit

Permalink
Modify AlpnList if using custom authorizer (#265)
Browse files Browse the repository at this point in the history
* Added code to use mqtt in alpnList if trying to use custom authorizer
* Add back port check to custom authorizer condition
  • Loading branch information
TwistedTwigleg authored Apr 21, 2022
1 parent b33b08c commit c04ce42
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,14 @@ public MqttClientConnection build() {
// This does mean that once you call build() once, modifying the tls context options or client bootstrap
// has no affect on subsequently-created connections.
synchronized(this) {
// Is this going to a custom authorizer at the correct (443) port? If so change the alpnList to "mqtt".
if (config.getUsername() != null) {
if (config.getUsername().contains("x-amz-customauthorizer-name") && config.getPort() == 443) {
tlsOptions.alpnList.clear();
tlsOptions.alpnList.add("mqtt");
}
}

if (tlsOptions != null && (tlsContext == null || resetLazilyCreatedResources)) {
try (ClientTlsContext clientTlsContext = new ClientTlsContext(tlsOptions)) {
swapReferenceTo(tlsContext, clientTlsContext);
Expand Down

0 comments on commit c04ce42

Please sign in to comment.