/** {@inheritDoc} */ @Override public int hashCode() { return getId().hashCode(); }
/** {@inheritDoc} */ @Override public String toString() { return MoreObjects.toStringHelper(this).add("flowId", getId()).toString(); }
/** {@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); } }
/** {@inheritDoc} */ @Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext, @Nonnull final SubjectCanonicalizationContext c14nContext) { final SubjectCanonicalizationFlowDescriptor flow = selectUnattemptedFlow(profileRequestContext, c14nContext); if (flow == null) { log.error("{} No potential flows left to choose from, canonicalization will fail", getLogPrefix()); ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_POTENTIAL_FLOW); return; } log.debug("{} Selecting canonicalization flow {}", getLogPrefix(), flow.getId()); ActionSupport.buildEvent(profileRequestContext, flow.getId()); }
/** * 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; }
/** {@inheritDoc} */ @Override protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext, @Nonnull final SubjectCanonicalizationContext c14nContext) { // Detect a previous attempted flow, and move it to the intermediate collection. // This will prevent re-selecting the same (probably failed) flow again. if (c14nContext.getAttemptedFlow() != null) { log.info("{} Moving incomplete flow {} to intermediate set, reselecting a different one", getLogPrefix(), c14nContext.getAttemptedFlow().getId()); c14nContext.getIntermediateFlows().put( c14nContext.getAttemptedFlow().getId(), c14nContext.getAttemptedFlow()); } return super.doPreExecute(profileRequestContext, c14nContext); }
flowDescriptor.getId(), NameIDCanonicalizationFlowDescriptor.class.getCanonicalName()); return false;
flowDescriptor.getId(), NameIDCanonicalizationFlowDescriptor.class.getCanonicalName()); return false;