Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

(no description)

File Size: 150 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

user_migration_claim:: (4 methods):
  __construct()
  verify_signature()
  get_consumer_key()
  get_user_id()


Class: user_migration_claim  - X-Ref

A simplified representation of a 'https://purl.imsglobal.org/spec/lti/claim/lti1p1' migration claim.

This serves the purpose of migrating a legacy user account only. Claim properties that do not relate to user migration are not
included or handled by this representation.

See https://www.imsglobal.org/spec/lti/v1p3/migr#lti-1-1-migration-claim

__construct(array $jwt, array $consumersecrets)   X-Ref
The migration_claim constructor.

The signature of a migration claim must be verifiable. To achieve this, the constructor takes a list of secrets
corresponding to the 'oauth_consumer_key' provided in the 'https://purl.imsglobal.org/spec/lti/claim/lti1p1'
claim. How these secrets are determined is not the responsibility of this class. The constructor assumes these
correspond.

param: array $jwt the array of claim data, as received in a resource link launch JWT.
param: array $consumersecrets a list of consumer secrets for the consumerkey included in the migration claim.

verify_signature(string $consumerkey, string $signature, string $deploymentid, string $platform,string $clientid, string $exp, string $nonce, array $consumersecrets)   X-Ref
Verify the claim signature by recalculating it using the launch data and cross-checking consumer secrets.

param: string $consumerkey the LTI 1.1 consumer key.
param: string $signature a signature of the LTI 1.1 consumer key and associated launch data.
param: string $deploymentid the deployment id included in the launch.
param: string $platform the platform included in the launch.
param: string $clientid the client id included in the launch.
param: string $exp the exp included in the launch.
param: string $nonce the nonce included in the launch.
param: array $consumersecrets the list of consumer secrets used with the given $consumerkey param
return: bool true if the signature was verified, false otherwise.

get_consumer_key()   X-Ref
Return the consumer key stored in the claim.

return: string the consumer key included in the claim.

get_user_id()   X-Ref
Return the LTI 1.1 user id stored in the claim.

return: string the user id, or null if not provided in the claim.