Search in sources :

Example 6 with ActionState

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);
}
Also used : ActionState(org.springframework.webflow.engine.ActionState)

Example 7 with ActionState

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);
}
Also used : ViewState(org.springframework.webflow.engine.ViewState) ActionState(org.springframework.webflow.engine.ActionState)

Example 8 with ActionState

use of org.springframework.webflow.engine.ActionState in project cas by apereo.

the class DelegatedAuthenticationWebflowConfigurer method createClientActionActionState.

private void createClientActionActionState(final Flow flow) {
    final ActionState actionState = createActionState(flow, CasWebflowConstants.STATE_ID_CLIENT_ACTION, createEvaluateAction(CasWebflowConstants.STATE_ID_CLIENT_ACTION));
    actionState.getTransitionSet().add(createTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_SEND_TICKET_GRANTING_TICKET));
    actionState.getTransitionSet().add(createTransition(CasWebflowConstants.TRANSITION_ID_ERROR, getStartState(flow).getId()));
    actionState.getTransitionSet().add(createTransition(CasWebflowConstants.TRANSITION_ID_STOP, CasWebflowConstants.STATE_ID_STOP_WEBFLOW));
    setStartState(flow, actionState);
}
Also used : ActionState(org.springframework.webflow.engine.ActionState)

Example 9 with ActionState

use of org.springframework.webflow.engine.ActionState in project cas by apereo.

the class PasswordManagementWebflowConfigurer method configurePasswordResetFlow.

private void configurePasswordResetFlow(final Flow flow, final String id) {
    createFlowVariable(flow, FLOW_VAR_ID_PASSWORD, PasswordChangeBean.class);
    final BinderConfiguration binder = createStateBinderConfiguration(CollectionUtils.wrapList(FLOW_VAR_ID_PASSWORD, "confirmedPassword"));
    final ViewState viewState = createViewState(flow, id, id, binder);
    createStateModelBinding(viewState, FLOW_VAR_ID_PASSWORD, PasswordChangeBean.class);
    viewState.getEntryActionList().add(this.initPasswordChangeAction);
    final Transition transition = createTransitionForState(viewState, CasWebflowConstants.TRANSITION_ID_SUBMIT, PASSWORD_CHANGE_ACTION);
    transition.getAttributes().put("bind", Boolean.TRUE);
    transition.getAttributes().put("validate", Boolean.TRUE);
    createStateDefaultTransition(viewState, id);
    final ActionState pswChangeAction = createActionState(flow, PASSWORD_CHANGE_ACTION, createEvaluateAction(PASSWORD_CHANGE_ACTION));
    pswChangeAction.getTransitionSet().add(createTransition(PasswordChangeAction.PASSWORD_UPDATE_SUCCESS, CasWebflowConstants.STATE_ID_PASSWORD_UPDATE_SUCCESS));
    pswChangeAction.getTransitionSet().add(createTransition(CasWebflowConstants.TRANSITION_ID_ERROR, id));
}
Also used : Transition(org.springframework.webflow.engine.Transition) ViewState(org.springframework.webflow.engine.ViewState) ActionState(org.springframework.webflow.engine.ActionState) BinderConfiguration(org.springframework.webflow.engine.builder.BinderConfiguration)

Example 10 with ActionState

use of org.springframework.webflow.engine.ActionState in project cas by apereo.

the class PasswordManagementWebflowConfigurer method createPasswordResetFlow.

