org.springframework.webflow.engine.Flow Java Examples

The following examples show how to use org.springframework.webflow.engine.Flow. 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
/**
 * Create multi factor parent subflow state definitions.
 *
 * @param flow the flow
 * @param id the id
 */
protected void createMultiFactorParentSubflowStateDefinitions(final Flow flow, final String id) {
    final EvaluateAction action = createEvaluateAction("generateMfaCredentialsAction");

    final SubflowState subflowState = createSubflowState(flow, id, id, action);

    final List<DefaultMapping> mappings = new ArrayList<>();
    mappings.add(createMappingToSubflowState("mfaCredentials", "flowScope.mfaCredentials", true,
            MultiFactorCredentials.class));
    mappings.add(createMappingToSubflowState("mfaService", "flowScope.service", true,
            MultiFactorAuthenticationSupportingWebApplicationService.class));

    final Mapper inputMapper = createMapperToSubflowState(mappings);
    final SubflowAttributeMapper subflowMapper = createSubflowAttributeMapper(inputMapper, null);
    subflowState.setAttributeMapper(subflowMapper);

    final ActionState actionState = (ActionState) flow.getState(STATE_DEFINITION_ID_REAL_SUBMIT);
    final String targettedStateId = actionState.getTransition(SUCCESS_EVENT_ID).getTargetStateId();
    subflowState.getTransitionSet().add(createTransition(MFA_SUCCESS_EVENT_ID, targettedStateId));
    subflowState.getTransitionSet().add(createTransition(UNKNOWN_PRINCIPAL_ERROR_EVENT_ID,
            "viewUnknownPrincipalErrorView"));
    subflowState.getTransitionSet().add(createTransition(MFA_UNRECOGNIZED_AUTHN_METHOD_ERROR_EVENT_ID,
            VIEW_MFA_UNRECOGNIZED_AUTHN_METHOD_ERROR_VIEW));
}
 
Example #2
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 #3
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 6 votes vote down vote up
/**
 * 绑定自定义的Credential信息
 *
 * @param flow
 */
protected void bindCredential(Flow flow) {

    // 重写绑定自定义credential
    // 重写绑定自定义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, true));
    cfg.addBinding(new BinderConfiguration.Binding("telephone", null, true));

}
 
Example #4
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 #5
Source File: CasMultiFactorWebflowConfigurer.java    From cas-mfa with Apache License 2.0 6 votes vote down vote up
/**
 * Add global transition if exception is thrown.
 *
 * @param flow          the flow
 * @param targetStateId the target state id
 * @param clazz         the exception class
 */
protected void addGlobalTransitionIfExceptionIsThrown(final Flow flow, final String targetStateId, final Class<? extends Throwable>
        clazz) {

    try {
        final TransitionExecutingFlowExecutionExceptionHandler handler = new TransitionExecutingFlowExecutionExceptionHandler();
        final TargetStateResolver targetStateResolver = (TargetStateResolver) fromStringTo(TargetStateResolver.class)
                .execute(targetStateId);
        handler.add(clazz, targetStateResolver);

        LOGGER.debug("Added transition {} to execute on the occurrence of {}", targetStateId, clazz.getName());
        flow.getExceptionHandlerSet().add(handler);
    } catch (final Exception e) {
        LOGGER.error(e.getMessage(), e);
    }


}
 
Example #6
Source File: CasMultiFactorWebflowConfigurer.java    From cas-mfa with Apache License 2.0 6 votes vote down vote up
/**
 * Sets webflow.
 * @param flowIds the flow ids
 */

