Class EvaluateDelegationPolicy
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.saml.saml2.profile.delegation.impl.EvaluateDelegationPolicy
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
Action which implements policy controls to decide whether an SSO request based
on a delegated
Assertion token is allowed to proceed.
Two policy checks are performed:
-
The active
SSOSProfileConfigurationis resolved and its predicate is applied. If the predicate evaluates to false, the request is not allowed. An example predicate commonly used here isAllowedSAMLPresentersPredicate. -
The length of the delegation chain as indicated in the inbound assertion token's
DelegationRestrictionTypecondition is evaluated against a policy maximum resolved via the strategy set bysetPolicyMaxChainLengthStrategy(Function), or fromBrowserSSOProfileConfiguration.DEFAULT_DELEGATION_CHAIN_LENGTHif no value can otherwise be resolved. If the chain ofDelegatechild elements is greater than or equal to the resolved policy max chain length, the request is not allowed. The default policy resolution strategy is to look at the firstDelegationPolicycontained within the inbound assertion token'sAdvice.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassDefault strategy used to resolve the policy maximum token delegation chain length. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AssertionThe inbound delegated assertion token being evaluated.private Function<ProfileRequestContext,Assertion> Function used to resolve the assertion token to process.private booleanWhether the request is allowed to proceed.private org.slf4j.LoggerLogger.private LongThe policy maximum token delegation chain length.private Function<ProfileRequestContext,Long> Function used to resolve the policy maximum delegation chain length.Strategy used to lookup the RelyingPartyContext.private LongThe actual token delegation chain length. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckAllowedDelegate(ProfileRequestContext profileRequestContext) Apply policy control.protected booleancheckTokenDelegationChainLength(ProfileRequestContext profileRequestContext) Apply policy control which checks the actual token chain length against the policy maximum chain length.protected voiddoExecute(ProfileRequestContext profileRequestContext) protected booleandoPreExecute(ProfileRequestContext profileRequestContext) protected booleandoPreExecuteInbound(ProfileRequestContext profileRequestContext) Pre-execute actions on the inbound message.protected booleandoPreExecuteRelyingParty(ProfileRequestContext profileRequestContext) Pre-execute actions on the relying party context info.protected DelegationRestrictionTypegetDelegationRestrictionCondition(Conditions conditions) Get the DelegationRestrictionType Condition from the supplied Conditions, if present.protected LonggetPolicyMaxDelegationChainLength(ProfileRequestContext profileRequestContext) Get the effective maximum delegation chain length allowed by policy.protected LongGet the length of the delegation chain in the presented token.voidSet the strategy used to locate the inbound assertion token to process.voidSet the strategy used to resolve the policy maximum delegation chain length.voidSet the strategy used to locate the currentRelyingPartyContext.Methods 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, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, setHttpServletRequest, setHttpServletRequestSupplier, setHttpServletResponse, setHttpServletResponseSupplierMethods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, doInitialize, 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.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
log
@Nonnull private org.slf4j.Logger logLogger. -
relyingPartyContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,RelyingPartyContext> relyingPartyContextLookupStrategyStrategy used to lookup the RelyingPartyContext. -
assertionTokenStrategy
Function used to resolve the assertion token to process. -
policyMaxChainLengthStrategy
Function used to resolve the policy maximum delegation chain length. -
assertionToken
The inbound delegated assertion token being evaluated. -
policyMaxChainLength
The policy maximum token delegation chain length. -
tokenChainLength
The actual token delegation chain length. -
delegationAllowed
private boolean delegationAllowedWhether the request is allowed to proceed.
-
-
Constructor Details
-
EvaluateDelegationPolicy
public EvaluateDelegationPolicy()Constructor.
-
-
Method Details
-
setPolicyMaxChainLengthStrategy
Set the strategy used to resolve the policy maximum delegation chain length.- Parameters:
strategy- the strategy
-
setAssertionTokenStrategy
Set the strategy used to locate the inbound assertion token to process.- Parameters:
strategy- lookup strategy
-
setRelyingPartyContextLookupStrategy
public void setRelyingPartyContextLookupStrategy(@Nonnull Function<ProfileRequestContext, RelyingPartyContext> strategy) Set the strategy used to locate the currentRelyingPartyContext.- Parameters:
strategy- strategy used to locate the currentRelyingPartyContext
-
doPreExecute
- Overrides:
doPreExecutein classAbstractConditionalProfileAction
-
doPreExecuteInbound
Pre-execute actions on the inbound message.- Parameters:
profileRequestContext- the current profile request context- Returns:
- true iff
doExecute(ProfileRequestContext)should proceed
-
doPreExecuteRelyingParty
Pre-execute actions on the relying party context info.- Parameters:
profileRequestContext- the current profile request context- Returns:
- true iff
doExecute(ProfileRequestContext)should proceed
-
doExecute
- Overrides:
doExecutein classAbstractProfileAction
-
checkAllowedDelegate
Apply policy control.- Parameters:
profileRequestContext- the current request context- Returns:
- true if check passes, false if not
-
checkTokenDelegationChainLength
protected boolean checkTokenDelegationChainLength(@Nonnull ProfileRequestContext profileRequestContext) Apply policy control which checks the actual token chain length against the policy maximum chain length.- Parameters:
profileRequestContext- the current request context- Returns:
- true if check passes, false if not
-
getTokenDelegationChainLength
Get the length of the delegation chain in the presented token.- Parameters:
token- the token to evaluate- Returns:
- the token delegation chain length
-
getDelegationRestrictionCondition
protected DelegationRestrictionType getDelegationRestrictionCondition(@Nullable Conditions conditions) Get the DelegationRestrictionType Condition from the supplied Conditions, if present.- Parameters:
conditions- the Assertion Conditions to process- Returns:
- the DelegationRestrictionType Condition object, or null if not present
-
getPolicyMaxDelegationChainLength
@Nonnull protected Long getPolicyMaxDelegationChainLength(@Nonnull ProfileRequestContext profileRequestContext) Get the effective maximum delegation chain length allowed by policy.- Parameters:
profileRequestContext- the current request context- Returns:
- the policy max delegation chain policy length
-