Skip to content

Dev#18

Merged
Raydberg merged 4 commits intomainfrom
dev
Oct 8, 2025
Merged

Dev#18
Raydberg merged 4 commits intomainfrom
dev

Conversation

@Raydberg
Copy link
Copy Markdown
Contributor

@Raydberg Raydberg commented Oct 8, 2025

Summary by CodeRabbit

  • New Features
    • Inclusión del correo electrónico en los eventos de creación/actualización de usuario.
  • Bug Fixes
    • El cierre de sesión devuelve 500 en caso de error y corrige el mensaje mostrado.
  • Security
    • Activación de protección CSRF con tokens en cookie (excluyendo /auth/register).
    • Secreto del cliente ahora gestionado por configuración, no hardcodeado.
  • Refactor
    • Publicación de notificaciones asíncrona con mejor trazabilidad de éxito/errores.

JhonRodriguez31 and others added 4 commits October 7, 2025 21:58
@Raydberg Raydberg merged commit 9fd124c into main Oct 8, 2025
1 check passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 8, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Se inyecta el secreto del cliente OAuth desde configuración; se habilita y configura CSRF con cookie y exclusión de /auth/register; se ajusta el manejo de error en logout a 500; el evento CreatedUserEvent incorpora email; servicios de registro y OAuth2 pasan email en el evento; envío Kafka pasa a ser asíncrono con callbacks.

Changes

Cohort / File(s) Summary
Config de Autorización y Seguridad
src/main/java/com/security/config/auth/AuthorizationServerConfig.java, src/main/java/com/security/config/auth/SecurityConfig.java
Autoriza el secreto del cliente vía @Value y lo codifica; cambia CSRF de deshabilitado a habilitado usando CookieCsrfTokenRepository y excluye /auth/register de CSRF.
Controlador de Autenticación
src/main/java/com/security/controllers/AuthController.java
En logout, al capturar excepción responde 500 con mismo DTO y mensaje con acento; limpieza de cookies y logging se mantienen; limpieza de comentarios.
Evento de Usuario Creado
src/main/java/com/security/events/notification/CreatedUserEvent.java
El record añade el campo email entre phone y profileImageUrl.
Servicio de Registro
src/main/java/com/security/services/Impl/AuthServiceImpl.java
En registerUser, la publicación de CreatedUserEvent ahora incluye email.
Servicio OAuth2
src/main/java/com/security/services/oauth2/CustomOAuth2UserService.java
Incluye email en las llamadas a CreatedUserEvent en creación y actualización de usuario.
Notificaciones (Kafka)
src/main/java/com/security/services/Impl/NotificationServiceImpl.java
Cambia envío Kafka a asíncrono con CompletableFuture, callbacks de éxito/fracaso y logging; añade imports correspondientes y try-catch.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Cliente
  participant Navegador
  participant App as App (Servidor)
  participant CSRF as CSRF Repo (Cookie)
  Cliente->>Navegador: Solicita /auth/register
  Note over App,CSRF: CSRF habilitado con CookieCsrfTokenRepository
  Navegador->>App: POST /auth/register (exento de CSRF)
  App-->>Navegador: 200/resultado
  Cliente->>Navegador: Solicita POST protegido
  Navegador->>CSRF: Lee/escribe cookie XSRF
  Navegador->>App: POST protegido + cabecera CSRF
  App-->>Navegador: Respuesta según validación CSRF
Loading
sequenceDiagram
  autonumber
  participant Service as NotificationServiceImpl
  participant Kafka as KafkaTemplate
  participant Broker as Kafka Broker
  Service->>Kafka: send(topic, payload)
  note right of Kafka: Devuelve CompletableFuture
  Kafka-->>Service: CompletableFuture<SendResult>
  alt Éxito
    Service->>Service: callback onSuccess (log offset)
    Kafka->>Broker: Produce mensaje
  else Error
    Service->>Service: callback onFailure (log error)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

Salté entre commits con suave emoción,
un email se suma a la notificación.
La cookie CSRF vigila el jardín,
y Kafka ahora canta en futuro sin fin.
Si falla el logout, 500 sonará;
mi nariz tiembla: seguridad quedará. 🐇✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ecfe274 and 087cca4.

📒 Files selected for processing (7)
  • src/main/java/com/security/config/auth/AuthorizationServerConfig.java (2 hunks)
  • src/main/java/com/security/config/auth/SecurityConfig.java (2 hunks)
  • src/main/java/com/security/controllers/AuthController.java (2 hunks)
  • src/main/java/com/security/events/notification/CreatedUserEvent.java (1 hunks)
  • src/main/java/com/security/services/Impl/AuthServiceImpl.java (1 hunks)
  • src/main/java/com/security/services/Impl/NotificationServiceImpl.java (2 hunks)
  • src/main/java/com/security/services/oauth2/CustomOAuth2UserService.java (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Oct 8, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants