linkahead.connection.authentication.interface module#
This module provides the interfaces for authenticating requests to the LinkAhead server.
Implementing modules must provide a get_authentication_provider() method.
- class linkahead.connection.authentication.interface.AbstractAuthenticator#
Bases:
ABCAbstractAuthenticator.
Interface for different authentication mechanisms. e.g. username/password authentication or SSH key authentication.
- logger#
A logger which should be used for all logging which has to do with authentication.
- Type:
Logger
- auth_token#
A string representation of a LinkAhead Auth Token.
- Type:
str
- login(abstract)#
- logout(abstract)#
- configure(abstract)#
- on_request()#
- on_response()#
- abstractmethod configure(**config)#
configure.
Configure this authenticator.
- Parameters:
**config – Keyword arguments for the configuration.
- Return type:
None
- abstractmethod login()#
login.
To be implemented by the child classes.
- Return type:
None
- abstractmethod logout()#
logout.
To be implemented by the child classes.
- Return type:
None
- on_request(method: str, path: str, headers: QueryDict, **kwargs)#
on_request.
A call-back which is to be called by the connection before each request. This method set the auth cookie for that request.
- Parameters:
method (str) – The request method.
path (str) – The request path.
headers (dict) – A dictionary with headers which are to be set.
**kwargs – Ignored
- on_response(response: CaosDBHTTPResponse)#
on_response.
A call-back with is to be called by the connection after each response. This method reads the latest auth cookie from the response.
- Parameters:
response (CaosDBHTTPResponse) – The response of the server
- class linkahead.connection.authentication.interface.CredentialsAuthenticator(credentials_provider)#
Bases:
AbstractAuthenticatorCredentialsAuthenticator.
Subclass of AbstractAuthenticator which provides authentication via credentials (username/password). This class always needs a credentials_provider which provides valid credentials_provider before each login.
- Parameters:
credentials_provider (CredentialsProvider) – The source for the username and the password.
- login()#
- logout()#
- configure()#
- configure(**config)#
configure.
Configure this authenticator.
- Parameters:
**config – Keyword arguments for the configuration.
- Return type:
None
- login()#
login.
To be implemented by the child classes.
- Return type:
None
- logout()#
logout.
To be implemented by the child classes.
- Return type:
None
- class linkahead.connection.authentication.interface.CredentialsProvider#
Bases:
ABCCredentialsProvider.
An abstract class for username/password authentication.
- password(abstract)#
- username(abstract)#
- logger#
A logger which should be used for all logging which has to do with the provision of credentials. This is usually just the “authentication” logger.
- Type:
Logger
- configure(abstract)#
- abstractmethod configure(**config)#
configure.
Configure the credentials provider with a dict.
- Parameters:
**config – Keyword arguments. The relevant arguments depend on the implementing subclass of this class.
- Return type:
None
- abstract property password#
password.
- abstract property username#
username.