/** {@inheritDoc} */ @Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext, @Nonnull final SubjectCanonicalizationContext c14nContext) { log.debug("{} Installing {} canonicalization flows into SubjectCanonicalizationContext", getLogPrefix(), availableFlows.size()); for (final SubjectCanonicalizationFlowDescriptor desc : availableFlows) { c14nContext.getPotentialFlows().put(desc.getId(), desc); } }
/** * Select the first potential flow not found in the intermediate flows collection, * and that is applicable to the context. * * @param profileRequestContext the current IdP profile request context * @param c14nContext the current c14n context * @return an eligible flow, or null */ @Nullable private SubjectCanonicalizationFlowDescriptor selectUnattemptedFlow( @Nonnull final ProfileRequestContext profileRequestContext, @Nonnull final SubjectCanonicalizationContext c14nContext) { for (final SubjectCanonicalizationFlowDescriptor flow : c14nContext.getPotentialFlows().values()) { if (!c14nContext.getIntermediateFlows().containsKey(flow.getId())) { log.debug("{} Checking canonicalization flow {} for applicability...", getLogPrefix(), flow.getId()); c14nContext.setAttemptedFlow(flow); if (flow.apply(profileRequestContext)) { return flow; } log.debug("{} Canonicalization flow {} was not applicable to this request", getLogPrefix(), flow.getId()); // Note that we don't exclude this flow from possible future selection, since one flow // could in theory do partial work and change the context such that this flow then applies. } } return null; }