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 support for auth in URL #670

Merged
merged 14 commits into from
Nov 5, 2024
Merged

Add support for auth in URL #670

merged 14 commits into from
Nov 5, 2024

Conversation

Mrxx99
Copy link
Contributor

@Mrxx99 Mrxx99 commented Nov 2, 2024

@mtmk As discussed, here is the PR for support for Auth in URL, I also made it to support token in URL, since if it works with username + password, I think users would also expect for it to work with a token.

Aspire PR that will uses this: dotnet/aspire#6259

Note: some Serializer unit test were already failing before I made changes.

@mtmk
Copy link
Collaborator

mtmk commented Nov 2, 2024

thanks @Mrxx99 could you please force push signed commits? it#s CNCF requirement we have the commits signed. sorry about the inconvenience :-(

@mtmk
Copy link
Collaborator

mtmk commented Nov 2, 2024

Note: some Serializer unit test were already failing before I made changes.

we have a few flaky tests especially on Windows but I can check if you can let me know which tests aren't passing for you

@Mrxx99 Mrxx99 force-pushed the feature/auth-in-url branch from 17d7d1f to ef8b414 Compare November 2, 2024 15:44
@Mrxx99
Copy link
Contributor Author

Mrxx99 commented Nov 2, 2024

@mtmk commit is signed now

@Mrxx99
Copy link
Contributor Author

Mrxx99 commented Nov 2, 2024

Note: some Serializer unit test were already failing before I made changes.

we have a few flaky tests especially on Windows but I can check if you can let me know which tests aren't passing for you

The test ist NATS.Client.Core.Tests.SerializerTest.Utf8_serializer and btw the ConsoleApp sandbox project also fails during serialization.
And the memory tests failed, it seems they need some external program to run.

Copy link
Collaborator

@mtmk mtmk left a comment

Choose a reason for hiding this comment

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

couple of minor comments.

src/NATS.Client.Core/NatsConnection.cs Outdated Show resolved Hide resolved
src/NATS.Client.Core/NatsConnection.cs Outdated Show resolved Hide resolved
@mtmk
Copy link
Collaborator

mtmk commented Nov 2, 2024

Note: some Serializer unit test were already failing before I made changes.

we have a few flaky tests especially on Windows but I can check if you can let me know which tests aren't passing for you

The test ist NATS.Client.Core.Tests.SerializerTest.Utf8_serializer and btw the ConsoleApp sandbox project also fails during serialization. And the memory tests failed, it seems they need some external program to run.

ah, you need nats-server.exe in your PATH

@Mrxx99
Copy link
Contributor Author

Mrxx99 commented Nov 2, 2024

Note: some Serializer unit test were already failing before I made changes.

we have a few flaky tests especially on Windows but I can check if you can let me know which tests aren't passing for you

The test ist NATS.Client.Core.Tests.SerializerTest.Utf8_serializer and btw the ConsoleApp sandbox project also fails during serialization. And the memory tests failed, it seems they need some external program to run.

ah, you need nats-server.exe in your PATH

I have, I figured this out, otherwise most tests would fail.

@mtmk
Copy link
Collaborator

mtmk commented Nov 2, 2024

fyi failing tests might be flappers. I'll rerun them.

@mtmk
Copy link
Collaborator

mtmk commented Nov 2, 2024

@Mrxx99 just added a few tests and did a minor fix in URL user-password rewrite.

mtmk added 3 commits November 3, 2024 06:56
Redact passwords and tokens at the `NatsUri` level to preserve the original
URIs, especially when used in WebSocket connections. This change aims to
maintain backward compatibility and prevent disruptions in WebSocket connections
that may rely on tokens or user-password pairs for proxy-level authentication.
Modified the NatsUri class to store the redacted URI as a string instead of a
Uri object. This change simplifies the ToString method and ensures that sensitive
information like user credentials is consistently redacted for logging purposes.
Redacted string is created once in the ctor and avoiding Uri.ToString() calls
being made everytime it's needed.
@mtmk
Copy link
Collaborator

mtmk commented Nov 4, 2024

@Mrxx99 I moved redaction to NatsUri class to keep the original URLs since I suspect some people might be using this to go through WebSocket proxies.

Copy link
Collaborator

@mtmk mtmk left a comment

Choose a reason for hiding this comment

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

LGTM thanks @Mrxx99

@mtmk mtmk requested a review from scottf November 4, 2024 15:01
src/NATS.Client.Core/NatsConnection.cs Outdated Show resolved Hide resolved
Copy link
Contributor

@scottf scottf left a comment

Choose a reason for hiding this comment

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

LGTM

@mtmk mtmk merged commit aedc9aa into nats-io:main Nov 5, 2024
10 checks passed
mtmk added a commit that referenced this pull request Nov 5, 2024
* Add support for auth in URL (#670)
@mtmk mtmk mentioned this pull request Nov 5, 2024
mtmk added a commit that referenced this pull request Nov 5, 2024
* Add support for auth in URL (#670)
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.

4 participants