-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow tokens in connection strings and add tests #506
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello there! thanks for the PR! with tests too, I like that 😁
Additions look good, some clippy and rustfmt errors.
One thing tho, even if we're pre 1.0 we try to minimize breaking changes and keep the nats crate stable. So we'd probably want to preserve has_user_pass
and introduce something like has_token
?
CC @Jarema
nats/src/connector.rs
Outdated
@@ -603,9 +604,18 @@ impl ServerAddress { | |||
self.0.scheme() == "tls" | |||
} | |||
|
|||
/// Returns if the server url had embedded username and password. | |||
pub fn has_user_pass(&self) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Public method, so probably don't want to be removing that outright.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I didn't mean to remove that. I've added it back.
@paulgb thanks for that PR! Now it IMHO looks good! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks for your contribution!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thank you 💯
Many NATS clients allow for token authentication to be specified in a connection URL by passing a username without a password. This enables that approach, and adds some tests.
If this looks good, I'm happy to make a similar change on the
async_nats
side, either in this PR or in a follow-up as appropriate.