Class AddSubjectConfirmationToSubjects
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- org.opensaml.profile.action.AbstractProfileAction
-
- org.opensaml.saml.saml2.profile.impl.AddSubjectConfirmationToSubjects
-
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction
public class AddSubjectConfirmationToSubjects extends AbstractProfileAction
Action that buildsSubjectConfirmationand adds it to theSubjectof 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 will be created by this action, but if no
Subjectexists in the assertions found, it will be cretaed.An associated
SubjectConfirmationDatawill be built to spec based on a set of lookup functions that optionally provide various attributes. They have appropriate defaults for the simple use case of a bearer SSO assertion but need to be overridden for other cases.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classAddSubjectConfirmationToSubjects.RemoteAddressStrategyDefault strategy for obtaining client address from servlet layer.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description AddSubjectConfirmationToSubjects()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private SubjectConfirmationcloneConfirmation(SubjectConfirmation confirmation)Create an efficient field-wise copy of aSubjectConfirmation.protected voiddoExecute(ProfileRequestContext profileRequestContext)protected voiddoInitialize()protected booleandoPreExecute(ProfileRequestContext profileRequestContext)private SubjectgetAssertionSubject(Assertion assertion)Get the subject to which the confirmation will be added.voidsetAddressLookupStrategy(Function<ProfileRequestContext,String> strategy)Set the strategy used to obtain value forSubjectConfirmationData.getAddress().voidsetInResponseToLookupStrategy(Function<ProfileRequestContext,String> strategy)Set the strategy used to obtain value forSubjectConfirmationData.getInResponseTo().voidsetLifetimeLookupStrategy(Function<ProfileRequestContext,Long> strategy)Set the strategy used to obtain value forSubjectConfirmationData.getNotOnOrAfter().voidsetMethod(String method)Set the confirmation method to use.voidsetOverwriteExisting(boolean flag)Set whether to overwrite any existingSubjectConfirmationobjects found.voidsetRecipientLookupStrategy(Function<ProfileRequestContext,String> strategy)Set the strategy used to obtain value forSubjectConfirmationData.getRecipient().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, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, setHttpServletRequest, setHttpServletRequestSupplier, setHttpServletResponse, setHttpServletResponseSupplier
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
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.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.
-
confirmationBuilder
@Nonnull private final SAMLObjectBuilder<SubjectConfirmation> confirmationBuilder
Builder for SubjectConfirmation objects.
-
confirmationDataBuilder
@Nonnull private final SAMLObjectBuilder<SubjectConfirmationData> confirmationDataBuilder
Builder for SubjectConfirmation objects.
-
overwriteExisting
private boolean overwriteExisting
Flag controlling whether to overwrite existing confirmations.
-
responseLookupStrategy
@Nonnull private Function<ProfileRequestContext,Response> responseLookupStrategy
Strategy used to locate theResponseto operate on.
-
addressLookupStrategy
@NonnullAfterInit private Function<ProfileRequestContext,String> addressLookupStrategy
Strategy to obtain value forSubjectConfirmationData.getAddress().
-
inResponseToLookupStrategy
@Nullable private Function<ProfileRequestContext,String> inResponseToLookupStrategy
Optional strategy to obtain value forSubjectConfirmationData.getInResponseTo().
-
recipientLookupStrategy
@Nullable private Function<ProfileRequestContext,String> recipientLookupStrategy
Optional strategy to obtain value forSubjectConfirmationData.getRecipient().
-
lifetimeLookupStrategy
@Nullable private Function<ProfileRequestContext,Long> lifetimeLookupStrategy
Optional strategy to obtain value forSubjectConfirmationData.getNotOnOrAfter().
-
confirmationMethod
@NonnullAfterInit private String confirmationMethod
Method to add.
-
response
@Nullable private Response response
Response to modify.
-
-
Method Detail
-
setOverwriteExisting
public void setOverwriteExisting(boolean flag)
Set whether to overwrite any existingSubjectConfirmationobjects found.- Parameters:
flag- true iff the action should overwrite any existing objects
-
setResponseLookupStrategy
public void setResponseLookupStrategy(@Nonnull Function<ProfileRequestContext,Response> strategy)Set the strategy used to locate theResponseto operate on.- Parameters:
strategy- strategy used to locate theResponseto operate on
-
setAddressLookupStrategy
public void setAddressLookupStrategy(@Nullable Function<ProfileRequestContext,String> strategy)Set the strategy used to obtain value forSubjectConfirmationData.getAddress().- Parameters:
strategy- lookup strategy
-
setInResponseToLookupStrategy
public void setInResponseToLookupStrategy(@Nullable Function<ProfileRequestContext,String> strategy)Set the strategy used to obtain value forSubjectConfirmationData.getInResponseTo().- Parameters:
strategy- lookup strategy
-
setRecipientLookupStrategy
public void setRecipientLookupStrategy(@Nullable Function<ProfileRequestContext,String> strategy)Set the strategy used to obtain value forSubjectConfirmationData.getRecipient().- Parameters:
strategy- lookup strategy
-
setLifetimeLookupStrategy
public void setLifetimeLookupStrategy(@Nullable Function<ProfileRequestContext,Long> strategy)Set the strategy used to obtain value forSubjectConfirmationData.getNotOnOrAfter().- Parameters:
strategy- lookup strategy
-
setMethod
public void setMethod(@Nonnull @NotEmpty String method)
Set the confirmation method to use.- Parameters:
method- confirmation method to use
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
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 confirmation will be added.- Parameters:
assertion- the assertion being modified- Returns:
- the subject to which the confirmation will be added
-
cloneConfirmation
@Nonnull private SubjectConfirmation cloneConfirmation(@Nonnull SubjectConfirmation confirmation)
Create an efficient field-wise copy of aSubjectConfirmation.- Parameters:
confirmation- the object to clone- Returns:
- the copy
-
-