Class RandomIdentifierGenerationStrategy

java.lang.Object
net.shibboleth.utilities.java.support.security.impl.RandomIdentifierGenerationStrategy
All Implemented Interfaces:
IdentifierGenerationStrategy
Direct Known Subclasses:
SecureRandomIdentifierGenerationStrategy

public class RandomIdentifierGenerationStrategy
extends Object
implements IdentifierGenerationStrategy
Generates a random number of bytes via a Random source and encodes them into a string using a BinaryEncoder (Hex by default).
  • Field Details

    • random

      private final Random random
      Random number generator.
    • sizeOfIdentifier

      private final int sizeOfIdentifier
      Number of random bytes in the identifier.
    • encoder

      private final org.apache.commons.codec.BinaryEncoder encoder
      Encoder used to convert the random bytes in to a string.
  • Constructor Details

    • RandomIdentifierGenerationStrategy

      public RandomIdentifierGenerationStrategy()
      Constructor. Initializes the random number source to a new SecureRandom, size of identifier is set to 16 bytes, and the encoder is set to a Hex.
    • RandomIdentifierGenerationStrategy

      public RandomIdentifierGenerationStrategy​(int identifierSize)
      Constructor. Initializes the random number source to a new SecureRandom and the encoder is set to a Hex.
      Parameters:
      identifierSize - number of random bytes in identifier
    • RandomIdentifierGenerationStrategy

      public RandomIdentifierGenerationStrategy​(@Nonnull Random source, int identifierSize, @Nonnull org.apache.commons.codec.BinaryEncoder identifierEncoder)
      Constructor.
      Parameters:
      source - source of random bytes
      identifierSize - number of random bytes in the identifier
      identifierEncoder - encoder used to convert random bytes to string identifier
  • Method Details