/** {@inheritDoc} */ @Nullable public Long apply(@Nullable final ProfileRequestContext input) { if (assertionToken == null || assertionToken.getAdvice() == null) { return null; } final Advice inboundAdvice = assertionToken.getAdvice(); final List<XMLObject> inboundPolicies = inboundAdvice.getChildren(DelegationPolicy.DEFAULT_ELEMENT_NAME); if (inboundPolicies != null && !inboundPolicies.isEmpty()) { return ((DelegationPolicy)inboundPolicies.get(0)).getMaximumTokenDelegationChainLength(); } return null; }
/** {@inheritDoc} */ protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) { final DelegationPolicy delegationPolicy = (DelegationPolicy) XMLObjectSupport.buildXMLObject( DelegationPolicy.DEFAULT_ELEMENT_NAME); delegationPolicy.setMaximumTokenDelegationChainLength(maxChainLength); if (assertion.getAdvice() == null) { assertion.setAdvice((Advice) XMLObjectSupport.buildXMLObject(Advice.DEFAULT_ELEMENT_NAME)); } assertion.getAdvice().getChildren().add(delegationPolicy); }
if (attestedAssertion.getAdvice() != null) { final List<XMLObject> inboundPolicies = attestedAssertion.getAdvice().getChildren(DelegationPolicy.DEFAULT_ELEMENT_NAME); if (inboundPolicies != null && !inboundPolicies.isEmpty()) { return ((DelegationPolicy)inboundPolicies.get(0)).getMaximumTokenDelegationChainLength();
/** * Creates and adds a {@link Advice} to a given {@link Assertion}. If the {@link Assertion} already contains an * {@link Advice} this method just returns. * * @param action current action * @param assertion assertion to which the advice will be added * * @return the {@link Advice} that already existed on, or the one that was added to, the {@link Assertion} */ @Nonnull public static Advice addAdviceToAssertion(@Nonnull final AbstractProfileAction action, @Nonnull final Assertion assertion) { Advice advice = assertion.getAdvice(); if (advice == null) { final SAMLObjectBuilder<Advice> adviceBuilder = (SAMLObjectBuilder<Advice>) XMLObjectProviderRegistrySupport.getBuilderFactory().<Advice>getBuilderOrThrow( Advice.DEFAULT_ELEMENT_NAME); advice = adviceBuilder.buildObject(); assertion.setAdvice(advice); getLogger().debug("Profile Action {}: Assertion {} did not already contain Advice, one was added", action.getClass().getSimpleName(), assertion.getID()); } else { getLogger().debug("Profile Action {}: Assertion {} already contained Advice, nothing was done", action.getClass().getSimpleName(), assertion.getID()); } return advice; }