📚 제6장: Phase 3 - 통신 프로토콜

이 장에서는 LTI 1.3 통합, OAuth 2.0 인증 및 실시간 통신을 위한 프로토콜을 정의합니다.


6.1 LTI 1.3 통합

6.1.1 LTI 개요

Learning Tools Interoperability (LTI) 1.3은 교육 도구와 플랫폼 간의 안전한 통합을 가능하게 합니다. WIA EDU 표준은 LTI 1.3을 확장하여 접근성 정보를 전송합니다.

6.1.2 접근성 클레임 확장

// LTI 1.3 ID 토큰 내 접근성 클레임
{
  "https://wiastandards.com/claim/accessibility": {
    "profile_id": "EDU-2025-AB12-CD34",
    "profile_url": "https://api.wiastandards.com/edu/v1/profiles/EDU-2025-AB12-CD34",
    "preferences_hash": "sha256:abc123...",
    "accommodations": {
      "timing": {
        "extended_time_multiplier": 1.5
      },
      "presentation": {
        "screen_reader": true,
        "high_contrast": true
      },
      "content": {
        "captions": true,
        "sign_language": "ksl"
      }
    },
    "consent": {
      "shared_with_tool": true,
      "consent_date": "2025-01-10T09:00:00Z"
    }
  }
}

6.1.3 LTI 서비스 확장

// 접근성 프로필 서비스
{
  "https://wiastandards.com/spec/lti/accessibility_profile": {
    "endpoint": "https://platform.example.com/lti/accessibility",
    "actions": ["read", "update"],
    "scopes": [
      "https://wiastandards.com/scope/accessibility.readonly",
      "https://wiastandards.com/scope/accessibility.write"
    ]
  }
}

6.2 OAuth 2.0 인증

6.2.1 인증 흐름

OAuth 2.0 Authorization Code Flow:

┌─────────┐     ┌─────────────┐     ┌─────────────┐
│ 학습자   │     │  LMS 플랫폼  │     │ WIA EDU API │
└────┬────┘     └──────┬──────┘     └──────┬──────┘
     │                 │                   │
     │  1. 로그인 요청  │                   │
     │────────────────►│                   │
     │                 │                   │
     │  2. 인증 리다이렉트                  │
     │◄────────────────│                   │
     │                 │                   │
     │  3. 사용자 인증 (WIA OAuth)          │
     │─────────────────────────────────────►
     │                 │                   │
     │  4. 인가 코드 반환                   │
     │◄─────────────────────────────────────
     │                 │                   │
     │  5. 토큰 교환    │                   │
     │────────────────►│                   │
     │                 │  6. 토큰 요청      │
     │                 │──────────────────►│
     │                 │                   │
     │                 │  7. 액세스 토큰    │
     │                 │◄──────────────────│
     │                 │                   │
     │  8. 세션 생성    │                   │
     │◄────────────────│                   │
     │                 │                   │
        

6.2.2 토큰 요청

POST /oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code
&code={authorization_code}
&redirect_uri=https://lms.example.com/callback
&client_id={client_id}
&client_secret={client_secret}

응답:
{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4...",
  "scope": "profile.read profile.write accommodations.read"
}

6.2.3 스코프 정의

스코프 설명 권한
profile.read 프로필 읽기 학습자 프로필 조회
profile.write 프로필 쓰기 프로필 생성 및 수정
accommodations.read 편의제공 읽기 편의제공 설정 조회
match.execute 매칭 실행 프로필-과정 매칭

6.3 실시간 통신

6.3.1 WebSocket 연결

// WebSocket 연결 설정
const ws = new WebSocket('wss://api.wiastandards.com/edu/v1/realtime');

ws.onopen = () => {
  // 인증 및 구독
  ws.send(JSON.stringify({
    type: 'authenticate',
    token: 'Bearer eyJhbGci...',
    subscriptions: [
      'profile.EDU-2025-AB12-CD34.updates',
      'accommodations.changes'
    ]
  }));
};

ws.onmessage = (event) => {
  const message = JSON.parse(event.data);

  switch (message.type) {
    case 'profile_updated':
      // 프로필 변경 처리
      applyProfileChanges(message.changes);
      break;
    case 'accommodation_applied':
      // 편의제공 적용 알림
      notifyUser(message.accommodation);
      break;
  }
};

6.3.2 실시간 이벤트 유형

이벤트 설명 페이로드
profile_updated 프로필 변경 변경된 필드 목록
accommodation_applied 편의제공 적용 적용된 편의제공 정보
content_ready 접근 가능 콘텐츠 준비 콘텐츠 URL 및 형식
assessment_timer 평가 시간 업데이트 남은 시간, 휴식 상태

6.4 Webhook 통합

6.4.1 Webhook 등록

POST /webhooks
Content-Type: application/json
Authorization: Bearer {token}

{
  "url": "https://lms.example.com/wia-webhooks",
  "events": [
    "profile.created",
    "profile.updated",
    "accommodation.requested",
    "accommodation.approved"
  ],
  "secret": "webhook_secret_key"
}

응답:
{
  "webhook_id": "WH-2025-001",
  "status": "active",
  "created_at": "2025-01-15T09:00:00Z"
}

6.4.2 Webhook 페이로드

POST https://lms.example.com/wia-webhooks
Content-Type: application/json
X-WIA-Signature: sha256=abc123...
X-WIA-Event: profile.updated

{
  "event": "profile.updated",
  "timestamp": "2025-01-15T10:30:00Z",
  "data": {
    "profile_id": "EDU-2025-AB12-CD34",
    "changes": [
      {
        "path": "display_preferences.text_settings.font_size",
        "old_value": "large",
        "new_value": "x-large"
      }
    ]
  }
}

6.5 보안 고려사항

6.5.1 데이터 암호화

6.5.2 개인정보 보호

// 최소 권한 원칙
{
  "data_sharing": {
    "principle": "need_to_know",
    "disclosed_fields": [
      "accommodations.timing",
      "accommodations.presentation"
    ],
    "withheld_fields": [
      "learner_info.medical_details",
      "learner_info.diagnosis"
    ],
    "consent_required": true,
    "consent_granularity": "per_field"
  }
}

6.6 장 요약

핵심 내용:

  1. LTI 1.3: 접근성 클레임으로 확장된 교육 도구 통합
  2. OAuth 2.0: 안전한 인증 및 세분화된 스코프
  3. 실시간 통신: WebSocket을 통한 즉각적인 프로필 동기화
  4. Webhook: 이벤트 기반 시스템 통합
  5. 보안: TLS 1.3, AES-256, 최소 권한 원칙