Class PluginUtils

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

public class PluginUtils extends 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 Details

    • sourceCodeID

      public static final String sourceCodeID
      See Also:
    • logger

      public static final Logger logger
  • Constructor Details

    • PluginUtils

      public PluginUtils()
  • Method Details

    • getCurrentTime

      public static 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 String hash(String cleartext, 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 String getHashingAlgorithm(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(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 String getHashedAttributes()
      Returns the attributes that are hashed
      Returns:
      hashed attributes
      Since:
      8.0.0.3
    • trace

      public static void trace(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 String decodeBase64(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 String encodeBase64(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 String decodeURL(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 String encodeURL(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(String username, String password) throws 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:
      Exception
      Since:
      8.0.1.0
    • isValidUsername

      public static boolean isValidUsername(String username) throws 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:
      Exception
      Since:
      9.0.2.0
    • logAuditEvent

      public static void logAuditEvent(String username, 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