pub enum AccessSpecifier {
Audience(String),
Scopes(Vec<String>),
}Expand description
Variants§
Audience(String)
Use AccessSpecifier::Audience for setting audience in the token.
aud is a JWT claim specifying intended recipient of the token,
that is, a service.
Only one of audience or scopes can be specified for a credentials.
Scopes(Vec<String>)
Use AccessSpecifier::Scopes for setting scopes in the token.
scopes is a JWT claim specifying requested permission(s) for the token.
Only one of audience or scopes can be specified for a credentials.
scopes define the permissions being requested for this specific session
when interacting with a service. For example, https://www.googleapis.com/auth/devstorage.read_write.
IAM permissions, on the other hand, define the underlying capabilities
the service account possesses within a system. For example, storage.buckets.delete.
When a token generated with specific scopes is used, the request must be permitted
by both the service account’s underlying IAM permissions and the scopes requested
for the token. Therefore, scopes act as an additional restriction on what the token
can be used for. Please see relevant section in service account authorization to learn
more about scopes and IAM permissions.
Implementations§
Source§impl AccessSpecifier
impl AccessSpecifier
Sourcepub fn from_scopes<I, S>(scopes: I) -> Self
pub fn from_scopes<I, S>(scopes: I) -> Self
Creates AccessSpecifier with scopes.
§Example
let access_specifier = AccessSpecifier::from_scopes(["https://www.googleapis.com/auth/pubsub"]);
let service_account_key = serde_json::json!({ /* add details here */ });
let credentials = Builder::new(service_account_key)
.with_access_specifier(access_specifier)
.build();Sourcepub fn from_audience<S: Into<String>>(audience: S) -> Self
pub fn from_audience<S: Into<String>>(audience: S) -> Self
Creates AccessSpecifier with an audience.
The value should be https://{SERVICE}/, e.g., https://pubsub.googleapis.com/
§Example
let access_specifier = AccessSpecifier::from_audience("https://bigtable.googleapis.com/");
let service_account_key = serde_json::json!({ /* add details here */ });
let credentials = Builder::new(service_account_key)
.with_access_specifier(access_specifier)
.build();Trait Implementations§
Source§impl Clone for AccessSpecifier
impl Clone for AccessSpecifier
Source§fn clone(&self) -> AccessSpecifier
fn clone(&self) -> AccessSpecifier
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more