qhana_plugin_runner.api.jwt_helper module

Module containing JWT security features for the API.

class qhana_plugin_runner.api.jwt_helper.DemoUser(username: str)

Bases: object

This class should be replaced by the actual user class!

username: str
qhana_plugin_runner.api.jwt_helper.JWT = <flask_jwt_extended.jwt_manager.JWTManager object>

Basic JWT security scheme.

class qhana_plugin_runner.api.jwt_helper.JWTMixin

Bases: object

Extend Blueprint to add security documentation and jwt handling

require_jwt(security_scheme: str | Dict[str, List[Any]], *, fresh: bool = False, optional: bool = False, refresh_token: bool = False) Callable[[Callable[[...], RT]], Callable[[...], RT]]

Decorator validating jwt tokens and documenting them for openapi specification (only version 3…).

qhana_plugin_runner.api.jwt_helper.JWT_REFRESH_SCHEME = {'bearerFormat': 'JWT', 'description': 'The jwt refresh token as returned by login. Must only be used to get a new access token.', 'scheme': 'bearer', 'type': 'http'}

Security schemes to be added to the swagger.json api documentation.

qhana_plugin_runner.api.jwt_helper.JWT_SCHEME = {'bearerFormat': 'JWT', 'description': 'The jwt access token as returned by login or refresh.', 'scheme': 'bearer', 'type': 'http'}

JWT security scheme for JWT refresh tokens.

qhana_plugin_runner.api.jwt_helper.loadUserObject(jwt_header: dict, jwt_payload: dict)
qhana_plugin_runner.api.jwt_helper.load_user_identity(user: DemoUser)
qhana_plugin_runner.api.jwt_helper.on_expired_token(jwt_header: dict, jwt_payload: dict)
qhana_plugin_runner.api.jwt_helper.on_invalid_token(message: str)
qhana_plugin_runner.api.jwt_helper.on_revoked_token(jwt_header: dict, jwt_payload: dict)
qhana_plugin_runner.api.jwt_helper.on_stale_token(jwt_header: dict, jwt_payload: dict)
qhana_plugin_runner.api.jwt_helper.on_unauthorized(message: str)
qhana_plugin_runner.api.jwt_helper.on_user_load_error(jwt_header: dict, jwt_payload: dict)
qhana_plugin_runner.api.jwt_helper.register_jwt(app: Flask)

Register jwt manager with flask app.