protected void setupWebflow(final String[] flowIds) {
    try {
        LOGGER.debug("Starting to configure webflow...");

        final Flow flow = (Flow) this.flowDefinitionRegistry.getFlowDefinition(FLOW_ID_LOGIN);
        LOGGER.debug("Retrieved flow id {} from flow definition registry", flow.getId());

        addTicketGrantingTicketExistsCheck(flow, flowIds);
        addMultiFactorOutcomeTransitionsToSubmissionActionState(flow, flowIds);
        addMultiFactorViewEndStates(flow);
        addMultiFactorGlobalTransitionsForExceptionHandling(flow);
        addOnEntryActionToServiceCheckState(flow);
        createMultiFactorSubflowStateDefinitions(flow, flowIds);
    } catch (final Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
}
 
Example #7
Source File: ValidateWebflowConfigurer.java    From sso with MIT License 6 votes vote down vote up
/**
 * 发送邮箱前输入验证码流程
 */
private void createPasswordResetValidateFlow() {
    final Flow flow = getLoginFlow();
    if (flow != null) {
        ViewState accountInfo = (ViewState) flow.getState(CasWebflowConstants.VIEW_ID_SEND_RESET_PASSWORD_ACCT_INFO);
        //提交查找用户后,先校验验证码
        createTransitionForState(accountInfo, "findAccount", VALIDATE_CAPTCHA_ACTION, true);
        //校验图片动作
        ActionState actionState = createActionState(flow, VALIDATE_CAPTCHA_ACTION, createEvaluateAction(VALIDATE_CAPTCHA_ACTION));
        //失败重新是发送页
        createTransitionForState(actionState, CasWebflowConstants.TRANSITION_ID_RESET_PASSWORD,
                CasWebflowConstants.VIEW_ID_SEND_RESET_PASSWORD_ACCT_INFO);
        //发送邮件
        createTransitionForState(actionState, "sendInstructions", "sendInstructions");
    }
}
 
Example #8
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 #9
Source File: CasMultiFactorWebflowConfigurer.java    From cas-mfa with Apache License 2.0 5 votes vote down vote up
/**
 * Add ticket granting ticket exists check.
 *
 * @param flow the flow
 * @param flowIds the flow ids
 */
protected void addTicketGrantingTicketExistsCheck(final Flow flow, final String[] flowIds) {
    try {
        final ActionState actionState = new ActionState(flow, "mfaTicketGrantingTicketExistsCheck");
        LOGGER.debug("Created action state {}", actionState.getId());
        actionState.getActionList().add(createEvaluateAction("validateInitialMfaRequestAction"));
        LOGGER.debug("Added action to the action state {} list of actions: {}", actionState.getId(), actionState.getActionList());

        for (final String flowId : flowIds) {
            addTransitionToActionState(actionState, flowId, flowId);
        }
        final TransitionableState currentStartState = TransitionableState.class.cast(flow.getStartState());

        LOGGER.debug("Mapping the transition [{}] of state [{}] to the existing start state [{}]",
                ValidateInitialMultiFactorAuthenticationRequestAction.EVENT_ID_REQUIRE_TGT,
                actionState.getId(), currentStartState.getId());
        addTransitionToActionState(actionState, "requireTgt", currentStartState.getId());

        if (!STATE_DEFINITION_ID_TGT_EXISTS_CHECK.equals(currentStartState.getId())) {
            LOGGER.debug("Found a custom existing start state [{}]. Will add a default transition to "
                            + "[{}] so the flow can resume normally.",
                    STATE_DEFINITION_ID_TGT_EXISTS_CHECK,
                    currentStartState.getId());
            addDefaultTransitionToState(currentStartState, STATE_DEFINITION_ID_TGT_EXISTS_CHECK);
        }

        flow.setStartState(actionState);
        LOGGER.debug("Replaced flow {} start state with {}", flow.getId(), flow.getStartState().getId());
    } catch (final Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
}
 
Example #10
Source File: CasMultiFactorWebflowConfigurer.java    From cas-mfa with Apache License 2.0 5 votes vote down vote up
/**
 * Add on entry action to service check state.
 *
 * @param flow the flow
 */
protected void addOnEntryActionToServiceCheckState(final Flow flow) {
    final DecisionState state = (DecisionState) flow.getState(STATE_DEFINITION_ID_SERVICE_CHECK);

    final EvaluateAction action = createEvaluateAction("removeHostnameServiceInContextAction");
    state.getEntryActionList().add(action);
    LOGGER.debug("Set on-entry action for decision state {}", state.getId());
}
 
Example #11
Source File: CasMultiFactorWebflowConfigurer.java    From cas-mfa with Apache License 2.0 5 votes vote down vote up
/**
 * Add multi factor global transitions for exception handling.
 *
 * @param flow the flow
 */
protected void addMultiFactorGlobalTransitionsForExceptionHandling(final Flow flow) {
    addGlobalTransitionIfExceptionIsThrown(flow,
            STATE_DEFINITION_ID_TGT_EXISTS_CHECK, NoAuthenticationContextAvailable.class);
    addGlobalTransitionIfExceptionIsThrown(flow,
            VIEW_MFA_UNRECOGNIZED_AUTHN_METHOD_ERROR_VIEW, UnrecognizedAuthenticationMethodException.class);
}
 
Example #12
Source File: AddSoRPersonFlowTests.java    From openregistry with Apache License 2.0 5 votes vote down vote up
public Flow createMockAddRoleSubflow() {
    Flow mockAddRoleFlow = new Flow("add-role");
    mockAddRoleFlow.setInputMapper(new Mapper() {
        public MappingResults map(Object source, Object target) {
            assertNotNull(((AttributeMap) source).get("sorPerson"));
            return null;
        }
    });
    new EndState(mockAddRoleFlow, "roleWasAdded");
    return mockAddRoleFlow;
}
 
Example #13
Source File: CustomWebflowConfigurer.java    From sso with MIT License 5 votes vote down vote up
/**
 * 绑定输入信息
 *
 * @param flow
 */
protected void bindCredential(Flow flow) {
    //重写绑定自定义credential
    createFlowVariable(flow, CasWebflowConstants.VAR_ID_CREDENTIAL, UsernamePasswordSysCredential.class);
    //登录页绑定新参数
    final ViewState state = (ViewState) flow.getState(CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM);
    final BinderConfiguration cfg = getViewStateBinderConfiguration(state);
    //由于用户名以及密码已经绑定,所以只需对新加系统参数绑定即可
    cfg.addBinding(new BinderConfiguration.Binding("system", null, false));
}
 
Example #14
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 #15
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 #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: 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 #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: 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 #20
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 #21
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 #22
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 4 votes vote down vote up
@Override
protected void doInitialize() {
    final Flow flow = super.getLoginFlow();
    bindCredential(flow);
}
 
Example #23
Source File: ViewCompletePersonFlowTests.java    From openregistry with Apache License 2.0 4 votes vote down vote up
public Flow createMockSearchSubflow(){
    Flow mockSearchFlow = new Flow("searchForPerson");

    new EndState(mockSearchFlow, "personSelected");
    return mockSearchFlow;
}
 
Example #24
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 4 votes vote down vote up
@Override
protected void doInitialize() {
    final Flow flow = super.getLoginFlow();
    bindCredential(flow);
}
 
Example #25
Source File: CustomWebflowConfigurer.java    From sso with MIT License 4 votes vote down vote up
@Override
protected void doInitialize() throws Exception {
    final Flow flow = getLoginFlow();
    bindCredential(flow);
}
 
Example #26
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 4 votes vote down vote up
@Override
protected void doInitialize() {
    final Flow flow = super.getLoginFlow();
    bindCredential(flow);
}
 
Example #27
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 4 votes vote down vote up
@Override
protected void doInitialize() {
    final Flow flow = super.getLoginFlow();
    bindCredential(flow);
}
 
Example #28
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 4 votes vote down vote up
@Override
protected void doInitialize() {
    final Flow flow = super.getLoginFlow();
    bindCredential(flow);
}
 
Example #29
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 4 votes vote down vote up
@Override
protected void doInitialize() {
    final Flow flow = super.getLoginFlow();
    bindCredential(flow);
}
 
Example #30
Source File: CustomWebflowConfigurer.java    From CAS with Apache License 2.0 4 votes vote down vote up
@Override
protected void doInitialize() {
    final Flow flow = super.getLoginFlow();
    bindCredential(flow);
}