Package net.shibboleth.shared.security

# Interface IdentifierGenerationStrategy

All Known Implementing Classes:
  `RandomIdentifierGenerationStrategy`, `SecureRandomIdentifierGenerationStrategy`, `Type4UUIDIdentifierGenerationStrategy`

@ThreadSafe public interface IdentifierGenerationStrategy
Interface for identifier generators. This identifier can be used for things like digital signature identifiers, opaque principal identifiers, etc.

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static interface`
`IdentifierGenerationStrategy.ParameterSpec`
Marker interface for parameters specific to particular provider types.
`static enum`
`IdentifierGenerationStrategy.ProviderType`
Enum of supported provider types.

## Method Summary

Modifier and Type
Method
Description
`String`
`generateIdentifier()`
Generates an identifier guaranteed to be XML ID safe.
`String`
`generateIdentifier(boolean xmlSafe)`
Generates an identifier.
`static IdentifierGenerationStrategy`
`getInstance(IdentifierGenerationStrategy.ProviderType type)`
Get an instance of a particular provider of identifiers with no parameters.
`static IdentifierGenerationStrategy`
`getInstance(IdentifierGenerationStrategy.ProviderType type, IdentifierGenerationStrategy.ParameterSpec params)`
Get an instance of a particular provider of identifiers with parameters.

## Method Details

### generateIdentifier

@Nonnull @NotEmpty String generateIdentifier()
Generates an identifier guaranteed to be XML ID safe.

Returns:
  the identifier

### generateIdentifier

@Nonnull @NotEmpty String generateIdentifier(boolean xmlSafe)
Generates an identifier.

Parameters:
  `xmlSafe` - true iff the result must be XML ID safe
Returns:
  the identifier

### getInstance

@Nonnull static IdentifierGenerationStrategy getInstance(@Nonnull IdentifierGenerationStrategy.ProviderType type)
Get an instance of a particular provider of identifiers with no parameters.

If the type is somehow unrecognized, the `IdentifierGenerationStrategy.ProviderType.RANDOM` is used to guarantee a successful result.

Parameters:
  `type` - provider type
Returns:
  identifier provider
Since:
  9.0.0

### getInstance

@Nonnull static IdentifierGenerationStrategy getInstance(@Nonnull IdentifierGenerationStrategy.ProviderType type, @Nonnull IdentifierGenerationStrategy.ParameterSpec params) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException
Get an instance of a particular provider of identifiers with parameters.

Parameters:
  `type` - provider type
  `params` - implementation-specific parameter instance
Returns:
  identifier provider
Throws:
  `NoSuchAlgorithmException` - if the type is unknown
  `InvalidAlgorithmParameterException` - if the parameters were invalid
Since:
  9.0.0