Class ManipulateClaimsForIDToken
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.plugin.oidc.op.profile.impl.AbstractOIDCRequestAction<com.nimbusds.openid.connect.sdk.AuthenticationRequest>
net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCAuthenticationRequestAction
net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCAuthenticationResponseAction
net.shibboleth.idp.plugin.oidc.op.profile.impl.ManipulateClaimsForIDToken
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
An action that can be used for manipulating id_token claims via configurable strategy (bi-function). If the
function exists, its result (a Map) is used as-is for building new contents for the upcoming id_token, i.e.
the previously built claims set is replaced. If the function returns null, the existing id_token contents
are not replaced.
- Event:
EventIds.INVALID_MSG_CTXIf the id_token does not exist.,IdPEventIds.INVALID_PROFILE_CONFIGIf the new claims set is not compatible with the id_token requirements (e.g. due to missing mandatory claims, or claims having unexpected syntax).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate com.nimbusds.openid.connect.sdk.claims.IDTokenClaimsSetThe id_token to operate on.private Function<ProfileRequestContext,BiFunction<ProfileRequestContext, Map<String, Object>, Map<String, Object>>> Lookup function to supply strategy bi-function for manipulating id_token claims.private org.slf4j.LoggerClass logger.private BiFunction<ProfileRequestContext,Map<String, Object>, Map<String, Object>> The strategy used for manipulating the id_token.private com.fasterxml.jackson.databind.ObjectMapperObject mapper used for pretty-printing JWT contents.private org.slf4j.LoggerUsed to log protocol messages. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoExecute(ProfileRequestContext profileRequestContext) protected voidprotected booleandoPreExecute(ProfileRequestContext profileRequestContext) protected voiddoProtocolLog(ProfileRequestContext profileRequestContext, com.nimbusds.openid.connect.sdk.claims.IDTokenClaimsSet claimsSet) Create a protocol message containing the pretty-printed contents of the given claims set.voidsetIDTokenManipulationStrategyLookupStrategy(Function<ProfileRequestContext, BiFunction<ProfileRequestContext, Map<String, Object>, Map<String, Object>>> strategy) Set the lookup function to supply strategy bi-function for manipulating id_token claims.voidsetObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper) Set the object mapper used for pretty-printing JWT contents.Methods inherited from class net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCAuthenticationResponseAction
getMetadataContext, getOidcResponseContextMethods inherited from class net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCAuthenticationRequestAction
getAuthenticationRequestMethods inherited from class net.shibboleth.idp.plugin.oidc.op.profile.impl.AbstractOIDCRequestAction
getRequestMethods 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
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 org.slf4j.Logger logClass logger. -
protocolMessageLog
@Nonnull private org.slf4j.Logger protocolMessageLogUsed to log protocol messages. -
idTokenManipulationStrategyLookupStrategy
@Nonnull private Function<ProfileRequestContext,BiFunction<ProfileRequestContext, idTokenManipulationStrategyLookupStrategyMap<String, Object>, Map<String, Object>>> Lookup function to supply strategy bi-function for manipulating id_token claims. -
manipulationStrategy
private BiFunction<ProfileRequestContext,Map<String, manipulationStrategyObject>, Map<String, Object>> The strategy used for manipulating the id_token. -
objectMapper
Object mapper used for pretty-printing JWT contents. -
idToken
private com.nimbusds.openid.connect.sdk.claims.IDTokenClaimsSet idTokenThe id_token to operate on.
-
-
Constructor Details
-
ManipulateClaimsForIDToken
public ManipulateClaimsForIDToken()Constructor.
-
-
Method Details
-
setIDTokenManipulationStrategyLookupStrategy
public void setIDTokenManipulationStrategyLookupStrategy(@Nonnull Function<ProfileRequestContext, BiFunction<ProfileRequestContext, Map<String, Object>, Map<String, Object>>> strategy) Set the lookup function to supply strategy bi-function for manipulating id_token claims.- Parameters:
strategy- What to set
-
setObjectMapper
public void setObjectMapper(@Nonnull com.fasterxml.jackson.databind.ObjectMapper mapper) Set the object mapper used for pretty-printing JWT contents.- Parameters:
mapper- What to set.- Since:
- 4.1.0
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doPreExecute
- Overrides:
doPreExecutein classAbstractOIDCAuthenticationResponseAction
-
doExecute
- Overrides:
doExecutein classAbstractProfileAction
-
doProtocolLog
protected void doProtocolLog(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull com.nimbusds.openid.connect.sdk.claims.IDTokenClaimsSet claimsSet) Create a protocol message containing the pretty-printed contents of the given claims set.- Parameters:
profileRequestContext- Profile request context where to publish possible error eventclaimsSet- The claims set to be logged
-