Class UserAuthUtil

java.lang.Object
com.skava.util.UserAuthUtil

public final class UserAuthUtil extends Object
This is a utility class for user which contains util methods used in this service.
Author:
Infosys Equinox
  • Method Details

    • getNotificationParamName

      public static String getNotificationParamName(UserNotificationRequest request)
      This method is used to get notification param for a user notification request. It contains auth notification param appended with operation. Operation means 2FA etc.
      Parameters:
      request - Holds UserNotificationRequest object is used to get notification param for an user.
      Returns:
      The notification param.
    • getParamValueFromUserIdAndTime

      public static String getParamValueFromUserIdAndTime(long userId)
      This method is used to get activation or reset param for an user. It contains random generated OTP code appended with user id appended with timestamp.
      Parameters:
      userId - Indicates the user identifier for which user the notification param is used generated.
      Returns:
      The activation/reset param
    • getParamValueFromUserIdAndTime

      public static String getParamValueFromUserIdAndTime(long userId, String otp)
    • getRandomOTPCode

      public static String getRandomOTPCode()
      This method is used to generate OTP code.
      Returns:
      The random OTP code
    • loadType

      public static int loadType(String requestType, UserCommonServices userCommonServices, String locale)
      This method is used to set integer type based on the given string type.
      Parameters:
      requestType - Indicates the user's type.
      userCommonServices - Holds UserCommonServices object for response message.
      locale - Indicates the locale message.
      Returns:
      The valid type.
    • loadEnableUserMergeValueFromDB

      public static String loadEnableUserMergeValueFromDB(Collection collection, UserCommonServices userCommonServices, CollectionCommonServices collectionCommonServices)
      This method is used to load collection property value from DB
      Parameters:
      collection - Holds Collection object to get collection property value.
      userCommonServices - Holds UserCommonServices object to get property value from DB.
      collectionCommonServices - Holds CollectionCommonServices object to get property value.
      Returns:
      The valid String value.
    • loadMFAValueFromDB

      public static String loadMFAValueFromDB(Collection collection, UserCommonServices userCommonServices, CollectionCommonServices collectionCommonServices, String name)
      This method is used to load collection property value from DB
      Parameters:
      collection - Holds Collection object to get collection property value.
      userCommonServices - Holds UserCommonServices object to get property value from DB.
      collectionCommonServices - Holds CollectionCommonServices object to get property value.
      name - Indicates the name of the property which is used for loading the value from DB.
      Returns:
      The valid String value.
    • deleteLoginAttemptCountCustomPropertyFromDB

      public static void deleteLoginAttemptCountCustomPropertyFromDB(UsersEntity user, UserCommonServices userCommonServices, String name)
      This method is used to delete the given custom properties from DB.
      Parameters:
      user - Holds UsersEntity object to delete the custom property from DB.
      userCommonServices - Holds UserCommonServices object to delete custom property.
      name - Indicates the name of the property which is used for deleting the given property.
    • deleteMultipleCustomPropertiesFromDB

      public static void deleteMultipleCustomPropertiesFromDB(UsersEntity user, UserCommonServices userCommonServices, List<String> names)
      This method is used to delete the given custom properties from DB.
      Parameters:
      user - Holds UsersEntity object used to delete the custom property from DB.
      userCommonServices - Holds UserCommonServices object used to delete custom property.
      names - Indicates the list of name of the property which is used for deleting the given property.
    • setAuthResponseAndGenerateLoginToken

      public static UserAuthResponse setAuthResponseAndGenerateLoginToken(UsersEntity userEntity, UserCommonServices userCommonServices)
      This method is used to generate login token and set user id in user model object.
      Parameters:
      userEntity - Holds UsersEntity object used to get user id and set id in user model.
      userCommonServices - Holds UserCommonServices object to generate login token and used for encrypting login token.
      Returns:
      The Holds UserAuthResponse object which contains user object and login tokens.
    • setAuthResponseAndLoginToken

      public static UserAuthResponse setAuthResponseAndLoginToken(UsersEntity userEntity, String loginToken, int availableRetries, int maxFailLimit, boolean resetParam)
      This method is used to set login token and availableRetries in auth response and set user id in user model object.
      Parameters:
      userEntity - Holds UsersEntity object used to get user id and set id in user model.
      loginToken - Indicates the login token.
      availableRetries - Indicates the available retry count of an user.
      maxFailLimit - Indicates the maximum fail limit of the user.
      Returns:
      The UserAuthResponse object which contains user object and login tokens.
    • loadResendMaxLimitFromCollectionProperties

      public static int loadResendMaxLimitFromCollectionProperties(Collection collection, UserCommonServices userCommonServices, CollectionCommonServices collectionCommonServices)
      This method used to load collection property of resend limit for MFA
      Parameters:
      collection - Holds Collection object used to load resent limit property for that particular collection id.
      userCommonServices - Holds UserCommonServices object for getting collection attributes.
      collectionCommonServices - Holds CollectionCommonServices object for getting collection attributes.
      Returns:
      The valid resends limit integer value.
    • loadFailMaxLimitFromCollectionProperties

      public static int loadFailMaxLimitFromCollectionProperties(Collection collection, UserCommonServices userCommonServices, CollectionCommonServices collectionCommonServices)
      This method used to load collection property of resend limit for MFA
      Parameters:
      collection - Holds Collection object used to load resent limit property for that particular collection id.
      userCommonServices - Holds UserCommonServices object for getting collection attributes.
      collectionCommonServices - Holds CollectionCommonServices object for getting collection attributes.
      Returns:
      The valid resends limit integer value.
    • triggerLockedStatusEmail

      public static void triggerLockedStatusEmail(UserAuthRequest request, CollectionCommonServices collectionCommonServices, com.skava.core.event.EventClientComponent clientComponent, Optional<UsersEntity> user)
      triggerLockedStatusEmail - This method is used to trigger email notification for locked status.
      Parameters:
      request - Holds UserAuthRequest object used to get collection id and auth token.
      collectionCommonServices - Holds CollectionCommonServices object used to get property value from DB.
      clientComponent - Holds EventClientComponent object used to send email notification.
      user - Holds UsersEntity object used to get user object.
    • updateEmailNotifyProp

      public static void updateEmailNotifyProp(UserAuthRequest request, UserCommonServices userCommonServices, Optional<UsersEntity> user)
      updateEmailNotifyProp - This method is used to update email notify property.
      Parameters:
      request - Holds UserAuthRequest object used to update email notify property.
      userCommonServices - Holds UserCommonServices object used to update email notify property.
      user - Holds UsersEntity object used to update email notify property.