Allow executing program to retrieve credentials
* config / authentication: permit to call external program for getting credentials You can add into your ncspot/config.toml like this: ``` creds_username = "mylogin" creds_passeval = "pass my_pass_path_to_spot_password" ``` Or using any password manager who send your password.to stdout. If a newline is detected it will be automatically removed * Move credential commands into separate structure Also add an option for a username command * Document credential commands --------- Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -191,7 +191,17 @@ fn main() -> Result<(), String> {
|
||||
info!("Using cached credentials");
|
||||
c
|
||||
}
|
||||
None => credentials_prompt(None)?,
|
||||
None => {
|
||||
info!("Attempting to resolve credentials via username/password commands");
|
||||
let creds = cfg.values().credentials.clone().unwrap_or_default();
|
||||
|
||||
match (creds.username_cmd, creds.password_cmd) {
|
||||
(Some(username_cmd), Some(password_cmd)) => {
|
||||
authentication::credentials_eval(&username_cmd, &password_cmd)?
|
||||
}
|
||||
_ => credentials_prompt(None)?,
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user