package org.example.something;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.web.flow.configurer.AbstractCasWebflowConfigurer;
import org.apereo.cas.web.flow.CasWebflowConstants;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.webflow.definition.registry.FlowDefinitionRegistry;
import org.springframework.webflow.engine.Flow;
import org.springframework.webflow.engine.builder.support.FlowBuilderServices;
import org.springframework.webflow.engine.ViewState;
@Slf4j
public class SomethingWebflowConfigurer extends AbstractCasWebflowConfigurer {
public SomethingWebflowConfigurer(FlowBuilderServices flowBuilderServices,
FlowDefinitionRegistry flowDefinitionRegistry,
ConfigurableApplicationContext applicationContext,
CasConfigurationProperties casProperties) {
super(flowBuilderServices, flowDefinitionRegistry, applicationContext, casProperties);
}
@Override
protected void doInitialize() {
var flow = super.getLoginFlow();
LOGGER.debug("[TESTING] doInitialize@SomethingWebflowConfigurer flow={}", flow);
if (flow != null) {
tweakFlow(flow);
}
}
protected void tweakFlow(final Flow flow) {
LOGGER.debug("[TESTING] tweakFlow@@SomethingWebflowConfigurer flow={}", flow);
val state = getState(flow, CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM, ViewState.class);
state.getTransitionSet().remove(createTransitionForState(state, CasWebflowConstants.TRANSITION_ID_SUBMIT, CasWebflowConstants.STATE_ID_REAL_SUBMIT));
createStateDefaultTransition(state, CasWebflowConstants.STATE_ID_MFA_UNAVAILABLE);
}
}