protected List<String> getFlowDefinitionIds() { return Arrays.asList(loginFlowDefinitionRegistry.getFlowDefinitionIds()); }
@Override public Flow getLoginFlow() { if (this.loginFlowDefinitionRegistry == null) { LOGGER.error("Login flow registry is not configured and/or initialized correctly."); return null; } val found = Arrays.asList(this.loginFlowDefinitionRegistry.getFlowDefinitionIds()).contains(FLOW_ID_LOGIN); if (found) { return (Flow) this.loginFlowDefinitionRegistry.getFlowDefinition(FLOW_ID_LOGIN); } LOGGER.error("Could not find flow definition [{}]. Available flow definition ids are [{}]", FLOW_ID_LOGIN, this.loginFlowDefinitionRegistry.getFlowDefinitionIds()); return null; }
/** * Gets flow definition ids. * * @param excludedFlowIds the excluded flow ids * @return the flow definition ids */ protected List<String> getFlowDefinitionIds(final String[] excludedFlowIds) { String[] flowIds = loginFlowDefinitionRegistry.getFlowDefinitionIds(); for (final String flowId : excludedFlowIds) { flowIds = ArrayUtils.removeElement(flowIds, flowId); } return Arrays.asList(flowIds); }
/** * Register flow definition into login flow registry. * * @param sourceRegistry the source registry */ protected void registerMultifactorFlowDefinitionIntoLoginFlowRegistry(final FlowDefinitionRegistry sourceRegistry) { val flowIds = sourceRegistry.getFlowDefinitionIds(); for (val flowId : flowIds) { val definition = sourceRegistry.getFlowDefinition(flowId); LOGGER.trace("Registering flow definition [{}]", flowId); this.loginFlowDefinitionRegistry.registerFlowDefinition(definition); } }
@Override @PostConstruct public void afterPropertiesSet() throws Exception { try { String[] flowIds = flowDefinitionRegistry.getFlowDefinitionIds(); flowIds = ArrayUtils.removeElement(flowIds, FLOW_ID_LOGIN); flowIds = ArrayUtils.removeElement(flowIds, FLOW_ID_LOGOUT); LOGGER.debug("Detected {} flow configurations: [{}]", flowIds.length, Arrays.toString(flowIds)); LOGGER.debug("Configuring webflow for multifactor authentication..."); setupWebflow(flowIds); LOGGER.debug("Configured webflow for multifactor authentication."); LOGGER.debug("Registering default credentials-to-principal resolver..."); registerDefaultCredentialsToPrincipalResolver(); LOGGER.debug("Registered default credentials-to-principal resolver."); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } }
val map = this.applicationContext.getBeansOfType(FlowDefinitionRegistry.class, false, true); map.forEach((k, v) -> Arrays.stream(v.getFlowDefinitionIds()) .filter(currentId -> { if (StringUtils.isNotBlank(flowId)) {
/** * Augment mfa provider flow registry. * * @param mfaProviderFlowRegistry the mfa provider flow registry */ protected void augmentMultifactorProviderFlowRegistry(final FlowDefinitionRegistry mfaProviderFlowRegistry) { val flowIds = mfaProviderFlowRegistry.getFlowDefinitionIds(); Arrays.stream(flowIds).forEach(id -> { val flow = (Flow) mfaProviderFlowRegistry.getFlowDefinition(id); if (containsFlowState(flow, CasWebflowConstants.STATE_ID_REAL_SUBMIT)) { val states = getCandidateStatesForMultifactorAuthentication(); states.forEach(s -> { val state = getState(flow, s); ensureEndStateTransitionExists(state, flow, CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_SUCCESS); ensureEndStateTransitionExists(state, flow, CasWebflowConstants.TRANSITION_ID_SUCCESS_WITH_WARNINGS, CasWebflowConstants.TRANSITION_ID_SUCCESS_WITH_WARNINGS); ensureEndStateTransitionExists(state, flow, CasWebflowConstants.TRANSITION_ID_UNAVAILABLE, CasWebflowConstants.STATE_ID_MFA_UNAVAILABLE); ensureEndStateTransitionExists(state, flow, CasWebflowConstants.TRANSITION_ID_DENY, CasWebflowConstants.STATE_ID_MFA_DENIED); }); } }); }
validateFlowDefinitionConfiguration(flowDefinitionRegistry); LOGGER.debug("Flow definitions found in the registry are [{}]", (Object[]) flowDefinitionRegistry.getFlowDefinitionIds()); val flowId = Arrays.stream(flowDefinitionRegistry.getFlowDefinitionIds()).findFirst().get(); LOGGER.debug("Processing flow definition [{}]", flowId);