Package net.shibboleth.idp.saml.nameid.impl

# Class StoredTransientIdGenerationStrategy

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.saml.nameid.impl.StoredTransientIdGenerationStrategy

All Implemented Interfaces:
  `TransientIdGenerationStrategy`, `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`

public class StoredTransientIdGenerationStrategy extends AbstractIdentifiableInitializableComponent implements TransientIdGenerationStrategy
Generates transients using a `StorageService` to manage the reverse mappings.

The identifier itself is the record key, and the value combines the principal name with the identifier of the recipient.

## Field Summary

Fields
Modifier and Type
Field
Description
`private IdentifierGenerationStrategy`
`idGenerator`
Generator of random, hex-encoded, identifiers.
`private Duration`
`idLifetime`
Length identifiers are valid.
`private int`
`idSize`
Size, in bytes, of the identifier.
`private StorageService`
`idStore`
Store used to map identifiers to principals.
`private final org.slf4j.Logger`
`log`
Class logger.

## Constructor Summary

Constructors
Constructor
Description
`StoredTransientIdGenerationStrategy()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
`String`
`generate(String relyingPartyId, String principalName)`
Generate a new Transient ID.
`Duration`
`getIdLifetime()`
Get the time ids are valid.
`int`
`getIdSize()`
Get the size, in bytes, of the id.
`void`
`setIdGenerator(IdentifierGenerationStrategy generator)`
Set the ID generator we should use.
`void`
`setIdLifetime(Duration lifetime)`
Set the time ids are valid.
`void`
`setIdSize(int size)`
Set the size, in bytes, of the id.
`void`
`setIdStore(StorageService store)`
Set the ID store we should use.

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

`setId`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

`ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

`getId`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### idStore

@NonnullAfterInit private StorageService idStore
Store used to map identifiers to principals.

### idGenerator

@NonnullAfterInit private IdentifierGenerationStrategy idGenerator
Generator of random, hex-encoded, identifiers.

### idSize

private int idSize
Size, in bytes, of the identifier.

### idLifetime

@Nonnull private Duration idLifetime
Length identifiers are valid.

## Constructor Details

### StoredTransientIdGenerationStrategy

public StoredTransientIdGenerationStrategy()
Constructor.

## Method Details

### setIdStore

public void setIdStore(@Nonnull StorageService store)
Set the ID store we should use.

Parameters:
  `store` - the store to use.

### setIdGenerator

public void setIdGenerator(@Nonnull IdentifierGenerationStrategy generator)
Set the ID generator we should use.

Parameters:
  `generator` - identifier generation strategy to use

### getIdSize

@Positive public int getIdSize()
Get the size, in bytes, of the id.

Returns:
  id size, in bytes

### setIdSize

public void setIdSize(@Positive int size)
Set the size, in bytes, of the id.

Parameters:
  `size` - size, in bytes, of the id

### getIdLifetime

@Nonnull public Duration getIdLifetime()
Get the time ids are valid.

Returns:
  time ids are valid

### setIdLifetime

public void setIdLifetime(@Nonnull Duration lifetime)
Set the time ids are valid.

Parameters:
  `lifetime` - time ids are valid

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractIdentifiedInitializableComponent`
Throws:
  `ComponentInitializationException`

### generate

@Nonnull @NotEmpty public String generate(@Nonnull @NotEmpty String relyingPartyId, @Nonnull @NotEmpty String principalName) throws SAMLException
Generate a new Transient ID.

Specified by:
  `generate` in interface `TransientIdGenerationStrategy`
Parameters:
  `relyingPartyId` - the relying party for whom we're generating
  `principalName` - the principal to map to
Returns:
  the new identifier
Throws:
  `SAMLException` - if an error occurs generating the identifier