ai_api_client_sdk.helpers.authenticator
index
/home/jenkins/agent/workspace/ndation_ai-api-client-sdk_master/ai_api_client_sdk/helpers/authenticator.py

 
Modules
       
requests

 
Classes
       
builtins.object
Authenticator

 
class Authenticator(builtins.object)
    Authenticator(auth_url: str, client_id: str, client_secret: str = None, cert_file_path: str = None, key_file_path: str = None)
 
Authenticator class is implemented to retrieve and cache the authorization token from the xsuaa server
 
:param auth_url: URL of the authorization endpoint. Should be the full URL (including /oauth/token)
:type auth_url: str
:param client_id: client id to be used for authorization
:type client_id: str
:param client_secret: client secret to be used for authorization, either client_secret or
    (cert_file_path and key_file_path) need to be provided, defaults to None
:type client_secret: str, optional
:param cert_file_path: path to the certificate file, needs to be provided alongside the key_file_path parameter,
    defaults to None
:type cert_file_path: str, optional
:param key_file_path: path to the key file, needs to be provided alongside the cert_file_path parameter,
    defaults to None
:type key_file_path: str, optional
 
  Methods defined here:
__init__(self, auth_url: str, client_id: str, client_secret: str = None, cert_file_path: str = None, key_file_path: str = None)
Initialize self.  See help(type(self)) for accurate signature.
get_token(self) -> str
Retrieves the token from the xsuaa server or from cache when expiration date not reached.
 
:raises: class:`ai_api_client_sdk.exception.AIAPIAuthenticatorException` if an unexpected exception occurs while
    trying to retrieve the token
:return: The Bearer token
:rtype: str

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
Lock = allocate_lock(...)
allocate_lock() -> lock object
(allocate() is an obsolete synonym)
 
Create a new lock object. See help(type(threading.Lock())) for
information about locks.

 
Data
        PARAM_ERROR_MESSAGE = 'Either client_secret needs to provided, or both cert_file_path and key_file_path'