private void createPasswordResetFlow() {
    final Flow flow = getLoginFlow();
    if (flow != null) {
        final boolean autoLogin = casProperties.getAuthn().getPm().isAutoLogin();
        final ViewState state = getState(flow, CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM, ViewState.class);
        createTransitionForState(state, CasWebflowConstants.TRANSITION_ID_RESET_PASSWORD, CasWebflowConstants.VIEW_ID_SEND_RESET_PASSWORD_ACCT_INFO);
        final ViewState accountInfo = createViewState(flow, CasWebflowConstants.VIEW_ID_SEND_RESET_PASSWORD_ACCT_INFO, CasWebflowConstants.VIEW_ID_SEND_RESET_PASSWORD_ACCT_INFO);
        createTransitionForState(accountInfo, "findAccount", SEND_PASSWORD_RESET_INSTRUCTIONS_ACTION);
        final ActionState sendInst = createActionState(flow, SEND_PASSWORD_RESET_INSTRUCTIONS_ACTION, createEvaluateAction("sendPasswordResetInstructionsAction"));
        createTransitionForState(sendInst, CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.VIEW_ID_SENT_RESET_PASSWORD_ACCT_INFO);
        createTransitionForState(sendInst, CasWebflowConstants.TRANSITION_ID_ERROR, accountInfo.getId());
        createViewState(flow, CasWebflowConstants.VIEW_ID_SENT_RESET_PASSWORD_ACCT_INFO, CasWebflowConstants.VIEW_ID_SENT_RESET_PASSWORD_ACCT_INFO);
        final Flow pswdFlow = buildFlow("classpath:/webflow/pswdreset/pswdreset-webflow.xml", FLOW_ID_PASSWORD_RESET);
        createViewState(pswdFlow, "passwordResetErrorView", CasWebflowConstants.VIEW_ID_PASSWORD_RESET_ERROR);
        createViewState(pswdFlow, CasWebflowConstants.STATE_ID_PASSWORD_UPDATE_SUCCESS, CasWebflowConstants.VIEW_ID_PASSWORD_UPDATE_SUCCESS);
        configurePasswordResetFlow(pswdFlow, CasWebflowConstants.VIEW_ID_MUST_CHANGE_PASSWORD);
        loginFlowDefinitionRegistry.registerFlowDefinition(pswdFlow);
        final ActionState initializeLoginFormState = getState(flow, CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM, ActionState.class);
        final String originalTargetState = initializeLoginFormState.getTransition(CasWebflowConstants.STATE_ID_SUCCESS).getTargetStateId();
        final SubflowState pswdResetSubFlowState = createSubflowState(flow, CasWebflowConstants.STATE_ID_PASSWORD_RESET_SUBFLOW, FLOW_ID_PASSWORD_RESET);
        getTransitionableState(flow, CasWebflowConstants.STATE_ID_REAL_SUBMIT).getEntryActionList().add(createEvaluateAction("flowScope." + DO_CHANGE_PASSWORD_PARAMETER + " = requestParameters." + DO_CHANGE_PASSWORD_PARAMETER + " != null"));
        createDecisionState(flow, CasWebflowConstants.CHECK_FOR_PASSWORD_RESET_TOKEN_ACTION, "requestParameters." + SendPasswordResetInstructionsAction.PARAMETER_NAME_TOKEN + " != null", CasWebflowConstants.STATE_ID_PASSWORD_RESET_SUBFLOW, originalTargetState);
        createTransitionForState(initializeLoginFormState, CasWebflowConstants.STATE_ID_SUCCESS, CasWebflowConstants.CHECK_FOR_PASSWORD_RESET_TOKEN_ACTION, true);
        createEndState(pswdFlow, CasWebflowConstants.STATE_ID_PASSWORD_RESET_FLOW_COMPLETE);
        createTransitionForState(getTransitionableState(pswdFlow, CasWebflowConstants.STATE_ID_PASSWORD_UPDATE_SUCCESS), CasWebflowConstants.TRANSITION_ID_PROCEED, CasWebflowConstants.STATE_ID_PASSWORD_RESET_FLOW_COMPLETE);
        createEndState(flow, CasWebflowConstants.STATE_ID_REDIRECT_TO_LOGIN, "'" + CasWebflowConfigurer.FLOW_ID_LOGIN + "'", true);
        createTransitionForState(pswdResetSubFlowState, CasWebflowConstants.STATE_ID_PASSWORD_RESET_FLOW_COMPLETE, autoLogin ? CasWebflowConstants.STATE_ID_REAL_SUBMIT : CasWebflowConstants.STATE_ID_REDIRECT_TO_LOGIN);
        createDecisionState(flow, CasWebflowConstants.STATE_ID_CHECK_DO_CHANGE_PASSWORD, "flowScope." + DO_CHANGE_PASSWORD_PARAMETER + " == true", CasWebflowConstants.VIEW_ID_MUST_CHANGE_PASSWORD, getTransitionableState(flow, CasWebflowConstants.STATE_ID_REAL_SUBMIT).getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS).getTargetStateId()).getEntryActionList().add(createEvaluateAction("flowScope.pswdChangePostLogin=true"));
        createTransitionForState(getTransitionableState(flow, CasWebflowConstants.STATE_ID_REAL_SUBMIT), CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_CHECK_DO_CHANGE_PASSWORD, true);
        createDecisionState(flow, CasWebflowConstants.STATE_ID_POST_LOGIN_PASSWORD_CHANGE_CHECK, "flowScope.pswdChangePostLogin == true", getTransitionableState(flow, CasWebflowConstants.VIEW_ID_SHOW_AUTHN_WARNING_MSGS).getTransition(CasWebflowConstants.TRANSITION_ID_PROCEED).getTargetStateId(), autoLogin ? CasWebflowConstants.STATE_ID_REAL_SUBMIT : CasWebflowConstants.STATE_ID_REDIRECT_TO_LOGIN);
        createTransitionForState(getTransitionableState(flow, CasWebflowConstants.STATE_ID_PASSWORD_UPDATE_SUCCESS), CasWebflowConstants.TRANSITION_ID_PROCEED, CasWebflowConstants.STATE_ID_POST_LOGIN_PASSWORD_CHANGE_CHECK);
    }
}
Also used : SubflowState(org.springframework.webflow.engine.SubflowState) ViewState(org.springframework.webflow.engine.ViewState) ActionState(org.springframework.webflow.engine.ActionState) Flow(org.springframework.webflow.engine.Flow)

Aggregations

ActionState (org.springframework.webflow.engine.ActionState)59 Flow (org.springframework.webflow.engine.Flow)17 ViewState (org.springframework.webflow.engine.ViewState)12 Transition (org.springframework.webflow.engine.Transition)6 Action (org.springframework.webflow.execution.Action)4 ArrayList (java.util.ArrayList)2 EvaluateAction (org.springframework.webflow.action.EvaluateAction)2 SubflowState (org.springframework.webflow.engine.SubflowState)2 BinderConfiguration (org.springframework.webflow.engine.builder.BinderConfiguration)2 DefaultTargetStateResolver (org.springframework.webflow.engine.support.DefaultTargetStateResolver)2 AccountLockedException (javax.security.auth.login.AccountLockedException)1 AccountNotFoundException (javax.security.auth.login.AccountNotFoundException)1 CredentialExpiredException (javax.security.auth.login.CredentialExpiredException)1 FailedLoginException (javax.security.auth.login.FailedLoginException)1 PrincipalException (org.apereo.cas.authentication.PrincipalException)1 UnauthorizedAuthenticationException (org.apereo.cas.authentication.adaptive.UnauthorizedAuthenticationException)1 AccountDisabledException (org.apereo.cas.authentication.exceptions.AccountDisabledException)1 AccountPasswordMustChangeException (org.apereo.cas.authentication.exceptions.AccountPasswordMustChangeException)1 InvalidLoginLocationException (org.apereo.cas.authentication.exceptions.InvalidLoginLocationException)1 InvalidLoginTimeException (org.apereo.cas.authentication.exceptions.InvalidLoginTimeException)1