Class ValidateOIDCAuthentication
- 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.authn.AbstractAuthenticationAction
-
- net.shibboleth.idp.authn.AbstractValidationAction
-
- net.shibboleth.idp.plugin.authn.oidc.rp.impl.ValidateOIDCAuthentication
-
- All Implemented Interfaces:
net.shibboleth.idp.authn.principal.PrincipalSupportingComponent,Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
public class ValidateOIDCAuthentication extends net.shibboleth.idp.authn.AbstractValidationActionAn action that builds anAuthenticationResultbased on an inbound OIDC authentication response.A
EndUserClaimsContextis used as the basis of the result, which stores the merged id_token and UserInfo claims set, alongside the raw id_token claims.Actual validation is all upstream of this action, but the use of the ValidationAction subclass is a convenience for auditing and handling the result.
- Event:
EventIds.PROCEED_EVENT_ID,EventIds.INVALID_PROFILE_CTX,IdPEventIds.INVALID_RELYING_PARTY_CTX,IdPEventIds.INVALID_PROFILE_CONFIG,AuthnEventIds.NO_CREDENTIALS- Precondition:
ProfileRequestContext.getSubcontext(AuthenticationContext.class).getAttemptedFlow() != null
- Postcondition:
- If AuthenticationContext.getSubcontext(EndUserClaimsContext.class, false)!= null,
then an
AuthenticationResultis saved to theAuthenticationContext.
-
-
Field Summary
Fields Modifier and Type Field Description private Function<Collection<String>,Collection<Principal>>acrTranslatorIncoming context translation function for converting OIDC ACRs into Principals.private Function<Collection<String>,Collection<Principal>>amrTranslatorIncoming context translation function for converting OIDC ACRs into Principals.private net.shibboleth.idp.attribute.context.AttributeContextattributeContextContext for externally supplied inbound attributes.private Function<ProfileRequestContext,Collection<net.shibboleth.idp.attribute.IdPAttribute>>attributeExtractionStrategyPluggable strategy function for generalized extraction of data.private ReloadableService<net.shibboleth.idp.attribute.filter.AttributeFilter>attributeFilterServiceService used to get the engine used to filter attributes.private Function<ProfileRequestContext,Collection<Principal>>contextToPrivateCredentialsMappingStrategyA hook to map context information to private credentials.private static StringDEFAULT_METRIC_NAMEDefault prefix for metrics.private Function<ProfileRequestContext,EndUserClaimsContext>endUserClaimsContextLookupStrategyStrategy used to look up theEndUserClaimsContextto set the parameters for.private EndUserClaimsContextendUserContextThe context with claims pertaining to the end-user of this authentication.private org.slf4j.LoggerlogClass logger.private MetadataResolvermetadataResolverOptional supplemental metadata source for filtering.private ProfileRequestContextprcThe profile request context.private net.shibboleth.oidc.profile.config.OIDCAuthenticationRelyingPartyProfileConfigurationprofileConfigurationStore off profile config.private Function<ProfileRequestContext,net.shibboleth.idp.profile.context.RelyingPartyContext>relyingPartyContextLookupStrategyStrategy used to look up aRelyingPartyContextfor configuration options.private ReloadableService<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry>transcoderRegistryTranscoder registry service object.
-
Constructor Summary
Constructors Constructor Description ValidateOIDCAuthentication()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private net.shibboleth.idp.authn.principal.ProxyAuthenticationPrincipalbuildProxyPrincipal()Construct a populatedProxyAuthenticationPrincipalbased on the upstream OP (the issuer of the id_token).private voiddecodeAttribute(net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry registry, ProfileRequestContext profileRequestContext, net.minidev.json.JSONObject input, Multimap<String,net.shibboleth.idp.attribute.IdPAttribute> results)Access the registry of transcoding rules to transform (decode) the input claims to IdP Attributes.protected voiddoExecute(ProfileRequestContext profileRequestContext, net.shibboleth.idp.authn.context.AuthenticationContext authenticationContext)protected voiddoInitialize()protected booleandoPreExecute(ProfileRequestContext profileRequestContext, net.shibboleth.idp.authn.context.AuthenticationContext authenticationContext)private voidfilterAttributes(ProfileRequestContext profileRequestContext)Check for inbound attributes and apply filtering.private voidpopulateFilterContext(ProfileRequestContext profileRequestContext, net.shibboleth.idp.attribute.filter.context.AttributeFilterContext filterContext)Fill in the filter context data.protected SubjectpopulateSubject(Subject subject)private voidprocessAttributes(ProfileRequestContext profileRequestContext)Process the inbound OIDC claims.voidsetAttributeExtractionStrategy(Function<ProfileRequestContext,Collection<net.shibboleth.idp.attribute.IdPAttribute>> strategy)Sets the strategy function to invoke for generalized extraction of data intoIdPAttributeobjects for inclusion in theAuthenticationResult.voidsetAttributeFilter(ReloadableService<net.shibboleth.idp.attribute.filter.AttributeFilter> filterService)Sets the filter service to use for inbound attributes.voidsetContextToPrivateCredentialsMappingStrategy(Function<ProfileRequestContext,Collection<Principal>> strategy)Set the context to principal mapping strategy for mapping context information into principal collections to place in the private credentials set of the subject.voidsetMetadataResolver(MetadataResolver resolver)Set a metadata source to use during filtering.voidsetRelyingPartyContextLookupStrategy(Function<ProfileRequestContext,net.shibboleth.idp.profile.context.RelyingPartyContext> strategy)Set the strategy used to return theRelyingPartyContextfor configuration options.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.authn.AbstractValidationAction
addDefaultPrincipals, buildAuthenticationResult, getClassifiedErrors, getCleanupHook, getMetricName, getRequesterLookupStrategy, getResponderLookupStrategy, getResultCachingPredicate, getSubject, getSupportedPrincipals, handleError, handleError, handleWarning, recordFailure, recordFailure, recordSuccess, recordSuccess, setAddDefaultPrincipals, setClassifiedMessages, setCleanupHook, setMetricName, setRequesterLookupStrategy, setResponderLookupStrategy, setResultCachingPredicate, setSupportedPrincipals
-
Methods inherited from class net.shibboleth.idp.authn.AbstractAuthenticationAction
doExecute, doPreExecute, setAuthenticationContextLookupStrategy
-
Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
doExecute, execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, 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, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, setHttpServletRequest, setHttpServletRequestSupplier, setHttpServletResponse, setHttpServletResponseSupplier
-
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
-
DEFAULT_METRIC_NAME
@Nonnull @NotEmpty private static final String DEFAULT_METRIC_NAME
Default prefix for metrics.- See Also:
- Constant Field Values
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
transcoderRegistry
@NonnullAfterInit private ReloadableService<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry> transcoderRegistry
Transcoder registry service object.
-
attributeFilterService
@Nullable private ReloadableService<net.shibboleth.idp.attribute.filter.AttributeFilter> attributeFilterService
Service used to get the engine used to filter attributes.
-
metadataResolver
@Nullable private MetadataResolver metadataResolver
Optional supplemental metadata source for filtering.
-
relyingPartyContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,net.shibboleth.idp.profile.context.RelyingPartyContext> relyingPartyContextLookupStrategy
Strategy used to look up aRelyingPartyContextfor configuration options.
-
contextToPrivateCredentialsMappingStrategy
@Nullable private Function<ProfileRequestContext,Collection<Principal>> contextToPrivateCredentialsMappingStrategy
A hook to map context information to private credentials.
-
profileConfiguration
@Nullable private net.shibboleth.oidc.profile.config.OIDCAuthenticationRelyingPartyProfileConfiguration profileConfiguration
Store off profile config.
-
endUserContext
@Nullable private EndUserClaimsContext endUserContext
The context with claims pertaining to the end-user of this authentication.
-
endUserClaimsContextLookupStrategy
@Nonnull private final Function<ProfileRequestContext,EndUserClaimsContext> endUserClaimsContextLookupStrategy
Strategy used to look up theEndUserClaimsContextto set the parameters for.
-
attributeContext
@Nullable private net.shibboleth.idp.attribute.context.AttributeContext attributeContext
Context for externally supplied inbound attributes.
-
acrTranslator
@Nullable private Function<Collection<String>,Collection<Principal>> acrTranslator
Incoming context translation function for converting OIDC ACRs into Principals.
-
amrTranslator
@Nullable private Function<Collection<String>,Collection<Principal>> amrTranslator
Incoming context translation function for converting OIDC ACRs into Principals.
-
attributeExtractionStrategy
@Nullable private Function<ProfileRequestContext,Collection<net.shibboleth.idp.attribute.IdPAttribute>> attributeExtractionStrategy
Pluggable strategy function for generalized extraction of data.
-
prc
@Nullable private ProfileRequestContext prc
The profile request context.
-
-
Method Detail
-
setContextToPrivateCredentialsMappingStrategy
public void setContextToPrivateCredentialsMappingStrategy(@Nullable Function<ProfileRequestContext,Collection<Principal>> strategy)Set the context to principal mapping strategy for mapping context information into principal collections to place in the private credentials set of the subject.- Parameters:
strategy- the strategy to use
-
setAttributeFilter
public void setAttributeFilter(@Nullable ReloadableService<net.shibboleth.idp.attribute.filter.AttributeFilter> filterService)Sets the filter service to use for inbound attributes.- Parameters:
filterService- optional filter service for inbound attributes
-
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
-
setMetadataResolver
public void setMetadataResolver(@Nullable MetadataResolver resolver)Set a metadata source to use during filtering.- Parameters:
resolver- metadata resolver
-
setRelyingPartyContextLookupStrategy
public void setRelyingPartyContextLookupStrategy(@Nonnull Function<ProfileRequestContext,net.shibboleth.idp.profile.context.RelyingPartyContext> strategy)Set the strategy used to return theRelyingPartyContextfor configuration options.- Parameters:
strategy- lookup strategy
-
setAttributeExtractionStrategy
public void setAttributeExtractionStrategy(@Nullable Function<ProfileRequestContext,Collection<net.shibboleth.idp.attribute.IdPAttribute>> strategy)Sets the strategy function to invoke for generalized extraction of data intoIdPAttributeobjects for inclusion in theAuthenticationResult.- Parameters:
strategy- extraction strategy
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doPreExecute
protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull net.shibboleth.idp.authn.context.AuthenticationContext authenticationContext)- Overrides:
doPreExecutein classnet.shibboleth.idp.authn.AbstractValidationAction
-
doExecute
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull net.shibboleth.idp.authn.context.AuthenticationContext authenticationContext)- Overrides:
doExecutein classnet.shibboleth.idp.authn.AbstractAuthenticationAction
-
populateSubject
protected Subject populateSubject(@Nonnull Subject subject)
- Specified by:
populateSubjectin classnet.shibboleth.idp.authn.AbstractValidationAction
-
buildProxyPrincipal
@Nonnull private net.shibboleth.idp.authn.principal.ProxyAuthenticationPrincipal buildProxyPrincipal()
Construct a populatedProxyAuthenticationPrincipalbased on the upstream OP (the issuer of the id_token).- Returns:
- a constructed
ProxyAuthenticationPrincipalto include in theSubject
-
processAttributes
private void processAttributes(@Nonnull ProfileRequestContext profileRequestContext)Process the inbound OIDC claims.- Parameters:
profileRequestContext- current profile request context
-
filterAttributes
private void filterAttributes(@Nonnull ProfileRequestContext profileRequestContext)Check for inbound attributes and apply filtering.- Parameters:
profileRequestContext- current profile request context
-
populateFilterContext
private void populateFilterContext(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull net.shibboleth.idp.attribute.filter.context.AttributeFilterContext filterContext)Fill in the filter context data.- Parameters:
profileRequestContext- current profile request contextfilterContext- context to populate
-
decodeAttribute
private void decodeAttribute(@Nonnull net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry registry, @Nonnull ProfileRequestContext profileRequestContext, @Nonnull net.minidev.json.JSONObject input, @Nonnull @NonnullElements @Live Multimap<String,net.shibboleth.idp.attribute.IdPAttribute> results) throws net.shibboleth.idp.attribute.AttributeDecodingExceptionAccess the registry of transcoding rules to transform (decode) the input claims to IdP Attributes.- Parameters:
registry- registry of transcoding rulesprofileRequestContext- current profile request contextinput- input attributeresults- collection to add results to- Throws:
net.shibboleth.idp.attribute.AttributeDecodingException- if a non-ignorable error occurs
-
-