125 lines
3.4 KiB
Plaintext
125 lines
3.4 KiB
Plaintext
@startuml lti-grading-flow
|
||
skinparam defaultFontSize 10
|
||
skinparam sequenceMessageAlign center
|
||
scale 1200 width
|
||
|
||
title LTI 1.3 - Отправка оценки в LMS (Assignment and Grade Services)
|
||
|
||
actor "Студент" as Student
|
||
participant "TaskController" as Controller #DDDDFF
|
||
participant "TaskServiceImpl" as TaskService #DDDDFF
|
||
participant "ScriptExecutor\n(BashAdapter)" as ScriptExecutor #FFDDDD
|
||
participant "LMSGateway\n(LMSRestAdapter)" as LMSGateway #FFDDDD
|
||
participant "ResultServiceImpl" as ResultService #DDDDFF
|
||
participant "JwtService" as JwtService #DDDDFF
|
||
participant "LMS\n(Canvas/Moodle)" as LMS #EEEEEE
|
||
|
||
== Отправка задания на проверку ==
|
||
|
||
Student -> Controller: POST /tool/lti/submit
|
||
activate Controller
|
||
|
||
Controller -> TaskService: checkTask(CheckTaskRequest)
|
||
activate TaskService
|
||
note right
|
||
CheckTaskRequest содержит:
|
||
- contextId (UUID задачи)
|
||
- clientId (LMS client)
|
||
- idToken (JWT с данными пользователя)
|
||
end note
|
||
|
||
TaskService -> TaskService: findByContextId(contextId)
|
||
TaskService -> TaskService: getVerificationScript()
|
||
|
||
TaskService -> ScriptExecutor: runVerificationScript(contextId, script)
|
||
activate ScriptExecutor
|
||
note right
|
||
Запуск bash скрипта
|
||
с проверками:
|
||
- Docker контейнеры
|
||
- Kubernetes ресурсы
|
||
- Тесты приложения
|
||
end note
|
||
ScriptExecutor --> TaskService: boolean (true/false)
|
||
deactivate ScriptExecutor
|
||
|
||
TaskService -> LMSGateway: exchangeForAccessToken(clientId)
|
||
activate LMSGateway
|
||
|
||
LMSGateway -> LMSGateway: generateClientAssertion(clientId)
|
||
note right
|
||
JWT assertion для OAuth 2.0
|
||
с приватным ключом
|
||
end note
|
||
|
||
LMSGateway -> LMS: POST /lti/token\nContent-Type: application/x-www-form-urlencoded
|
||
note right
|
||
Body:
|
||
- grant_type: client_credentials
|
||
- client_assertion_type: jwt-bearer
|
||
- client_assertion: <JWT>
|
||
- scope: AGS scopes
|
||
end note
|
||
activate LMS
|
||
|
||
LMS --> LMSGateway: access_token
|
||
deactivate LMS
|
||
LMSGateway --> TaskService: accessToken
|
||
deactivate LMSGateway
|
||
|
||
TaskService -> ResultService: setResult(accessToken, idToken, passed)
|
||
activate ResultService
|
||
|
||
ResultService -> JwtService: getTokenPayload(idToken)
|
||
activate JwtService
|
||
JwtService --> ResultService: IdTokenPayload
|
||
deactivate JwtService
|
||
note right
|
||
IdTokenPayload содержит:
|
||
- sub (user ID)
|
||
- tokenEndpoint.lineitem
|
||
(URL для отправки оценки)
|
||
end note
|
||
|
||
ResultService -> ResultService: buildResultRequest(passed)
|
||
note right
|
||
ResultRequest:
|
||
- scoreGiven: 1 или 0
|
||
- scoreMaximum: 1
|
||
- activityProgress: Completed
|
||
- gradingProgress: FullyGraded
|
||
- timestamp: now()
|
||
- userId: sub
|
||
end note
|
||
|
||
ResultService -> LMS: POST {lineitem}/scores/result\nAuthorization: Bearer {accessToken}\nContent-Type: application/vnd.ims.lis.v1.score+json
|
||
activate LMS
|
||
note right
|
||
LTI Advantage
|
||
Assignment and Grade Services (AGS)
|
||
|
||
Отправка оценки согласно
|
||
IMS LTI 1.3 спецификации
|
||
end note
|
||
|
||
LMS --> ResultService: 200 OK (оценка сохранена)
|
||
deactivate LMS
|
||
|
||
ResultService --> TaskService: void
|
||
deactivate ResultService
|
||
|
||
TaskService --> Controller: ResultResponse("success"/"failed")
|
||
deactivate TaskService
|
||
|
||
Controller --> Student: HTTP 202 Accepted\n{"status": "success"}
|
||
deactivate Controller
|
||
|
||
== Результат в LMS ==
|
||
|
||
Student -> LMS: Просмотр оценок
|
||
activate LMS
|
||
LMS --> Student: Оценка: 1/1 (100%) или 0/1 (0%)
|
||
deactivate LMS
|
||
|
||
@enduml
|