pub struct ServerSideCredentialAccessBoundaryGranter { /* private fields */ }Expand description
Exchanges a Google OAuth access token for a server-issued CAB token.
The bound grant is stable configuration. Construct another granter (or use
ServerSideCredentialAccessBoundaryGranter::with_grant) for a different
authorization decision. The server-side CAB exchange does not accept a
requested lifetime, so reqsign_core::Granter::grant must be called with
None.
The source must be a token-only Credential containing a Google-issued
OAuth access token with a known absolute expiration and the
https://www.googleapis.com/auth/cloud-platform scope. Server-issued CAB
tokens support user and service-account principals. STS rejects tokens that
already carry security attributes; the opaque token string does not expose
enough information to detect its principal, scope, or existing attributes
locally. Credentials with unknown expiration or an attached service account
are rejected before STS I/O.
The returned Credential is token-only and can be consumed directly by
the existing Google crate::RequestSigner. Every grant performs a new STS
exchange; the service layer does not cache granted outputs.
§Example
use std::time::Duration;
use reqsign_core::{Context, Granter, time::Timestamp};
use reqsign_google::{
CredentialAccessBoundaryGrant, CredentialAccessBoundaryPermissions,
ServerSideCredentialAccessBoundaryGranter, TokenCredentialProvider,
};
let source = TokenCredentialProvider::new("source-oauth-token")
.with_expires_at(Timestamp::now() + Duration::from_secs(3600));
let grant = CredentialAccessBoundaryGrant::for_object_prefix(
"example-bucket",
"customer-a/",
CredentialAccessBoundaryPermissions::OBJECT_VIEWER,
);
// Supply a Context configured with an HttpSend implementation.
let context = Context::new();
let credential = Granter::new(
context,
source,
ServerSideCredentialAccessBoundaryGranter::new(grant),
)
.grant(None)
.await?;Implementations§
Source§impl ServerSideCredentialAccessBoundaryGranter
impl ServerSideCredentialAccessBoundaryGranter
Sourcepub fn new(grant: CredentialAccessBoundaryGrant) -> Self
pub fn new(grant: CredentialAccessBoundaryGrant) -> Self
Create a server-side granter for a bound Credential Access Boundary.
Sourcepub fn with_grant(self, grant: CredentialAccessBoundaryGrant) -> Self
pub fn with_grant(self, grant: CredentialAccessBoundaryGrant) -> Self
Replace the bound grant.
Trait Implementations§
Source§impl Clone for ServerSideCredentialAccessBoundaryGranter
impl Clone for ServerSideCredentialAccessBoundaryGranter
Source§fn clone(&self) -> ServerSideCredentialAccessBoundaryGranter
fn clone(&self) -> ServerSideCredentialAccessBoundaryGranter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl GrantCredential for ServerSideCredentialAccessBoundaryGranter
impl GrantCredential for ServerSideCredentialAccessBoundaryGranter
Source§type Credential = Credential
type Credential = Credential
Source§fn required_valid_until(
&self,
_credential: &Self::Credential,
_expires_in: Option<Duration>,
) -> Timestamp
fn required_valid_until( &self, _credential: &Self::Credential, _expires_in: Option<Duration>, ) -> Timestamp
Source§async fn grant_credential(
&self,
ctx: &Context,
credential: &Self::Credential,
expires_in: Option<Duration>,
) -> Result<Self::Credential>
async fn grant_credential( &self, ctx: &Context, credential: &Self::Credential, expires_in: Option<Duration>, ) -> Result<Self::Credential>
Auto Trait Implementations§
impl Freeze for ServerSideCredentialAccessBoundaryGranter
impl RefUnwindSafe for ServerSideCredentialAccessBoundaryGranter
impl Send for ServerSideCredentialAccessBoundaryGranter
impl Sync for ServerSideCredentialAccessBoundaryGranter
impl Unpin for ServerSideCredentialAccessBoundaryGranter
impl UnsafeUnpin for ServerSideCredentialAccessBoundaryGranter
impl UnwindSafe for ServerSideCredentialAccessBoundaryGranter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GrantCredentialDyn for Twhere
T: GrantCredential + ?Sized,
impl<T> GrantCredentialDyn for Twhere
T: GrantCredential + ?Sized,
Source§type Credential = <T as GrantCredential>::Credential
type Credential = <T as GrantCredential>::Credential
Source§fn required_valid_until_dyn(
&self,
credential: &<T as GrantCredentialDyn>::Credential,
expires_in: Option<Duration>,
) -> Timestamp
fn required_valid_until_dyn( &self, credential: &<T as GrantCredentialDyn>::Credential, expires_in: Option<Duration>, ) -> Timestamp
GrantCredential::required_valid_until.Source§fn grant_credential_dyn<'a>(
&'a self,
ctx: &'a Context,
credential: &'a <T as GrantCredentialDyn>::Credential,
expires_in: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<<T as GrantCredentialDyn>::Credential, Error>> + Send + 'a>>
fn grant_credential_dyn<'a>( &'a self, ctx: &'a Context, credential: &'a <T as GrantCredentialDyn>::Credential, expires_in: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<<T as GrantCredentialDyn>::Credential, Error>> + Send + 'a>>
GrantCredential::grant_credential.