Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
Packback\Lti1p3\LtiMessageLaunch Class Reference

Public Member Functions

 __construct (private IDatabase $db, private ICache $cache, private ICookie $cookie, private ILtiServiceConnector $serviceConnector)
 
 cacheLaunchData ()
 
 canMigrate ()
 
 getAgs ()
 Fetches an instance of the assignments and grades service for the current launch.
 
 getDeepLink ()
 Fetches a deep link that can be used to construct a deep linking response.
 
 getGs ()
 Fetches an instance of the groups service for the current launch.
 
 getLaunchData ()
 Fetches the decoded body of the JWT used in the current launch.
 
 getLaunchId ()
 Get the unique launch id for the current launch.
 
 getNrps ()
 Fetches an instance of the names and roles service for the current launch.
 
 hasAgs ()
 Returns whether or not the current launch can use the assignments and grades service.
 
 hasGs ()
 Returns whether or not the current launch can use the groups service.
 
 hasNrps ()
 Returns whether or not the current launch can use the names and roles service.
 
 initialize (array $request)
 
 isDeepLinkLaunch ()
 Returns whether or not the current launch is a deep linking launch.
 
 isResourceLaunch ()
 Returns whether or not the current launch is a resource launch.
 
 isSubmissionReviewLaunch ()
 Returns whether or not the current launch is a submission review launch.
 
 migrate ()
 
 setRequest (array $request)
 
 validate ()
 Validates all aspects of an incoming LTI message launch and caches the launch if successful.
 

Static Public Member Functions

static fromCache (string $launch_id, IDatabase $db, ICache $cache, ICookie $cookie, ILtiServiceConnector $serviceConnector)
 Load an LtiMessageLaunch from a Cache using a launch id.
 
static getMissingRegistrationErrorMsg (string $issuerUrl, ?string $clientId=null)
 
static new (IDatabase $db, ICache $cache, ICookie $cookie, ILtiServiceConnector $serviceConnector)
 Static function to allow for method chaining without having to assign to a variable first.
 

Public Attributes

string $launch_id
 
const ERR_CLIENT_NOT_REGISTERED = 'Client id not registered for this issuer.'
 
const ERR_FETCH_PUBLIC_KEY = 'Failed to fetch public key.'
 
const ERR_INVALID_ALG = 'Invalid alg was specified in the JWT header.'
 
const ERR_INVALID_ID_TOKEN = 'Invalid id_token, JWT must contain 3 parts'
 
const ERR_INVALID_MESSAGE = 'Message validation failed.'
 
const ERR_INVALID_MESSAGE_TYPE = 'Invalid message type'
 
const ERR_INVALID_NONCE = 'Invalid Nonce.'
 
const ERR_INVALID_SIGNATURE = 'Invalid signature on id_token'
 
const ERR_MISMATCHED_ALG_KEY = 'The alg specified in the JWT header is incompatible with the JWK key type.'
 
const ERR_MISSING_DEPLOYEMENT_ID = 'No deployment ID was specified'
 
const ERR_MISSING_ID_TOKEN = 'Missing id_token.'
 
const ERR_MISSING_NONCE = 'Missing Nonce.'
 
const ERR_MISSING_REGISTRATION = 'LTI 1.3 Registration not found for Issuer :issuerUrl and Client ID :clientId. Please make sure the LMS has provided the right information, and that the LMS has been registered correctly in the tool.'
 
const ERR_NO_DEPLOYMENT = 'Unable to find deployment.'
 
const ERR_NO_KID = 'No KID specified in the JWT Header.'
 
const ERR_NO_MATCHING_PUBLIC_KEY = 'Unable to find a public key which matches your JWT.'
 
const ERR_NO_PUBLIC_KEY = 'Unable to find public key.'
 
const ERR_OAUTH_KEY_SIGN_MISSING = 'Unable to upgrade from LTI 1.1 to 1.3. The oauth_consumer_key_sign was not provided.'
 
const ERR_OAUTH_KEY_SIGN_NOT_VERIFIED = 'Unable to upgrade from LTI 1.1 to 1.3. No OAuth Consumer Key matched this signature.'
 
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'
 
const ERR_UNRECOGNIZED_MESSAGE_TYPE = 'Unrecognized message type.'
 
const TYPE_DEEPLINK = 'LtiDeepLinkingRequest'
 
const TYPE_RESOURCELINK = 'LtiResourceLinkRequest'
 
const TYPE_SUBMISSIONREVIEW = 'LtiSubmissionReviewRequest'
 

Protected Member Functions

 validateDeployment ()
 
 validateJwtFormat ()
 
 validateJwtSignature ()
 
 validateMessage ()
 
 validateNonce ()
 
 validateRegistration ()
 
 validateState ()
 

Member Function Documentation

◆ fromCache()

static Packback\Lti1p3\LtiMessageLaunch::fromCache ( string $launch_id,
IDatabase $db,
ICache $cache,
ICookie $cookie,
ILtiServiceConnector $serviceConnector )
static

Load an LtiMessageLaunch from a Cache using a launch id.

Exceptions
LtiExceptionWill throw an LtiException if validation fails or launch cannot be found

◆ validate()

Packback\Lti1p3\LtiMessageLaunch::validate ( )

Validates all aspects of an incoming LTI message launch and caches the launch if successful.

Exceptions
LtiExceptionWill throw an LtiException if validation fails

The documentation for this class was generated from the following file: