InternalTokenCache

class gafaelfawr.cache.InternalTokenCache

Bases: TokenCache

Cache for internal tokens.

Methods Summary

get(token_data, service, scopes)

Retrieve an internal token from the cache.

store(token_data, service, scopes, token)

Store an internal token in the cache.

Methods Documentation

get(token_data, service, scopes)

Retrieve an internal token from the cache.

Parameters:
  • token_data (TokenData) – The authentication data for the parent token.

  • service (str) – The service of the internal token.

  • scopes (list[str]) – The scopes the internal token should have.

Returns:

The cached token or None if there is no matching token in the cache.

Return type:

Token or None

Notes

The token is not checked for validity or expiration. This must be done by the caller, while holding the lock, and the token replaced in the cache if it is not valid.

store(token_data, service, scopes, token)

Store an internal token in the cache.

Should only be called while holding the lock.

Parameters:
  • token_data (TokenData) – The authentication data for the parent token.

  • service (str) – The service of the internal token.

  • scopes (list[str]) – The scopes the internal token should have.

  • token (Token) – The token to cache.

Return type:

None