Package entity
Class AuthenticationResult
java.lang.Object
entity.AuthenticationResult
Represents the result of an authentication attempt.
Stores the outcome along with user details such as role, ID, and name.
- Author:
- TAMIL MUGHILAN
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAuthenticationResult
(boolean success, String role, int userId, String userName) Constructs anAuthenticationResult
object. -
Method Summary
-
Field Details
-
success
private final boolean success -
role
-
userId
private final int userId -
userName
-
-
Constructor Details
-
AuthenticationResult
Constructs anAuthenticationResult
object.- Parameters:
success
-true
if authentication was successfulrole
- role of the authenticated user (e.g., "CUSTOMER", "EMPLOYEE", "MANAGER")userId
- ID of the authenticated useruserName
- name of the authenticated user
-
-
Method Details
-
isSuccess
public boolean isSuccess()Returns whether the authentication was successful.- Returns:
true
if successful;false
otherwise
-
getRole
Returns the role of the authenticated user.- Returns:
- the user's role
-
getUserId
public int getUserId()Returns the ID of the authenticated user.- Returns:
- the user ID
-
getUserName
Returns the name of the authenticated user.- Returns:
- the user name
-