Перейти к основному содержимому

identity → все домены

Зачем нужно

Identity предоставляет всем 6 не-identity доменам аутентификацию, авторизацию, профиль пользователя, семейный и организационный контекст действия, а также события lifecycle пользователя, семьи, организации, членства, команд и official organization students.

Identity не является Learning Workspace: общие списки «мои ученики / мои группы» живут в учебном контуре как learning_group и learning_group_participant. Identity владеет educator_profile как анкетой и trust profile, но эта анкета не выдаёт прав. organization_student используется только для официального контура организации и не заменяет учебные группы преподавателя.

Стороны

  • источник истины: identity
  • потребитель: все остальные backend-сервисы и frontend-приложения
  • виды интеграции: online read (JWKS, userinfo, permissions), event-driven (lifecycle events), domain command (выдача service tokens)

Контракты

OIDC Discovery

GET https://id.systematika.tld/.well-known/openid-configuration
GET https://id.systematika.tld/.well-known/jwks.json

Используется backend-сервисами для валидации JWT (offline) и frontend для OAuth flow.

Userinfo

GET https://id.systematika.tld/userinfo
Authorization: Bearer <access_token>

Возвращает claim'ы пользователя по стандарту OIDC.

Расширенный профиль

GET https://id.systematika.tld/api/v2/identity/admin/users/{id}

Требует scope service:identity.users.read. Кеш на стороне потребителя — до 60 секунд.

Permissions check

GET https://id.systematika.tld/api/v2/identity/admin/users/{id}/permissions?domain=lms

Возвращает permissions пользователя для конкретного домена. Кеш — до 60 секунд.

Organization context

GET https://id.systematika.tld/api/v2/identity/organizations/{id}
GET https://id.systematika.tld/api/v2/identity/organizations/{id}/students
GET https://id.systematika.tld/api/v2/identity/admin/users/{id}/permissions?organizationId=...

Потребители получают только ссылки и безопасные snapshots. Внешние домены должны называть ссылку на organization как identity_organization_id, если рядом есть локальная projection:

  • identity_organization_id (organization_id only inside identity API payloads);
  • organization_student_id;
  • organization_membership_id;
  • organization_team_id;
  • effective permissions в organization/team/resource scope.

Потребители не пишут в identity-owned organization tables напрямую.

organization_student_id можно использовать только как ссылку на официальную запись ученика организации. Для учебных групп, кружков, тренажёров и преподавательского списка используются Learning Workspace refs, а не identity-owned tables.

Service tokens (client_credentials)

POST https://id.systematika.tld/oauth/token
grant_type=client_credentials&client_id=...&client_secret=...&scope=service:crm.entitlements.read

События

messageTypeНазначение
identity.user.registeredновый пользователь зарегистрировался
identity.user.activatedпользователь подтвердил контакты, аккаунт активен
identity.user.blockedпользователь заблокирован
identity.user.deletedsoft delete или анонимизация
identity.user.updatedизменения публично-видимых атрибутов профиля
identity.user_email.added / identity.user_email.removedконтактные данные
identity.user_phone.added / identity.user_phone.removed
identity.session.createdпользователь вошёл
identity.session.revokedсессия отозвана (logout, security)
identity.role.assigned / identity.role.revokedсмена ролей
identity.family_member.added / identity.family_member.removedсостав семьи
identity.family_student_profile.created / identity.family_student_profile.updated / identity.family_student_profile.linkedдети семьи
identity.delegated_session.started / identity.delegated_session.endeddelegated context взрослого по student_profile
identity.child_device_authorization.created / identity.child_device_authorization.approved / identity.child_device_authorization.completed / identity.child_device_authorization.revokedвход ребёнка на устройстве
identity.organization.created / identity.organization.updated / identity.organization.activatedlifecycle организации
identity.organization.archived / identity.organization.restoredорганизация скрыта или восстановлена
identity.organization.disputed / identity.organization.mergedспор или ручная склейка
identity.organization_invitation.created / identity.organization_invitation.sent / identity.organization_invitation.accepted / identity.organization_invitation.rejected / identity.organization_invitation.revokedlifecycle приглашений организации
identity.organization_membership.requested / identity.organization_membership.activated / identity.organization_membership.suspended / identity.organization_membership.leftсостав организации
identity.organization_ownership_claim.submitted / identity.organization_ownership_claim.approved / identity.organization_ownership_claim.rejectedзаявки на владение
identity.organization_ownership_transfer.created / identity.organization_ownership_transfer.completedпередача ownership
identity.organization_student.created / identity.organization_student.updated / identity.organization_student.archivedученики организации
identity.organization_team.created / identity.organization_team.updated / identity.organization_team.archivedкоманды организации
identity.organization_permission_grant.created / identity.organization_permission_grant.revokedorganization-scoped grants
identity.oauth_consent.granted / identity.oauth_consent.revokedOAuth consent

