Skip to content
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

Add jwt auth #27

Merged
merged 7 commits into from
Feb 1, 2024
Merged

Add jwt auth #27

merged 7 commits into from
Feb 1, 2024

Conversation

Jarema
Copy link
Member

@Jarema Jarema commented Jan 25, 2024

Signed-off-by: Tomasz Pietrek tomasz@nats.io

Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
@Jarema Jarema requested a review from piotrpio January 25, 2024 09:35
Copy link
Contributor

@piotrpio piotrpio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, some suggestions

@@ -32,6 +37,11 @@ public struct Auth {
init(token: String) {
self.token = token
}
static func fromCredentials(_ credentials: URL) -> Auth {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not another init(credentials: URL). Same as for token and user/password

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that will not work anyway... we will have also NKEYS, callback, etc. I wonder if we will have enough diversity in types to use init with bunch of overloads. But yeah - either we should move away from inits, or try to use it everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@piotrpio let's leave it as it is, and we will figure out soon how to handle it when we have all auth methods.

Sources/NatsSwift/NatsConnection.swift Outdated Show resolved Hide resolved
Sources/NatsSwift/NatsJwtUtils.swift Outdated Show resolved Hide resolved
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Copy link
Contributor

@piotrpio piotrpio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Jarema Jarema merged commit 4f96d21 into main Feb 1, 2024
1 check passed
@Jarema Jarema deleted the add-jwt-auth branch February 1, 2024 11:09
@piotrpio piotrpio mentioned this pull request Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants