diff --git a/public/lib/lti1p3/README.md b/public/lib/lti1p3/README.md
index b7befbbfa11..67cf96d0b70 100644
--- a/public/lib/lti1p3/README.md
+++ b/public/lib/lti1p3/README.md
@@ -4,7 +4,7 @@ A library used for building IMS-certified LTI 1.3 tool providers in PHP.
This library is a fork of the [packbackbooks/lti-1-3-php-library](https://github.com/packbackbooks/lti-1-3-php-library), patched specifically for use in [Moodle](https://github.com/moodle/moodle).
-It is currently based on version [6.0.0 of the packbackbooks/lti-1-3-php-library](https://github.com/packbackbooks/lti-1-3-php-library/releases/tag/v6.0.0) library.
+It is currently based on version [6.2.0 of the packbackbooks/lti-1-3-php-library](https://github.com/packbackbooks/lti-1-3-php-library/releases/tag/v6.2.0) library.
The following changes are included so that the library may be used with Moodle:
diff --git a/public/lib/lti1p3/composer.json b/public/lib/lti1p3/composer.json
index 739f973ed4b..1cce4fa6754 100644
--- a/public/lib/lti1p3/composer.json
+++ b/public/lib/lti1p3/composer.json
@@ -21,13 +21,14 @@
}
],
"require": {
+ "php": "^8.1",
"firebase/php-jwt": "^6.6",
"guzzlehttp/guzzle": "^7.0",
"phpseclib/phpseclib": "^3.0"
},
"require-dev": {
"mockery/mockery": "^1.4",
- "nesbot/carbon": "^2.43",
+ "nesbot/carbon": "^2.43 || ^3.0",
"laravel/pint": "^1.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.0|^10.0"
diff --git a/public/lib/lti1p3/src/DeepLinkResources/DateTimeInterval.php b/public/lib/lti1p3/src/DeepLinkResources/DateTimeInterval.php
index e3b2cef2868..3b3927b46cb 100644
--- a/public/lib/lti1p3/src/DeepLinkResources/DateTimeInterval.php
+++ b/public/lib/lti1p3/src/DeepLinkResources/DateTimeInterval.php
@@ -21,7 +21,7 @@ class DateTimeInterval
public static function new(): self
{
- return new DateTimeInterval();
+ return new DateTimeInterval;
}
public function getArray(): array
diff --git a/public/lib/lti1p3/src/DeepLinkResources/Icon.php b/public/lib/lti1p3/src/DeepLinkResources/Icon.php
index 267c983fc08..304b56e1303 100644
--- a/public/lib/lti1p3/src/DeepLinkResources/Icon.php
+++ b/public/lib/lti1p3/src/DeepLinkResources/Icon.php
@@ -12,8 +12,7 @@ class Icon
private string $url,
private int $width,
private int $height
- ) {
- }
+ ) {}
public static function new(string $url, int $width, int $height): self
{
diff --git a/public/lib/lti1p3/src/DeepLinkResources/Iframe.php b/public/lib/lti1p3/src/DeepLinkResources/Iframe.php
index 039ea8eb5e7..88ebf6d683e 100644
--- a/public/lib/lti1p3/src/DeepLinkResources/Iframe.php
+++ b/public/lib/lti1p3/src/DeepLinkResources/Iframe.php
@@ -12,12 +12,11 @@ class Iframe
private ?string $src = null,
private ?int $width = null,
private ?int $height = null
- ) {
- }
+ ) {}
public static function new(): self
{
- return new Iframe();
+ return new Iframe;
}
public function getArray(): array
diff --git a/public/lib/lti1p3/src/DeepLinkResources/Resource.php b/public/lib/lti1p3/src/DeepLinkResources/Resource.php
index 5cbb4b2be9a..16a11c389f5 100644
--- a/public/lib/lti1p3/src/DeepLinkResources/Resource.php
+++ b/public/lib/lti1p3/src/DeepLinkResources/Resource.php
@@ -25,7 +25,7 @@ class Resource
public static function new(): self
{
- return new Resource();
+ return new Resource;
}
public function getArray(): array
@@ -51,6 +51,8 @@ class Resource
$resource['lineItem'] = [
'scoreMaximum' => $this->line_item->getScoreMaximum(),
'label' => $this->line_item->getLabel(),
+ 'resourceId' => $this->line_item->getResourceId(),
+ 'tag' => $this->line_item->getTag(),
];
}
diff --git a/public/lib/lti1p3/src/DeepLinkResources/Window.php b/public/lib/lti1p3/src/DeepLinkResources/Window.php
index 7ee30ba00ce..8809027dcc2 100644
--- a/public/lib/lti1p3/src/DeepLinkResources/Window.php
+++ b/public/lib/lti1p3/src/DeepLinkResources/Window.php
@@ -13,12 +13,11 @@ class Window
private ?int $width = null,
private ?int $height = null,
private ?string $window_features = null
- ) {
- }
+ ) {}
public static function new(): self
{
- return new Window();
+ return new Window;
}
public function getArray(): array
diff --git a/public/lib/lti1p3/src/JwksEndpoint.php b/public/lib/lti1p3/src/JwksEndpoint.php
index 312b0241d5b..e685a4ededa 100644
--- a/public/lib/lti1p3/src/JwksEndpoint.php
+++ b/public/lib/lti1p3/src/JwksEndpoint.php
@@ -8,9 +8,7 @@ use Packback\Lti1p3\Interfaces\ILtiRegistration;
class JwksEndpoint
{
- public function __construct(private array $keys)
- {
- }
+ public function __construct(private array $keys) {}
public static function new(array $keys): self
{
diff --git a/public/lib/lti1p3/src/LtiAbstractService.php b/public/lib/lti1p3/src/LtiAbstractService.php
index d0614ba406b..47cb910e879 100644
--- a/public/lib/lti1p3/src/LtiAbstractService.php
+++ b/public/lib/lti1p3/src/LtiAbstractService.php
@@ -12,8 +12,7 @@ abstract class LtiAbstractService
private ILtiServiceConnector $serviceConnector,
private ILtiRegistration $registration,
private array $serviceData
- ) {
- }
+ ) {}
public function getServiceData(): array
{
diff --git a/public/lib/lti1p3/src/LtiConstants.php b/public/lib/lti1p3/src/LtiConstants.php
index 120ed8d00e9..65be52559e9 100644
--- a/public/lib/lti1p3/src/LtiConstants.php
+++ b/public/lib/lti1p3/src/LtiConstants.php
@@ -21,7 +21,7 @@ class LtiConstants
public const LAUNCH_PRESENTATION = 'https://purl.imsglobal.org/spec/lti/claim/launch_presentation';
public const LIS = 'https://purl.imsglobal.org/spec/lti/claim/lis';
public const LTI1P1 = 'https://purl.imsglobal.org/spec/lti/claim/lti1p1';
- public const ROLE_SCOPE_MENTOR = 'https://purlimsglobal.org/spec/lti/claim/role_scope_mentor';
+ public const ROLE_SCOPE_MENTOR = 'https://purl.imsglobal.org/spec/lti/claim/role_scope_mentor';
public const TOOL_PLATFORM = 'https://purl.imsglobal.org/spec/lti/claim/tool_platform';
// LTI DL
diff --git a/public/lib/lti1p3/src/LtiDeepLink.php b/public/lib/lti1p3/src/LtiDeepLink.php
index a1fae707e0e..5c91767b05c 100644
--- a/public/lib/lti1p3/src/LtiDeepLink.php
+++ b/public/lib/lti1p3/src/LtiDeepLink.php
@@ -11,8 +11,7 @@ class LtiDeepLink
private ILtiRegistration $registration,
private string $deployment_id,
private array $deep_link_settings
- ) {
- }
+ ) {}
public function getResponseJwt(array $resources): string
{
@@ -32,10 +31,71 @@ class LtiDeepLink
// https://www.imsglobal.org/spec/lti-dl/v2p0/#deep-linking-request-message
// 'data' is an optional property which, if it exists, must be returned by the tool
- if (isset($this->deep_link_settings['data'])) {
- $message_jwt[LtiConstants::DL_DATA] = $this->deep_link_settings['data'];
+ if (isset($this->settings()['data'])) {
+ $message_jwt[LtiConstants::DL_DATA] = $this->settings()['data'];
}
return JWT::encode($message_jwt, $this->registration->getToolPrivateKey(), 'RS256', $this->registration->getKid());
}
+
+ public function settings(): array
+ {
+ return $this->deep_link_settings;
+ }
+
+ public function returnUrl(): string
+ {
+ return $this->settings()['deep_link_return_url'];
+ }
+
+ public function acceptTypes(): array
+ {
+ return $this->settings()['accept_types'];
+ }
+
+ public function canAcceptType(string $acceptType): bool
+ {
+ return in_array($acceptType, $this->acceptTypes());
+ }
+
+ public function acceptPresentationDocumentTargets(): array
+ {
+ return $this->settings()['accept_presentation_document_targets'];
+ }
+
+ public function canAcceptPresentationDocumentTarget(string $target): bool
+ {
+ return in_array($target, $this->acceptPresentationDocumentTargets());
+ }
+
+ public function acceptMediaTypes(): ?string
+ {
+ return $this->settings()['accept_media_types'] ?? null;
+ }
+
+ public function canAcceptMultiple(): bool
+ {
+ return $this->settings()['accept_multiple'] ?? false;
+ }
+
+ public function canAcceptLineitem(): bool
+ {
+ return $this->settings()['accept_lineitem'] ?? false;
+ }
+
+ public function canAutoCreate(): bool
+ {
+ return $this->settings()['auto_create'] ?? false;
+ }
+
+ public function title(): ?string
+ {
+ return $this->settings()['title'] ?? null;
+ }
+
+ public function text(): ?string
+ {
+ return $this->settings()['text'] ?? null;
+ }
+
}
diff --git a/public/lib/lti1p3/src/LtiDeployment.php b/public/lib/lti1p3/src/LtiDeployment.php
index 7ac23989ed5..7b829e6a79d 100644
--- a/public/lib/lti1p3/src/LtiDeployment.php
+++ b/public/lib/lti1p3/src/LtiDeployment.php
@@ -8,8 +8,7 @@ class LtiDeployment implements ILtiDeployment
{
public function __construct(
private $deployment_id
- ) {
- }
+ ) {}
public static function new($deployment_id): self
{
diff --git a/public/lib/lti1p3/src/LtiException.php b/public/lib/lti1p3/src/LtiException.php
index 16527eafe81..366e24110b6 100644
--- a/public/lib/lti1p3/src/LtiException.php
+++ b/public/lib/lti1p3/src/LtiException.php
@@ -4,6 +4,4 @@ namespace Packback\Lti1p3;
use Exception;
-class LtiException extends Exception
-{
-}
+class LtiException extends Exception {}
diff --git a/public/lib/lti1p3/src/LtiGrade.php b/public/lib/lti1p3/src/LtiGrade.php
index bd673b4e0a8..4d17e3484c7 100644
--- a/public/lib/lti1p3/src/LtiGrade.php
+++ b/public/lib/lti1p3/src/LtiGrade.php
@@ -50,7 +50,7 @@ class LtiGrade
*/
public static function new(): self
{
- return new LtiGrade();
+ return new LtiGrade;
}
public function getScoreGiven()
diff --git a/public/lib/lti1p3/src/LtiGradeSubmissionReview.php b/public/lib/lti1p3/src/LtiGradeSubmissionReview.php
index 4732d784008..f44689f31b9 100644
--- a/public/lib/lti1p3/src/LtiGradeSubmissionReview.php
+++ b/public/lib/lti1p3/src/LtiGradeSubmissionReview.php
@@ -35,7 +35,7 @@ class LtiGradeSubmissionReview
*/
public static function new(): self
{
- return new LtiGradeSubmissionReview();
+ return new LtiGradeSubmissionReview;
}
public function getReviewableStatus()
diff --git a/public/lib/lti1p3/src/LtiMessageLaunch.php b/public/lib/lti1p3/src/LtiMessageLaunch.php
index 62f2f794d61..475829b488b 100644
--- a/public/lib/lti1p3/src/LtiMessageLaunch.php
+++ b/public/lib/lti1p3/src/LtiMessageLaunch.php
@@ -27,9 +27,9 @@ class LtiMessageLaunch
public const ERR_FETCH_PUBLIC_KEY = 'Failed to fetch public key.';
public const ERR_NO_PUBLIC_KEY = 'Unable to find public key.';
public const ERR_NO_MATCHING_PUBLIC_KEY = 'Unable to find a public key which matches your JWT.';
- public const ERR_STATE_NOT_FOUND = 'Please make sure you have cookies enabled in this browser and that you are not in private or incognito mode';
+ public const ERR_STATE_NOT_FOUND = 'Please make sure you have cookies and cross-site tracking enabled in the privacy and security settings of your browser.';
public const ERR_MISSING_ID_TOKEN = 'Missing id_token.';
- public const ERR_INVALID_ID_TOKEN = 'Invalid id_token, JWT must contain 3 parts';
+ public const ERR_INVALID_ID_TOKEN = 'Invalid id_token, JWT must contain 3 parts.';
public const ERR_MISSING_NONCE = 'Missing Nonce.';
public const ERR_INVALID_NONCE = 'Invalid Nonce.';
@@ -304,7 +304,7 @@ class LtiMessageLaunch
try {
$response = $this->serviceConnector->makeRequest($request);
} catch (TransferException $e) {
- throw new LtiException(static::ERR_NO_PUBLIC_KEY);
+ throw new LtiException(static::ERR_NO_PUBLIC_KEY, previous: $e);
}
$publicKeySet = $this->serviceConnector->getResponseBody($response);
@@ -438,11 +438,11 @@ class LtiMessageLaunch
// Validate JWT signature
try {
- $headers = new \stdClass();
+ $headers = new \stdClass;
JWT::decode($this->request['id_token'], $public_key, $headers);
} catch (ExpiredException $e) {
// Error validating signature.
- throw new LtiException(static::ERR_INVALID_SIGNATURE);
+ throw new LtiException(static::ERR_INVALID_SIGNATURE, previous: $e);
}
return $this;
diff --git a/public/lib/lti1p3/src/LtiOidcLogin.php b/public/lib/lti1p3/src/LtiOidcLogin.php
index 7b9dc7f8a12..c6f6b82b651 100644
--- a/public/lib/lti1p3/src/LtiOidcLogin.php
+++ b/public/lib/lti1p3/src/LtiOidcLogin.php
@@ -19,8 +19,7 @@ class LtiOidcLogin
public IDatabase $db,
public ICache $cache,
public ICookie $cookie
- ) {
- }
+ ) {}
/**
* Static function to allow for method chaining without having to assign to a variable first.
diff --git a/public/lib/lti1p3/src/LtiServiceConnector.php b/public/lib/lti1p3/src/LtiServiceConnector.php
index 90869535f6a..2170f341b62 100644
--- a/public/lib/lti1p3/src/LtiServiceConnector.php
+++ b/public/lib/lti1p3/src/LtiServiceConnector.php
@@ -20,8 +20,7 @@ class LtiServiceConnector implements ILtiServiceConnector
public function __construct(
private ICache $cache,
private Client $client
- ) {
- }
+ ) {}
public function setDebuggingMode(bool $enable): self
{
diff --git a/public/lib/lti1p3/src/OidcException.php b/public/lib/lti1p3/src/OidcException.php
index 67c36b9d742..146a98b49bb 100644
--- a/public/lib/lti1p3/src/OidcException.php
+++ b/public/lib/lti1p3/src/OidcException.php
@@ -4,6 +4,4 @@ namespace Packback\Lti1p3;
use Exception;
-class OidcException extends Exception
-{
-}
+class OidcException extends Exception {}
diff --git a/public/lib/lti1p3/src/ServiceRequest.php b/public/lib/lti1p3/src/ServiceRequest.php
index 044d3eb5e57..5d7a8cdef39 100644
--- a/public/lib/lti1p3/src/ServiceRequest.php
+++ b/public/lib/lti1p3/src/ServiceRequest.php
@@ -47,8 +47,7 @@ class ServiceRequest implements IServiceRequest
private string $method,
private string $url,
private string $type = self::TYPE_UNSUPPORTED
- ) {
- }
+ ) {}
public function getMethod(): string
{
diff --git a/public/lib/php-jwt/readme_moodle.txt b/public/lib/php-jwt/readme_moodle.txt
index e12cdcc6e92..1c0659951b9 100644
--- a/public/lib/php-jwt/readme_moodle.txt
+++ b/public/lib/php-jwt/readme_moodle.txt
@@ -2,7 +2,7 @@ Description of php-jwt library import into Moodle
Dependencies
------------
-- The lib/lti1p3 library currently depends on version 6.0 of php-jwt.
+- The lib/lti1p3 library currently depends on version 6.2.0 of php-jwt.
- There are usages of this library in mod/lti too. Please check these.
Instructions
diff --git a/public/lib/thirdpartylibs.xml b/public/lib/thirdpartylibs.xml
index 8a933d6de30..c77a13e9a72 100644
--- a/public/lib/thirdpartylibs.xml
+++ b/public/lib/thirdpartylibs.xml
@@ -452,7 +452,7 @@ All rights reserved.
lti1p3
LTI 1.3 Tool Library
A library used for building IMS-certified LTI 1.3 tool providers in PHP.
- 6.0.0
+ 6.2.0
Apache
2.0
https://github.com/packbackbooks/lti-1-3-php-library