Skip to content

Latest commit

 

History

History
62 lines (41 loc) · 3.61 KB

platform.md

File metadata and controls

62 lines (41 loc) · 3.61 KB

AGS Platform - Result service server

How to use the ResultServiceServerRequestHandler (with the core LtiServiceServer) to provide authenticated AGS endpoint for results retrieval as a platform.

Table of contents

Features

This library provides a ResultServiceServerRequestHandler ready to be use with the core LtiServiceServer to expose results to tools, as a platform.

It allows you to provide a result service endpoint as specified in AGS openapi documentation.

Usage

First, you need to provide:

Then:

<?php

use OAT\Library\Lti1p3Ags\Repository\LineItemRepositoryInterface;
use OAT\Library\Lti1p3Ags\Repository\ResultRepositoryInterface;
use OAT\Library\Lti1p3Ags\Service\Result\Server\Handler\ResultServiceServerRequestHandler;
use OAT\Library\Lti1p3Core\Registration\RegistrationRepositoryInterface;
use OAT\Library\Lti1p3Core\Security\OAuth2\Validator\RequestAccessTokenValidator;
use OAT\Library\Lti1p3Core\Service\Server\LtiServiceServer;
use Psr\Http\Message\ServerRequestInterface;

/** @var ServerRequestInterface $request */
$request = ...

/** @var RegistrationRepositoryInterface $registrationRepository */
$registrationRepository = ...

/** @var LineItemRepositoryInterface $lineItemRepository */
$lineItemRepository = ...

/** @var ResultRepositoryInterface $scoreRepository */
$resultRepository = ...

$validator = new RequestAccessTokenValidator($registrationRepository);

$handler = new ResultServiceServerRequestHandler($lineItemRepository, $resultRepository);

$server = new LtiServiceServer($validator, $handler);

// Generates an authenticated response containing the result list representation
$response = $server->handle($request);