provenaclient.auth.manager

Created Date: Monday June 17th 2024 +1000 Author: Peter Baker —– Last Modified: Monday June 17th 2024 4:45:39 pm +1000 Modified By: Peter Baker —– Description: Auth Manager interface which defines key methods for authorising API requests in the provena client —– HISTORY: Date By Comments ———- — ———————————————————

Attributes

LogType

DEFAULT_LOG_LEVEL

Classes

Log

Generic enumeration.

AuthManager

Helper class that provides a standard way to create an ABC using

Module Contents

class provenaclient.auth.manager.Log[source]

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

DEBUG = 10
INFO = 20
WARNING = 30
ERROR = 40
provenaclient.auth.manager.LogType
provenaclient.auth.manager.DEFAULT_LOG_LEVEL
class provenaclient.auth.manager.AuthManager(log_level: LogType | None = None)[source]

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

logger: logging.Logger
abstract get_token() str[source]

Get token information and other metadata.

abstract force_refresh() None[source]

Force refresh the current token

get_auth() provenaclient.auth.helpers.HttpxBearerAuth[source]

A helper function which produces a BearerAuth object for use in the httpx library. For example:

manager = DeviceFlow(…) auth = manager.get_auth httpx.post(…, auth=auth)

Returns:

The httpx auth object.

Return type:

BearerAuth

Raises:
  • Exception – Raises exception if tokens/public_key are not setup - make sure that the object is instantiated properly before calling this function.

  • Exception – If the token is invalid and cannot be refreshed.

  • Exception – If the token validation still fails after re-conducting the device flow.