Class AddNameIdentifierToSubjects
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- org.opensaml.profile.action.AbstractProfileAction
-
- org.opensaml.saml.saml1.profile.impl.AddNameIdentifierToSubjects
-
- All Implemented Interfaces:
net.shibboleth.utilities.java.support.component.Component,net.shibboleth.utilities.java.support.component.DestructableComponent,net.shibboleth.utilities.java.support.component.InitializableComponent,org.opensaml.profile.action.ProfileAction
public class AddNameIdentifierToSubjects extends org.opensaml.profile.action.AbstractProfileActionAction that builds aNameIdentifierand adds it to theSubjectof all the statements in all the assertions found via a lookup strategy, by default from the outbound message context.No assertions or statements will be created by this action, but if no
Subjectexists in the statements found, it will be created.The source of the
NameIdentifieris one of a set of candidateSAML1NameIdentifierGeneratorplugins injected into the action. The plugin(s) to attempt to use are derived from the Format value, which is established by a lookup strategy.- Event:
EventIds.PROCEED_EVENT_ID
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classAddNameIdentifierToSubjects.AssertionStrategyDefault strategy for obtaining assertions to modify.
-
Field Summary
Fields Modifier and Type Field Description private List<org.opensaml.saml.saml1.core.Assertion>assertionsAssertions to modify.private Function<org.opensaml.profile.context.ProfileRequestContext,List<org.opensaml.saml.saml1.core.Assertion>>assertionsLookupStrategyStrategy used to locate theAssertions to operate on.private Function<org.opensaml.profile.context.ProfileRequestContext,List<String>>formatLookupStrategyStrategy used to determine the formats to try.private List<String>formatsFormats to try.private org.opensaml.saml.saml1.profile.SAML1NameIdentifierGeneratorgeneratorGenerator to use.private org.slf4j.LoggerlogClass logger.private org.opensaml.saml.common.SAMLObjectBuilder<org.opensaml.saml.saml1.core.NameIdentifier>nameIdentifierBuilderBuilder for NameIdentifier objects.private booleanoverwriteExistingFlag controlling whether to overwrite an existing NameIdentifier.private org.opensaml.saml.common.SAMLObjectBuilder<org.opensaml.saml.saml1.core.Subject>subjectBuilderBuilder for Subject objects.
-
Constructor Summary
Constructors Constructor Description AddNameIdentifierToSubjects()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.opensaml.saml.saml1.core.NameIdentifiercloneNameIdentifier(org.opensaml.saml.saml1.core.NameIdentifier nameIdentifier)Create an efficient field-wise copy of aNameIdentifier.protected voiddoExecute(org.opensaml.profile.context.ProfileRequestContext profileRequestContext)protected voiddoInitialize()protected booleandoPreExecute(org.opensaml.profile.context.ProfileRequestContext profileRequestContext)private org.opensaml.saml.saml1.core.NameIdentifiergenerateNameIdentifier(org.opensaml.profile.context.ProfileRequestContext profileRequestContext)Attempt to generate aNameIdentifierusing each of the candidate Formats and plugins.private org.opensaml.saml.saml1.core.SubjectgetStatementSubject(org.opensaml.saml.saml1.core.SubjectStatement statement)Get the subject to which the name identifier will be added.voidsetAssertionsLookupStrategy(Function<org.opensaml.profile.context.ProfileRequestContext,List<org.opensaml.saml.saml1.core.Assertion>> strategy)Set the strategy used to locate theAssertions to operate on.voidsetFormatLookupStrategy(Function<org.opensaml.profile.context.ProfileRequestContext,List<String>> strategy)Set the strategy function to use to obtain the formats to try.voidsetNameIdentifierGenerator(org.opensaml.saml.saml1.profile.SAML1NameIdentifierGenerator theGenerator)Set the generator to use.voidsetOverwriteExisting(boolean flag)Set whether to overwrite any existingNameIdentifierobjects found.-
Methods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, execute, getHttpServletRequest, getHttpServletResponse, getLogPrefix, setHttpServletRequest, setHttpServletResponse
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
-
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
subjectBuilder
@Nonnull private final org.opensaml.saml.common.SAMLObjectBuilder<org.opensaml.saml.saml1.core.Subject> subjectBuilder
Builder for Subject objects.
-
nameIdentifierBuilder
@Nonnull private final org.opensaml.saml.common.SAMLObjectBuilder<org.opensaml.saml.saml1.core.NameIdentifier> nameIdentifierBuilder
Builder for NameIdentifier objects.
-
overwriteExisting
private boolean overwriteExisting
Flag controlling whether to overwrite an existing NameIdentifier.
-
assertionsLookupStrategy
@Nonnull private Function<org.opensaml.profile.context.ProfileRequestContext,List<org.opensaml.saml.saml1.core.Assertion>> assertionsLookupStrategy
Strategy used to locate theAssertions to operate on.
-
formatLookupStrategy
@Nonnull private Function<org.opensaml.profile.context.ProfileRequestContext,List<String>> formatLookupStrategy
Strategy used to determine the formats to try.
-
generator
@NonnullAfterInit private org.opensaml.saml.saml1.profile.SAML1NameIdentifierGenerator generator
Generator to use.
-
assertions
@Nonnull @NonnullElements private List<org.opensaml.saml.saml1.core.Assertion> assertions
Assertions to modify.
-
-
Method Detail
-
setOverwriteExisting
public void setOverwriteExisting(boolean flag)
Set whether to overwrite any existingNameIdentifierobjects found.- Parameters:
flag- true iff the action should overwrite any existing objects
-
setAssertionsLookupStrategy
public void setAssertionsLookupStrategy(@Nonnull Function<org.opensaml.profile.context.ProfileRequestContext,List<org.opensaml.saml.saml1.core.Assertion>> strategy)Set the strategy used to locate theAssertions to operate on.- Parameters:
strategy- lookup strategy
-
setFormatLookupStrategy
public void setFormatLookupStrategy(@Nonnull Function<org.opensaml.profile.context.ProfileRequestContext,List<String>> strategy)Set the strategy function to use to obtain the formats to try.- Parameters:
strategy- format lookup strategy
-
setNameIdentifierGenerator
public void setNameIdentifierGenerator(@Nonnull org.opensaml.saml.saml1.profile.SAML1NameIdentifierGenerator theGenerator)Set the generator to use.- Parameters:
theGenerator- the generator to use
-
doInitialize
protected void doInitialize() throws net.shibboleth.utilities.java.support.component.ComponentInitializationException- Overrides:
doInitializein classnet.shibboleth.utilities.java.support.component.AbstractInitializableComponent- Throws:
net.shibboleth.utilities.java.support.component.ComponentInitializationException
-
doPreExecute
protected boolean doPreExecute(@Nonnull org.opensaml.profile.context.ProfileRequestContext profileRequestContext)- Overrides:
doPreExecutein classorg.opensaml.profile.action.AbstractProfileAction
-
doExecute
protected void doExecute(@Nonnull org.opensaml.profile.context.ProfileRequestContext profileRequestContext)- Overrides:
doExecutein classorg.opensaml.profile.action.AbstractProfileAction
-
generateNameIdentifier
@Nullable private org.opensaml.saml.saml1.core.NameIdentifier generateNameIdentifier(@Nonnull org.opensaml.profile.context.ProfileRequestContext profileRequestContext)Attempt to generate aNameIdentifierusing each of the candidate Formats and plugins.- Parameters:
profileRequestContext- current profile request context- Returns:
- a generated
NameIdentifieror null
-
getStatementSubject
@Nonnull private org.opensaml.saml.saml1.core.Subject getStatementSubject(@Nonnull org.opensaml.saml.saml1.core.SubjectStatement statement)Get the subject to which the name identifier will be added.- Parameters:
statement- the statement being modified- Returns:
- the subject to which the name identifier will be added
-
cloneNameIdentifier
@Nonnull private org.opensaml.saml.saml1.core.NameIdentifier cloneNameIdentifier(@Nonnull org.opensaml.saml.saml1.core.NameIdentifier nameIdentifier)Create an efficient field-wise copy of aNameIdentifier.- Parameters:
nameIdentifier- the object to clone- Returns:
- the copy
-
-