-
Notifications
You must be signed in to change notification settings - Fork 595
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
feat(stream): add nkey and jwt auth methods for nats connector #12227
Conversation
ecae04e
to
9c9871e
Compare
Thanks Yufan! I wonder how did you test this functionality? There is no unit test nor intergation test. |
Yeah, I have checked other intergration test code, will add it like others. For unit test, currently the nats logic is not complex. I didn't find too much nessesary to add it. What do you think? I think it may take several days to write the test code. So after finishing this PR and that PR, and no more urgent feature appears, I will work in the test parts. |
lets do some validation before merging into main |
Codecov Report
@@ Coverage Diff @@
## main #12227 +/- ##
==========================================
- Coverage 69.85% 69.83% -0.03%
==========================================
Files 1417 1417
Lines 235533 235599 +66
==========================================
- Hits 164533 164531 -2
- Misses 71000 71068 +68
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I just want to ensure there is manual testing at least. Once developed, we don't expect extra back-and-forth communication with users |
…liest, by timestamp (#12176)
src/connector/src/common.rs
Outdated
#[serde(rename = "nats.connect_mode")] | ||
pub connect_mode: Option<String>, | ||
#[serde(rename = "username")] | ||
pub user: Option<String>, | ||
#[serde(rename = "nats.password")] | ||
#[serde(rename = "password")] | ||
pub password: Option<String>, | ||
#[serde(rename = "nats.jwt")] | ||
pub jwt: Option<String>, | ||
#[serde(rename = "nats.nkey")] | ||
pub nkey: Option<String>, |
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.
I wanted to propose stripping off all 'nats.' or 'cassandra.' prefixes given that it has been specified in 'connector'.
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.
removed.
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.
rest LGTM, good work!
src/connector/src/common.rs
Outdated
)); | ||
} | ||
} | ||
_ => {} |
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.
does it mean rw also accepts Nats without auth?
if so, user should connect with 'plain'
or sth else, instead of leaving it empty.
also, we need to reject unrecognized string here.
"-----BEGIN NATS USER JWT-----\n{}\n------END NATS USER JWT------\n\n\ | ||
************************* IMPORTANT *************************\n\ | ||
NKEY Seed printed below can be used to sign and prove identity.\n\ | ||
NKEYs are sensitive and should be treated as secrets.\n\n\ | ||
-----BEGIN USER NKEY SEED-----\n{}\n------END USER NKEY SEED------\n\n\ | ||
*************************************************************", |
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.
incredible the func need the format
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.
Yes, this is what the nats documents said, and also what syntropy told me
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.
Cargo.lock changes are related to the nats dependency. LGTM!
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
This PR try to refactor the nats client connection code and add some new methods (credential) to connect. The nats rust package support it here.
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.
Add filed:
connect_mode
, value can beuser_and_password
,credential
orplain
.When use
credential
, need to filljwt
andnkey
When use
user_and_password
need to fildusername
andpassword
If
plain
, no extra filed required.code example: