Imagy Identity — Eventos
Proposito
Identity publica eventos cuando ocurren cambios relevantes en el ciclo de vida de usuarios, tenants y sesiones. Estos eventos son consumidos principalmente por ImagID (para crear perfiles de sujeto) y por imagy-audit (para registro de auditoria).
Exchange y Routing
| Propiedad | Valor |
|---|---|
| Exchange | imagy.events |
| Tipo | Topic |
| Prefijo routing key | identity.* |
| Formato | JSON |
| Firma | HMAC-SHA256 en header X-Event-Signature |
Catalogo de Eventos
Eventos de Usuario
| Evento | Routing Key | Severidad | Consumidores |
|---|---|---|---|
| Usuario creado | identity.user.created | Informational | ImagID, Audit |
| Usuario actualizado | identity.user.updated | Informational | Audit |
| Usuario desactivado | identity.user.deactivated | Low | ImagID, Audit |
| Login exitoso | identity.user.login | Informational | Audit |
| Login fallido | identity.user.login_failed | Low | ImagID (patron), Audit |
| Logout | identity.user.logout | Informational | Audit |
| Password cambiado | identity.user.password_changed | Low | Audit |
Eventos de Roles y Permisos
| Evento | Routing Key | Severidad | Consumidores |
|---|---|---|---|
| Rol asignado | identity.role.assigned | Low | Audit |
| Rol removido | identity.role.removed | Low | Audit |
| Permiso cambiado | identity.permission.changed | Medium | Audit |
Eventos de Tenant
| Evento | Routing Key | Severidad | Consumidores |
|---|---|---|---|
| Tenant creado | identity.tenant.created | Informational | Audit |
| Tenant actualizado | identity.tenant.updated | Informational | Audit |
| Tenant suspendido | identity.tenant.suspended | High | Todos (dejan de procesar) |
| Tenant reactivado | identity.tenant.reactivated | Medium | Todos |
Eventos de Organizacion
| Evento | Routing Key | Severidad | Consumidores |
|---|---|---|---|
| Organizacion creada | identity.organization.created | Informational | Audit |
| Organizacion actualizada | identity.organization.updated | Informational | Audit |
Payloads Detallados
identity.user.created
Publicado cuando se crea un nuevo usuario en un tenant. Puede originarse desde el panel admin, desde el endpoint interno (pipeline de credito), o desde auto-registro.
{
"event_id": "evt-uuid-001",
"event_type": "identity.user.created",
"tenant_id": "tenant-uuid-001",
"timestamp": "2026-05-18T10:00:00Z",
"data": {
"user_id": "user-uuid-001",
"keycloak_id": "kc-uuid-001",
"email": "juan.perez@email.com",
"first_name": "Juan",
"last_name": "Perez",
"phone": "+593991234567",
"document_type": "cc",
"document_number": "1234567890",
"roles": ["applicant"],
"organization_id": null,
"origin": "credit_pipeline",
"created_by": "system-lending"
},
"metadata": {
"source": "imagy-identity-management",
"correlation_id": "corr-uuid-001",
"version": "1.0.0"
}
}Campos clave:
origin: Indica como se creo el usuario (admin_panel,credit_pipeline,self_registration,api)created_by: Actor que creo el usuario (user_id o service name)document_type/document_number: Usados por ImagID para vincular al perfil global del sujeto
identity.user.login
Publicado en cada login exitoso. Incluye informacion del dispositivo para deteccion de patrones.
{
"event_id": "evt-uuid-002",
"event_type": "identity.user.login",
"tenant_id": "tenant-uuid-001",
"timestamp": "2026-05-18T10:05:00Z",
"data": {
"user_id": "user-uuid-001",
"session_id": "session-uuid-001",
"ip_address": "190.95.200.100",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
"geo": {
"country": "EC",
"city": "Quito"
},
"auth_method": "password",
"mfa_used": false
},
"metadata": {
"source": "imagy-identity-gateway",
"correlation_id": "corr-uuid-002",
"version": "1.0.0"
}
}identity.user.login_failed
Publicado en intentos de login fallidos. Util para deteccion de ataques de fuerza bruta.
{
"event_id": "evt-uuid-003",
"event_type": "identity.user.login_failed",
"tenant_id": "tenant-uuid-001",
"timestamp": "2026-05-18T10:06:00Z",
"data": {
"email": "juan.perez@email.com",
"ip_address": "45.33.100.50",
"user_agent": "curl/7.88.1",
"reason": "invalid_credentials",
"attempt_count": 3,
"geo": {
"country": "RU",
"city": "Moscow"
}
},
"metadata": {
"source": "imagy-identity-gateway",
"correlation_id": "corr-uuid-003",
"version": "1.0.0"
}
}identity.tenant.created
Publicado cuando se crea un nuevo tenant en la plataforma.
{
"event_id": "evt-uuid-004",
"event_type": "identity.tenant.created",
"tenant_id": "tenant-uuid-002",
"timestamp": "2026-05-18T10:10:00Z",
"data": {
"tenant_id": "tenant-uuid-002",
"name": "Fintech XYZ",
"slug": "fintech-xyz",
"plan": "starter",
"realm_name": "fintech-xyz",
"admin_user_id": "user-uuid-010",
"modules_activated": ["imagflow", "imaglend"]
},
"metadata": {
"source": "imagy-identity-management",
"correlation_id": "corr-uuid-004",
"version": "1.0.0"
}
}identity.tenant.suspended
Publicado cuando un tenant es suspendido. Todos los servicios deben dejar de procesar requests de este tenant.
{
"event_id": "evt-uuid-005",
"event_type": "identity.tenant.suspended",
"tenant_id": "tenant-uuid-002",
"timestamp": "2026-05-18T12:00:00Z",
"data": {
"tenant_id": "tenant-uuid-002",
"reason": "payment_overdue",
"suspended_by": "platform-admin-001",
"effective_immediately": true
},
"metadata": {
"source": "imagy-identity-management",
"correlation_id": "corr-uuid-005",
"version": "1.0.0"
}
}identity.role.assigned
{
"event_id": "evt-uuid-006",
"event_type": "identity.role.assigned",
"tenant_id": "tenant-uuid-001",
"timestamp": "2026-05-18T10:15:00Z",
"data": {
"user_id": "user-uuid-001",
"role_code": "operator",
"assigned_by": "admin-uuid-001",
"previous_roles": ["viewer"],
"new_roles": ["viewer", "operator"]
},
"metadata": {
"source": "imagy-identity-management",
"correlation_id": "corr-uuid-006",
"version": "1.0.0"
}
}Eventos Consumidos
Identity no consume eventos de otros dominios. Es un productor puro de eventos.
La unica excepcion es el back-channel logout de Keycloak, que es un webhook HTTP (no un evento de RabbitMQ).
Estructura Comun de Eventos
Todos los eventos de Identity siguen esta estructura base:
{
"event_id": "UUID v4 — unico por evento",
"event_type": "identity.{entity}.{action}",
"tenant_id": "UUID del tenant afectado",
"timestamp": "ISO 8601 con timezone",
"data": { "...campos especificos del evento..." },
"metadata": {
"source": "nombre del servicio que publica",
"correlation_id": "UUID para trazabilidad cross-servicio",
"version": "version del schema del evento"
}
}Garantias
| Propiedad | Valor |
|---|---|
| Delivery | At-least-once (consumers deben ser idempotentes) |
| Orden | No garantizado entre eventos diferentes |
| Idempotencia | event_id es unico — consumers usan processed_events para deduplicar |
| Firma | HMAC-SHA256 con secret compartido por servicio |
| TTL en cola | 7 dias (mensajes no consumidos se descartan) |
| DLQ | Dead Letter Queue para mensajes que fallan 3+ veces |