-
Notifications
You must be signed in to change notification settings - Fork 98
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 Digest authentication #176
Conversation
also handle digest auth in session + a little bit of refactoring for auth.rs
Now that |
This reverts commit a635aa6.
also changed Context to be a black box
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.
This looks great! I like that unlike HTTPie it can actually print the intermediary requests.
Sorry for taking so long to review it.
@@ -2197,6 +2244,122 @@ fn warns_if_config_is_invalid() { | |||
.success(); | |||
} | |||
|
|||
#[test] |
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.
Could you additionally write a test against httpbin's digest endpoint, to make sure it works with a real implementation?
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.
Done
@@ -135,11 +135,9 @@ pub struct Cli { | |||
#[structopt(skip)] | |||
pub is_session_read_only: bool, | |||
|
|||
// Currently deprecated in favor of --bearer, un-hide if new auth types are introduced |
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.
We should probably hide --bearer
now
Co-authored-by: Jan Verbeek <jan.verbeek@posteo.nl>
/// Authenticate as USER with PASS. PASS will be prompted if missing. | ||
/// Authenticate as USER with PASS or with token. | ||
/// | ||
/// Use a trailing colon (i.e. `USER:`) to authenticate with just a username. | ||
/// PASS will be prompted if missing. Use a trailing colon (i.e. `USER:`) | ||
/// to authenticate with just a username. | ||
/// | ||
/// if --auth-type=bearer then --auth expects a token | ||
/// {n}{n}{n} | ||
#[structopt(short = "a", long, value_name = "USER[:PASS]")] | ||
#[structopt(short = "a", long, value_name = "USER[:PASS] | token")] |
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'd capitalize TOKEN
here, and write the last line as TOKEN is expected if `--auth-type=bearer`.
.
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.
Done 45af7be
Also introduces a middleware system "inspired" by https://truelayer.com/blog/adding-middleware-support-to-rust-reqwest.
Ticks another item from #4.