public class ComputedPersistentIdGenerationStrategy extends AbstractInitializableComponent implements PersistentIdGenerationStrategy
PersistentIdGenerationStrategy that generates a unique ID by computing the hash of
a given attribute value, the entity ID of the inbound message issuer, and a provided salt.
The original implementation and values in common use relied on base64 encoding of the result, but due to discovery of the lack of appropriate case handling of identifiers by applications, the ability to use base32 has been added to eliminate the possibility of case conflicts.
| Modifier and Type | Class and Description |
|---|---|
static class |
ComputedPersistentIdGenerationStrategy.Encoding
Post-digest encoding types.
|
| Modifier and Type | Field and Description |
|---|---|
private String |
algorithm
JCE digest algorithm name to use.
|
private ComputedPersistentIdGenerationStrategy.Encoding |
encoding
The encoding to apply to the digest.
|
private org.slf4j.Logger |
log
Class logger.
|
private byte[] |
salt
Salt used when computing the ID.
|
| Constructor and Description |
|---|
ComputedPersistentIdGenerationStrategy()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doInitialize() |
String |
generate(String assertingPartyId,
String relyingPartyId,
String principalName,
String sourceId)
Get a Persistent ID that corresponds to the inputs.
|
ComputedPersistentIdGenerationStrategy.Encoding |
getEncoding()
Get the post-digest encoding to use.
|
byte[] |
getSalt()
Get the salt used when computing the ID.
|
void |
setAlgorithm(String alg)
Set the JCE algorithm name of the digest algorithm to use (default is SHA).
|
void |
setEncodedSalt(String newValue)
Set the base64-encoded salt used when computing the ID.
|
void |
setEncoding(ComputedPersistentIdGenerationStrategy.Encoding enc)
Set the post-digest encoding to use.
|
void |
setSalt(byte[] newValue)
Set the salt used when computing the ID.
|
destroy, doDestroy, initialize, isDestroyed, isInitialized@Nonnull private final org.slf4j.Logger log
@NonnullAfterInit private byte[] salt
@Nonnull private ComputedPersistentIdGenerationStrategy.Encoding encoding
public ComputedPersistentIdGenerationStrategy()
@NonnullAfterInit public byte[] getSalt()
public void setSalt(@Nullable byte[] newValue)
An empty/null input is ignored.
newValue - used when computing the IDpublic void setEncodedSalt(@Nullable String newValue)
An empty/null input is ignored.
newValue - used when computing the IDpublic void setAlgorithm(@Nonnull@NotEmpty String alg)
alg - JCE message digest algorithm@Nonnull public ComputedPersistentIdGenerationStrategy.Encoding getEncoding()
public void setEncoding(@Nonnull ComputedPersistentIdGenerationStrategy.Encoding enc)
enc - encodingprotected void doInitialize()
throws ComponentInitializationException
doInitialize in class AbstractInitializableComponentComponentInitializationException@Nonnull @NotEmpty public String generate(@Nonnull@NotEmpty String assertingPartyId, @Nonnull@NotEmpty String relyingPartyId, @Nonnull@NotEmpty String principalName, @Nonnull@NotEmpty String sourceId) throws org.opensaml.saml.common.SAMLException
This may be generated directly from the inputs or retrieved from some other source.
generate in interface PersistentIdGenerationStrategyassertingPartyId - the asserting party providing the identifierrelyingPartyId - the relying party for whom we're obtaining the identifierprincipalName - name of the subjectsourceId - an underlying identifier for the subjectorg.opensaml.saml.common.SAMLException - if an error occurs generating the identifierCopyright © 1999–2017 Shibboleth Consortium. All rights reserved.