com.tivoli.am.rba.extensions

Class PluginUtils

  • java.lang.Object
    • com.tivoli.am.rba.extensions.PluginUtils


  • public class PluginUtils
    extends java.lang.Object
    This class exposes methods for any RBA extensions such as matchers or Javascript Policy Information Points to use.
    Since:
    8.0.0.3
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String copyright 
      static Logger logger 
      static java.lang.String sourceCodeID 
    • Constructor Summary

      Constructors 
      Constructor and Description
      PluginUtils() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String decodeBase64(java.lang.String b64Str)
      Returns a string that has been base64 decoded.
      static java.lang.String decodeURL(java.lang.String encodedURL)
      Returns a string that has been URL decoded.
      static java.lang.String encodeBase64(java.lang.String str)
      Returns a Base64 encoded string
      static java.lang.String encodeURL(java.lang.String str)
      Returns a encoded URL.
      static java.lang.String getCurrentTime()
      Returns a UTC time stamp with the format YYYY-MM-DDThh:mm:ss.sTZD
      static java.lang.String getHashedAttributes()
      Returns the attributes that are hashed
      static java.lang.String getHashingAlgorithm(java.lang.String hash)
      Returns the algorithm used to hash the input string
      static java.lang.String hash(java.lang.String cleartext, java.lang.String algorithm)
      Hashes the cleartext with the specified hashing algorithm
      static boolean isHashed(java.lang.String value)
      Checks if a string is hashed
      static boolean isValidUsername(java.lang.String username)
      Validates that the given username is valid for the underlying user registry.
      static boolean isValidUsernamePassword(java.lang.String username, java.lang.String password)
      Validates that the given username and password are valid for the underlying user registry.
      static void logAuditEvent(java.lang.String username, java.lang.String message, boolean result)
      Audit - Generate audit log event
      static void sleep(long timeInMillis)
      Sleep for a number of milliseconds.
      static void trace(java.lang.String traceMsg)
      This method allows for javascript rules / PIPs to log trace entries.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • copyright

        public static final java.lang.String copyright
      • logger

        public static final Logger logger
    • Constructor Detail

      • PluginUtils

        public PluginUtils()
    • Method Detail

      • getCurrentTime

        public static java.lang.String getCurrentTime()
        Returns a UTC time stamp with the format YYYY-MM-DDThh:mm:ss.sTZD
        Returns:
        returns the current time in the format YYYY-MM-DDThh:mm:ss.sTZD
        Since:
        8.0.0.3
      • hash

        public static java.lang.String hash(java.lang.String cleartext,
                                            java.lang.String algorithm)
        Hashes the cleartext with the specified hashing algorithm
        Parameters:
        cleartext - is the string that you want hashed
        algorithm - is the algorithm to use to hash the cleartext string
        Returns:
        a hashed string of the cleartext passed in
        Since:
        8.0.0.3
      • getHashingAlgorithm

        public static java.lang.String getHashingAlgorithm(java.lang.String hash)
        Returns the algorithm used to hash the input string
        Parameters:
        hash - is the string that you want to determine what hashing algorithm is used
        Returns:
        the string value of the hashing algorithm
        Since:
        8.0.0.3
      • isHashed

        public static boolean isHashed(java.lang.String value)
        Checks if a string is hashed
        Parameters:
        value - is the string to check if hashed
        Returns:
        true if hashed and false if not
        Since:
        8.0.0.3
      • getHashedAttributes

        public static java.lang.String getHashedAttributes()
        Returns the attributes that are hashed
        Returns:
        hashed attributes
        Since:
        8.0.0.3
      • trace

        public static void trace(java.lang.String traceMsg)
        This method allows for javascript rules / PIPs to log trace entries.
        Parameters:
        traceMsg - is the message to add to the trace logs
        Since:
        8.0.0.3
      • decodeBase64

        public static java.lang.String decodeBase64(java.lang.String b64Str)
        Returns a string that has been base64 decoded. If the decoded string isn't a string the result will be a garbled string result.
        Parameters:
        b64Str - is the base 64 encoded string to decode
        Returns:
        the base 64 decoded string
        Since:
        8.0.0.3
      • encodeBase64

        public static java.lang.String encodeBase64(java.lang.String str)
        Returns a Base64 encoded string
        Parameters:
        str - is the string to encode
        Returns:
        base 64 encoded string of the string passed in
        Since:
        8.0.0.3
      • decodeURL

        public static java.lang.String decodeURL(java.lang.String encodedURL)
        Returns a string that has been URL decoded.
        Parameters:
        encodedURL - is the URL encoded string to decode
        Returns:
        the URL decoded string
        Since:
        8.0.0.3
      • encodeURL

        public static java.lang.String encodeURL(java.lang.String str)
        Returns a encoded URL.
        Parameters:
        str - is the string value to URL encode
        Returns:
        URL encoded string
        Since:
        8.0.0.3
      • isValidUsernamePassword

        public static boolean isValidUsernamePassword(java.lang.String username,
                                                      java.lang.String password)
                                               throws java.lang.Exception
        Validates that the given username and password are valid for the underlying user registry.
        Parameters:
        username - is the user to validate
        password - is the user's password
        Returns:
        true if the username and password are valid and false if not
        Throws:
        java.lang.Exception
        Since:
        8.0.1.0
      • isValidUsername

        public static boolean isValidUsername(java.lang.String username)
                                       throws java.lang.Exception
        Validates that the given username is valid for the underlying user registry.
        Parameters:
        username - is the user to validate
        Returns:
        true if the username is valid and false if not
        Throws:
        java.lang.Exception
        Since:
        9.0.2.0
      • logAuditEvent

        public static void logAuditEvent(java.lang.String username,
                                         java.lang.String message,
                                         boolean result)
        Audit - Generate audit log event
        Parameters:
        username - user information to include in the audit record; may be null
        message - the message to include in the audit record
        result - boolean to indicate if the operation being audited was successful
        Since:
        8.0.1.0
      • sleep

        public static void sleep(long timeInMillis)
        Sleep for a number of milliseconds.
        Parameters:
        timeInMillis - to sleep for