pub struct Granter<K: SigningCredential> { /* private fields */ }Expand description
Loads a source credential and grants a bounded service credential.
Granter caches only the source credential. Every call to Granter::grant
invokes the configured service granter and validates the returned credential
after all granting I/O has completed. Granted outputs are never cached or
written back into the source cache.
Implementations§
Source§impl<K: SigningCredential> Granter<K>
impl<K: SigningCredential> Granter<K>
Sourcepub fn new(
ctx: Context,
provider: impl ProvideCredential<Credential = K>,
granter: impl GrantCredential<Credential = K>,
) -> Self
pub fn new( ctx: Context, provider: impl ProvideCredential<Credential = K>, granter: impl GrantCredential<Credential = K>, ) -> Self
Create a granter from a context, source provider, and bound granting operation.
Sourcepub fn with_context(self, ctx: Context) -> Self
pub fn with_context(self, ctx: Context) -> Self
Replace the context and create an isolated empty source credential cache.
Sourcepub fn with_credential_provider(
self,
provider: impl ProvideCredential<Credential = K>,
) -> Self
pub fn with_credential_provider( self, provider: impl ProvideCredential<Credential = K>, ) -> Self
Replace the source provider and create an isolated empty source credential cache.
Sourcepub fn with_credential_granter(
self,
granter: impl GrantCredential<Credential = K>,
) -> Self
pub fn with_credential_granter( self, granter: impl GrantCredential<Credential = K>, ) -> Self
Replace the granting operation while retaining the shared source credential cache.
The replacement operation must accept the same service credential family and
must still validate the same concrete source credential variant before
doing I/O. The service operation owns any service-specific intermediate
cache; Granter does not transfer such state from the old operation.
Sourcepub async fn grant(&self, expires_in: Option<Duration>) -> Result<K>
pub async fn grant(&self, expires_in: Option<Duration>) -> Result<K>
Grant a bounded service credential.
Cached source credentials must be fresh according to
SigningCredential::is_valid and usable through the service granter’s
required deadline. A refreshed source credential only needs to satisfy
the exact deadline. Provider and granting errors are returned without
retry or fallback. The granted result must own material independent from
the cached source credential.