Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
Packback\Lti1p3\LtiMessageLaunch Class Reference

Public Member Functions

 __construct (IDatabase $database, ICache $cache=null, ICookie $cookie=null, ILtiServiceConnector $serviceConnector=null)
 Constructor.
 
 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.
 
 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.
 
 validate (array $request=null)
 Validates all aspects of an incoming LTI message launch and caches the launch if successful.
 

Static Public Member Functions

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

Public Attributes

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_PUBLIC_KEY = 'Unable to find public key.'
 
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'
 

Constructor & Destructor Documentation

◆ __construct()

Packback\Lti1p3\LtiMessageLaunch::__construct ( IDatabase $database,
ICache $cache = null,
ICookie $cookie = null,
ILtiServiceConnector $serviceConnector = null )

Constructor.

Parameters
IDatabase$databaseInstance of the database interface used for looking up registrations and deployments
ICache$cacheInstance of the Cache interface used to loading and storing launches
ICookie$cookieInstance of the Cookie interface used to set and read cookies
ILtiServiceConnector$serviceConnectorInstance of the LtiServiceConnector used to by LTI services to make API requests

Member Function Documentation

◆ fromCache()

static Packback\Lti1p3\LtiMessageLaunch::fromCache ( $launch_id,
IDatabase $database,
ICache $cache = null,
ILtiServiceConnector $serviceConnector = null )
static

Load an LtiMessageLaunch from a Cache using a launch id.

Parameters
string$launch_idThe launch id of the LtiMessageLaunch object that is being pulled from the cache
IDatabase$databaseInstance of the database interface used for looking up registrations and deployments
ICache$cacheInstance of the Cache interface used to loading and storing launches. If non is provided launch data will be store in $_SESSION.
Exceptions
LtiExceptionWill throw an LtiException if validation fails or launch cannot be found
Return values
LtiMessageLaunchA populated and validated LtiMessageLaunch

◆ getAgs()

Packback\Lti1p3\LtiMessageLaunch::getAgs ( )

Fetches an instance of the assignments and grades service for the current launch.

Return values
LtiAssignmentsGradesServiceAn instance of the assignments an grades service that can be used to make calls within the scope of the current launch

◆ getDeepLink()

Packback\Lti1p3\LtiMessageLaunch::getDeepLink ( )

Fetches a deep link that can be used to construct a deep linking response.

Return values
LtiDeepLinkAn instance of a deep link to construct a deep linking response for the current launch

◆ getGs()

Packback\Lti1p3\LtiMessageLaunch::getGs ( )

Fetches an instance of the groups service for the current launch.

Return values
LtiCourseGroupsServiceAn instance of the groups service that can be used to make calls within the scope of the current launch

◆ getLaunchData()

Packback\Lti1p3\LtiMessageLaunch::getLaunchData ( )

Fetches the decoded body of the JWT used in the current launch.

Return values
array|objectReturns the decoded json body of the launch as an array

◆ getLaunchId()

Packback\Lti1p3\LtiMessageLaunch::getLaunchId ( )

Get the unique launch id for the current launch.

Return values
stringA unique identifier used to re-reference the current launch in subsequent requests

◆ getNrps()

Packback\Lti1p3\LtiMessageLaunch::getNrps ( )

Fetches an instance of the names and roles service for the current launch.

Return values
LtiNamesRolesProvisioningServiceAn instance of the names and roles service that can be used to make calls within the scope of the current launch

◆ hasAgs()

Packback\Lti1p3\LtiMessageLaunch::hasAgs ( )

Returns whether or not the current launch can use the assignments and grades service.

Return values
boolReturns a boolean indicating the availability of assignments and grades

◆ hasGs()

Packback\Lti1p3\LtiMessageLaunch::hasGs ( )

Returns whether or not the current launch can use the groups service.

Return values
boolReturns a boolean indicating the availability of groups

◆ hasNrps()

Packback\Lti1p3\LtiMessageLaunch::hasNrps ( )

Returns whether or not the current launch can use the names and roles service.

Return values
boolReturns a boolean indicating the availability of names and roles

◆ isDeepLinkLaunch()

Packback\Lti1p3\LtiMessageLaunch::isDeepLinkLaunch ( )

Returns whether or not the current launch is a deep linking launch.

Return values
boolReturns true if the current launch is a deep linking launch

◆ isResourceLaunch()

Packback\Lti1p3\LtiMessageLaunch::isResourceLaunch ( )

Returns whether or not the current launch is a resource launch.

Return values
boolReturns true if the current launch is a resource launch

◆ isSubmissionReviewLaunch()

Packback\Lti1p3\LtiMessageLaunch::isSubmissionReviewLaunch ( )

Returns whether or not the current launch is a submission review launch.

Return values
boolReturns true if the current launch is a submission review launch

◆ validate()

Packback\Lti1p3\LtiMessageLaunch::validate ( array $request = null)

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

Parameters
array | string$requestAn array of post request parameters. If not set will default to $_POST.
Exceptions
LtiExceptionWill throw an LtiException if validation fails
Return values
LtiMessageLaunchWill return $this if validation is successful

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