gws_core

Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version

AuthService

Functions
authenticate @classmethod

Authenticate a user. Return the DB user if ok, throw an exception if not ok

id_ : str
Return type : User
authenticate_from_token @classmethod
token : str
Return type : User
check_unique_code @classmethod

Use link the the token to check access for a unique code generated. return the object associated with the code

unique_code : str
Return type : User
check_user_access_token @classmethod
request : Request
Return type : User
check_user_access_token_or_streamlit_app @classmethod

Method to allow authentication from :

  • normal token
  • user access token for streamlit app

If user access token is provided, only this method is used even if there is a normal token

request : Request
Return type : User
generate_user_access_token @classmethod
id_ : str
Return type : str
generate_user_temp_access @classmethod
user_login_info : UserLoginInfo
Return type : str
get_and_check_token_from_request @classmethod
request : Request
Return type : str
get_and_refresh_user_from_space @classmethod

Check user space exists in the lab and if yes, it updates the user info

user_space : UserSpace
Return type : User
get_token_from_request @classmethod
request : Request
Return type : str | None
log_user @classmethod
user : User
response : Response
Return type : Response
login @classmethod
credentials : UserCredentialsDTO
Return type : Response
login_with_2fa @classmethod
credentials : UserCredentials2Fa
Return type : Response
logout @classmethod
Return type : JSONResponse
set_token_in_response @classmethod
token : str
expire_in_seconds : int
response : Response