diff --git a/pylti1p3/contrib/flask/cookie.py b/pylti1p3/contrib/flask/cookie.py index 775855f..ee67156 100644 --- a/pylti1p3/contrib/flask/cookie.py +++ b/pylti1p3/contrib/flask/cookie.py @@ -31,4 +31,5 @@ def update_response(self, response): if self._request.is_secure(): cookie_kwargs["samesite"] = "None" + cookie_kwargs["partitioned"] = True response.set_cookie(**cookie_kwargs) diff --git a/pylti1p3/cookies_allowed_check.py b/pylti1p3/cookies_allowed_check.py index 388d924..5d384d0 100644 --- a/pylti1p3/cookies_allowed_check.py +++ b/pylti1p3/cookies_allowed_check.py @@ -89,7 +89,7 @@ def get_js_block(self) -> str: function checkCookiesAllowed() { var cookie = "lti1p3_test_cookie=1; path=/"; if (siteProtocol === 'https') { - cookie = cookie + '; SameSite=None; secure'; + cookie = cookie + '; SameSite=None; secure; partitioned'; } document.cookie = cookie; var res = document.cookie.indexOf("lti1p3_test_cookie") !== -1; diff --git a/pylti1p3/deep_link_resource.py b/pylti1p3/deep_link_resource.py index 131606f..0574f29 100644 --- a/pylti1p3/deep_link_resource.py +++ b/pylti1p3/deep_link_resource.py @@ -65,7 +65,6 @@ def to_dict(self) -> t.Dict[str, object]: "type": self._type, "title": self._title, "url": self._url, - "custom": self._custom_params, } if self._lineitem: line_item: t.Dict[str, object] = { @@ -93,4 +92,7 @@ def to_dict(self) -> t.Dict[str, object]: if self._icon_url: res["icon"] = {"url": self._icon_url} + if self._custom_params: + res["custom"] = self._custom_params + return res diff --git a/pylti1p3/message_launch.py b/pylti1p3/message_launch.py index 4143900..3718525 100644 --- a/pylti1p3/message_launch.py +++ b/pylti1p3/message_launch.py @@ -775,7 +775,7 @@ def set_launch_data_storage( if session_id: data_storage.set_session_id(session_id) else: - raise LtiException(f"Missing %s cookie {session_cookie_name}") + raise LtiException(f"Missing {session_cookie_name} cookie") self._session_service.set_data_storage(data_storage) return self diff --git a/pylti1p3/oidc_login.py b/pylti1p3/oidc_login.py index 6d23e01..7a6574f 100644 --- a/pylti1p3/oidc_login.py +++ b/pylti1p3/oidc_login.py @@ -134,7 +134,10 @@ def _prepare_redirect_url(self, launch_url: str) -> str: # LTI message hint to identify LTI context within the platform auth_params["lti_message_hint"] = lti_message_hint - auth_login_return_url = auth_login_url + "?" + urlencode(auth_params) + if "?" in auth_login_url: + auth_login_return_url = auth_login_url + "&" + urlencode(auth_params) + else: + auth_login_return_url = auth_login_url + "?" + urlencode(auth_params) return auth_login_return_url def _prepare_redirect(self, launch_url: str) -> Redirect[RED]: