Class ValidateSAMLAuthentication
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.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
AuthenticationResult
is saved to theAuthenticationContext
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AttributeContext
Context 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 String
Default prefix for metrics.private final org.slf4j.Logger
Class logger.private String
An IdPAttribute ID to log as a "name" in place of the NameID for "info" purposes.private MetadataResolver
Optional supplemental metadata source for filtering.private BrowserSSOProfileConfiguration
Store off profile config.Strategy used to look up aRelyingPartyContext
for configuration options.private SAMLAuthnContext
Context containing the result to validate.Transcoder registry service object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ProxyAuthenticationPrincipal
buildProxyPrincipal
(AuthnContext authnContext) Construct a populatedProxyAuthenticationPrincipal
based on the inbound assertion.private void
decodeAttribute
(AttributeTranscoderRegistry registry, ProfileRequestContext profileRequestContext, Attribute input, Multimap<String, IdPAttribute> results) Access the registry of transcoding rules to decode the inputAttribute
.protected void
doExecute
(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext) Performs this authentication action.protected boolean
doPreExecute
(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext) Performs this authentication action's pre-execute step.private void
filterAttributes
(ProfileRequestContext profileRequestContext) Check for inbound attributes and apply filtering.protected void
Log a successful authentication based on a designated attribute ID or the NameID value.private void
populateFilterContext
(ProfileRequestContext profileRequestContext, AttributeFilterContext filterContext) Fill in the filter context data.protected Subject
populateSubject
(Subject subject) private void
processAttributes
(ProfileRequestContext profileRequestContext) Process the inbound SAML Attributes.void
Sets the strategy function to invoke for generalized extraction of data intoIdPAttribute
objects for inclusion in theAuthenticationResult
.void
setAttributeFilter
(ReloadableService<AttributeFilter> filterService) Sets the filter service to use for inbound attributes.void
An attribute ID to pull a "name" from for logging purposes.void
setMetadataResolver
(MetadataResolver resolver) Set a metadata source to use during filtering.void
Set the strategy used to return theRelyingPartyContext
for configuration options.void
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, 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, doInitialize, 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 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 aRelyingPartyContext
for 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
-
setTranscoderRegistry
public void setTranscoderRegistry(@Nullable ReloadableService<AttributeTranscoderRegistry> registry) Sets the registry of transcoding rules to apply to encode attributes.- Parameters:
registry
- registry service interface
-
setAttributeFilter
Sets the filter service to use for inbound attributes.- Parameters:
filterService
- optional filter service for inbound attributes
-
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 theRelyingPartyContext
for 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 intoIdPAttribute
objects 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:
doPreExecute
in 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:
doExecute
in 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 theSubject
withPrincipal
and 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:
populateSubject
in classAbstractValidationAction
- Parameters:
subject
- subject to populate- Returns:
- the input subject
-
buildProxyPrincipal
@Nonnull private ProxyAuthenticationPrincipal buildProxyPrincipal(@Nonnull AuthnContext authnContext) Construct a populatedProxyAuthenticationPrincipal
based on the inbound assertion.- Parameters:
authnContext
- the SAMLAuthnContext
issued by the proxied IdP- Returns:
- a constructed
ProxyAuthenticationPrincipal
to 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 @NonnullElements @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
-