Struct imagevault::authentication::ClientCredentialsAuthentication [−][src]
pub struct ClientCredentialsAuthentication { pub access_token: Option<String>, pub valid_to: Option<Instant>, pub impersonate_as: Option<String>, pub roles: Option<Vec<String>>, }
Fields
access_token: Option<String>
valid_to: Option<Instant>
impersonate_as: Option<String>
roles: Option<Vec<String>>
Implementations
Creates a new ClientCredentialAuthentication
Arguments
impersonate_as
- The user (if any) the client should impersonateroles
- A list of roles (if any) that the client should impersonate
Example
use imagevault::authentication::ClientCredentialsAuthentication; // No impersonation // Can also use ClientCredentialsAuthentication::default() let auth = ClientCredentialsAuthentication::new(None, None); // Impersonates user JohnD let auth = ClientCredentialsAuthentication::new( Some("JohnD"), None ); // Impersonates user JohnD and roles Admin and SuperAdmin let auth = ClientCredentialsAuthentication::new( Some("JohnD"), Some(vec!["Admin", "SuperAdmin"]) );
Trait Implementations
fn authenticate<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
client_identity: &'life1 str,
client_secret: &'life2 str,
base_url: &'life3 Url,
reqwest_client: &'life4 Client
) -> Pin<Box<dyn Future<Output = Result<String, ImageVaultError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Self: 'async_trait,
fn authenticate<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
client_identity: &'life1 str,
client_secret: &'life2 str,
base_url: &'life3 Url,
reqwest_client: &'life4 Client
) -> Pin<Box<dyn Future<Output = Result<String, ImageVaultError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Self: 'async_trait,
Authenticate is called from the ImageVault Client
whenever a request requiring authentication is made.
It shouldn’t be called directly. Read more
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl Send for ClientCredentialsAuthentication
impl Sync for ClientCredentialsAuthentication
impl Unpin for ClientCredentialsAuthentication