-
Notifications
You must be signed in to change notification settings - Fork 30
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
Auth token #248
Auth token #248
Conversation
…me `&mut self`; updated the `fetch_namespace` to only check local namespace map if operator log does not map the namespace
let url = RegistryUrl::new(url)?; | ||
Ok(Self { | ||
url, | ||
client: reqwest::Client::new(), | ||
warg_registry_header: None, | ||
auth_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 recommend using https://docs.rs/reqwest/0.11.24/reqwest/struct.ClientBuilder.html#method.default_headers to replace all the changes in this file. The first example in the method docs there is basically what you would need (plus prepending Bearer
to the value).
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.
There's a tradeoff on using the default_headers
for the Client
, where you might accidentally provide the auth header on a request that shouldn't have it. For instance, on the upload and download requests which may be URLs on a different host server that shouldn't have access to the auth secret.
It might be safer to forget the auth header on a request than to accidentally leak a secret. Thoughts?
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.
Think I agree with Calvin here... though if there's something in the middle, the default headers is definitely a smaller change. Went ahead and pushed the other suggestions.
This PR adds login and logout commands to add or delete auth tokens to your keyring and then adds them as bearer tokens to requests made to your warg server