Package org.opensaml.saml.saml2.profile

# Class AbstractSAML2NameIDGenerator

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
org.opensaml.saml.common.profile.AbstractNameIdentifierGenerator<NameID>
org.opensaml.saml.saml2.profile.AbstractSAML2NameIDGenerator

All Implemented Interfaces:
  `Predicate<ProfileRequestContext>`, `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`, `FormatSpecificNameIdentifierGenerator<NameID>`, `NameIdentifierGenerator<NameID>`, `SAML2NameIDGenerator`

public abstract class AbstractSAML2NameIDGenerator extends AbstractNameIdentifierGenerator<NameID> implements SAML2NameIDGenerator
Abstract base class for simple implementations of `SAML2NameIDGenerator`.

This class is suitable for implementing generators that produce simple kinds of identifiers. It supports various options controlling the inclusion of qualifier attributes.

Subclasses must override one of `doGenerate(ProfileRequestContext)` or `AbstractNameIdentifierGenerator.getIdentifier(ProfileRequestContext)`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final org.slf4j.Logger`
`log`
Class logger.
`private final SAMLObjectBuilder<NameID>`
`nameBuilder`
Builder for objects.
`private Function<ProfileRequestContext,AuthnRequest>`
`requestLookupStrategy`
Strategy used to locate an `AuthnRequest` to check.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`AbstractSAML2NameIDGenerator()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected NameID`
`doGenerate(ProfileRequestContext profileRequestContext)`
Override this method to fully control the generation process.
`protected String`
`getEffectiveSPNameQualifier(ProfileRequestContext profileRequestContext)`
Get the effective SPNameQualifier to apply based on the properties set and the current request.
`void`
`setRequestLookupStrategy(Function<ProfileRequestContext,AuthnRequest> strategy)`
Set the strategy used to locate the `AuthnRequest` to check for a `NameIDPolicy`.

### Methods inherited from class org.opensaml.saml.common.profile.AbstractNameIdentifierGenerator

`generate, getDefaultIdPNameQualifierLookupStrategy, getDefaultSPNameQualifierLookupStrategy, getEffectiveIdPNameQualifier, getFormat, getIdentifier, getIdPNameQualifier, getSPNameQualifier, getSPProvidedID, isOmitQualifiers, setActivationCondition, setDefaultIdPNameQualifierLookupStrategy, setDefaultSPNameQualifierLookupStrategy, setFormat, setIdPNameQualifier, setOmitQualifiers, setSPNameQualifier, setSPProvidedId, test`

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

`setId`

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

`doInitialize, 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`

### Methods inherited from interface java.util.function.Predicate

`and, negate, or`

### Methods inherited from interface org.opensaml.saml.saml2.profile.SAML2NameIDGenerator

`generate`

## Field Details

### log

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

### nameBuilder

@Nonnull private final SAMLObjectBuilder<NameID> nameBuilder
Builder for objects.

### requestLookupStrategy

@Nonnull private Function<ProfileRequestContext,AuthnRequest> requestLookupStrategy
Strategy used to locate an `AuthnRequest` to check.

## Constructor Details

### AbstractSAML2NameIDGenerator

protected AbstractSAML2NameIDGenerator()
Constructor.

## Method Details

### setRequestLookupStrategy

public void setRequestLookupStrategy(@Nonnull Function<ProfileRequestContext,AuthnRequest> strategy)
Set the strategy used to locate the `AuthnRequest` to check for a `NameIDPolicy`.

Parameters:
  `strategy` - lookup strategy

### doGenerate

@Nullable protected NameID doGenerate(@Nonnull ProfileRequestContext profileRequestContext) throws SAMLException
Override this method to fully control the generation process.

Specified by:
  `doGenerate` in class `AbstractNameIdentifierGenerator<NameID>`
Parameters:
  `profileRequestContext` - current profile request context
Returns:
  the generated object
Throws:
  `SAMLException` - if an error occurs

### getEffectiveSPNameQualifier

@Nullable protected String getEffectiveSPNameQualifier(@Nonnull ProfileRequestContext profileRequestContext)
Get the effective SPNameQualifier to apply based on the properties set and the current request.

Overrides:
  `getEffectiveSPNameQualifier` in class `AbstractNameIdentifierGenerator<NameID>`
Parameters:
  `profileRequestContext` - current profile context
Returns:
  the effective NameQualifier to set, or null