Fonctionnement de l’API¶
Module contents¶
Module API de l’application TerriStory
Modules principaux¶
actions module¶
api module¶
auth module¶
Module dédié à la partie d’authentification JWT de l’application.
- async authenticate(request, region)¶
Authenticate a user inside current region with login and password.
- Paramètres
request (sanic request) – must contain json args with login and password keys
region (str) – region key
- Renvoie
contains user_id structured as follows:
``` {
- »user_id »: {
« mail »: login, « region »: region
}
- Type renvoyé
- Lève
exceptions.AuthenticationFailed – when json params are missing
exceptions.AuthenticationFailed – when login or password are missing
exceptions.AuthenticationFailed – when user is not found
exceptions.AuthenticationFailed – when password is incorrect
- async extra_payload(payload: dict, *args, **kwargs)¶
Add information on current user inside JWT payload.
- async retrieve_refresh_token(request, user_id, *args, **kwargs)¶
Retrieve and check the refresh token for a specific account.
- Paramètres
user_id (dict) – must contain region and mail keys with user info
territorialsynthesis module¶
create_user module¶
user module¶
Blueprint for user
- async authenticate_user(request, region)¶
- async check_token_captcha(token)¶
- async create_user(request, region)¶
Create a new user
You can create a new user via the registration form. The account is not enabled by default. It is the admin, after receiving an e-mail, who must validate the account (see the “active” field).
- generate_password()¶
Generate a new random password.
- Renvoie
new password between 8 and 16 characters.
- Type renvoyé
Contrôleurs de l’API¶
Quelques informations sur les contrôleurs de l’API…
Éléments des contrôleurs de l’API