def get(self):
        """

        :return:
        """
        tool_conf = settings.LTI_TOOL_CONFIG
        launch_data_storage = FlaskCacheDataStorage(cache)

        flask_request = FlaskRequest()
        target_link_uri = flask_request.get_param('target_link_uri')

        if not target_link_uri:
            raise Exception('Missing "target_link_uri" param')

        logs.api_logger.info("LTI Login",
                             extra={
                                 "clientip": request.remote_addr,
                                 "path": request.path,
                                 "user": request.remote_user
                             })

        oidc_login = FlaskOIDCLogin(flask_request,
                                    tool_conf,
                                    launch_data_storage=launch_data_storage)
        return oidc_login.enable_check_cookies().redirect(target_link_uri)
    def post(self):
        """
        Post method
        :return:
        """

        flask_request = FlaskRequest()
        launch_data_storage = FlaskCacheDataStorage(cache)
        message_launch = FlaskMessageLaunch(
            flask_request,
            current_app.config['LTI_TOOL_CONFIG'],
            launch_data_storage=launch_data_storage)
        message_launch_data = message_launch.get_launch_data()
        pprint.pprint(message_launch_data)
        token = message_launch.get_launch_id()
        cache.set(token, message_launch_data)

        redirection = redirect('http://localhost:3000/deepLinkContent/' +
                               token)

        return redirection

        redirection = redirect('http://localhost:3000/deepLinkContent/' +
                               token)

        return redirection
示例#3
0
def get_launch_data_storage():
    return FlaskCacheDataStorage(cache)