Authentication
- class flame_hub.auth.PasswordAuth(username: str, password: str, base_url: str = 'https://auth.privateaim.dev', client: Client = None)
Bases:
AuthPassword authentication for the FLAME Hub.
This class implements a password authentication flow which is one possible flow that is recognized by the FLAME Hub. It is derived from the
httpxbase class for all authentication flowshttpx.Auth. For more information about this base class, click here. Note thatbase_urlis ignored if you pass your own client via theclientkeyword argument. An instance of this class could be used for authentication to access the Hub endpoints via the clients.- Parameters:
- username
str The user’s name which is used to execute the authentication flow.
- password
str The password which corresponds to
username.- base_url
str, default=DEFAULT_AUTH_BASE_URL The base URL for the authentication flow.
- client
httpx.Client Pass your own client to avoid the instantiation of a client while initializing an instance of this class.
- username
See also
- _update_token(token: RefreshToken, request_nanos: int)
Overwrites the current token and calculates the expiring point in time for the new token.
- Parameters:
- token
RefreshToken A new refresh token which replaces the current token.
- request_nanos
int The point in time where the request was sent that had
tokenas a response. The unit of this argument needs to be nanoseconds.
- token
See also
- auth_flow(request) Iterator[Request]
Executes the password authentication flow.
If there is no token set, this method requests a new refresh token by using
usernameandpassword. If the token is just expired, the current token is used to request a new one so that the old one can be replaced by the new refresh token. It then yields the authentication request. Click here for further information on this method.See also
- class flame_hub.auth.RobotAuth(robot_id: str, robot_secret: str, base_url: str = 'https://auth.privateaim.dev', client: Client = None)
Bases:
AuthRobot authentication for the FLAME Hub.
This class implements a robot authentication flow which is one possible flow that is recognized by the FLAME Hub. It is derived from the
httpxbase class for all authentication flowshttpx.Auth. For more information about this base class, click here. Note thatbase_urlis ignored if you pass your own client via theclientkeyword argument. An instance of this class could be used for authentication to access the Hub endpoints via the clients.- Parameters:
- robot_id
str The ID of the robot which is used to execute the authentication flow.
- robot_secret
str The secret which corresponds to the robot with ID
robot_id.- base_url
str, default=DEFAULT_AUTH_BASE_URL The base URL for the authentication flow.
- client
httpx.Client Pass your own client to avoid the instantiation of a client while initializing an instance of this class.
- robot_id
See also
- auth_flow(request) Iterator[Request]
Executes the robot authentication flow.
This method checks if the current access token is not set or expired and, if so, requests a new one from the Hub instance. It then yields the authentication request. Click here for further information on this method.
See also