pub struct ServiceAccount { /* private fields */ }Expand description
An EXTERNAL service account, authenticated with one of its keys: an
assertion signed with the key from its credentials file (RFC 7523,
ES256) is exchanged at the security token service for the account’s
access token, which is reused until a minute before it expires. Callers
that need a token while it is being renewed wait for that renewal and
share its token.
On wasm32-unknown-unknown it exists only with the feature
service-account-wasm, for runtimes that aren’t a browser: a web
page, and a Web Worker too, is shipped to whoever loads it, private key
and all.
Implementations§
Source§impl ServiceAccount
impl ServiceAccount
Sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self, Error>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self, Error>
The service account whose key’s credentials file is at path.
Sourcepub fn from_json(json: impl AsRef<[u8]>) -> Result<Self, Error>
pub fn from_json(json: impl AsRef<[u8]>) -> Result<Self, Error>
The service account whose key’s credentials file is json, such as
the credentialsFile a key’s creation answers with.
Sourcepub fn service_account(&self) -> &str
pub fn service_account(&self) -> &str
The service account’s full name, as the file names it.
Sourcepub fn with_http_client(self, http: Client) -> Self
pub fn with_http_client(self, http: Client) -> Self
Sends the token requests with http, instead of the client all
credentials share. Each request is bounded by 30 seconds either way.
Trait Implementations§
Source§impl Credentials for ServiceAccount
Available on crate feature service-account-wasm or non-WebAssembly only.
impl Credentials for ServiceAccount
service-account-wasm or non-WebAssembly only.