Interface IAuthService

All Superinterfaces:
org.springframework.security.core.userdetails.UserDetailsService
All Known Implementing Classes:
AuthServiceImpl

public interface IAuthService extends org.springframework.security.core.userdetails.UserDetailsService
Service interface for authentication operations.

This interface provides methods for user authentication and registration. Extends UserDetailsService to loads user-specific data.

  • Method Summary

    Modifier and Type
    Method
    Description
    login(String email, String password)
    Authenticates a user based on the provided credentials.
    register(String email, String password)
    Registers a new user in the system.

    Methods inherited from interface org.springframework.security.core.userdetails.UserDetailsService

    loadUserByUsername
  • Method Details

    • login

      AuthResponseDTO login(String email, String password)
      Authenticates a user based on the provided credentials.
      Parameters:
      email - The authentication request containing email credential - must not be null.
      password - The authentication request containing password credential - must not be null.
      Returns:
      The authentication response containing the token.
      Throws:
      BadRequestException - if the credentials of the user are invalid.
      NotFoundException - if the user is not found.
    • register

      AuthResponseDTO register(String email, String password)
      Registers a new user in the system.

      In this method should be verifying that no existing user has the same email by calling the appropriate validation method. If a user with the given email already exists, an exception must be thrown within this method.

      Parameters:
      email - The authentication request containing email credential - must not be null.
      password - The authentication request containing password credential - must not be null.
      Returns:
      The authentication response containing the token.
      Throws:
      BadRequestException - If a user with their unique field already exists.