org.apereo.cas.web.flow.TrustedAuthenticationWebflowConfigurer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cas-server-support-trusted-webflow Show documentation
Show all versions of cas-server-support-trusted-webflow Show documentation
cas-server-support-trusted-webflow
package org.apereo.cas.web.flow;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.web.flow.configurer.AbstractCasWebflowConfigurer;
import lombok.val;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.webflow.definition.registry.FlowDefinitionRegistry;
import org.springframework.webflow.engine.builder.support.FlowBuilderServices;
/**
* The {@link TrustedAuthenticationWebflowConfigurer} is responsible for
* adjusting the CAS webflow context for trusted authn integration.
*
* @author Misagh Moayyed
* @since 4.2
*/
public class TrustedAuthenticationWebflowConfigurer extends AbstractCasWebflowConfigurer {
private static final String ACTION_ID_REMOTE_USER_AUTHENTICATION_ACTION = "remoteUserAuthenticationAction";
public TrustedAuthenticationWebflowConfigurer(final FlowBuilderServices flowBuilderServices,
final FlowDefinitionRegistry loginFlowDefinitionRegistry,
final ConfigurableApplicationContext applicationContext,
final CasConfigurationProperties casProperties) {
super(flowBuilderServices, loginFlowDefinitionRegistry, applicationContext, casProperties);
}
@Override
protected void doInitialize() {
val flow = getLoginFlow();
if (flow != null) {
val action = createEvaluateAction(ACTION_ID_REMOTE_USER_AUTHENTICATION_ACTION);
val actionState = createActionState(flow, CasWebflowConstants.ACTION_ID_REMOTE_TRUSTED_AUTHENTICATION, action);
createTransitionForState(actionState, CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_CREATE_TICKET_GRANTING_TICKET);
createTransitionForState(actionState, CasWebflowConstants.TRANSITION_ID_GENERATE_SERVICE_TICKET, CasWebflowConstants.STATE_ID_GENERATE_SERVICE_TICKET);
val currentStartState = getStartState(flow).getId();
createTransitionForState(actionState, CasWebflowConstants.TRANSITION_ID_ERROR, currentStartState);
createTransitionForState(actionState, CasWebflowConstants.TRANSITION_ID_AUTHENTICATION_FAILURE, CasWebflowConstants.STATE_ID_HANDLE_AUTHN_FAILURE);
actionState.getExitActionList().add(createEvaluateAction(CasWebflowConstants.ACTION_ID_CLEAR_WEBFLOW_CREDENTIALS));
setStartState(flow, actionState);
}
}
}