pub struct AuthConfig { /* private fields */ }
Expand description
This struct contains all necessary information to request an authentication token from Google. This structure is intended to be reused by the client for several token generation requests.
Implementations§
Source§impl AuthConfig
impl AuthConfig
Sourcepub fn build(
service_account_json_str: &str,
usage: &Usage,
) -> Result<Self, TokenGenerationError>
pub fn build( service_account_json_str: &str, usage: &Usage, ) -> Result<Self, TokenGenerationError>
This function generates an auth configuration with the provided information. A config is used to request auth_tokens
.
This function generates only tokens with the RS256 encryption like the Google jwt authentication service does.
§Params
service_account_json_str
: String
Each google service account has a json file that can be downloaded in the Google console during the key generation.
This json file cannot be downloaded twice! A new key must be generated, if the file gets lost!
The content of this file needs to be provided by this param as string.
usage
: String
Each google api request requires individual permissions to be executed.
Beside the service account permission a usage or a scope should be provided.
See here for more information: Google Scopes.
lifetime
: u16
An auth_token
has a limited lifetime to am maximum of 3600 seconds.
This value should be between 30 and 3600 Seconds.
Inputs out of this ranged will not be accepted.
§Errors
See Error
for a more detailed answer.
§Returns
The above-mentioned jwt as String.