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 (ActionState) flow.getTransitionableState(name);
}
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 AbstractCasWebflowConfigurer method registerMultifactorProviderAuthenticationWebflow.
/**
* Register multifactor provider authentication webflow.
*
* @param flow the flow
* @param subflowId the subflow id
* @param registry the registry
*/
protected void registerMultifactorProviderAuthenticationWebflow(final Flow flow, final String subflowId, final FlowDefinitionRegistry registry) {
final SubflowState subflowState = createSubflowState(flow, subflowId, subflowId);
final ActionState actionState = (ActionState) flow.getState(CasWebflowConstants.TRANSITION_ID_REAL_SUBMIT);
final String targetStateId = actionState.getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS).getTargetStateId();
final List<DefaultMapping> mappings = new ArrayList<>();
final Mapper inputMapper = createMapperToSubflowState(mappings);
final SubflowAttributeMapper subflowMapper = createSubflowAttributeMapper(inputMapper, null);
subflowState.setAttributeMapper(subflowMapper);
subflowState.getTransitionSet().add(createTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS, targetStateId));
LOGGER.debug("Retrieved action state [{}]", actionState.getId());
createTransitionForState(actionState, subflowId, subflowId);
registerFlowDefinitionIntoLoginFlowRegistry(registry);
final TransitionableState state = flow.getTransitionableState(CasWebflowConstants.TRANSITION_ID_INITIAL_AUTHN_REQUEST_VALIDATION_CHECK);
createTransitionForState(state, subflowId, subflowId);
}
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) {
if (flowDefinitionRegistry.getFlowDefinitionCount() <= 0) {
throw new IllegalArgumentException("Flow definition registry has no flow definitions");
}
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 = (ActionState) flow.getState(CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM);
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("mfaVerifyTrustAction"));
// handle device registration
if (enableDeviceRegistration) {
createTransitionForState(verifyAction, CasWebflowConstants.TRANSITION_ID_YES, "finishMfaTrustedAuth");
} else {
createTransitionForState(verifyAction, CasWebflowConstants.TRANSITION_ID_YES, CasWebflowConstants.TRANSITION_ID_REAL_SUBMIT);
}
createTransitionForState(verifyAction, CasWebflowConstants.TRANSITION_ID_NO, targetStateId);
createDecisionState(flow, CasWebflowConstants.DECISION_STATE_REQUIRE_REGISTRATION, isDeviceRegistrationRequired(), CasWebflowConstants.VIEW_ID_REGISTER_DEVICE, CasWebflowConstants.TRANSITION_ID_REAL_SUBMIT);
final ActionState submit = (ActionState) flow.getState(CasWebflowConstants.TRANSITION_ID_REAL_SUBMIT);
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");
viewRegister.getTransitionSet().add(createTransition(CasWebflowConstants.TRANSITION_ID_SUBMIT, CasWebflowConstants.STATE_ID_REGISTER_TRUSTED_DEVICE));
final ActionState registerAction = createActionState(flow, CasWebflowConstants.STATE_ID_REGISTER_TRUSTED_DEVICE, createEvaluateAction("mfaSetTrustAction"));
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, "finishMfaTrustedAuth", act);
finishMfaTrustedAuth.getTransitionSet().add(createTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_SUCCESS));
createStateDefaultTransition(finishMfaTrustedAuth, CasWebflowConstants.STATE_ID_SUCCESS);
}
use of org.springframework.webflow.engine.ActionState in project cas by apereo.
the class DefaultWebflowConfigurer method createGatewayServicesMgmtAction.
private void createGatewayServicesMgmtAction(final Flow flow) {
final ActionState gatewayServicesManagementCheck = createActionState(flow, CasWebflowConstants.STATE_ID_GATEWAY_SERVICES_MGMT_CHECK, createEvaluateAction("gatewayServicesManagementCheck"));
createTransitionForState(gatewayServicesManagementCheck, CasWebflowConstants.STATE_ID_SUCCESS, CasWebflowConstants.STATE_ID_REDIRECT);
}
use of org.springframework.webflow.engine.ActionState in project cas by apereo.
the class DefaultWebflowConfigurer method createServiceWarningViewState.
private void createServiceWarningViewState(final Flow flow) {
final ViewState stateWarning = createViewState(flow, CasWebflowConstants.STATE_ID_SHOW_WARNING_VIEW, CasWebflowConstants.VIEW_ID_CONFIRM);
createTransitionForState(stateWarning, CasWebflowConstants.TRANSITION_ID_SUCCESS, "finalizeWarning");
final ActionState finalizeWarn = createActionState(flow, "finalizeWarning", createEvaluateAction("serviceWarningAction"));
createTransitionForState(finalizeWarn, CasWebflowConstants.STATE_ID_REDIRECT, CasWebflowConstants.STATE_ID_REDIRECT);
}
Aggregations