mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-07 19:16:56 +00:00
client: add Client::set_authentication method
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
2fd5502321
commit
bea97ccce1
@ -133,9 +133,17 @@ impl Client {
|
|||||||
self.auth.lock().unwrap().clone()
|
self.auth.lock().unwrap().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deprecated(note = "use set_authentication instead")]
|
||||||
/// Replace the authentication information with an API token.
|
/// Replace the authentication information with an API token.
|
||||||
pub fn use_api_token(&self, token: Token) {
|
pub fn use_api_token(&self, token: Token) {
|
||||||
*self.auth.lock().unwrap() = Some(Arc::new(token.into()));
|
self.set_authentication(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Replace the currently used authentication.
|
||||||
|
///
|
||||||
|
/// This can be a `Token` or an [`Authentication`](proxmox_login::Authentication).
|
||||||
|
pub fn set_authentication(&self, auth: impl Into<AuthenticationKind>) {
|
||||||
|
*self.auth.lock().unwrap() = Some(Arc::new(auth.into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Drop the current authentication information.
|
/// Drop the current authentication information.
|
||||||
|
Loading…
Reference in New Issue
Block a user