pub struct ManagedTokenBuilder<T> {
pub token_id: Option<T>,
pub scopes: Vec<Scope>,
}Expand description
A builder to configure a ManagedToken.
Fields§
§token_id: Option<T>§scopes: Vec<Scope>Implementations§
Source§impl<T: Eq + Send + Clone + Display> ManagedTokenBuilder<T>
impl<T: Eq + Send + Clone + Display> ManagedTokenBuilder<T>
Sourcepub fn with_identifier(&mut self, token_id: T) -> &mut Self
pub fn with_identifier(&mut self, token_id: T) -> &mut Self
Sets the token identifier to identify and query the managed token.
Setting the identifier is mandatory.
Sourcepub fn with_scope(&mut self, scope: Scope) -> &mut Self
pub fn with_scope(&mut self, scope: Scope) -> &mut Self
Adds a Scope to be granted by the AccessToken.
Sourcepub fn with_scopes(&mut self, scopes: Vec<Scope>) -> &mut Self
pub fn with_scopes(&mut self, scopes: Vec<Scope>) -> &mut Self
Adds multiple Scopes to be granted by the AccessToken.
Sourcepub fn with_scopes_from_env(
&mut self,
) -> StdResult<&mut Self, InitializationError>
pub fn with_scopes_from_env( &mut self, ) -> StdResult<&mut Self, InitializationError>
Adds Scopes from the environment. They are read from
TOKKIT_MANAGED_TOKEN_SCOPES and must be separated by spaces.
Sourcepub fn with_scopes_from_selected_env_var(
&mut self,
env_name: &str,
) -> StdResult<&mut Self, InitializationError>
pub fn with_scopes_from_selected_env_var( &mut self, env_name: &str, ) -> StdResult<&mut Self, InitializationError>
Adds Scopes from the environment. They are read from
an environment variable with the given name and must be separated by
spaces.
Sourcepub fn build(self) -> StdResult<ManagedToken<T>, InitializationError>
pub fn build(self) -> StdResult<ManagedToken<T>, InitializationError>
Builds the managed token if properly configured.
Source§impl ManagedTokenBuilder<String>
impl ManagedTokenBuilder<String>
Sourcepub fn with_id_from_env(&mut self) -> StdResult<&mut Self, InitializationError>
pub fn with_id_from_env(&mut self) -> StdResult<&mut Self, InitializationError>
Sets the token_id for this managed token from an environment variable.
The token_id is read from TOKKIT_MANAGED_TOKEN_ID.
Sourcepub fn with_id_from_selected_env_var(
&mut self,
env_name: &str,
) -> StdResult<&mut Self, InitializationError>
pub fn with_id_from_selected_env_var( &mut self, env_name: &str, ) -> StdResult<&mut Self, InitializationError>
Sets the token_id for this managed token from an environment variable.
The token_id is read from an environment variable with the given name.