nats-io / nats.java

Java client for NATS
Apache License 2.0
563 stars 153 forks source link

Add fix to be able to use NKey + Seed auth handler and username + pas… #1138

Closed ryad-eldajani closed 3 months ago

ryad-eldajani commented 3 months ago

Updated PR based on discussion in https://github.com/nats-io/nats.java/pull/1129

When trying to connect to a NATS server with Auth Callout, the client may be required to use a combination of an auth handler (NKey + Seed) plus user info (username + password). Currently, only either auth handler or user info is append in the options when building the client options string.

AuthHandler authHandler = Nats.staticCredentials(jwt, nkey); Options connectOptions = Options.builder() .server(serverUri) .authHandler(authHandler) .userInfo(username, password)
.build();

This PR fixes the behavior in the client options to allow the usage of an auth handler in combination with username and password.

ryad-eldajani commented 3 months ago

Dear @scottf thanks for your review. Is there something missing or anything I can do to have this merged? Thanks in advance!