Class BaseAddAttributeStatementToAssertion<T extends SAMLObject>
- java.lang.Object
-
- net.shibboleth.utilities.java.support.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 anAttributeContextinto a SAML attribute statement.The
IdPAttributeset to be encoded is drawn from anAttributeContextreturned from a lookup strategy, by default located on theRelyingPartyContextbeneath the profile request context.
-
-
Field Summary
Fields Modifier and Type Field Description private Function<ProfileRequestContext,AttributeContext>attributeContextLookupStrategyStrategy used to locate theAttributeContextassociated with a givenProfileRequestContext.private AttributeContextattributeCtxAttributeContext to use.private IdentifierGenerationStrategyidGeneratorThe generator to use.private Function<ProfileRequestContext,IdentifierGenerationStrategy>idGeneratorLookupStrategyStrategy used to locate theIdentifierGenerationStrategyto use.private booleanignoringUnencodableAttributesWhether attributes that result in anAttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition.private StringissuerIdEntityID to populate as assertion issuer.private Function<ProfileRequestContext,String>issuerLookupStrategyStrategy used to obtain the assertion issuer value.private org.slf4j.LoggerlogClass logger.private booleanstatementInOwnAssertionWhether the generated attribute statement should be placed in its own assertion or added to one if it exists.private ReloadableService<AttributeTranscoderRegistry>transcoderRegistryTranscoder registry service object.
-
Constructor Summary
Constructors Constructor Description BaseAddAttributeStatementToAssertion()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoInitialize()protected 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.AttributeContextgetAttributeContext()Get theAttributeContextto encode.IdentifierGenerationStrategygetIdGenerator()Get theIdentifierGenerationStrategyto use if an assertion must be created.StringgetIssuerId()Get the issuer name to use if an assertion must be created.ReloadableService<AttributeTranscoderRegistry>getTranscoderRegistry()Gets the registry of transcoding rules to apply to encode attributes.booleanisIgnoringUnencodableAttributes()Get whether the attributes that result in anAttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition.booleanisStatementInOwnAssertion()Set whether the generated attribute statement should be placed in its own assertion or added to one if it exists.voidsetAttributeContextLookupStrategy(Function<ProfileRequestContext,AttributeContext> strategy)Set 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.voidsetIssuerLookupStrategy(Function<ProfileRequestContext,String> strategy)Set 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.voidsetTranscoderRegistry(ReloadableService<AttributeTranscoderRegistry> registry)Sets the registry of transcoding rules to apply to encode attributes.-
Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
doExecute, execute, getMessage, getMessage, getMessage, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategy
-
Methods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction
getActivationCondition, setActivationCondition
-
Methods inherited from class org.opensaml.profile.action.AbstractProfileAction
doExecute, doPostExecute, doPostExecute, execute, getHttpServletRequest, getHttpServletResponse, getLogPrefix, setHttpServletRequest, setHttpServletResponse
-
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.
-
statementInOwnAssertion
private boolean statementInOwnAssertion
Whether the generated attribute statement should be placed in its own assertion or added to one if it exists.
-
ignoringUnencodableAttributes
private boolean ignoringUnencodableAttributes
Whether attributes that result in anAttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition.
-
idGeneratorLookupStrategy
@NonnullAfterInit private Function<ProfileRequestContext,IdentifierGenerationStrategy> idGeneratorLookupStrategy
Strategy used to locate theIdentifierGenerationStrategyto use.
-
issuerLookupStrategy
@Nonnull private Function<ProfileRequestContext,String> issuerLookupStrategy
Strategy used to obtain the assertion issuer value.
-
attributeContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,AttributeContext> attributeContextLookupStrategy
Strategy used to locate theAttributeContextassociated with a givenProfileRequestContext.
-
transcoderRegistry
@NonnullAfterInit private ReloadableService<AttributeTranscoderRegistry> transcoderRegistry
Transcoder registry service object.
-
attributeCtx
@Nullable private AttributeContext attributeCtx
AttributeContext to use.
-
idGenerator
@Nullable private IdentifierGenerationStrategy idGenerator
The generator to use.
-
issuerId
@Nullable private String issuerId
EntityID to populate as assertion issuer.
-
-
Method Detail
-
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
public void setIssuerLookupStrategy(@Nonnull Function<ProfileRequestContext,String> strategy)Set the strategy used to locate the issuer value to use.- Parameters:
strategy- lookup strategy
-
getTranscoderRegistry
@NonnullAfterInit public ReloadableService<AttributeTranscoderRegistry> getTranscoderRegistry()
Gets the registry of transcoding rules to apply to encode attributes.- Returns:
- registry
-
setTranscoderRegistry
public void setTranscoderRegistry(@Nonnull ReloadableService<AttributeTranscoderRegistry> registry)Sets the registry of transcoding rules to apply to encode attributes.- Parameters:
registry- registry service interface
-
getAttributeContext
@Nonnull public AttributeContext getAttributeContext()
Get theAttributeContextto encode.- Returns:
- the context to encode
-
getIdGenerator
@Nonnull public IdentifierGenerationStrategy getIdGenerator()
Get theIdentifierGenerationStrategyto use if an assertion must be created.- Returns:
- the ID generation strategy
-
getIssuerId
@Nonnull @NotEmpty public String getIssuerId()
Get the issuer name to use if an assertion must be created.- Returns:
- the issuer name
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doPreExecute
protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext)- Overrides:
doPreExecutein classAbstractConditionalProfileAction
-
encodeAttribute
protected int encodeAttribute(@Nonnull AttributeTranscoderRegistry registry, @Nonnull ProfileRequestContext profileRequestContext, @Nonnull IdPAttribute attribute, @Nonnull Class<T> to, @Nonnull @NonnullElements @Live Collection<T> results) throws AttributeEncodingExceptionAccess 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
-
-