49 'basic-lti-launch-request' =>
'LtiResourceLinkRequest',
50 'ContentItemSelectionRequest' =>
'LtiDeepLinkingRequest',
51 'ContentItemSelection' =>
'LtiDeepLinkingResponse',
52 'ContentItemUpdateRequest' =>
'LtiDeepLinkingUpdateRequest' 59 'accept_types' => array(
'suffix' =>
'dl',
'group' =>
'deep_linking_settings',
'claim' =>
'accept_types',
'isArray' =>
true),
60 'accept_copy_advice' => array(
'suffix' =>
'dl',
'group' =>
'deep_linking_settings',
'claim' =>
'copyAdvice',
'isBoolean' =>
true),
61 'accept_media_types' => array(
'suffix' =>
'dl',
'group' =>
'deep_linking_settings',
'claim' =>
'accept_media_types'),
62 'accept_multiple' => array(
'suffix' =>
'dl',
'group' =>
'deep_linking_settings',
'claim' =>
'accept_multiple',
'isBoolean' =>
true),
63 'accept_presentation_document_targets' => array(
'suffix' =>
'dl',
'group' =>
'deep_linking_settings',
'claim' =>
'accept_presentation_document_targets',
'isArray' =>
true),
64 'accept_unsigned' => array(
'suffix' =>
'dl',
'group' =>
'deep_linking_settings',
'claim' =>
'accept_unsigned',
'isBoolean' =>
true),
65 'auto_create' => array(
'suffix' =>
'dl',
'group' =>
'deep_linking_settings',
'claim' =>
'auto_create',
'isBoolean' =>
true),
66 'can_confirm' => array(
'suffix' =>
'dl',
'group' =>
'deep_linking_settings',
'claim' =>
'can_confirm'),
67 'content_item_return_url' => array(
'suffix' =>
'dl',
'group' =>
'deep_linking_settings',
'claim' =>
'deep_link_return_url'),
68 'content_items' => array(
'suffix' =>
'dl',
'group' =>
'',
'claim' =>
'content_items',
'isObject' =>
true),
69 'data' => array(
'suffix' =>
'dl',
'group' =>
'deep_linking_settings',
'claim' =>
'data'),
70 'data.LtiDeepLinkingResponse' => array(
'suffix' =>
'dl',
'group' =>
'',
'claim' =>
'data'),
71 'text' => array(
'suffix' =>
'dl',
'group' =>
'deep_linking_settings',
'claim' =>
'text'),
72 'title' => array(
'suffix' =>
'dl',
'group' =>
'deep_linking_settings',
'claim' =>
'title'),
73 'lti_msg' => array(
'suffix' =>
'dl',
'group' =>
'',
'claim' =>
'msg'),
74 'lti_errormsg' => array(
'suffix' =>
'dl',
'group' =>
'',
'claim' =>
'errormsg'),
75 'lti_log' => array(
'suffix' =>
'dl',
'group' =>
'',
'claim' =>
'log'),
76 'lti_errorlog' => array(
'suffix' =>
'dl',
'group' =>
'',
'claim' =>
'errorlog'),
77 'context_id' => array(
'suffix' =>
'',
'group' =>
'context',
'claim' =>
'id'),
78 'context_label' => array(
'suffix' =>
'',
'group' =>
'context',
'claim' =>
'label'),
79 'context_title' => array(
'suffix' =>
'',
'group' =>
'context',
'claim' =>
'title'),
80 'context_type' => array(
'suffix' =>
'',
'group' =>
'context',
'claim' =>
'type',
'isArray' =>
true),
81 'lis_course_offering_sourcedid' => array(
'suffix' =>
'',
'group' =>
'lis',
'claim' =>
'course_offering_sourcedid'),
82 'lis_course_section_sourcedid' => array(
'suffix' =>
'',
'group' =>
'lis',
'claim' =>
'course_section_sourcedid'),
83 'launch_presentation_css_url' => array(
'suffix' =>
'',
'group' =>
'launch_presentation',
'claim' =>
'css_url'),
84 'launch_presentation_document_target' => array(
'suffix' =>
'',
'group' =>
'launch_presentation',
'claim' =>
'document_target'),
85 'launch_presentation_height' => array(
'suffix' =>
'',
'group' =>
'launch_presentation',
'claim' =>
'height'),
86 'launch_presentation_locale' => array(
'suffix' =>
'',
'group' =>
'launch_presentation',
'claim' =>
'locale'),
87 'launch_presentation_return_url' => array(
'suffix' =>
'',
'group' =>
'launch_presentation',
'claim' =>
'return_url'),
88 'launch_presentation_width' => array(
'suffix' =>
'',
'group' =>
'launch_presentation',
'claim' =>
'width'),
89 'lis_person_contact_email_primary' => array(
'suffix' =>
'',
'group' => null,
'claim' =>
'email'),
90 'lis_person_name_family' => array(
'suffix' =>
'',
'group' => null,
'claim' =>
'family_name'),
91 'lis_person_name_full' => array(
'suffix' =>
'',
'group' => null,
'claim' =>
'name'),
92 'lis_person_name_given' => array(
'suffix' =>
'',
'group' => null,
'claim' =>
'given_name'),
93 'lis_person_sourcedid' => array(
'suffix' =>
'',
'group' =>
'lis',
'claim' =>
'person_sourcedid'),
94 'user_id' => array(
'suffix' =>
'',
'group' => null,
'claim' =>
'sub'),
95 'user_image' => array(
'suffix' =>
'',
'group' => null,
'claim' =>
'picture'),
96 'roles' => array(
'suffix' =>
'',
'group' =>
'',
'claim' =>
'roles',
'isArray' =>
true),
97 'platform_id' => array(
'suffix' =>
'',
'group' => null,
'claim' =>
'iss'),
98 'deployment_id' => array(
'suffix' =>
'',
'group' =>
'',
'claim' =>
'deployment_id'),
99 'lti_message_type' => array(
'suffix' =>
'',
'group' =>
'',
'claim' =>
'message_type'),
100 'lti_version' => array(
'suffix' =>
'',
'group' =>
'',
'claim' =>
'version'),
101 'resource_link_description' => array(
'suffix' =>
'',
'group' =>
'resource_link',
'claim' =>
'description'),
102 'resource_link_id' => array(
'suffix' =>
'',
'group' =>
'resource_link',
'claim' =>
'id'),
103 'resource_link_title' => array(
'suffix' =>
'',
'group' =>
'resource_link',
'claim' =>
'title'),
104 'target_link_uri' => array(
'suffix' =>
'',
'group' =>
'',
'claim' =>
'target_link_uri'),
105 'tool_consumer_info_product_family_code' => array(
'suffix' =>
'',
'group' =>
'tool_platform',
'claim' =>
'product_family_code'),
106 'tool_consumer_info_version' => array(
'suffix' =>
'',
'group' =>
'tool_platform',
'claim' =>
'version'),
107 'tool_consumer_instance_contact_email' => array(
'suffix' =>
'',
'group' =>
'tool_platform',
'claim' =>
'contact_email'),
108 'tool_consumer_instance_description' => array(
'suffix' =>
'',
'group' =>
'tool_platform',
'claim' =>
'description'),
109 'tool_consumer_instance_guid' => array(
'suffix' =>
'',
'group' =>
'tool_platform',
'claim' =>
'guid'),
110 'tool_consumer_instance_name' => array(
'suffix' =>
'',
'group' =>
'tool_platform',
'claim' =>
'name'),
111 'tool_consumer_instance_url' => array(
'suffix' =>
'',
'group' =>
'tool_platform',
'claim' =>
'url'),
112 'tool_state' => array(
'suffix' =>
'',
'group' =>
'tool',
'claim' =>
'state'),
113 'custom_context_memberships_v2_url' => array(
'suffix' =>
'nrps',
'group' =>
'namesroleservice',
'claim' =>
'context_memberships_url'),
114 'custom_nrps_versions' => array(
'suffix' =>
'nrps',
'group' =>
'namesroleservice',
'claim' =>
'service_versions',
'isArray' =>
true),
115 'custom_lineitems_url' => array(
'suffix' =>
'ags',
'group' =>
'endpoint',
'claim' =>
'lineitems'),
116 'custom_lineitem_url' => array(
'suffix' =>
'ags',
'group' =>
'endpoint',
'claim' =>
'lineitem'),
117 'custom_ags_scopes' => array(
'suffix' =>
'ags',
'group' =>
'endpoint',
'claim' =>
'scope',
'isArray' =>
true),
118 'custom_context_groups_url' => array(
'suffix' =>
'gs',
'group' =>
'groupsservice',
'claim' =>
'context_groups_url'),
119 'custom_context_group_sets_url' => array(
'suffix' =>
'gs',
'group' =>
'groupsservice',
'claim' =>
'context_group_sets_url'),
120 'custom_gs_scopes' => array(
'suffix' =>
'gs',
'group' =>
'groupsservice',
'claim' =>
'scope',
'isArray' =>
true),
121 'custom_gs_versions' => array(
'suffix' =>
'gs',
'group' =>
'groupsservice',
'claim' =>
'service_versions',
'isArray' =>
true),
122 'lis_outcome_service_url' => array(
'suffix' =>
'bo',
'group' =>
'basicoutcome',
'claim' =>
'lis_outcome_service_url'),
123 'lis_result_sourcedid' => array(
'suffix' =>
'bo',
'group' =>
'basicoutcome',
'claim' =>
'lis_result_sourcedid'),
124 'custom_ap_attempt_number' => array(
'suffix' =>
'ap',
'group' =>
'',
'claim' =>
'attempt_number',
'isInteger' =>
true),
125 'custom_ap_start_assessment_url' => array(
'suffix' =>
'ap',
'group' =>
'',
'claim' =>
'start_assessment_url'),
126 'custom_ap_session_data' => array(
'suffix' =>
'ap',
'group' =>
'',
'claim' =>
'session_data'),
127 'custom_ap_acs_actions' => array(
'suffix' =>
'ap',
'group' =>
'acs',
'claim' =>
'actions',
'isArray' =>
true),
128 'custom_ap_acs_url' => array(
'suffix' =>
'ap',
'group' =>
'acs',
'claim' =>
'assessment_control_url'),
129 'custom_ap_proctoring_settings_data' => array(
'suffix' =>
'ap',
'group' =>
'proctoring_settings',
'claim' =>
'data'),
130 'custom_ap_email_verified' => array(
'suffix' =>
'',
'group' => null,
'claim' =>
'email_verified',
'isBoolean' =>
true),
131 'custom_ap_verified_user_given_name' => array(
'suffix' =>
'ap',
'group' =>
'verified_user',
'claim' =>
'given_name'),
132 'custom_ap_verified_user_family_name' => array(
'suffix' =>
'ap',
'group' =>
'verified_user',
'claim' =>
'family_name'),
133 'custom_ap_verified_user_full_name' => array(
'suffix' =>
'ap',
'group' =>
'verified_user',
'claim' =>
'full_name'),
134 'custom_ap_verified_user_image' => array(
'suffix' =>
'ap',
'group' =>
'verified_user',
'claim' =>
'picture'),
135 'custom_ap_end_assessment_return' => array(
'suffix' =>
'ap',
'group' =>
'',
'claim' =>
'end_assessment_return',
'isBoolean' =>
true)
161 public static array
$LTI_VERSIONS = array(self::LTI_VERSION1, self::LTI_VERSION1P3, self::LTI_VERSION2);
167 'basic-lti-launch-request' =>
'onLaunch',
168 'ConfigureLaunchRequest' =>
'onConfigure',
169 'DashboardRequest' =>
'onDashboard',
170 'ContentItemSelectionRequest' =>
'onContentItem',
171 'ContentItemSelection' =>
'onContentItem',
172 'ContentItemUpdateRequest' =>
'onContentItemUpdate',
173 'ToolProxyRegistrationRequest' =>
'onRegister',
174 'LtiStartProctoring' =>
'onLtiStartProctoring',
175 'LtiStartAssessment' =>
'onLtiStartAssessment',
176 'LtiEndAssessment' =>
'onLtiEndAssessment' 205 $wrapper = $DIC->http()->wrapper()->post();
206 $refString = $DIC->refinery()->kindlyTo()->string();
207 $isLti = ($wrapper->has(
'lti_message_type') && $wrapper->retrieve(
'lti_message_type', $refString) !=
'') ||
208 ($wrapper->has(
'id_token') && $wrapper->retrieve(
'id_token', $refString) !=
'') ||
209 ($wrapper->has(
'JWT') && $wrapper->retrieve(
'JWT', $refString) !=
'') ||
210 ($wrapper->has(
'iss') && $wrapper->retrieve(
'iss', $refString) !=
'');
212 $wrapper = $DIC->http()->wrapper()->query();
213 $isLti = ($wrapper->has(
'iss') && $wrapper->retrieve(
'iss', $refString) !=
'') ||
214 ($wrapper->has(
'openid_configuration') && $wrapper->retrieve(
'openid_configuration', $refString) !=
'');
226 if (is_null(self::$requestParameters)) {
237 $post = $DIC->http()->wrapper()->post();
238 $query = $DIC->http()->wrapper()->query();
239 $refinery = $DIC->refinery()->kindlyTo()->string();
241 $divAr = [
'accept_copy_advice',
242 'accept_media_types',
244 'accept_presentation_document_targets',
250 'content_item_return_url',
254 'custom_ap_attempt_number',
255 'custom_content_item_id',
257 'custom_tc_profile_url',
258 'custom_user_username',
261 'ext_launch_presentation_css_url',
266 'launch_presentation_css_url',
267 'launch_presentation_document_target',
268 'launch_presentation_height',
269 'launch_presentation_return_url',
270 'launch_presentation_width',
271 'lis_person_contact_email_primary',
272 'lis_person_name_family',
273 'lis_person_name_full',
274 'lis_person_name_given',
275 'lis_person_sourcedid',
281 'oauth_consumer_key',
282 'oauth_signature_method',
283 'openid_configuration',
287 'registration_token',
290 'resource_link_title',
294 'tool_consumer_info_product_family_code',
295 'tool_consumer_info_version',
296 'tool_consumer_instance_guid',
297 'tool_consumer_instance_name',
301 $LTI_CONSUMER_SETTING_NAMES = [
'custom_tc_profile_url',
'custom_system_setting_url',
'custom_oauth2_access_token_url'];
302 $LTI_CONTEXT_SETTING_NAMES = [
'custom_context_setting_url',
303 'ext_ims_lis_memberships_id',
'ext_ims_lis_memberships_url',
304 'custom_context_memberships_url',
'custom_context_memberships_v2_url',
305 'custom_context_group_sets_url',
'custom_context_groups_url',
306 'custom_lineitems_url',
'custom_ags_scopes' 308 $LTI_RESOURCE_LINK_SETTING_NAMES = [
'lis_result_sourcedid',
'lis_outcome_service_url',
309 'ext_ims_lis_basic_outcome_url',
'ext_ims_lis_resultvalue_sourcedids',
'ext_outcome_data_values_accepted',
310 'ext_ims_lis_memberships_id',
'ext_ims_lis_memberships_url',
311 'ext_ims_lti_tool_setting',
'ext_ims_lti_tool_setting_id',
'ext_ims_lti_tool_setting_url',
312 'custom_link_setting_url',
'custom_link_memberships_url',
313 'custom_lineitems_url',
'custom_lineitem_url',
'custom_ags_scopes',
317 $requestAr = array_merge($divAr, $LTI_CONSUMER_SETTING_NAMES, $LTI_CONTEXT_SETTING_NAMES, $LTI_RESOURCE_LINK_SETTING_NAMES);
319 foreach ($requestAr as
$param) {
320 if (
$query->has($param)) {
323 if (
$post->has($param)) {
328 return self::$requestParameters;
339 if (self::$logLevel >= self::LOGLEVEL_ERROR) {
340 self::log(
"[ERROR] {$message}", $showSource);
352 if (self::$logLevel >= self::LOGLEVEL_INFO) {
353 self::log(
"[INFO] {$message}", $showSource);
365 if (self::$logLevel >= self::LOGLEVEL_DEBUG) {
366 self::log(
"[DEBUG] {$message}", $showSource);
378 $logLevel = self::LOGLEVEL_INFO;
380 $logLevel = self::LOGLEVEL_DEBUG;
382 if (self::$logLevel >= $logLevel) {
383 $message =
"{$_SERVER['REQUEST_METHOD']} request received for '{$_SERVER['REQUEST_URI']}'";
385 $body = file_get_contents(LTIOAuth\OAuthRequest::$POST_INPUT);
388 $params = LTIOAuth\OAuthUtil::parse_parameters($body);
392 $message .=
" with a body of:\n" . var_export($body,
true);
411 public static function logForm(
string $url, array
$params,
string $method =
'POST',
bool $debugLevel =
false)
414 $logLevel = self::$logLevel;
416 $logLevel = self::LOGLEVEL_DEBUG;
418 if (self::$logLevel >= self::LOGLEVEL_INFO) {
419 $message =
"Form submitted using {$method} to '{$url}'";
420 if (!empty($params)) {
421 $message .=
" with parameters of:\n" . var_export($params,
true);
425 if ($logLevel < self::LOGLEVEL_DEBUG) {
439 public static function log(
string $message,
bool $showSource =
false)
443 $backtraces = debug_backtrace();
444 foreach ($backtraces as $backtrace) {
445 if (isset($backtrace[
'file'])) {
446 $source .= PHP_EOL .
" {$backtrace['file']}";
447 if (isset($backtrace[
'line'])) {
448 $source .=
" line {$backtrace['line']}";
453 $source = PHP_EOL .
"See: {$source}";
468 self::logForm($url, $params,
'POST');
472 <title>IMS
LTI message</title>
473 <script type=
"text/javascript">
475 function doOnLoad() {
476 document.forms[0].submit();
479 window.onload=doOnLoad;
484 <
form action=
"{$url}" method=
"post" target=
"{$target}" encType=
"application/x-www-form-urlencoded">
487 if (!empty($params)) {
488 foreach ($params as
$key => $value) {
489 $key = htmlentities(
$key, ENT_COMPAT | ENT_HTML401,
'UTF-8');
490 if (!is_array($value)) {
491 $value = htmlentities($value, ENT_COMPAT | ENT_HTML401,
'UTF-8');
493 <input type=
"hidden" name=
"{$key}" value=
"{$value}" />
497 foreach ($value as $element) {
498 $element = htmlentities($element, ENT_COMPAT | ENT_HTML401,
'UTF-8');
500 <input type=
"hidden" name=
"{$key}" value=
"{$element}" />
525 if (!empty($params)) {
526 if (strpos($url,
'?') ===
false) {
532 foreach ($params as
$key => $value) {
534 if (!is_array($value)) {
535 $value = urlencode($value);
536 $url .=
"{$sep}{$key}={$value}";
539 foreach ($value as $element) {
540 $element = urlencode($element);
541 $url .=
"{$sep}{$key}={$element}";
548 header(
"Location: {$url}");
560 $chars =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
563 $charsLength = strlen($chars) - 1;
565 for (
$i = 1;
$i <= $length;
$i++) {
566 $value .= $chars[rand(0, $charsLength)];
579 $html = strip_tags($html);
580 $html = html_entity_decode($html, ENT_QUOTES | ENT_HTML401);
593 $objVars = get_object_vars($clone);
594 foreach ($objVars as $attrName => $attrValue) {
595 if (is_object($clone->$attrName)) {
596 $clone->$attrName = self::cloneObject($clone->$attrName);
597 } elseif (is_array($clone->$attrName)) {
598 foreach ($clone->$attrName as &$attrArrayValue) {
599 if (is_object($attrArrayValue)) {
600 $attrArrayValue = self::cloneObject($attrArrayValue);
602 unset($attrArrayValue);
611 public static function logtxt(
string $msg)
613 file_put_contents(
"log.txt", $msg .
"\n", FILE_APPEND);
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
form( $class_path, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Refinery Factory $refinery