Class BaseAddAttributeStatementToAssertion<T extends SAMLObject>
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.profile.action.AbstractProfileAction
org.opensaml.profile.action.AbstractConditionalProfileAction
net.shibboleth.idp.profile.AbstractProfileAction
net.shibboleth.idp.saml.profile.impl.BaseAddAttributeStatementToAssertion<T>
- Type Parameters:
T- type of objects being encoded
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
- Direct Known Subclasses:
AddAttributeStatementToAssertion,AddAttributeStatementToAssertion
public abstract class BaseAddAttributeStatementToAssertion<T extends SAMLObject>
extends AbstractProfileAction
Base class for actions that encode an
AttributeContext into a SAML attribute statement.
The IdPAttribute set to be encoded is drawn from
an AttributeContext returned from a
lookup strategy, by default located on the RelyingPartyContext beneath the profile request context.
-
Field Summary
FieldsModifier and TypeFieldDescriptionStrategy used to locate theAttributeContextassociated with a givenProfileRequestContext.private AttributeContextAttributeContext to use.private IdentifierGenerationStrategyThe generator to use.Strategy used to locate theIdentifierGenerationStrategyto use.private booleanWhether attributes that result in anAttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition.private StringEntityID to populate as assertion issuer.private Function<ProfileRequestContext,String> Strategy used to obtain the assertion issuer value.private final org.slf4j.LoggerClass logger.private booleanWhether the generated attribute statement should be placed in its own assertion or added to one if it exists.Transcoder registry service object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected booleandoPreExecute(ProfileRequestContext profileRequestContext) protected intencodeAttribute(AttributeTranscoderRegistry registry, ProfileRequestContext profileRequestContext, IdPAttribute attribute, Class<T> to, Collection<T> results) Access the registry of transcoding rules to transform the input attribute into a target type.Get theAttributeContextto encode.Get theIdentifierGenerationStrategyto use if an assertion must be created.Get the issuer name to use if an assertion must be created.Gets the registry of transcoding rules to apply to encode attributes.booleanGet whether the attributes that result in anAttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition.booleanSet whether the generated attribute statement should be placed in its own assertion or added to one if it exists.voidSet the strategy used to locate theAttributeContextassociated with a givenProfileRequestContext.voidsetIdentifierGeneratorLookupStrategy(Function<ProfileRequestContext, IdentifierGenerationStrategy> strategy) Set the strategy used to locate theIdentifierGenerationStrategyto use.voidsetIgnoringUnencodableAttributes(boolean flag) Set whether the attributes that result in anAttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition.voidSet the strategy used to locate the issuer value to use.voidsetStatementInOwnAssertion(boolean flag) Set whether the generated attribute statement should be placed in its own assertion or added to one if it exists.voidSets the registry of transcoding rules to apply to encode attributes.Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
doExecute, execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategyMethods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction
getActivationCondition, setActivationConditionMethods inherited from class org.opensaml.profile.action.AbstractProfileAction
doExecute, doPostExecute, doPostExecute, ensureHttpServletRequest, ensureHttpServletResponse, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, isPreExecuteCalled, setHttpServletRequestSupplier, setHttpServletResponseSupplierMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
statementInOwnAssertion
private boolean statementInOwnAssertionWhether the generated attribute statement should be placed in its own assertion or added to one if it exists. -
ignoringUnencodableAttributes
private boolean ignoringUnencodableAttributesWhether attributes that result in anAttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition. -
idGeneratorLookupStrategy
@NonnullAfterInit private Function<ProfileRequestContext,IdentifierGenerationStrategy> idGeneratorLookupStrategyStrategy used to locate theIdentifierGenerationStrategyto use. -
issuerLookupStrategy
Strategy used to obtain the assertion issuer value. -
attributeContextLookupStrategy
Strategy used to locate theAttributeContextassociated with a givenProfileRequestContext. -
transcoderRegistry
Transcoder registry service object. -
attributeCtx
AttributeContext to use. -
idGenerator
The generator to use. -
issuerId
EntityID to populate as assertion issuer.
-
-
Constructor Details
-
BaseAddAttributeStatementToAssertion
public BaseAddAttributeStatementToAssertion()Constructor.
-
-
Method Details
-
isStatementInOwnAssertion
public boolean isStatementInOwnAssertion()Set whether the generated attribute statement should be placed in its own assertion or added to one if it exists.- Returns:
- whether the generated attribute statement should be placed in its own assertion or added to one if it exists
-
setStatementInOwnAssertion
public void setStatementInOwnAssertion(boolean flag) Set whether the generated attribute statement should be placed in its own assertion or added to one if it exists.- Parameters:
flag- whether the generated attribute statement should be placed in its own assertion or added to one if it exists
-
isIgnoringUnencodableAttributes
public boolean isIgnoringUnencodableAttributes()Get whether the attributes that result in anAttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition.- Returns:
- whether the attributes that result in an
AttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition
-
setIgnoringUnencodableAttributes
public void setIgnoringUnencodableAttributes(boolean flag) Set whether the attributes that result in anAttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition.- Parameters:
flag- flag to set
-
setAttributeContextLookupStrategy
public void setAttributeContextLookupStrategy(@Nonnull Function<ProfileRequestContext, AttributeContext> strategy) Set the strategy used to locate theAttributeContextassociated with a givenProfileRequestContext.- Parameters:
strategy- strategy used to locate theAttributeContextassociated with a givenProfileRequestContext
-
setIdentifierGeneratorLookupStrategy
public void setIdentifierGeneratorLookupStrategy(@Nonnull Function<ProfileRequestContext, IdentifierGenerationStrategy> strategy) Set the strategy used to locate theIdentifierGenerationStrategyto use.- Parameters:
strategy- lookup strategy
-
setIssuerLookupStrategy
Set the strategy used to locate the issuer value to use.- Parameters:
strategy- lookup strategy
-
getTranscoderRegistry
Gets the registry of transcoding rules to apply to encode attributes.- Returns:
- registry
-
getAttributeContext
Get theAttributeContextto encode.- Returns:
- the context to encode
-
getIdGenerator
Get theIdentifierGenerationStrategyto use if an assertion must be created.- Returns:
- the ID generation strategy
-
getIssuerId
Get the issuer name to use if an assertion must be created.- Returns:
- the issuer name
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doPreExecute
- Overrides:
doPreExecutein classAbstractConditionalProfileAction
-
encodeAttribute
protected int encodeAttribute(@Nonnull AttributeTranscoderRegistry registry, @Nonnull ProfileRequestContext profileRequestContext, @Nonnull IdPAttribute attribute, @Nonnull Class<T> to, @Nonnull @Live Collection<T> results) throws AttributeEncodingException Access the registry of transcoding rules to transform the input attribute into a target type.- Parameters:
registry- registry of transcoding rulesprofileRequestContext- current profile request contextattribute- input attributeto- target typeresults- collection to add results to- Returns:
- number of results added
- Throws:
AttributeEncodingException- if a non-ignorable error occurs
-