19declare(strict_types=1);
26require_once(
"../vendor/composer/vendor/autoload.php");
41if (strtoupper(
$DIC->http()->request()->getMethod()) !==
"POST") {
48if (!
$post->has(
'client_assertion') || !
$post->has(
'client_assertion_type') || !
$post->has(
'grant_type') || !
$post->has(
'scope')) {
113 $jwks = file_get_contents(
$provider->getPublicKeyset());
114 $keyset = json_decode($jwks,
true);
115 $keys = JWK::parseKeySet($keyset);
121 }
catch (Exception
$e) {
133 "exp" => $now + 3600,
134 "imsglobal.org.security.scope" =>
$scopes
140 'access_token' => $accessToken,
141 'token_type' =>
'bearer',
142 'expires_in' => 3600,
146 }
catch (Exception
$e) {
Indicates general problems with the input or output operations.
static init(string $a_type)
Init context by type.
static initILIAS()
ilias initialisation
static getProviderIdFromClientId(string $clientId)
static sendResponseError(int $code, string $message, $log=true)
static verifyPrivateKey()
static sendResponseJson(array $obj)
sendAccessToken(string $scopes, ilLTIConsumeProvider $provider)
if(!empty(ilObjLTIConsumer::verifyPrivateKey())) if(strtoupper($DIC->http() ->request() ->getMethod()) !=="POST") $params
invalidRequest(string $log="")
if(! $post->has('client_assertion')||! $post->has('client_assertion_type')||! $post->has('grant_type')||! $post->has('scope')) $clientAssertion
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
validateServiceToken(string $token, ilLTIConsumeProvider $provider)
if($claims==null) $clientId
serverError(string $log="")
if(count($parts) !=3) $payload
if(empty($clientId)) $providerId