Class IdentifierGenerator

java.lang.Object
org.apache.guacamole.net.auth.IdentifierGenerator

public class IdentifierGenerator extends Object
Generator of unique and unpredictable identifiers. Each generated identifier is an arbitrary, random string produced using a cryptographically-secure random number generator.
  • Method Details

    • generateIdentifier

      public static String generateIdentifier()
      Generates a unique and unpredictable identifier. Each identifier is at least 256-bit and produced using a cryptographically-secure random number generator. The identifier may contain characters that differ only in case.
      Returns:
      A unique and unpredictable identifier with at least 256 bits of entropy.
    • generateIdentifier

      public static String generateIdentifier(int minBits)
      Generates a unique and unpredictable identifier having at least the given number of bits of entropy. The resulting identifier may have more than the number of bits required. The identifier may contain characters that differ only in case.
      Parameters:
      minBits - The number of bits of entropy that the identifier should contain.
      Returns:
      A unique and unpredictable identifier with at least the given number of bits of entropy.
    • generateIdentifier

      public static String generateIdentifier(int minBits, boolean caseSensitive)
      Generates a unique and unpredictable identifier having at least the given number of bits of entropy. The resulting identifier may have more than the number of bits required. The identifier may contain characters that differ only in case.
      Parameters:
      minBits - The number of bits of entropy that the identifier should contain.
      caseSensitive - Whether identifiers are permitted to contain characters that vary by case. If false, all characters that may vary by case will be lowercase, and the generated identifier will be longer.
      Returns:
      A unique and unpredictable identifier with at least the given number of bits of entropy.