From 354179d838a2813cdc658eedeee1506654a04f95 Mon Sep 17 00:00:00 2001
From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de>
Date: Thu, 12 May 2022 09:35:17 +0000
Subject: [PATCH] fix handling of custom params and add `oauth_callback`, fixes
 #1040

Closes #1040

Merge request studip/studip!611
---
 app/controllers/course/lti.php | 4 ++--
 lib/classes/LtiLink.php        | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/app/controllers/course/lti.php b/app/controllers/course/lti.php
index ab71e46a792..01c57ded24c 100644
--- a/app/controllers/course/lti.php
+++ b/app/controllers/course/lti.php
@@ -242,7 +242,7 @@ class Course_LtiController extends StudipController
         ]);
 
         foreach ($custom_parameters as $param) {
-            list($key, $value) = explode('=', $param);
+            list($key, $value) = explode('=', $param, 2);
             if (isset($value)) {
                 $lti_link->addCustomParameter(trim($key), trim($value));
             }
@@ -351,7 +351,7 @@ class Course_LtiController extends StudipController
         ]);
 
         foreach ($custom_parameters as $param) {
-            list($key, $value) = explode('=', $param);
+            list($key, $value) = explode('=', $param, 2);
             if (isset($value)) {
                 $lti_link->addCustomParameter(trim($key), trim($value));
             }
diff --git a/lib/classes/LtiLink.php b/lib/classes/LtiLink.php
index d62c01c9142..546a5339d39 100644
--- a/lib/classes/LtiLink.php
+++ b/lib/classes/LtiLink.php
@@ -51,6 +51,7 @@ class LtiLink
             'lti_version' => 'LTI-1p0',
             'lti_message_type' => 'basic-lti-launch-request',
             'oauth_consumer_key' => $this->consumer_key,
+            'oauth_callback' => 'about:blank',
             'oauth_version' => '1.0',
             'oauth_nonce' => uniqid('lti', true),
             'oauth_timestamp' => time(),
-- 
GitLab