xia_authenticator.authenticator.LocalAuthenticator

class xia_authenticator.authenticator.LocalAuthenticator

Bases: Authenticator

Local Authenticator, could be used for a simple user / password check

__init__()

Methods

__init__()

authenticate(payload, token_info)

Authenticate the user and prepare the callback information

get_password_reset_token(user_id)

Get password reset token

parse_callback(payload)

Parse the callback information to check if it is trustful

parse_password_reset_token(payload)

Parse when the user has clicked the

refresh(user_id, token_info[, user_object])

refresh information to be stored in access token

Attributes

CALLBACK_TOKEN_LIFETIME

Callback token lifetime, default = 15 seconds

CALLBACK_TOKEN_NAME

Callback token name

PASSWORD_TOKEN_LIFETIME

Password reset token

key

secret key to be used to decode token

CALLBACK_TOKEN_LIFETIME = 15

Callback token lifetime, default = 15 seconds

CALLBACK_TOKEN_NAME = 'xia_callback_token'

Callback token name

PASSWORD_TOKEN_LIFETIME = 3600

Password reset token

classmethod authenticate(payload: dict, token_info: dict) str

Authenticate the user and prepare the callback information

Parameters
  • payload – payload to be signed. typically: username, password etc…

  • token_info – token information to be signed

Returns

Call back token

Return type

str

classmethod get_password_reset_token(user_id: str)

Get password reset token

Parameters

user_id (str) – Username

key = ''

secret key to be used to decode token

classmethod parse_callback(payload: dict)

Parse the callback information to check if it is trustful

Parameters

payload (dict) – data passed to callback

Returns

user, token info, state

classmethod parse_password_reset_token(payload: dict)

Parse when the user has clicked the

Parameters

payload (dict) – payload of user’s call {token (str): password reset token}

Returns

username whose password could be reseted

Return type

str

classmethod refresh(user_id, token_info: dict, user_object: Optional[User] = None)

refresh information to be stored in access token

Parameters
  • user_id – username

  • token_info – information from refresh token

  • user_object – Could pass directly the user_object to avoid a second load

Returns

User data except password token_info: information to be set in ACCESS token

Return type

user_profile

user_engine

alias of object