Class ChainingNameIdentifierGenerator<NameIdType extends SAMLObject>
java.lang.Object
org.opensaml.saml.common.profile.impl.ChainingNameIdentifierGenerator<NameIdType>
- Type Parameters:
NameIdType- the type of identifier object supported
- All Implemented Interfaces:
NameIdentifierGenerator<NameIdType>
- Direct Known Subclasses:
ChainingSAML1NameIdentifierGenerator,ChainingSAML2NameIDGenerator
public class ChainingNameIdentifierGenerator<NameIdType extends SAMLObject>
extends Object
implements NameIdentifierGenerator<NameIdType>
A compound implementation of the
NameIdentifierGenerator interface that wraps a sequence of
candidate generators along with a default to try if no format-specific options are available.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate NameIdentifierGenerator<NameIdType>Fallback generator, generally for legacy support.private final org.slf4j.LoggerClass logger.private ListMultimap<String,NameIdentifierGenerator<NameIdType>> Map of formats to generators. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerate(ProfileRequestContext profileRequestContext, String format) Generate an identifier object.voidsetDefaultGenerator(NameIdentifierGenerator<NameIdType> generator) Set the generator to try if no generator(s) are mapped to a desired format.voidsetGenerators(List<NameIdentifierGenerator<NameIdType>> generators) Set the format-specific generators to use.
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
nameIdGeneratorMap
@Nonnull private ListMultimap<String,NameIdentifierGenerator<NameIdType extends SAMLObject>> nameIdGeneratorMapMap of formats to generators. -
defaultNameIdGenerator
Fallback generator, generally for legacy support.
-
-
Constructor Details
-
ChainingNameIdentifierGenerator
public ChainingNameIdentifierGenerator()Constructor.
-
-
Method Details
-
setGenerators
Set the format-specific generators to use.Only generators that support the
FormatSpecificNameIdentifierGeneratorinterface are installed, and the generators are prioritized for a given format by the order they are supplied.- Parameters:
generators- generators to use
-
setDefaultGenerator
Set the generator to try if no generator(s) are mapped to a desired format.- Parameters:
generator- a fallback default generator, if any
-
generate
@Nullable public NameIdType generate(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull @NotEmpty String format) throws SAMLException Generate an identifier object.- Specified by:
generatein interfaceNameIdentifierGenerator<NameIdType extends SAMLObject>- Parameters:
profileRequestContext- the current profile request contextformat- the identifier format to generate- Returns:
- the identifier object, or null
- Throws:
SAMLException- if an error occurs generating an identifier
-