pub struct Impersonated { /* private fields */ }Expand description
Another credential’s token exchanged at the security token service for
a service account’s (impersonation, RFC 8693): the caller, typically a
person logged in with origin id login, acts as the account, with the
account’s roles alone, and the audit log names both. The STS issues the
token only to a caller granted roles/iam.service-account-token-creator
on the account (or its project or organization), and only for an
EXTERNAL or WORKLOAD account that is active.
The account’s token lives five minutes at most, and is reused until a
minute before it expires; then the underlying credential’s current
token is exchanged again. Callers that need a token while it is being
renewed wait for that renewal and share its token. A refused exchange is
an error naming the account: the caller’s own token is never sent in
its place. An exchange the STS can’t answer right now (503) is sent
again twice.
ClientBuilder::impersonate_service_account,
or ORIGINCLOUD_IMPERSONATE_SERVICE_ACCOUNT, wraps a client’s
credentials in it.
Implementations§
Source§impl Impersonated
impl Impersonated
Sourcepub fn new(
base: Arc<dyn Credentials>,
service_account: impl Into<String>,
) -> Result<Self, Error>
pub fn new( base: Arc<dyn Credentials>, service_account: impl Into<String>, ) -> Result<Self, Error>
Acts as the service account service_account, its full name
(//iam.origincloudapis.eu/organizations/{organization}/serviceAccounts/{service_account}),
with the tokens base supplies, such as those
default_credentials finds. A name that isn’t a service
account’s is refused.
Sourcepub fn service_account(&self) -> &str
pub fn service_account(&self) -> &str
The full name of the service account it acts as.
Sourcepub fn with_endpoint(self, url: impl Into<String>) -> Self
pub fn with_endpoint(self, url: impl Into<String>) -> Self
Exchanges the tokens at the STS at url instead of
STS_ENDPOINT: an https URL, or http to the loopback interface,
as the caller’s token must not travel in the clear.
Sourcepub fn with_http_client(self, http: Client) -> Self
pub fn with_http_client(self, http: Client) -> Self
Sends the exchanges with http, instead of the client all
credentials share. Each exchange is bounded by 30 seconds either way.