wallaroo.auth
Handles authentication to the Wallaroo platform.
Performs a "device code"-style OAuth login flow.
The code is organized as follows:
Auth objects returned by
create()
should be placed on each request to platform APIs. Currently, we have the following types:- NoAuth: Does not modify requests
- PlatformAuth: Places
Authorization: Bearer XXX
headers on each outgoing request
Objects derived from TokenFetcher know how to obtain an AccessToken from a particular provider:
- KeycloakTokenFetcher: Fetches a token from Keycloak using a device code login flow
- CachedTokenFetcher: Wraps another TokenFetcher and caches the value to a JSON file to reduce the number of user logins needed.
Defines all the supported auth types.
Handles conversions from string names to enum values.
Inherited Members
- enum.Enum
- name
- value
TokenData(token, user_email, user_id)
Create new instance of TokenData(token, user_email, user_id)
Inherited Members
- builtins.tuple
- index
- count
Returns an auth object of the corresponding type.
Parameters
- str keycloak_addr: Address of the Keycloak instance to auth against
- AuthType or str auth_type: Type of authentication to use
Returns
Auth object that can be passed to all
requests
calls
Raises
- NotImplementedError: if auth_type is not recognized
Removes cached values for all third-party auth providers.
This will not invalidate auth objects already created with create()
.
Base type for all errors in this module.
Inherited Members
- builtins.BaseException
- with_traceback
- args
Errors encountered while performing a login.
Errors encountered while refreshing an AccessToken.