-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Not forcing Mauth, avoid performance on empty scenarios and find more…
… scenarios
- Loading branch information
Showing
5 changed files
with
28 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "minos" | ||
version = "0.3.1" | ||
version = "0.3.3" | ||
authors = ["Jordi Polo Carres <[email protected]>"] | ||
description = """ | ||
Minos is a command line tool to generate and run scenarios against | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
use mauth_client::*; | ||
use tracing::info; | ||
|
||
pub struct Authentication { | ||
mauth_info: mauth_client::MAuthInfo | ||
mauth_info: Option<mauth_client::MAuthInfo> | ||
} | ||
|
||
impl Authentication { | ||
pub fn new() -> Self { | ||
let auth = match MAuthInfo::from_default_file() { | ||
Err(_) => { | ||
info!("Mauth file not found on ~/.mauth_config.yml or incorrect format."); | ||
None | ||
}, | ||
Ok(file) => Some(file) | ||
}; | ||
Authentication { | ||
mauth_info: MAuthInfo::from_default_file().expect("Mauth file missing") | ||
mauth_info: auth | ||
} | ||
} | ||
pub fn authenticate(&self, mut requ: &mut hyper::Request<hyper::Body>) { | ||
// on empty body we digest "" TODO: Support request bodies | ||
let (_, body_digest) = MAuthInfo::build_body_with_digest("".to_string()); | ||
self.mauth_info.sign_request_v2(&mut requ, &body_digest); | ||
self.mauth_info.sign_request_v1(&mut requ, &body_digest); | ||
} | ||
} | ||
|
||
/* | ||
pub struct Authentication {} | ||
impl Authentication { | ||
pub fn new() -> Self { | ||
Authentication {} | ||
if let Some(mauth_info) = &self.mauth_info { | ||
// on empty body we digest "" TODO: Support request bodies | ||
let (_, body_digest) = MAuthInfo::build_body_with_digest("".to_string()); | ||
mauth_info.sign_request_v2(&mut requ, &body_digest); | ||
mauth_info.sign_request_v1(&mut requ, &body_digest); | ||
} | ||
} | ||
pub fn authenticate(&self, mut _requ: &mut hyper::Request<hyper::Body>) {} | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters