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 Summary
Modifier and TypeMethodDescriptionboolean
changePassword
(User user, String newPassword) Changes a user's password.Authenticates a user with the provided credentials.boolean
registerApplicant
(String nric, String name, int age, MaritalStatus maritalStatus) Registers a new Applicant user.
-
Method Details
-
login
Authenticates a user with the provided credentials.- Parameters:
nric
- The NRIC of the userpassword
- 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 changednewPassword
- 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 userage
- Age of the usermaritalStatus
- 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.
-