Class PrepareAgentResponse
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.sp.profile.AbstractAgentRequestAction
net.shibboleth.sp.profile.AbstractAgentAction
net.shibboleth.sp.profile.AbstractApplicationAction
net.shibboleth.sp.profile.AbstractTokenConsumerResponseAction
net.shibboleth.sp.oidc.profile.impl.PrepareAgentResponse
- All Implemented Interfaces:
net.shibboleth.shared.component.Component,net.shibboleth.shared.component.DestructableComponent,net.shibboleth.shared.component.InitializableComponent,org.opensaml.profile.action.ProfileAction,Aware,MessageSource,MessageSourceAware,Action
public class PrepareAgentResponse
extends net.shibboleth.sp.profile.AbstractTokenConsumerResponseAction
OIDC-specific subclass of a token consumer response action.
Extracts the access token and refresh token from the AccessTokenResponseContext
and stores them in the session data return to the agent. These tokens can later be retrieved by the
agent when needed—for example, to refresh user profile information via the
UserInfo endpoint. The access token is used if it is still valid; otherwise,
the refresh token is used to obtain a new access token.
If a DataSealer is supplied, the tokens will be sealed before they are added to the session. Tokens are
sensitive so a data sealer is strongly recommended.
If the data sealer fails to seal a token, that token (and its associated data) will simply not be included in the session data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringParameter for accessing the access_token from opaque data.private Function<org.opensaml.profile.context.ProfileRequestContext,net.shibboleth.oidc.profile.context.AccessTokenResponseContext> Strategy used to look up theAccessTokenResponseContext.private net.shibboleth.shared.security.DataSealerOptional data sealer to use.static final StringParameter for accessing the expires_in from opaque data.static final StringParameter for accessing the id_token from opaque data.static final StringParameter for accessing the issued_token_type from opaque data.private final org.slf4j.LoggerClass logger.static final StringParameter for accessing the refresh_token from opaque data.static final StringParameter for accessing the scope from opaque data.static final StringStructure name for all tokens.static final StringParameter for accessing the token_type from opaque data.private net.shibboleth.oidc.profile.context.AccessTokenResponseContextThe stashed token response context. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringconditionallySeal(String token) If the data sealer is configured, use it to seal the token value.protected booleandoPreExecute(org.opensaml.profile.context.ProfileRequestContext profileRequestContext) protected net.shibboleth.sp.ddf.DDFgetSessionData(org.opensaml.profile.context.ProfileRequestContext profileRequestContext) voidsetAccessTokenResponseContextLookupStrategy(Function<org.opensaml.profile.context.ProfileRequestContext, net.shibboleth.oidc.profile.context.AccessTokenResponseContext> strategy) Set the strategy used to look up aAccessTokenResponseContext.voidsetDataSealer(net.shibboleth.shared.security.DataSealer sealer) SetsDataSealerto use.Methods inherited from class net.shibboleth.sp.profile.AbstractTokenConsumerResponseAction
doExecute, getSessionNotOnOrAfter, setAttributeContextLookupStrategy, setStateDataContextLookupStrategyMethods inherited from class net.shibboleth.sp.profile.AbstractApplicationAction
ensureApplication, getApplicationMethods inherited from class net.shibboleth.sp.profile.AbstractAgentAction
ensureAgent, getAgentMethods inherited from class net.shibboleth.sp.profile.AbstractAgentRequestAction
ensureAgentRequestContext, getAgentRequestContext, setAgentRequestContextLookupStrategyMethods 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, doInitialize, 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
-
TOKEN_STRUCTURE
Structure name for all tokens.- See Also:
-
ACCESS_TOKEN_PARAM
Parameter for accessing the access_token from opaque data.- See Also:
-
REFRESH_TOKEN_PARAM
Parameter for accessing the refresh_token from opaque data.- See Also:
-
ID_TOKEN_PARAM
Parameter for accessing the id_token from opaque data.- See Also:
-
TOKEN_TYPE_PARAM
Parameter for accessing the token_type from opaque data.- See Also:
-
EXPIRES_IN_PARAM
Parameter for accessing the expires_in from opaque data.- See Also:
-
SCOPE_PARAM
Parameter for accessing the scope from opaque data.- See Also:
-
ISSUED_TOKEN_TYPE_PARAM
Parameter for accessing the issued_token_type from opaque data.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
accessTokenResponseContextLookupStrategy
@Nonnull private Function<org.opensaml.profile.context.ProfileRequestContext,net.shibboleth.oidc.profile.context.AccessTokenResponseContext> accessTokenResponseContextLookupStrategyStrategy used to look up theAccessTokenResponseContext. -
tokenResponseContext
@NonnullBeforeExec private net.shibboleth.oidc.profile.context.AccessTokenResponseContext tokenResponseContextThe stashed token response context. -
dataSealer
@Nullable private net.shibboleth.shared.security.DataSealer dataSealerOptional data sealer to use.
-
-
Constructor Details
-
PrepareAgentResponse
public PrepareAgentResponse()Constructor.
-
-
Method Details
-
setAccessTokenResponseContextLookupStrategy
public void setAccessTokenResponseContextLookupStrategy(@Nonnull Function<org.opensaml.profile.context.ProfileRequestContext, net.shibboleth.oidc.profile.context.AccessTokenResponseContext> strategy) Set the strategy used to look up aAccessTokenResponseContext.- Parameters:
strategy- lookup strategy
-
doPreExecute
protected boolean doPreExecute(@Nonnull org.opensaml.profile.context.ProfileRequestContext profileRequestContext) - Overrides:
doPreExecutein classnet.shibboleth.sp.profile.AbstractTokenConsumerResponseAction
-
getSessionData
protected net.shibboleth.sp.ddf.DDF getSessionData(@Nonnull org.opensaml.profile.context.ProfileRequestContext profileRequestContext) - Specified by:
getSessionDatain classnet.shibboleth.sp.profile.AbstractTokenConsumerResponseAction
-
conditionallySeal
@Nonnull private String conditionallySeal(@Nonnull @NotEmpty String token) throws net.shibboleth.shared.security.DataSealerException If the data sealer is configured, use it to seal the token value. If configured, failure to seal a token results in an exception being thrown. If a sealer is not configured, the token is passed back untouched.- Parameters:
token- the token to seal or pass through- Returns:
- the sealed token, or the original token passed-through
- Throws:
net.shibboleth.shared.security.DataSealerException- if sealing fails