Class UsersUtility
java.lang.Object
es.kukenan.smartfi.microservice.backoffice.utils.UsersUtility
Utillity class for users-microservice.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UsersUtility.LoginStatecipherPassword(String password, String cipherPassword, String keyPrivate) This method cipher plain password in request for hash Core password.static StringgenerateRandomPassword(String characters, int length) Generate password with defined length.static StringmapFullName(User user) Get user full name.static es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.user.BasicUserDtomapToBackoffice(User user, List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Company> companies) Map the givenUserto aBasicUserDto.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 givenUserlist to aBasicUserDtolist.static es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.BasicUserInfoDtomapToBasicInfo(User user) Map the given User to Basic Dto.
-
Field Details
-
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
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
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 givenUserto aBasicUserDto.- 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 givenUserlist to aBasicUserDtolist.- Parameters:
users- a user backoffice entity list.companies- companies information.- Returns:
- the mapped BasicUserDto list.
-