GafaelfawrStorage#

class mobu.storage.gafaelfawr.GafaelfawrStorage(http_client, logger)#

Bases: object

Manage users and authentication tokens.

mobu uses bot users to run its tests. Those users may be pre-existing or manufactured on the fly by mobu. Either way, mobu creates new service tokens for the configured users, and then provides those usernames and tokens to monkeys to use for executing their business.

This class handles the call to Gafaelfawr to create the service token.

Parameters:
  • http_client (AsyncClient) – Shared HTTP client.

  • logger (BoundLogger) – Logger to use.

Methods Summary

create_service_token(user, scopes)

Create a service token for a user.

Methods Documentation

async create_service_token(user, scopes)#

Create a service token for a user.

Parameters:
  • user (User) – Metadata for the user. If uid or gid are set for the user, they will be stored with the token and override Gafaelfawr’s normal user metadata source.

  • scopes (list[str]) – Scopes the requested token should have.

Returns:

Authenticated user with their metadata, scopes, and token.

Return type:

AuthenticatedUser

Raises:
  • GafaelfawrParseError – Raised if the input or output data for Gafaelfawr’s token call could not be parsed.

  • GafaelfawrWebError – Raised if an HTTP protocol error occurred talking to Gafaelfawr.