AuthorizationService
Service for handling user authorization when accessing resources
Attributes
allow_dev_app_connections: boolFunctions
authenticate_from_token @classmethod
token :
str Return type :
AuthContextUser 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 | gws_core.user.auth_context.AuthContextExternalLab check_unique_code @classmethod
Consume a one-time code and authenticate the user it was minted for.
unique_code :
str the single-use code (consumed here)
allow_inactive :
bool - False 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 | gws_core.user.auth_context.AuthContextExternalLab 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 | gws_core.user.auth_context.AuthContextExternalLab get_and_check_token_from_request @classmethod
request :
Request Return type :
str get_token_from_request @classmethod
request :
Request Return type :
str | None