Class UserUpdateMFAUtil

java.lang.Object
com.skava.util.UserUpdateMFAUtil

public final class UserUpdateMFAUtil extends Object
This is a Utility class for User model which contains validator and util methods used in this service.
Author:
Infosys Equinox
  • 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 - Holds UserCommonServices object to save loginOTP in DB.
      request - Holds UserRequest object to get store id and locale from request.
      collection - Holds Collection object to get collection id and business id for triggering event.
      user - Holds Users object to set MFAPayload details.
      eventClientComponent - Holds EventClientComponent object used to convert and send the message.
      collectionCommonServices - Holds CollectionCommonServices 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 - Holds UserCommonServices object to save loginOTP in DB.
      request - Holds UserRequest object to get store id and locale from request.
      collection - Holds Collection object to get collection id and business id for triggering event.
      user - Holds Users object to set MFAPayload details.
      eventClientComponent - Holds EventClientComponent object used to convert and send the message.
      collectionCommonServices - Holds CollectionCommonServices 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.
      Parameters:
      loginOTP - Indicates the login OTP which is used for checking the old otps.
      recentOTPList - Holds List of String which contains old otps list used for checking the old OTP.
      limit - Indicates the limit for storing the old passwords.
      Returns:
      The List of OTPs
    • convertRecentOTPToList

      public static List<String> convertRecentOTPToList(PropertiesEntity recentOTPPropertyFromDB)
      This method is used to convert recent OTP string value to list.
      Parameters:
      recentOTPPropertyFromDB - Holds PropertiesEntity object which contains recent OTP values.
      Returns:
      The list of recent OTPs.
    • getRandomOTPCode

      public 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.
      Parameters:
      recentOTPList - Holds List of String which contains recent OTPs.
      Returns:
      The valid random otp.
    • 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 - Holds UsersEntity object used to set values in login MFA payload.
      otp - Indicates the MFA OTP
      token - Indicates the MFA token
      Returns:
      The MfaPayload object used to set MFA payload values.