use of org.springframework.webflow.engine.ActionState in project cas by apereo.
the class AbstractCasWebflowConfigurer method createEvaluateActionForExistingActionState.
/**
* Create evaluate action for action state action.
*
* @param flow the flow
* @param actionStateId the action state id
* @param evaluateActionId the evaluate action id
* @return the action
*/
public Action createEvaluateActionForExistingActionState(final Flow flow, final String actionStateId, final String evaluateActionId) {
final ActionState action = getState(flow, actionStateId, ActionState.class);
final Action[] actions = action.getActionList().toArray();
Arrays.stream(actions).forEach(action.getActionList()::remove);
final Action evaluateAction = createEvaluateAction(evaluateActionId);
action.getActionList().add(evaluateAction);
action.getActionList().addAll(actions);
return evaluateAction;
}
use of org.springframework.webflow.engine.ActionState in project cas by apereo.
the class AbstractCasWebflowConfigurer method createClonedActionState.
/**
* Clone and create action state.
*
* @param flow the flow
* @param actionStateId the action state id
* @param actionStateIdToClone the action state id to clone
*/
public void createClonedActionState(final Flow flow, final String actionStateId, final String actionStateIdToClone) {
final ActionState generateServiceTicket = getState(flow, actionStateIdToClone, ActionState.class);
final ActionState consentTicketAction = createActionState(flow, actionStateId);
cloneActionState(generateServiceTicket, consentTicketAction);
}
use of org.springframework.webflow.engine.ActionState in project cas by apereo.
the class AbstractCasWebflowConfigurer method createActionState.
@Override
public ActionState createActionState(final Flow flow, final String name, final Action... actions) {
if (containsFlowState(flow, name)) {
LOGGER.debug("Flow [{}] already contains a definition for state id [{}]", flow.getId(), name);
return getTransitionableState(flow, name, ActionState.class);
}
final ActionState actionState = new ActionState(flow, name);
LOGGER.debug("Created action state [{}]", actionState.getId());
actionState.getActionList().addAll(actions);
LOGGER.debug("Added action to the action state [{}] list of actions: [{}]", actionState.getId(), actionState.getActionList());
return actionState;
}
use of org.springframework.webflow.engine.ActionState in project cas by apereo.
the class AbstractMultifactorTrustedDeviceWebflowConfigurer method registerMultifactorTrustedAuthentication.
/**
* Register multifactor trusted authentication into webflow.
*
* @param flowDefinitionRegistry the flow definition registry
*/
protected void registerMultifactorTrustedAuthentication(final FlowDefinitionRegistry flowDefinitionRegistry) {
validateFlowDefinitionConfiguration(flowDefinitionRegistry);
LOGGER.debug("Flow definitions found in the registry are [{}]", (Object[]) flowDefinitionRegistry.getFlowDefinitionIds());
final String flowId = Arrays.stream(flowDefinitionRegistry.getFlowDefinitionIds()).findFirst().get();
LOGGER.debug("Processing flow definition [{}]", flowId);
final Flow flow = (Flow) flowDefinitionRegistry.getFlowDefinition(flowId);
// Set the verify action
final ActionState state = getState(flow, CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM, ActionState.class);
final Transition transition = (Transition) state.getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS);
final String targetStateId = transition.getTargetStateId();
transition.setTargetStateResolver(new DefaultTargetStateResolver(CasWebflowConstants.STATE_ID_VERIFY_TRUSTED_DEVICE));
final ActionState verifyAction = createActionState(flow, CasWebflowConstants.STATE_ID_VERIFY_TRUSTED_DEVICE, createEvaluateAction(MFA_VERIFY_TRUST_ACTION_BEAN_ID));
// handle device registration
if (enableDeviceRegistration) {
createTransitionForState(verifyAction, CasWebflowConstants.TRANSITION_ID_YES, CasWebflowConstants.STATE_ID_FINISH_MFA_TRUSTED_AUTH);
} else {
createTransitionForState(verifyAction, CasWebflowConstants.TRANSITION_ID_YES, CasWebflowConstants.STATE_ID_REAL_SUBMIT);
}
createTransitionForState(verifyAction, CasWebflowConstants.TRANSITION_ID_NO, targetStateId);
createDecisionState(flow, CasWebflowConstants.DECISION_STATE_REQUIRE_REGISTRATION, isDeviceRegistrationRequired(), CasWebflowConstants.VIEW_ID_REGISTER_DEVICE, CasWebflowConstants.STATE_ID_REAL_SUBMIT);
final ActionState submit = getState(flow, CasWebflowConstants.STATE_ID_REAL_SUBMIT, ActionState.class);
final Transition success = (Transition) submit.getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS);
if (enableDeviceRegistration) {
success.setTargetStateResolver(new DefaultTargetStateResolver(CasWebflowConstants.VIEW_ID_REGISTER_DEVICE));
} else {
success.setTargetStateResolver(new DefaultTargetStateResolver(CasWebflowConstants.STATE_ID_REGISTER_TRUSTED_DEVICE));
}
final ViewState viewRegister = createViewState(flow, CasWebflowConstants.VIEW_ID_REGISTER_DEVICE, "casMfaRegisterDeviceView");
final Transition viewRegisterTransition = createTransition(CasWebflowConstants.TRANSITION_ID_SUBMIT, CasWebflowConstants.STATE_ID_REGISTER_TRUSTED_DEVICE);
viewRegister.getTransitionSet().add(viewRegisterTransition);
final ActionState registerAction = createActionState(flow, CasWebflowConstants.STATE_ID_REGISTER_TRUSTED_DEVICE, createEvaluateAction(MFA_SET_TRUST_ACTION_BEAN_ID));
createStateDefaultTransition(registerAction, CasWebflowConstants.STATE_ID_SUCCESS);
if (submit.getActionList().size() == 0) {
throw new IllegalArgumentException("There are no actions defined for the final submission event of " + flowId);
}
final Action act = submit.getActionList().iterator().next();
final ActionState finishMfaTrustedAuth = createActionState(flow, CasWebflowConstants.STATE_ID_FINISH_MFA_TRUSTED_AUTH, act);
final Transition finishedTransition = createTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_SUCCESS);
finishMfaTrustedAuth.getTransitionSet().add(finishedTransition);
createStateDefaultTransition(finishMfaTrustedAuth, CasWebflowConstants.STATE_ID_SUCCESS);
}
use of org.springframework.webflow.engine.ActionState in project cas by apereo.
the class DefaultLoginWebflowConfigurer method createGenerateServiceTicketAction.
/**
* Create generate service ticket action.
*
* @param flow the flow
*/
protected void createGenerateServiceTicketAction(final Flow flow) {
final ActionState handler = createActionState(flow, CasWebflowConstants.STATE_ID_GENERATE_SERVICE_TICKET, createEvaluateAction(CasWebflowConstants.ACTION_ID_GENERATE_SERVICE_TICKET));
createTransitionForState(handler, CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_REDIRECT);
createTransitionForState(handler, CasWebflowConstants.TRANSITION_ID_WARN, CasWebflowConstants.STATE_ID_WARN);
createTransitionForState(handler, CasWebflowConstants.TRANSITION_ID_AUTHENTICATION_FAILURE, CasWebflowConstants.STATE_ID_HANDLE_AUTHN_FAILURE);
createTransitionForState(handler, CasWebflowConstants.TRANSITION_ID_ERROR, CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM);
createTransitionForState(handler, CasWebflowConstants.TRANSITION_ID_GATEWAY, CasWebflowConstants.STATE_ID_GATEWAY_SERVICES_MGMT_CHECK);
}
Aggregations