Package entity

Class AuthenticationResult

java.lang.Object
entity.AuthenticationResult

public class AuthenticationResult extends Object
Represents the result of an authentication attempt. Stores the outcome along with user details such as role, ID, and name.
Author:
TAMIL MUGHILAN
  • Field Details

    • success

      private final boolean success
    • role

      private final String role
    • userId

      private final int userId
    • userName

      private final String userName
  • Constructor Details

    • AuthenticationResult

      public AuthenticationResult(boolean success, String role, int userId, String userName)
      Constructs an AuthenticationResult object.
      Parameters:
      success - true if authentication was successful
      role - role of the authenticated user (e.g., "CUSTOMER", "EMPLOYEE", "MANAGER")
      userId - ID of the authenticated user
      userName - name of the authenticated user
  • Method Details

    • isSuccess

      public boolean isSuccess()
      Returns whether the authentication was successful.
      Returns:
      true if successful; false otherwise
    • getRole

      public String 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

      public String getUserName()
      Returns the name of the authenticated user.
      Returns:
      the user name