Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

AuthorizationService

Service for handling user authorization when accessing resources

Attributes
allow_dev_app_connections: bool
Functions
authenticate_from_token @classmethod
token : str
Return type : gws_core.user.auth_context.AuthContextUser | gws_core.user.auth_context.AuthContextApp | gws_core.user.auth_context.AuthContextShareLink
authenticate_user @classmethod

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

user_id : str
Return type : AuthContextUser
check_authorization @classmethod

Method to check the authorization based on the provided modes

The modes are checked in the order they are provided

request : Request
modes : list
Return type : gws_core.user.auth_context.AuthContextUser | gws_core.user.auth_context.AuthContextApp | gws_core.user.auth_context.AuthContextShareLink
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 : AuthContextUser
check_user_access_token @classmethod
request : Request
Return type : gws_core.user.auth_context.AuthContextUser | gws_core.user.auth_context.AuthContextApp | gws_core.user.auth_context.AuthContextShareLink
check_user_access_token_or_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 : gws_core.user.auth_context.AuthContextUser | gws_core.user.auth_context.AuthContextApp | gws_core.user.auth_context.AuthContextShareLink
get_and_check_token_from_request @classmethod
request : Request
Return type : str
get_token_from_request @classmethod
request : Request
Return type : str | None
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.