Class ValidateSAMLAuthentication
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.authn.AbstractAuthenticationAction
net.shibboleth.idp.authn.AbstractValidationAction
net.shibboleth.idp.saml.saml2.profile.impl.ValidateSAMLAuthentication
- All Implemented Interfaces:
PrincipalSupportingComponent,Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
An action that produces an
AuthenticationResult based on an inbound
SAML 2.0 SSO response.
A SAMLAuthnContext is used as the basis of the result and the lack of a context is a signal
to record a failure. 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- Precondition:
ProfileRequestContext.getSubcontext(AuthenticationContext.class).getAttemptedFlow() != null
- Postcondition:
- If AuthenticationContext.getSubcontext(SAMLAuthnContext.class) != null, then
an
AuthenticationResultis saved to theAuthenticationContext.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AttributeContextContext for externally supplied inbound attributes.private Function<ProfileRequestContext,Collection<IdPAttribute>> Pluggable strategy function for generalized extraction of data.private ReloadableService<AttributeFilter>Service used to get the engine used to filter attributes.private Function<AuthnContext,Collection<Principal>> Incoming context translation function.private Function<ProfileRequestContext,Collection<Principal>> Incoming context extended translation function.private static final StringDefault prefix for metrics.private final org.slf4j.LoggerClass logger.private StringAn IdPAttribute ID to log as a "name" in place of the NameID for "info" purposes.private MetadataResolverOptional supplemental metadata source for filtering.private BrowserSSOProfileConfigurationStore off profile config.Strategy used to look up aRelyingPartyContextfor configuration options.private SAMLAuthnContextContext containing the result to validate.Transcoder registry service object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ProxyAuthenticationPrincipalbuildProxyPrincipal(AuthnContext authnContext) Construct a populatedProxyAuthenticationPrincipalbased on the inbound assertion.private voiddecodeAttribute(AttributeTranscoderRegistry registry, ProfileRequestContext profileRequestContext, Attribute input, Multimap<String, IdPAttribute> results) Access the registry of transcoding rules to decode the inputAttribute.protected voiddoExecute(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext) Performs this authentication action.protected booleandoPreExecute(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext) Performs this authentication action's pre-execute step.private voidfilterAttributes(ProfileRequestContext profileRequestContext) Check for inbound attributes and apply filtering.protected voidLog a successful authentication based on a designated attribute ID or the NameID value.private voidpopulateFilterContext(ProfileRequestContext profileRequestContext, AttributeFilterContext filterContext) Fill in the filter context data.protected SubjectpopulateSubject(Subject subject) private voidprocessAttributes(ProfileRequestContext profileRequestContext) Process the inbound SAML Attributes.voidSets the strategy function to invoke for generalized extraction of data intoIdPAttributeobjects for inclusion in theAuthenticationResult.voidsetAttributeFilter(ReloadableService<AttributeFilter> filterService) Sets the filter service to use for inbound attributes.voidAn attribute ID to pull a "name" from for logging purposes.voidsetMetadataResolver(MetadataResolver resolver) Set a metadata source to use during filtering.voidSet the strategy used to return theRelyingPartyContextfor configuration options.voidSets 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, recordSuccess, setAddDefaultPrincipals, setClassifiedMessages, setCleanupHook, setMetricName, setRequesterLookupStrategy, setResponderLookupStrategy, setResultCachingPredicate, setSupportedPrincipalsMethods inherited from class net.shibboleth.idp.authn.AbstractAuthenticationAction
doExecute, doPreExecute, setAuthenticationContextLookupStrategyMethods 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
-
DEFAULT_METRIC_NAME
Default prefix for metrics.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
transcoderRegistry
Transcoder registry service object. -
attributeFilterService
Service used to get the engine used to filter attributes. -
metadataResolver
Optional supplemental metadata source for filtering. -
relyingPartyContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,RelyingPartyContext> relyingPartyContextLookupStrategyStrategy used to look up aRelyingPartyContextfor configuration options. -
attributeExtractionStrategy
@Nullable private Function<ProfileRequestContext,Collection<IdPAttribute>> attributeExtractionStrategyPluggable strategy function for generalized extraction of data. -
loggedAttributeId
An IdPAttribute ID to log as a "name" in place of the NameID for "info" purposes. -
samlAuthnContext
Context containing the result to validate. -
profileConfiguration
Store off profile config. -
authnContextTranslator
Incoming context translation function. -
authnContextTranslatorEx
Incoming context extended translation function. -
attributeContext
Context for externally supplied inbound attributes.
-
-
Constructor Details
-
ValidateSAMLAuthentication
public ValidateSAMLAuthentication()Constructor.
-
-
Method Details
-
setMetadataResolver
Set a metadata source to use during filtering.- Parameters:
resolver- metadata resolver
-
setRelyingPartyContextLookupStrategy
public void setRelyingPartyContextLookupStrategy(@Nonnull Function<ProfileRequestContext, RelyingPartyContext> strategy) Set the strategy used to return theRelyingPartyContextfor configuration options.- Parameters:
strategy- lookup strategy
-
setAttributeExtractionStrategy
public void setAttributeExtractionStrategy(@Nullable Function<ProfileRequestContext, Collection<IdPAttribute>> strategy) Sets the strategy function to invoke for generalized extraction of data intoIdPAttributeobjects for inclusion in theAuthenticationResult.- Parameters:
strategy- extraction strategy
-
setLoggedAttributeId
An attribute ID to pull a "name" from for logging purposes.- Parameters:
id- attribute ID- Since:
- 4.2.0
-
doPreExecute
protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext) Performs this authentication action's pre-execute step. Default implementation just returns true.- Overrides:
doPreExecutein classAbstractValidationAction- Parameters:
profileRequestContext- the current IdP profile request contextauthenticationContext- the current authentication context- Returns:
- true iff execution should continue
-
doExecute
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext) Performs this authentication action. Default implementation throws an exception.- Overrides:
doExecutein classAbstractAuthenticationAction- Parameters:
profileRequestContext- the current IdP profile request contextauthenticationContext- the current authentication context
-
logSuccess
protected void logSuccess()Log a successful authentication based on a designated attribute ID or the NameID value. -
populateSubject
Subclasses must override this method to complete the population of theSubjectwithPrincipaland credential information based on the validation they perform.Typically this will include attaching a
UsernamePrincipal, but this is not a requirement if other components are suitably overridden.- Specified by:
populateSubjectin classAbstractValidationAction- Parameters:
subject- subject to populate- Returns:
- the input subject
-
buildProxyPrincipal
@Nonnull private ProxyAuthenticationPrincipal buildProxyPrincipal(@Nonnull AuthnContext authnContext) Construct a populatedProxyAuthenticationPrincipalbased on the inbound assertion.- Parameters:
authnContext- the SAMLAuthnContextissued by the proxied IdP- Returns:
- a constructed
ProxyAuthenticationPrincipalto include in theSubject
-
processAttributes
Process the inbound SAML Attributes.- Parameters:
profileRequestContext- current profile request context
-
decodeAttribute
private void decodeAttribute(@Nonnull AttributeTranscoderRegistry registry, @Nonnull ProfileRequestContext profileRequestContext, @Nonnull Attribute input, @Nonnull @Live Multimap<String, IdPAttribute> results) throws AttributeDecodingExceptionAccess the registry of transcoding rules to decode the inputAttribute.- Parameters:
registry- registry of transcoding rulesprofileRequestContext- current profile request contextinput- input objectresults- collection to add results to- Throws:
AttributeDecodingException- if an error occurs or no results were obtained
-
filterAttributes
Check for inbound attributes and apply filtering.- Parameters:
profileRequestContext- current profile request context
-
populateFilterContext
private void populateFilterContext(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AttributeFilterContext filterContext) Fill in the filter context data.- Parameters:
profileRequestContext- current profile request contextfilterContext- context to populate