Package com.skava.util
Class UserUpdateMFAUtil
java.lang.Object
com.skava.util.UserUpdateMFAUtil
This is a Utility class for User model which contains validator and util methods used in this service.
- Author:
- Infosys Equinox
-
Method Summary
Modifier and TypeMethodDescriptionconvertRecentOTPToList
(PropertiesEntity recentOTPPropertyFromDB) This method is used to convert recent OTP string value to list.static String
generateTokenAndOTPForMFAAndCheckRecentOTPs
(UserCommonServices userCommonServices, UserRequest request, Collection collection, Users user, com.skava.core.event.EventClientComponent eventClientComponent, CollectionCommonServices collectionCommonServices) This method is used to generate OTP and Token which is used for MFA .static String
generateTokenAndOTPForMFAAndCheckRecentOTPs
(UserCommonServices userCommonServices, UserRequest request, Collection collection, Users user, com.skava.core.event.EventClientComponent eventClientComponent, CollectionCommonServices collectionCommonServices, String routingKey) This method is used to generate OTP and Token which is used for MFA .static String
getRandomOTPCode
(List<String> recentOTPList) This method is used to generate random OTP and checks whether the generated OTP is present in recent OTPs.static MfaPayload
setMfaPayloadValueFromUserEntity
(UsersEntity userEntity, String otp, String token) This method is used to set MFA payload details from user entity.updateRecentOtpList
(String loginOTP, List<String> recentOTPList, int limit) This method is used to check new OTP with old OTP list.
-
Method Details
-
generateTokenAndOTPForMFAAndCheckRecentOTPs
public static String generateTokenAndOTPForMFAAndCheckRecentOTPs(UserCommonServices userCommonServices, UserRequest request, Collection collection, Users user, com.skava.core.event.EventClientComponent eventClientComponent, CollectionCommonServices collectionCommonServices) This method is used to generate OTP and Token which is used for MFA .- Parameters:
userCommonServices
- HoldsUserCommonServices
object to save loginOTP in DB.request
- HoldsUserRequest
object to get store id and locale from request.collection
- HoldsCollection
object to get collection id and business id for triggering event.user
- HoldsUsers
object to set MFAPayload details.eventClientComponent
- HoldsEventClientComponent
object used to convert and send the message.collectionCommonServices
- HoldsCollectionCommonServices
object for loading properties.- Returns:
- The valid token.
-
generateTokenAndOTPForMFAAndCheckRecentOTPs
public static String generateTokenAndOTPForMFAAndCheckRecentOTPs(UserCommonServices userCommonServices, UserRequest request, Collection collection, Users user, com.skava.core.event.EventClientComponent eventClientComponent, CollectionCommonServices collectionCommonServices, String routingKey) This method is used to generate OTP and Token which is used for MFA .- Parameters:
userCommonServices
- HoldsUserCommonServices
object to save loginOTP in DB.request
- HoldsUserRequest
object to get store id and locale from request.collection
- HoldsCollection
object to get collection id and business id for triggering event.user
- HoldsUsers
object to set MFAPayload details.eventClientComponent
- HoldsEventClientComponent
object used to convert and send the message.collectionCommonServices
- HoldsCollectionCommonServices
object for loading properties.- Returns:
- The valid token.
-
updateRecentOtpList
public static List<String> updateRecentOtpList(String loginOTP, List<String> recentOTPList, int limit) This method is used to check new OTP with old OTP list. -
convertRecentOTPToList
This method is used to convert recent OTP string value to list.- Parameters:
recentOTPPropertyFromDB
- HoldsPropertiesEntity
object which contains recent OTP values.- Returns:
- The list of recent OTPs.
-
getRandomOTPCode
This method is used to generate random OTP and checks whether the generated OTP is present in recent OTPs. -
setMfaPayloadValueFromUserEntity
public static MfaPayload setMfaPayloadValueFromUserEntity(UsersEntity userEntity, String otp, String token) This method is used to set MFA payload details from user entity.- Parameters:
userEntity
- HoldsUsersEntity
object used to set values in login MFA payload.otp
- Indicates the MFA OTPtoken
- Indicates the MFA token- Returns:
- The
MfaPayload
object used to set MFA payload values.
-