Authentication

Authentication in Snoweaver involves securely incorporating secrets into your HTTP or REST requests. This can be achieved by embedding secrets within the parameters, headers, or payload of your requests. Snoweaver uses Jinja templating to dynamically insert these secrets, ensuring sensitive information is handled securely. This section provides a comprehensive guide on utilizing secrets for authentication, including the specific syntax for each type of secret.

String Secrets

String secrets are straightforward to use. They can be directly inserted into your requests using the following syntax: {{ secrets.[secret_name] }}.

Example - Specifying an API key in the headers:

headers => { 'Authorization': 'Token {{ secrets.api_key }}' }

Basic Authentication Secrets

Basic secrets, which include a username and password, can be accessed using the syntax: {{ secrets.[secret_name].[username|password] }}.

Additionally, Snoweaver provides a Jinja function to generate a Base64 encoded string of the credentials, suitable for Basic access authentication:

Example - Using basic authentication credentials in the headers:

headers =>
  {
    'Authorization': 'Basic {{ generate_basic_credentials(secrets.myaccount.username, secrets.account.password) }}'
  }

generate_basic_credentials

This function takes a username and password as arguments and returns a Base64 encoded string.

OAuth2 Secrets

OAuth2 secrets, typically consisting of an access token, can be included using the syntax: {{ secrets.[secret_name] }}.

Example - Including an OAuth token in the headers:

headers => {'Authorization': 'Bearer {{ secrets.oauth_token }}'}