Class MFAUtil


  • public class MFAUtil
    extends java.lang.Object
    MFA utilities.
    Since:
    16.1.0
    Version:
    $Revision: 26156 $ $Date: 2024-01-13 10:26:46 -0300 (Sat, 13 Jan 2024) $
    • Constructor Summary

      Constructors 
      Constructor Description
      MFAUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void clearExpired()
      Clears all expired tokens.
      static IMFATokenSendResult sendMFATokenEmail​(java.lang.String userLogin)
      Sends an email with the MFA token.
      static void sendTestMFAEmail​(java.lang.String emailTemplateId, java.lang.String mfaServiceInstanceId)
      Sends a test email with the MFA token.
      static boolean validateMFAToken​(java.lang.String userLogin, java.lang.String token)
      Returns whether the given token is valid for the given user.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MFAUtil

        public MFAUtil()
    • Method Detail

      • validateMFAToken

        public static boolean validateMFAToken​(java.lang.String userLogin,
                                               java.lang.String token)
                                        throws PortalException,
                                               java.lang.IllegalArgumentException
        Returns whether the given token is valid for the given user.
        Parameters:
        userLogin - the user login
        token - the token
        Returns:
        whether the given token is valid for the given user
        Throws:
        java.lang.IllegalArgumentException - if userLogin is null or empty
        PortalException - if some error occurs
        Since:
        16.1.0
      • sendMFATokenEmail

        public static IMFATokenSendResult sendMFATokenEmail​(java.lang.String userLogin)
                                                     throws PortalException,
                                                            java.lang.IllegalArgumentException,
                                                            java.lang.IllegalStateException
        Sends an email with the MFA token.
        Parameters:
        userLogin - the user login
        Returns:
        the created token result
        Throws:
        java.lang.IllegalArgumentException - if userLogin is null or empty
        java.lang.IllegalStateException - if there's no mfa service instance configured globally
        PortalException - if some error occurs
        Since:
        16.1.0
      • sendTestMFAEmail

        public static void sendTestMFAEmail​(java.lang.String emailTemplateId,
                                            java.lang.String mfaServiceInstanceId)
                                     throws PortalException
        Sends a test email with the MFA token.
        Parameters:
        emailTemplateId - the email template id
        mfaServiceInstanceId - the mfa service instance
        Throws:
        java.lang.IllegalArgumentException - if emailTemplateId is null or empty
        java.lang.IllegalStateException - if there's no mfa service instance configured globally
        PortalException - if some error occurs
        Since:
        16.1.0
      • clearExpired

        public static void clearExpired()
        Clears all expired tokens.
        Since:
        16.1.0