pub struct StaticCredentialProvider { /* private fields */ }Expand description
A simple in-memory credential provider backed by a HashMap.
Suitable for testing and development environments. For production use,
implement CredentialProvider with a secure credential store.
§Examples
use rustack_auth::credentials::{CredentialProvider, StaticCredentialProvider};
let provider = StaticCredentialProvider::new(vec![
("AKIAIOSFODNN7EXAMPLE".to_owned(), "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY".to_owned()),
]);
let secret = provider.get_secret_key("AKIAIOSFODNN7EXAMPLE").unwrap();
assert_eq!(secret, "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY");Implementations§
Source§impl StaticCredentialProvider
impl StaticCredentialProvider
Sourcepub fn new(credentials: impl IntoIterator<Item = (String, String)>) -> Self
pub fn new(credentials: impl IntoIterator<Item = (String, String)>) -> Self
Create a new StaticCredentialProvider from an iterable of (access_key_id, secret_key)
pairs.
Trait Implementations§
Source§impl Clone for StaticCredentialProvider
impl Clone for StaticCredentialProvider
Source§fn clone(&self) -> StaticCredentialProvider
fn clone(&self) -> StaticCredentialProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StaticCredentialProvider
impl RefUnwindSafe for StaticCredentialProvider
impl Send for StaticCredentialProvider
impl Sync for StaticCredentialProvider
impl Unpin for StaticCredentialProvider
impl UnsafeUnpin for StaticCredentialProvider
impl UnwindSafe for StaticCredentialProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more