Skip to content

Conversation

@MateusOK
Copy link
Owner

This pull request introduces a complete authentication module for the application, implementing user registration and login with domain-driven design principles. It covers the API layer, application layer (use cases and DTOs), domain models, infrastructure for persistence and security, and includes tests for authentication logic.

API Layer:

  • Adds AuthController with endpoints for user registration (/register, /signup) and login (/login, /signin), delegating logic to use cases.

Application Layer:

  • Defines DTOs for authentication and user creation (AuthUserRequest, CreateUserRequest, CreateUserResponse). [1] [2] [3]
  • Implements use cases for user authentication and registration, including validation and error handling. [1] [2]
  • Introduces a PasswordHasher interface for password security.
  • Provides Spring configuration for use case beans.

Domain Layer:

  • Adds the User aggregate root with factory methods, status management, and validation.
  • Defines UserRole and UserStatus enums. [1] [2]
  • Specifies the UserRepository interface.

Infrastructure Layer:

  • Implements JPA entity (UserEntity) and repository (UserJpaRepository, UserRepositoryImpl) for user persistence. [1] [2] [3]
  • Provides a mapper between domain model and entity (UserMapper).
  • Implements BCryptPasswordHasher for secure password hashing.

Testing:

  • Adds unit tests for the authentication use case, covering success and failure scenarios.

Most important changes:

API and Application Layer

  • Introduced AuthController with endpoints for registration and login, delegating to use cases.
  • Implemented AuthenticateUserUseCase and RegisterUserUseCase for authentication and user creation, including validation and error handling. [1] [2]
  • Defined DTOs for user authentication and registration flows. [1] [2] [3]
  • Added PasswordHasher abstraction and its Spring configuration. [1] [2]

Domain and Infrastructure Layer

  • Created the User domain model with status management, and supporting enums (UserRole, UserStatus). [1] [2] [3]
  • Implemented persistence with JPA entity, repository, and domain-entity mapper. [1] [2] [3] [4]
  • Provided a secure password hasher implementation using BCrypt.

Testing

  • Added comprehensive unit tests for the authentication use case.

@MateusOK MateusOK self-assigned this Sep 25, 2025
@MateusOK
Copy link
Owner Author

@MateusOK MateusOK merged commit 6f06df8 into main Sep 25, 2025
1 check passed
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