Подробные payloads — в ../domains/identity/events.md.

Actor context

Заголовок X-Actor-Context (см. ../platform/auth-integration.md). Все 6 доменов обязаны принимать и проверять контекст для действий, требующих не-personal контекста. В family context главным subject является studentProfileId; linked child user передаётся только как optional reference.

Organization consumers

Competitions

Competitions reads:

  • organization;
  • organization_student;
  • organization_membership;
  • organization_team;
  • permission context.

Competitions writes only competition-owned data: competition_participant, competition_registration, submissions, results and awards.

Competitions must not create the canonical «my students / my groups» list. Competition-specific grouping, if used, is an event/season access projection and cannot become the source for future LMS training or educator workspace screens.

LMS / Learning Workspace

LMS/Learning Workspace owns:

  • learning_group;
  • learning_group_participant;
  • learning assignments, training attempts, review sessions and learning evidence.

Identity supplies user, educator_profile, student_profile, family, official organization and permission context for these objects. Family adult context даёт чтение календаря и прогресса ребёнка, но не даёт adult-to-adult доступ.

Task-bank

Task-bank uses organization/team permission grants for access to collections and problem sets. Task-bank owns problem, problem_set, problem_usage, attempts and checking; identity owns organization/team/membership context.

Task-bank must not create learning groups or teacher-student rosters. It stores task/check context and references the Learning Workspace context supplied by LMS.

CRM

CRM may link identity users, student_profile, family_group and identity_organization_id to commercial accounts, contacts, invoices, payments and entitlements. Commercial ownership remains CRM. CRM must distinguish purchaser/payer from beneficiary/enrollment subject.

Management

Management subscribes to organization events for analytics. It does not mutate organizations.

Идемпотентность

  • события идемпотентны по messageId;
  • service token cache invalidate на identity.session.revoked.
  • downstream consumers при identity.organization.archived, identity.organization.merged, identity.organization_membership.suspended и grant revocation инвалидируют organization cache, скрывают org-specific write actions и не удаляют исторические записи.

Ошибки

СценарийПоведение потребителя
401 от identityпринудительный logout пользователя на frontend
403 от identityпоказать «нет прав», audit
5xx от identityexponential backoff retry, fallback на cached JWKS

Scopes

Scopes для service tokens документируются в domains/identity/oauth-server.md и в domains/<consumer>/integrations.md.

Базовый набор:

  • service:identity.users.read
  • service:identity.permissions.read
  • service:identity.events.subscribe

Retention

  • события identity: 30 дней (lifecycle), 7 лет audit-связанные;
  • userinfo cache на стороне потребителя: до 60 секунд.

Безопасность

  • service secrets — отдельные на окружение;
  • TLS обязателен;
  • pgp-подписи токенов через JWKS (RS256);
  • не передавать пароли, OTP-коды, refresh tokens в payload.

Связанные ADR

Связанные документы