Class AddAttributesToClaimsSet
- 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.plugin.oidc.op.profile.impl.AbstractOIDCResponseAction
-
- net.shibboleth.idp.plugin.oidc.op.profile.impl.AddAttributesToClaimsSet
-
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
public class AddAttributesToClaimsSet extends AbstractOIDCResponseAction
Action that adds claims to aClaimsSet. Claims are formed of resolved attributes having OIDC encoder. Action verifies user has consented to release attribute, if consent information is available. Actions will not add claims listed as reserved.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanaddToIDTokenByDefaultWhether we can add claims to IDToken by default i.e.private Set<String>alwaysIncludedAttributesAttributes to include in ID token no matter what.private Function<ProfileRequestContext,Set<String>>alwaysIncludedAttributesLookupStrategyStrategy used to obtain the set of attribute IDs to include in the ID token in all cases.private Function<ProfileRequestContext,net.shibboleth.idp.attribute.context.AttributeContext>attributeContextLookupStrategyStrategy used to locate theAttributeContextassociated with a givenProfileRequestContext.private net.shibboleth.idp.attribute.context.AttributeContextattributeCtxAttributeContext to use.private com.nimbusds.openid.connect.sdk.claims.ClaimsSetclaimsSetClaims Set to use.private Function<ProfileRequestContext,OIDCAuthenticationResponseConsentContext>consentContextLookupStrategyStrategy used to locate theOIDCAuthenticationResponseConsentContext.private Set<String>deniedUserInfoAttributesAttributes to omit from UserInfo token.private Function<ProfileRequestContext,Set<String>>deniedUserInfoAttributesLookupStrategyStrategy used to obtain the set of attribute IDs to omit from the UserInfo token.private booleanignoringUnencodableAttributesWhether attributes that result in anAttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition.private org.slf4j.LoggerlogClass logger.private List<String>reservedClaimNamesList of claim names that will not be added.private Function<ProfileRequestContext,com.nimbusds.openid.connect.sdk.claims.ClaimsSet>responseClaimsSetLookupStrategyStrategy used to locate the responseClaimsSetassociated with a givenProfileRequestContext.private ReloadableService<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry>transcoderRegistryTranscoder registry service object.
-
Constructor Summary
Constructors Constructor Description AddAttributesToClaimsSet()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoExecute(ProfileRequestContext profileRequestContext)protected voiddoInitialize()protected booleandoPreExecute(ProfileRequestContext profileRequestContext)private voidencodeAttribute(net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry registry, ProfileRequestContext profileRequestContext, net.shibboleth.idp.attribute.IdPAttribute attribute, Collection<net.minidev.json.JSONObject> results)Access the registry of transcoding rules to transform the input attribute into claims.voidsetAlwaysIncludedAttributesLookupStrategy(Function<ProfileRequestContext,Set<String>> strategy)Set the strategy used to obtain the set of attribute IDs always included in ID tokens.voidsetAttributeContextLookupStrategy(Function<ProfileRequestContext,net.shibboleth.idp.attribute.context.AttributeContext> strategy)Set the strategy used to locate theAttributeContextassociated with a givenProfileRequestContext.voidsetDeniedUserInfoAttributesLookupStrategy(Function<ProfileRequestContext,Set<String>> strategy)Set the strategy used to obtain the set of attribute IDs to omit from UserInfo tokens.voidsetIgnoringUnencodableAttributes(boolean flag)Set whether the attributes that result in anAttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition.voidsetOIDCAuthenticationResponseConsentContextLookupStrategy(Function<ProfileRequestContext,OIDCAuthenticationResponseConsentContext> strategy)Set the strategy used to locate theOIDCAuthenticationResponseTokenClaimsContextassociated with a givenProfileRequestContext.voidsetReservedClaimNames(List<String> claimNames)Set list of claim names that will not be added.voidsetResponseClaimsSetLookupStrategy(Function<ProfileRequestContext,com.nimbusds.openid.connect.sdk.claims.ClaimsSet> strategy)Set the strategy used to locate the responseClaimsSetassociated with a givenProfileRequestContext.voidsetTranscoderRegistry(ReloadableService<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry> registry)Sets the registry of transcoding rules to apply to encode attributes.-
Methods inherited from class net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCResponseAction
getMetadataContext, getOidcResponseContext
-
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 Detail
-
log
@Nonnull private org.slf4j.Logger log
Class logger.
-
attributeContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,net.shibboleth.idp.attribute.context.AttributeContext> attributeContextLookupStrategy
Strategy used to locate theAttributeContextassociated with a givenProfileRequestContext.
-
responseClaimsSetLookupStrategy
@Nonnull private Function<ProfileRequestContext,com.nimbusds.openid.connect.sdk.claims.ClaimsSet> responseClaimsSetLookupStrategy
Strategy used to locate the responseClaimsSetassociated with a givenProfileRequestContext.
-
consentContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,OIDCAuthenticationResponseConsentContext> consentContextLookupStrategy
Strategy used to locate theOIDCAuthenticationResponseConsentContext.
-
alwaysIncludedAttributesLookupStrategy
@Nonnull private Function<ProfileRequestContext,Set<String>> alwaysIncludedAttributesLookupStrategy
Strategy used to obtain the set of attribute IDs to include in the ID token in all cases.
-
deniedUserInfoAttributesLookupStrategy
@Nonnull private Function<ProfileRequestContext,Set<String>> deniedUserInfoAttributesLookupStrategy
Strategy used to obtain the set of attribute IDs to omit from the UserInfo token.
-
transcoderRegistry
@NonnullAfterInit private ReloadableService<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry> transcoderRegistry
Transcoder registry service object.
-
ignoringUnencodableAttributes
private boolean ignoringUnencodableAttributes
Whether attributes that result in anAttributeEncodingExceptionwhen being encoded should be ignored or result in anIdPEventIds.UNABLE_ENCODE_ATTRIBUTEtransition.
-
attributeCtx
@Nullable private net.shibboleth.idp.attribute.context.AttributeContext attributeCtx
AttributeContext to use.
-
claimsSet
@Nullable private com.nimbusds.openid.connect.sdk.claims.ClaimsSet claimsSet
Claims Set to use.
-
addToIDTokenByDefault
private boolean addToIDTokenByDefault
Whether we can add claims to IDToken by default i.e. response type is "id_token".
-
reservedClaimNames
@Nullable @NonnullElements private List<String> reservedClaimNames
List of claim names that will not be added.
-
alwaysIncludedAttributes
@Nullable @NonnullElements private Set<String> alwaysIncludedAttributes
Attributes to include in ID token no matter what.
-
deniedUserInfoAttributes
@Nullable @NonnullElements private Set<String> deniedUserInfoAttributes
Attributes to omit from UserInfo token.
-
-
Method Detail
-
setTranscoderRegistry
public void setTranscoderRegistry(@Nonnull ReloadableService<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry> registry)Sets the registry of transcoding rules to apply to encode attributes.- Parameters:
registry- registry service interface
-
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
-
setReservedClaimNames
public void setReservedClaimNames(List<String> claimNames)
Set list of claim names that will not be added.- Parameters:
claimNames- list of claim names that will not be added.
-
setResponseClaimsSetLookupStrategy
public void setResponseClaimsSetLookupStrategy(@Nonnull Function<ProfileRequestContext,com.nimbusds.openid.connect.sdk.claims.ClaimsSet> strategy)Set the strategy used to locate the responseClaimsSetassociated with a givenProfileRequestContext.- Parameters:
strategy- strategy used to locate the responseClaimsSetassociated with a givenProfileRequestContext
-
setAttributeContextLookupStrategy
public void setAttributeContextLookupStrategy(@Nonnull Function<ProfileRequestContext,net.shibboleth.idp.attribute.context.AttributeContext> strategy)Set the strategy used to locate theAttributeContextassociated with a givenProfileRequestContext.- Parameters:
strategy- strategy used to locate theAttributeContextassociated with a givenProfileRequestContext
-
setOIDCAuthenticationResponseConsentContextLookupStrategy
public void setOIDCAuthenticationResponseConsentContextLookupStrategy(@Nonnull Function<ProfileRequestContext,OIDCAuthenticationResponseConsentContext> strategy)Set the strategy used to locate theOIDCAuthenticationResponseTokenClaimsContextassociated with a givenProfileRequestContext.- Parameters:
strategy- lookup strategy
-
setAlwaysIncludedAttributesLookupStrategy
public void setAlwaysIncludedAttributesLookupStrategy(@Nonnull Function<ProfileRequestContext,Set<String>> strategy)Set the strategy used to obtain the set of attribute IDs always included in ID tokens.- Parameters:
strategy- lookup strategy
-
setDeniedUserInfoAttributesLookupStrategy
public void setDeniedUserInfoAttributesLookupStrategy(@Nonnull Function<ProfileRequestContext,Set<String>> strategy)Set the strategy used to obtain the set of attribute IDs to omit from UserInfo tokens.- Parameters:
strategy- lookup strategy
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doPreExecute
protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext)- Overrides:
doPreExecutein classAbstractOIDCResponseAction
-
doExecute
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext)- Overrides:
doExecutein classAbstractProfileAction
-
encodeAttribute
private void encodeAttribute(@Nonnull net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry registry, @Nonnull ProfileRequestContext profileRequestContext, @Nonnull net.shibboleth.idp.attribute.IdPAttribute attribute, @Nonnull @NonnullElements @Live Collection<net.minidev.json.JSONObject> results) throws net.shibboleth.idp.attribute.AttributeEncodingExceptionAccess the registry of transcoding rules to transform the input attribute into claims.- Parameters:
registry- registry of transcoding rulesprofileRequestContext- current profile request contextattribute- input attributeresults- collection to add results to- Throws:
net.shibboleth.idp.attribute.AttributeEncodingException- if a non-ignorable error occurs
-
-