public function LTIToolProvider::applies in LTI Tool Provider 8
Same name and namespace in other branches
- 2.x src/Authentication/Provider/LTIToolProvider.php \Drupal\lti_tool_provider\Authentication\Provider\LTIToolProvider::applies()
Overrides AuthenticationProviderInterface::applies
See also
https://www.imsglobal.org/wiki/step-1-lti-launch-request
File
- src/
Authentication/ Provider/ LTIToolProvider.php, line 109
Class
- LTIToolProvider
- Oauth authentication provider for LTI Tool Provider.
Namespace
Drupal\lti_tool_provider\Authentication\ProviderCode
public function applies(Request $request) : bool {
$lti_message_type = $request->request
->get('lti_message_type');
$lti_version = $request->request
->get('lti_version');
$oauth_consumer_key = $request->request
->get('oauth_consumer_key');
$resource_link_id = $request->request
->get('resource_link_id');
if (!$request
->isMethod('POST')) {
return false;
}
if ($lti_message_type !== 'basic-lti-launch-request') {
return false;
}
if (!in_array($lti_version, [
'LTI-1p0',
'LTI-1p2',
])) {
return false;
}
if (empty($oauth_consumer_key)) {
return false;
}
if (empty($resource_link_id)) {
return false;
}
return true;
}