hopeit.toolkit package¶
hopeit.engine toolkit
Helper modules intended to be used by apps to solve common problems
- auth: helpers to work with authentication and authorization mechanisms
Submodules¶
auth module, provides functionallity to create, validate and decode access and refresh tokens
call init() to load or create RSA keys before using token manipulation methods
-
hopeit.toolkit.auth.
init
(auth_config: hopeit.server.config.AuthConfig)¶ loads or creates RSA private/public keys that will be used to create, validate and decode tokens
Parameters: auth_config – AuthConfig, authorization/authentication server configuration
-
hopeit.toolkit.auth.
new_token
(payload: dict) → str¶
-
hopeit.toolkit.auth.
decode_token
(token: str) → dict¶
-
hopeit.toolkit.auth.
validate_token
(token: str, context: hopeit.app.context.EventContext) → Optional[dict]¶
-
hopeit.toolkit.auth.
validate_auth_method
(auth_type: hopeit.server.config.AuthType, data: str, context: hopeit.app.context.EventContext)¶
-
class
hopeit.toolkit.auth.
AuthType
¶ Bases:
str
,enum.Enum
Supported Authorization/Authentication types
-
BASIC
= 'Basic'¶
-
BEARER
= 'Bearer'¶
-
REFRESH
= 'Refresh'¶
-
UNSECURED
= 'Unsecured'¶
-
Utilities for handling Web requests
-
hopeit.toolkit.web.
save_multipart_attachment
(file_hook: hopeit.app.context.PreprocessFileHook, path: Union[str, pathlib.Path], *, chunk_size: int = 8192)¶ Save file using chunks from multipart upload to specified path