pub struct Credential { /* private fields */ }Expand description
An implementation of crate::credentials::CredentialTrait.
Represents a Credential used to obtain auth Tokens and the corresponding request headers.
In general, Credentials are “digital object that provide proof of identity”, the archetype may be a username and password combination, but a private RSA key may be a better example.
Modern authentication protocols do not send the credentials to authenticate with a service. Even when sent over encrypted transports, the credentials may be accidentally exposed via logging or may be captured if there are errors in the transport encryption. Because the credentials are often long-lived, that risk of exposure is also long-lived.
Instead, modern authentication protocols exchange the credentials for a time-limited Token, a digital object that shows the caller was in possession of the credentials. Because tokens are time limited, risk of misuse is also time limited. Tokens may be further restricted to only a certain subset of the RPCs in the service, or even to specific resources, or only when used from a given machine (virtual or not). Further limiting the risks associated with any leaks of these tokens.
This struct also abstracts token sources that are not backed by a specific digital object. The canonical example is the Metadata Service. This service is available in many Google Cloud environments, including Google Compute Engine, and Google Kubernetes Engine.
Implementations§
Source§impl Credential
impl Credential
pub async fn get_token(&self) -> Result<Token, CredentialError>
pub async fn get_headers( &self, ) -> Result<Vec<(HeaderName, HeaderValue)>, CredentialError>
pub async fn get_universe_domain(&self) -> Option<String>
Trait Implementations§
Source§impl Clone for Credential
impl Clone for Credential
Source§fn clone(&self) -> Credential
fn clone(&self) -> Credential
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more