Skip to content

[JITERA] Implement User Creation in UserServiceImpl

chi le requested to merge feat/create-user-service-1749612519 into master

Created by: chi-jitera

Overview

This pull request implements the user creation functionality in the UserServiceImpl class of the authentication service. It ensures that new users can be created while checking for existing usernames and securely storing passwords.

Changes

  1. User Existence Check:

    • The method create(User user) checks if a user with the same username already exists in the repository. If the user exists, it throws an IllegalArgumentException to prevent duplicate entries.
  2. Password Encoding:

    • The user's password is encoded using BCryptPasswordEncoder before saving it to the repository. This ensures that passwords are stored securely.
  3. User Saving:

    • After encoding the password, the new user is saved to the repository.
  4. Logging:

    • A log statement is added to indicate that a new user has been created, which helps in tracking user creation events.

This implementation follows best practices for user management and enhances the security of user data.

Merge request reports