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:
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 CopyNameIdentifierFromRequest extends org.opensaml.profile.action.AbstractProfileActionAction that builds aNameIdentifierand 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
NameIdentifieris aSAMLSubjectNameIdentifierContextreturned by a lookup strategy.- Event:
EventIds.PROCEED_EVENT_ID,EventIds.INVALID_MSG_CTX
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.LoggerlogClass logger.private org.opensaml.saml.saml1.core.NameIdentifiernameIdentifierNameIdentifier to copy.private org.opensaml.saml.common.SAMLObjectBuilder<org.opensaml.saml.saml1.core.NameIdentifier>nameIdentifierBuilderBuilder for NameIdentifier objects.private Function<org.opensaml.profile.context.ProfileRequestContext,org.opensaml.saml.common.messaging.context.SAMLSubjectNameIdentifierContext>nameIdentifierContextLookupStrategyStrategy used to locate the name identifier context to copy from.private booleanoverwriteExistingFlag controlling whether to overwrite an existing NameIdentifier.private org.opensaml.saml.saml1.core.ResponseresponseResponse to modify.private Function<org.opensaml.profile.context.ProfileRequestContext,org.opensaml.saml.saml1.core.Response>responseLookupStrategyStrategy used to locate theResponseto operate on.private org.opensaml.saml.common.SAMLObjectBuilder<org.opensaml.saml.saml1.core.Subject>subjectBuilderBuilder for Subject objects.
-
Constructor Summary
Constructors Constructor Description CopyNameIdentifierFromRequest()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.opensaml.saml.saml1.core.NameIdentifiercloneNameIdentifier()Create an efficient field-wise copy of aNameIdentifier.protected voiddoExecute(org.opensaml.profile.context.ProfileRequestContext profileRequestContext)protected booleandoPreExecute(org.opensaml.profile.context.ProfileRequestContext profileRequestContext)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.voidsetNameIdentifierContextLookupStrategy(Function<org.opensaml.profile.context.ProfileRequestContext,org.opensaml.saml.common.messaging.context.SAMLSubjectNameIdentifierContext> strategy)Set the strategy used to locate theSAMLSubjectNameIdentifierContextto copy from.voidsetOverwriteExisting(boolean flag)Set whether to overwrite any existingNameIdentifierobjects found.voidsetResponseLookupStrategy(Function<org.opensaml.profile.context.ProfileRequestContext,org.opensaml.saml.saml1.core.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
-
-
-
-
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.
-
nameIdentifierContextLookupStrategy
@Nonnull private Function<org.opensaml.profile.context.ProfileRequestContext,org.opensaml.saml.common.messaging.context.SAMLSubjectNameIdentifierContext> nameIdentifierContextLookupStrategy
Strategy used to locate the name identifier context to copy from.
-
responseLookupStrategy
@Nonnull private Function<org.opensaml.profile.context.ProfileRequestContext,org.opensaml.saml.saml1.core.Response> responseLookupStrategy
Strategy used to locate theResponseto operate on.
-
nameIdentifier
@Nullable private org.opensaml.saml.saml1.core.NameIdentifier nameIdentifier
NameIdentifier to copy.
-
response
@Nullable private org.opensaml.saml.saml1.core.Response response
Response 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
-
setNameIdentifierContextLookupStrategy
public void setNameIdentifierContextLookupStrategy(@Nonnull Function<org.opensaml.profile.context.ProfileRequestContext,org.opensaml.saml.common.messaging.context.SAMLSubjectNameIdentifierContext> strategy)Set the strategy used to locate theSAMLSubjectNameIdentifierContextto copy from.- Parameters:
strategy- lookup strategy
-
setResponseLookupStrategy
public void setResponseLookupStrategy(@Nonnull Function<org.opensaml.profile.context.ProfileRequestContext,org.opensaml.saml.saml1.core.Response> strategy)Set the strategy used to locate theResponseto operate on.- Parameters:
strategy- lookup strategy
-
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
-
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()
Create an efficient field-wise copy of aNameIdentifier.- Returns:
- the copy
-
-