org.springframework.webflow.execution.Action Java Examples

The following examples show how to use org.springframework.webflow.execution.Action. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CasMultiFactorWebflowConfigurer.java    From cas-mfa with Apache License 2.0 6 votes vote down vote up
/**
 * Add end state backed by view.
 *
 * @param flow   the flow
 * @param id     the id
 * @param viewId the view id
 */
protected void addEndStateBackedByView(final Flow flow, final String id, final String viewId) {
    try {
        final EndState endState = new EndState(flow, id);
        final ViewFactory viewFactory = this.flowBuilderServices.getViewFactoryCreator().createViewFactory(
                new LiteralExpression(viewId),
                this.flowBuilderServices.getExpressionParser(),
                this.flowBuilderServices.getConversionService(),
                null, this.flowBuilderServices.getValidator(),
                this.flowBuilderServices.getValidationHintResolver());

        final Action finalResponseAction = new ViewFactoryActionAdapter(viewFactory);
        endState.setFinalResponseAction(finalResponseAction);
        LOGGER.debug("Created end state state {} on flow id {}, backed by view {}", id, flow.getId(), viewId);
    } catch (final Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
}
 
Example #2
Source File: CasMultiFactorWebflowConfigurer.java    From cas-mfa with Apache License 2.0 6 votes vote down vote up
/**
 * Add multi factor outcome transitions to submission action state.
 *
 * @param flow the flow
 * @param flowIds the flow ids
 */
protected void addMultiFactorOutcomeTransitionsToSubmissionActionState(final Flow flow, final String[] flowIds) {
    final ActionState actionState = (ActionState) flow.getState(STATE_DEFINITION_ID_REAL_SUBMIT);
    LOGGER.debug("Retrieved action state {}", actionState.getId());

    final Action existingAction = actionState.getActionList().get(0);
    actionState.getActionList().remove(existingAction);

    final EvaluateAction action = createEvaluateAction("initiatingAuthenticationViaFormAction");
    actionState.getActionList().add(action);
    LOGGER.debug("Set action {} for action state {}", actionState.getId());

    for (final String flowId : flowIds) {
        addTransitionToActionState(actionState, flowId, flowId);
    }

}
 
Example #3
Source File: CustomerAuthWebflowConfiguration.java    From CAS with Apache License 2.0 5 votes vote down vote up
@Bean
@RefreshScope
@ConditionalOnMissingBean(name = "validateLoginAction")
public Action validateLoginAction() {
    ValidateLoginAction validateCaptchaAction = new ValidateLoginAction();
    return validateCaptchaAction;
}
 
Example #4
Source File: CasMultiFactorWebflowConfigurer.java    From cas-mfa with Apache License 2.0 5 votes vote down vote up
/**
 * Create subflow state.
 *
 * @param flow the flow
 * @param id the id
 * @param subflow the subflow
 * @param entryAction the entry action
 * @return the subflow state
 */
protected SubflowState createSubflowState(final Flow flow, final String id, final String subflow,
                                        final Action entryAction) {

    final SubflowState state = new SubflowState(flow, id, new BasicSubflowExpression(subflow));
    if (entryAction != null) {
        state.getEntryActionList().add(entryAction);
    }

    return state;
}
 
Example #5
Source File: ValidateWebflowConfiguation.java    From sso with MIT License 5 votes vote down vote up
@ConditionalOnMissingBean(name = "validateLoginCaptchaAction")
@Bean
@RefreshScope
public Action validateLoginCaptchaAction() {
    ValidateLoginCaptchaAction validateCaptchaAction = new ValidateLoginCaptchaAction(captchaResultProvider);
    return validateCaptchaAction;
}
 
Example #6
Source File: ValidateWebflowConfigurer.java    From sso with MIT License 5 votes vote down vote up
/**
 * 登录校验流程
 */
private void createLoginValidateValidateFlow() {
    final Flow flow = getLoginFlow();
    if (flow != null) {
        final ActionState state = (ActionState) flow.getState(CasWebflowConstants.TRANSITION_ID_REAL_SUBMIT);
        final List<Action> currentActions = new ArrayList<>();
        state.getActionList().forEach(currentActions::add);
        currentActions.forEach(a -> state.getActionList().remove(a));

        state.getActionList().add(createEvaluateAction("validateLoginCaptchaAction"));
        currentActions.forEach(a -> state.getActionList().add(a));

        state.getTransitionSet().add(createTransition("captchaError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    }
}
 
Example #7
Source File: CustomerAuthWebflowConfiguration.java    From CAS with Apache License 2.0 5 votes vote down vote up
@Bean
@RefreshScope
@ConditionalOnMissingBean(name = "validateLoginAction")
public Action validateLoginAction() {
    ValidateLoginAction validateCaptchaAction = new ValidateLoginAction();
    return validateCaptchaAction;
}
 
Example #8
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定自定义的Credential信息
 *
 * @param flow
 */
protected void bindCredential(Flow flow) {

    // 重写绑定自定义credential
    createFlowVariable(flow, CasWebflowConstants.VAR_ID_CREDENTIAL, CustomCredential.class);

    // 登录页绑定新参数
    final ViewState state = (ViewState) flow.getState(CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM);
    final BinderConfiguration cfg = getViewStateBinderConfiguration(state);
    // 由于用户名以及密码已经绑定,所以只需对新加系统参数绑定即可
    // 字段名,转换器,是否必须字段
    cfg.addBinding(new BinderConfiguration.Binding("email", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("telephone", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("capcha", null, false));



    final ActionState actionState = (ActionState) flow.getState(CasWebflowConstants.STATE_ID_REAL_SUBMIT);
    final List<Action> currentActions = new ArrayList<>();
    actionState.getActionList().forEach(currentActions::add);
    currentActions.forEach(a -> actionState.getActionList().remove(a));

    actionState.getActionList().add(createEvaluateAction("validateLoginAction"));
    currentActions.forEach(a -> actionState.getActionList().add(a));

    actionState.getTransitionSet().add(createTransition("emailError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("telephoneError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("captchaError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));


}
 
Example #9
Source File: CustomerAuthWebflowConfiguration.java    From CAS with Apache License 2.0 5 votes vote down vote up
@Bean
@RefreshScope
@ConditionalOnMissingBean(name = "validateLoginAction")
public Action validateLoginAction() {
    ValidateLoginAction validateCaptchaAction = new ValidateLoginAction();
    return validateCaptchaAction;
}
 
Example #10
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定自定义的Credential信息
 *
 * @param flow
 */
protected void bindCredential(Flow flow) {

    // 重写绑定自定义credential
    createFlowVariable(flow, CasWebflowConstants.VAR_ID_CREDENTIAL, CustomCredential.class);

    // 登录页绑定新参数
    final ViewState state = (ViewState) flow.getState(CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM);
    final BinderConfiguration cfg = getViewStateBinderConfiguration(state);
    // 由于用户名以及密码已经绑定,所以只需对新加系统参数绑定即可
    // 字段名,转换器,是否必须字段
    cfg.addBinding(new BinderConfiguration.Binding("email", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("telephone", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("capcha", null, false));



    final ActionState actionState = (ActionState) flow.getState(CasWebflowConstants.STATE_ID_REAL_SUBMIT);
    final List<Action> currentActions = new ArrayList<>();
    actionState.getActionList().forEach(currentActions::add);
    currentActions.forEach(a -> actionState.getActionList().remove(a));

    actionState.getActionList().add(createEvaluateAction("validateLoginAction"));
    currentActions.forEach(a -> actionState.getActionList().add(a));

    actionState.getTransitionSet().add(createTransition("emailError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("telephoneError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("captchaError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));


}
 
Example #11
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定自定义的Credential信息
 *
 * @param flow
 */
protected void bindCredential(Flow flow) {

    // 重写绑定自定义credential
    createFlowVariable(flow, CasWebflowConstants.VAR_ID_CREDENTIAL, CustomCredential.class);

    // 登录页绑定新参数
    final ViewState state = (ViewState) flow.getState(CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM);
    final BinderConfiguration cfg = getViewStateBinderConfiguration(state);
    // 由于用户名以及密码已经绑定,所以只需对新加系统参数绑定即可
    // 字段名,转换器,是否必须字段
    cfg.addBinding(new BinderConfiguration.Binding("email", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("telephone", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("capcha", null, false));



    final ActionState actionState = (ActionState) flow.getState(CasWebflowConstants.STATE_ID_REAL_SUBMIT);
    final List<Action> currentActions = new ArrayList<>();
    actionState.getActionList().forEach(currentActions::add);
    currentActions.forEach(a -> actionState.getActionList().remove(a));

    actionState.getActionList().add(createEvaluateAction("validateLoginAction"));
    currentActions.forEach(a -> actionState.getActionList().add(a));

    actionState.getTransitionSet().add(createTransition("emailError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("telephoneError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("captchaError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));


}
 
Example #12
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定自定义的Credential信息
 *
 * @param flow
 */
protected void bindCredential(Flow flow) {

    // 重写绑定自定义credential
    createFlowVariable(flow, CasWebflowConstants.VAR_ID_CREDENTIAL, CustomCredential.class);

    // 登录页绑定新参数
    final ViewState state = (ViewState) flow.getState(CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM);
    final BinderConfiguration cfg = getViewStateBinderConfiguration(state);
    // 由于用户名以及密码已经绑定,所以只需对新加系统参数绑定即可
    // 字段名,转换器,是否必须字段
    cfg.addBinding(new BinderConfiguration.Binding("email", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("telephone", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("capcha", null, false));



    final ActionState actionState = (ActionState) flow.getState(CasWebflowConstants.STATE_ID_REAL_SUBMIT);
    final List<Action> currentActions = new ArrayList<>();
    actionState.getActionList().forEach(currentActions::add);
    currentActions.forEach(a -> actionState.getActionList().remove(a));

    actionState.getActionList().add(createEvaluateAction("validateLoginAction"));
    currentActions.forEach(a -> actionState.getActionList().add(a));

    actionState.getTransitionSet().add(createTransition("emailError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("telephoneError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("captchaError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));


}
 
Example #13
Source File: CustomerAuthWebflowConfiguration.java    From CAS with Apache License 2.0 5 votes vote down vote up
@Bean
@RefreshScope
@ConditionalOnMissingBean(name = "validateLoginAction")
public Action validateLoginAction() {
    ValidateLoginAction validateCaptchaAction = new ValidateLoginAction();
    return validateCaptchaAction;
}
 
Example #14
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定自定义的Credential信息
 *
 * @param flow
 */
protected void bindCredential(Flow flow) {

    // 重写绑定自定义credential
    createFlowVariable(flow, CasWebflowConstants.VAR_ID_CREDENTIAL, CustomCredential.class);

    // 登录页绑定新参数
    final ViewState state = (ViewState) flow.getState(CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM);
    final BinderConfiguration cfg = getViewStateBinderConfiguration(state);
    // 由于用户名以及密码已经绑定,所以只需对新加系统参数绑定即可
    // 字段名,转换器,是否必须字段
    cfg.addBinding(new BinderConfiguration.Binding("email", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("telephone", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("capcha", null, false));



    final ActionState actionState = (ActionState) flow.getState(CasWebflowConstants.STATE_ID_REAL_SUBMIT);
    final List<Action> currentActions = new ArrayList<>();
    actionState.getActionList().forEach(currentActions::add);
    currentActions.forEach(a -> actionState.getActionList().remove(a));

    actionState.getActionList().add(createEvaluateAction("validateLoginAction"));
    currentActions.forEach(a -> actionState.getActionList().add(a));

    actionState.getTransitionSet().add(createTransition("emailError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("telephoneError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("captchaError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));


}
 
Example #15
Source File: CustomerAuthWebflowConfiguration.java    From CAS with Apache License 2.0 5 votes vote down vote up
@Bean
@RefreshScope
@ConditionalOnMissingBean(name = "validateLoginAction")
public Action validateLoginAction() {
    ValidateLoginAction validateCaptchaAction = new ValidateLoginAction();
    return validateCaptchaAction;
}
 
Example #16
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定自定义的Credential信息
 *
 * @param flow
 */
protected void bindCredential(Flow flow) {

    // 重写绑定自定义credential
    createFlowVariable(flow, CasWebflowConstants.VAR_ID_CREDENTIAL, CustomCredential.class);

    // 登录页绑定新参数
    final ViewState state = (ViewState) flow.getState(CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM);
    final BinderConfiguration cfg = getViewStateBinderConfiguration(state);
    // 由于用户名以及密码已经绑定,所以只需对新加系统参数绑定即可
    // 字段名,转换器,是否必须字段
    cfg.addBinding(new BinderConfiguration.Binding("email", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("telephone", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("capcha", null, false));



    final ActionState actionState = (ActionState) flow.getState(CasWebflowConstants.STATE_ID_REAL_SUBMIT);
    final List<Action> currentActions = new ArrayList<>();
    actionState.getActionList().forEach(currentActions::add);
    currentActions.forEach(a -> actionState.getActionList().remove(a));

    actionState.getActionList().add(createEvaluateAction("validateLoginAction"));
    currentActions.forEach(a -> actionState.getActionList().add(a));

    actionState.getTransitionSet().add(createTransition("emailError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("telephoneError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("captchaError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));


}
 
Example #17
Source File: CustomerAuthWebflowConfiguration.java    From CAS with Apache License 2.0 5 votes vote down vote up
@Bean
@RefreshScope
@ConditionalOnMissingBean(name = "validateLoginAction")
public Action validateLoginAction() {
    ValidateLoginAction validateCaptchaAction = new ValidateLoginAction();
    return validateCaptchaAction;
}
 
Example #18
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 5 votes vote down vote up
/**
 * 绑定自定义的Credential信息
 *
 * @param flow
 */
protected void bindCredential(Flow flow) {

    // 重写绑定自定义credential
    createFlowVariable(flow, CasWebflowConstants.VAR_ID_CREDENTIAL, CustomCredential.class);

    // 登录页绑定新参数
    final ViewState state = (ViewState) flow.getState(CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM);
    final BinderConfiguration cfg = getViewStateBinderConfiguration(state);
    // 由于用户名以及密码已经绑定,所以只需对新加系统参数绑定即可
    // 字段名,转换器,是否必须字段
    cfg.addBinding(new BinderConfiguration.Binding("email", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("telephone", null, false));
    cfg.addBinding(new BinderConfiguration.Binding("capcha", null, false));



    final ActionState actionState = (ActionState) flow.getState(CasWebflowConstants.STATE_ID_REAL_SUBMIT);
    final List<Action> currentActions = new ArrayList<>();
    actionState.getActionList().forEach(currentActions::add);
    currentActions.forEach(a -> actionState.getActionList().remove(a));

    actionState.getActionList().add(createEvaluateAction("validateLoginAction"));
    currentActions.forEach(a -> actionState.getActionList().add(a));

    actionState.getTransitionSet().add(createTransition("emailError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("telephoneError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    actionState.getTransitionSet().add(createTransition("captchaError", CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));


}
 
Example #19
Source File: CustomerAuthWebflowConfiguration.java    From CAS with Apache License 2.0 5 votes vote down vote up
@Bean
@RefreshScope
@ConditionalOnMissingBean(name = "validateLoginAction")
public Action validateLoginAction() {
    ValidateLoginAction validateCaptchaAction = new ValidateLoginAction();
    return validateCaptchaAction;
}