Class CopyNameIdentifierFromRequest
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- org.opensaml.profile.action.AbstractProfileAction
-
- org.opensaml.saml.saml1.profile.impl.CopyNameIdentifierFromRequest
-
- All Implemented Interfaces:
Component
,DestructableComponent
,InitializableComponent
,ProfileAction
public class CopyNameIdentifierFromRequest extends AbstractProfileAction
Action that builds aNameIdentifier
and adds it to theSubject
of 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
Subject
exists in the statements found, it will be created.The source of the
NameIdentifier
is aSAMLSubjectNameIdentifierContext
returned by a lookup strategy.
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.Logger
log
Class logger.private NameIdentifier
nameIdentifier
NameIdentifier to copy.private SAMLObjectBuilder<NameIdentifier>
nameIdentifierBuilder
Builder for NameIdentifier objects.private Function<ProfileRequestContext,SAMLSubjectNameIdentifierContext>
nameIdentifierContextLookupStrategy
Strategy used to locate the name identifier context to copy from.private boolean
overwriteExisting
Flag controlling whether to overwrite an existing NameIdentifier.private Response
response
Response to modify.private Function<ProfileRequestContext,Response>
responseLookupStrategy
Strategy used to locate theResponse
to operate on.private SAMLObjectBuilder<Subject>
subjectBuilder
Builder for Subject objects.
-
Constructor Summary
Constructors Constructor Description CopyNameIdentifierFromRequest()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private NameIdentifier
cloneNameIdentifier()
Create an efficient field-wise copy of aNameIdentifier
.protected void
doExecute(ProfileRequestContext profileRequestContext)
protected boolean
doPreExecute(ProfileRequestContext profileRequestContext)
private Subject
getStatementSubject(SubjectStatement statement)
Get the subject to which the name identifier will be added.void
setNameIdentifierContextLookupStrategy(Function<ProfileRequestContext,SAMLSubjectNameIdentifierContext> strategy)
Set the strategy used to locate theSAMLSubjectNameIdentifierContext
to copy from.void
setOverwriteExisting(boolean flag)
Set whether to overwrite any existingNameIdentifier
objects found.void
setResponseLookupStrategy(Function<ProfileRequestContext,Response> strategy)
Set the strategy used to locate theResponse
to 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.
-
nameIdentifierBuilder
@Nonnull private final SAMLObjectBuilder<NameIdentifier> nameIdentifierBuilder
Builder for NameIdentifier objects.
-
overwriteExisting
private boolean overwriteExisting
Flag controlling whether to overwrite an existing NameIdentifier.
-
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 theResponse
to operate on.
-
nameIdentifier
@Nullable private NameIdentifier nameIdentifier
NameIdentifier to copy.
-
response
@Nullable private Response response
Response to modify.
-
-
Method Detail
-
setOverwriteExisting
public void setOverwriteExisting(boolean flag)
Set whether to overwrite any existingNameIdentifier
objects found.- Parameters:
flag
- true iff the action should overwrite any existing objects
-
setNameIdentifierContextLookupStrategy
public void setNameIdentifierContextLookupStrategy(@Nonnull Function<ProfileRequestContext,SAMLSubjectNameIdentifierContext> strategy)
Set the strategy used to locate theSAMLSubjectNameIdentifierContext
to copy from.- Parameters:
strategy
- lookup strategy
-
setResponseLookupStrategy
public void setResponseLookupStrategy(@Nonnull Function<ProfileRequestContext,Response> strategy)
Set the strategy used to locate theResponse
to operate on.- Parameters:
strategy
- lookup strategy
-
doPreExecute
protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext)
- Overrides:
doPreExecute
in classAbstractProfileAction
-
doExecute
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext)
- Overrides:
doExecute
in classAbstractProfileAction
-
getStatementSubject
@Nonnull private Subject getStatementSubject(@Nonnull 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 NameIdentifier cloneNameIdentifier()
Create an efficient field-wise copy of aNameIdentifier
.- Returns:
- the copy
-
-