Class AddAttributeStatementToAssertion
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<Attribute>
net.shibboleth.idp.saml.saml2.profile.impl.AddAttributeStatementToAssertion
- All Implemented Interfaces:
Component
,DestructableComponent
,InitializableComponent
,ProfileAction
,Aware
,MessageSource
,MessageSourceAware
,Action
public class AddAttributeStatementToAssertion
extends BaseAddAttributeStatementToAssertion<Attribute>
Action that builds an
AttributeStatement
and adds it to an Assertion
returned by a lookup
strategy, by default in the InOutOperationContext.getOutboundMessageContext()
.
If no Response
exists, then an Assertion
directly in the outbound message context will
be used or created
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Default strategy for obtaining assertion to modify. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Function<ProfileRequestContext,
Assertion> Strategy used to locate theAssertion
to operate on.private final org.slf4j.Logger
Class logger. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate AttributeStatement
buildAttributeStatement
(ProfileRequestContext profileRequestContext, Collection<IdPAttribute> attributes) Builds an attribute statement from a collection of attributes.protected void
doExecute
(ProfileRequestContext profileRequestContext) private void
encodeAttribute
(AttributeTranscoderRegistry registry, ProfileRequestContext profileRequestContext, IdPAttribute attribute, Collection<Attribute> results) Encodes aIdPAttribute
into zero or moreAttribute
objects if a proper encoder is available.private Attribute
findExistingAttribute
(AttributeStatement statement, Attribute newAttribute) Find a matchingAttribute
in the statement, if any.void
Set the strategy used to locate theAssertion
to operate on.Methods inherited from class net.shibboleth.idp.saml.profile.impl.BaseAddAttributeStatementToAssertion
doInitialize, doPreExecute, encodeAttribute, getAttributeContext, getIdGenerator, getIssuerId, getTranscoderRegistry, isIgnoringUnencodableAttributes, isStatementInOwnAssertion, setAttributeContextLookupStrategy, setIdentifierGeneratorLookupStrategy, setIgnoringUnencodableAttributes, setIssuerLookupStrategy, setStatementInOwnAssertion, setTranscoderRegistry
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
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. -
assertionLookupStrategy
Strategy used to locate theAssertion
to operate on.
-
-
Constructor Details
-
AddAttributeStatementToAssertion
public AddAttributeStatementToAssertion()Constructor.
-
-
Method Details
-
setAssertionLookupStrategy
Set the strategy used to locate theAssertion
to operate on.- Parameters:
strategy
- strategy used to locate theAssertion
to operate on
-
doExecute
- Overrides:
doExecute
in classAbstractProfileAction
-
buildAttributeStatement
@Nullable private AttributeStatement buildAttributeStatement(@Nonnull ProfileRequestContext profileRequestContext, @Nullable @NullableElements Collection<IdPAttribute> attributes) throws AttributeEncodingException Builds an attribute statement from a collection of attributes.- Parameters:
profileRequestContext
- current profile request contextattributes
- the collection of attributes- Returns:
- the attribute statement or null if no attributes can be encoded
- Throws:
AttributeEncodingException
- thrown if there is a problem encoding an attribute
-
findExistingAttribute
@Nullable private Attribute findExistingAttribute(@Nonnull AttributeStatement statement, @Nonnull Attribute newAttribute) Find a matchingAttribute
in the statement, if any.- Parameters:
statement
- input statementnewAttribute
- the attribute to match- Returns:
- a match, or null
-
encodeAttribute
private void encodeAttribute(@Nonnull AttributeTranscoderRegistry registry, @Nonnull ProfileRequestContext profileRequestContext, @Nonnull IdPAttribute attribute, @Nonnull @NonnullElements Collection<Attribute> results) throws AttributeEncodingException Encodes aIdPAttribute
into zero or moreAttribute
objects if a proper encoder is available.- Parameters:
registry
- transcoding registryprofileRequestContext
- current profile request contextattribute
- the attribute to be encodedresults
- collection to add the encoded SAML attributes to- Throws:
AttributeEncodingException
- thrown if there is a problem encoding an attribute
-