java.lang.Object
es.kukenan.smartfi.microservice.backoffice.utils.UsersUtility

public final class UsersUtility extends Object
Utillity class for users-microservice.
  • Field Details

    • STRING_ALL_CHARACTERS

      public static final String STRING_ALL_CHARACTERS
      Characters to calculate random password.
      See Also:
  • Constructor Details

    • UsersUtility

      public UsersUtility()
  • Method Details

    • cipherPassword

      public static UsersUtility.LoginState cipherPassword(String password, String cipherPassword, String keyPrivate)
      This method cipher plain password in request for hash Core password.
      Parameters:
      password - plain password of user.
      cipherPassword - Password found in Database.
      keyPrivate - Key for correct password cipher.
      Returns:
      LoginState.OK user found in Database, LoginState.NOT_FOUND user not found in Database.
    • generateRandomPassword

      public static String generateRandomPassword(String characters, int length)
      Generate password with defined length.
      Parameters:
      characters - String with all characters.
      length - String length.
      Returns:
      Random password.
    • mapToBasicInfo

      public static es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.BasicUserInfoDto mapToBasicInfo(User user)
      Map the given User to Basic Dto.
      Parameters:
      user - from database.
      Returns:
      Basic User Information Dto.
    • mapFullName

      public static String mapFullName(User user)
      Get user full name.
      Parameters:
      user - user from databes.
      Returns:
      user full name.
    • mapToBackoffice

      public static es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.BasicUserDto mapToBackoffice(User user, List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Company> companies)
      Map the given User to a BasicUserDto.
      Parameters:
      user - a contract entity.
      companies - companies information.
      Returns:
      the mapped BasicUserDto.
    • mapToBackoffice

      public static List<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.BasicUserDto> mapToBackoffice(List<User> users, List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Company> companies)
      Map the given User list to a BasicUserDto list.
      Parameters:
      users - a user backoffice entity list.
      companies - companies information.
      Returns:
      the mapped BasicUserDto list.