Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.

feat(*): add support for http basic auth to bindle server#165

Merged
vdice merged 3 commits intodeislabs:mainfrom
vdice:feat/bindle-http-auth
Mar 3, 2022
Merged

feat(*): add support for http basic auth to bindle server#165
vdice merged 3 commits intodeislabs:mainfrom
vdice:feat/bindle-http-auth

Conversation

@vdice
Copy link
Copy Markdown
Member

@vdice vdice commented Feb 22, 2022

  • adds support for sending in http basic auth creds for comms with the bindle server
  • also adds support for ignoring bindle server cert errors

Closes #154

  - also adds support for ignoring bindle server cert errors

Signed-off-by: Vaughn Dice <vaughn.dice@fermyon.com>
src/wagi_app.rs Outdated
(Some(bindle_id), None, Some(bindle_url), None) => {
// Cases: got a bindle id and server URL. Can't have a bindir dir or module file.
// No basic http auth creds for bindle server supplied
(Some(bindle_id), None, Some(bindle_url), None, None, None) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This duplicates a considerable amount of code and breaks up the flow of cases even more than it was already broken up (which I admit was quite a bit).

An alternative to consider:

  • Keep the match pattern as it is
  • Write a helper method that matches on the user and password values to create an auth object
  • Use that auth object to create the Bindle client

The perennial problem with this, I know, and something that really vexes me about the Bindle client design, is the auth type being a type-level parameter of the client. The solution is to nick the AnyAuth type from the Hippo CLI and use that as the auth type.

This should be how the Bindle client works by default and I will die on this hill.

Copy link
Copy Markdown
Member Author

@vdice vdice Mar 1, 2022

Choose a reason for hiding this comment

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

Thanks @itowlson. I pushed a commit which refactors things with an approach derived from hippo-cli. I do like how it slims down the CLI config -> emplacing a remote bindle flow, however, I'm anticipating there are still some things to tweak. One: I couldn't figure out how to keep the 'Debug' trait on the structs that use the newly introduced BindleConnectionInfo struct/impl due to the underlying token_manager, so I removed the trait to get things working -- no doubt this isn't ideal 😂. WDYT?

Signed-off-by: Vaughn Dice <vaughn.dice@fermyon.com>
Copy link
Copy Markdown
Contributor

@itowlson itowlson left a comment

Choose a reason for hiding this comment

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

Minor tweaks but otherwise looks really nice and clean

ModuleConfigFile(PathBuf),
StandaloneBindle(PathBuf, bindle::Id),
RemoteBindle(url::Url, bindle::Id),
RemoteBindle(bindle::Id, BindleConnectionInfo),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reverse order of tuple to stay consistent with the StandaloneBindle case

Suggested change
RemoteBindle(bindle::Id, BindleConnectionInfo),
RemoteBindle(BindleConnectionInfo, bindle::Id),

let client = bindle::client::Client::new(bindle_base_url.as_str(), token)?;

self.emplace_bindle(&client, id).await
async fn emplace_remote_bindle(self, id: &bindle::Id, bindle_connection_info: crate::bindle_util::BindleConnectionInfo) -> anyhow::Result<EmplacedHandlerConfiguration> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider reverting arg order to retain consistency with emplace_standalone_bindle

Suggested change
async fn emplace_remote_bindle(self, id: &bindle::Id, bindle_connection_info: crate::bindle_util::BindleConnectionInfo) -> anyhow::Result<EmplacedHandlerConfiguration> {
async fn emplace_remote_bindle(self, bindle_connection_info: crate::bindle_util::BindleConnectionInfo, id: &bindle::Id) -> anyhow::Result<EmplacedHandlerConfiguration> {

…g trait

Signed-off-by: Vaughn Dice <vaughn.dice@fermyon.com>
Copy link
Copy Markdown
Contributor

@itowlson itowlson left a comment

Choose a reason for hiding this comment

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

LGTM

@vdice vdice merged commit b3d1781 into deislabs:main Mar 3, 2022
@vdice vdice deleted the feat/bindle-http-auth branch March 3, 2022 01:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Bindle client authn

2 participants