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 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 theAttributeContext
associated with a givenProfileRequestContext
.private AttributeContext
AttributeContext to use.private IdentifierGenerationStrategy
The generator to use.Strategy used to locate theIdentifierGenerationStrategy
to use.private boolean
Whether attributes that result in anAttributeEncodingException
when being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTE
transition.private String
EntityID to populate as assertion issuer.private Function<ProfileRequestContext,
String> Strategy used to obtain the assertion issuer value.private final org.slf4j.Logger
Class logger.private boolean
Whether 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 void
protected boolean
doPreExecute
(ProfileRequestContext profileRequestContext) protected int
encodeAttribute
(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 theAttributeContext
to encode.Get theIdentifierGenerationStrategy
to 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.boolean
Get whether the attributes that result in anAttributeEncodingException
when being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTE
transition.boolean
Set whether the generated attribute statement should be placed in its own assertion or added to one if it exists.void
Set the strategy used to locate theAttributeContext
associated with a givenProfileRequestContext
.void
setIdentifierGeneratorLookupStrategy
(Function<ProfileRequestContext, IdentifierGenerationStrategy> strategy) Set the strategy used to locate theIdentifierGenerationStrategy
to use.void
setIgnoringUnencodableAttributes
(boolean flag) Set whether the attributes that result in anAttributeEncodingException
when being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTE
transition.void
Set the strategy used to locate the issuer value to use.void
setStatementInOwnAssertion
(boolean flag) Set whether the generated attribute statement should be placed in its own assertion or added to one if it exists.void
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 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 anAttributeEncodingException
when being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTE
transition. -
idGeneratorLookupStrategy
@NonnullAfterInit private Function<ProfileRequestContext,IdentifierGenerationStrategy> idGeneratorLookupStrategyStrategy used to locate theIdentifierGenerationStrategy
to use. -
issuerLookupStrategy
Strategy used to obtain the assertion issuer value. -
attributeContextLookupStrategy
Strategy used to locate theAttributeContext
associated 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 anAttributeEncodingException
when being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTE
transition.- Returns:
- whether the attributes that result in an
AttributeEncodingException
when being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTE
transition
-
setIgnoringUnencodableAttributes
public void setIgnoringUnencodableAttributes(boolean flag) Set whether the attributes that result in anAttributeEncodingException
when being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTE
transition.- Parameters:
flag
- flag to set
-
setAttributeContextLookupStrategy
public void setAttributeContextLookupStrategy(@Nonnull Function<ProfileRequestContext, AttributeContext> strategy) Set the strategy used to locate theAttributeContext
associated with a givenProfileRequestContext
.- Parameters:
strategy
- strategy used to locate theAttributeContext
associated with a givenProfileRequestContext
-
setIdentifierGeneratorLookupStrategy
public void setIdentifierGeneratorLookupStrategy(@Nonnull Function<ProfileRequestContext, IdentifierGenerationStrategy> strategy) Set the strategy used to locate theIdentifierGenerationStrategy
to 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
-
setTranscoderRegistry
Sets the registry of transcoding rules to apply to encode attributes.- Parameters:
registry
- registry service interface
-
getAttributeContext
Get theAttributeContext
to encode.- Returns:
- the context to encode
-
getIdGenerator
Get theIdentifierGenerationStrategy
to 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:
doInitialize
in classAbstractInitializableComponent
- Throws:
ComponentInitializationException
-
doPreExecute
- Overrides:
doPreExecute
in 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 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
-