Interface IAuthenticationService

All Known Implementing Classes:
AuthenticationService

public interface IAuthenticationService
Service interface for authentication operations in the BTO Management System.

This interface defines the contract for authentication services, providing methods to authenticate users and perform password-related operations. It serves as an abstraction layer between controllers and user credential management.

  • Method Details

    • login

      User login(String nric, String password) throws AuthenticationException
      Authenticates a user with the provided credentials.
      Parameters:
      nric - The NRIC of the user
      password - The password provided by the user
      Returns:
      The authenticated User object if credentials are valid
      Throws:
      AuthenticationException - If authentication fails due to invalid credentials
    • changePassword

      boolean changePassword(User user, String newPassword) throws WeakPasswordException, DataAccessException
      Changes a user's password.
      Parameters:
      user - The user whose password should be changed
      newPassword - The new password to set
      Returns:
      true if the password was successfully changed, false otherwise
      Throws:
      WeakPasswordException - if the new password does not meet strength criteria.
      DataAccessException - if there's an error saving the user data.
    • registerApplicant

      boolean registerApplicant(String nric, String name, int age, MaritalStatus maritalStatus) throws AuthenticationException, DataAccessException
      Registers a new Applicant user.
      Parameters:
      nric - NRIC of the new user (must be unique)
      name - Full name of the user
      age - Age of the user
      maritalStatus - Marital status of the user
      Returns:
      true if registration was successful, false otherwise
      Throws:
      AuthenticationException - if NRIC already exists or validation fails.
      DataAccessException - if saving fails.