Class CopyNameIDFromRequest
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- org.opensaml.profile.action.AbstractProfileAction
-
- org.opensaml.saml.saml2.profile.impl.CopyNameIDFromRequest
-
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction
public class CopyNameIDFromRequest extends AbstractProfileAction
Action that builds aNameIDand adds it to theSubjectof all the statements in all the assertions found in aResponse. The message to update is returned by a lookup strategy, by default the message returned byInOutOperationContext.getOutboundMessageContext().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
NameIDis aSAMLSubjectNameIdentifierContextreturned by a lookup strategy.
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.LoggerlogClass logger.private NameIDnameIdNameID to copy.private SAMLObjectBuilder<NameID>nameIdBuilderBuilder for NameID objects.private Function<ProfileRequestContext,SAMLSubjectNameIdentifierContext>nameIdentifierContextLookupStrategyStrategy used to locate the name identifier context to copy from.private booleanoverwriteExistingFlag controlling whether to overwrite an existing NameID.private ResponseresponseResponse to modify.private Function<ProfileRequestContext,Response>responseLookupStrategyStrategy used to locate theResponseto operate on.private SAMLObjectBuilder<Subject>subjectBuilderBuilder for Subject objects.
-
Constructor Summary
Constructors Constructor Description CopyNameIDFromRequest()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private NameIDcloneNameID()Create an efficient field-wise copy of aNameID.protected voiddoExecute(ProfileRequestContext profileRequestContext)protected booleandoPreExecute(ProfileRequestContext profileRequestContext)private SubjectgetAssertionSubject(Assertion assertion)Get the subject to which the name identifier will be added.voidsetNameIDContextLookupStrategy(Function<ProfileRequestContext,SAMLSubjectNameIdentifierContext> strategy)Set the strategy used to locate theSAMLSubjectNameIdentifierContextto copy from.voidsetOverwriteExisting(boolean flag)Set whether to overwrite any existingNameIDobjects found.voidsetResponseLookupStrategy(Function<ProfileRequestContext,Response> strategy)Set the strategy used to locate theResponseto operate on.-
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, doInitialize, 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.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
subjectBuilder
@Nonnull private final SAMLObjectBuilder<Subject> subjectBuilder
Builder for Subject objects.
-
nameIdBuilder
@Nonnull private final SAMLObjectBuilder<NameID> nameIdBuilder
Builder for NameID objects.
-
overwriteExisting
private boolean overwriteExisting
Flag controlling whether to overwrite an existing NameID.
-
nameIdentifierContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,SAMLSubjectNameIdentifierContext> nameIdentifierContextLookupStrategy
Strategy used to locate the name identifier context to copy from.
-
responseLookupStrategy
@Nonnull private Function<ProfileRequestContext,Response> responseLookupStrategy
Strategy used to locate theResponseto operate on.
-
nameId
@Nullable private NameID nameId
NameID to copy.
-
response
@Nullable private Response response
Response to modify.
-
-
Method Detail
-
setOverwriteExisting
public void setOverwriteExisting(boolean flag)
Set whether to overwrite any existingNameIDobjects found.- Parameters:
flag- true iff the action should overwrite any existing objects
-
setNameIDContextLookupStrategy
public void setNameIDContextLookupStrategy(@Nonnull Function<ProfileRequestContext,SAMLSubjectNameIdentifierContext> strategy)Set the strategy used to locate theSAMLSubjectNameIdentifierContextto copy from.- Parameters:
strategy- lookup strategy
-
setResponseLookupStrategy
public void setResponseLookupStrategy(@Nonnull Function<ProfileRequestContext,Response> strategy)Set the strategy used to locate theResponseto operate on.- Parameters:
strategy- lookup strategy
-
doPreExecute
protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext)- Overrides:
doPreExecutein classAbstractProfileAction
-
doExecute
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext)- Overrides:
doExecutein classAbstractProfileAction
-
getAssertionSubject
@Nonnull private Subject getAssertionSubject(@Nonnull Assertion assertion)
Get the subject to which the name identifier will be added.- Parameters:
assertion- the assertion being modified- Returns:
- the assertion to which the name identifier will be added
-
-