Java Code Examples for org.springframework.webflow.engine.Flow#getState()
The following examples show how to use
org.springframework.webflow.engine.Flow#getState() .
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: CustomWebflowConfigurer.java From CAS with Apache License 2.0 | 6 votes |
/** * 绑定自定义的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 2
Source File: ValidateWebflowConfigurer.java From sso with MIT License | 6 votes |
/** * 发送邮箱前输入验证码流程 */ 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 3
Source File: CasMultiFactorWebflowConfigurer.java From cas-mfa with Apache License 2.0 | 6 votes |
/** * 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 4
Source File: CasMultiFactorWebflowConfigurer.java From cas-mfa with Apache License 2.0 | 6 votes |
/** * 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 5
Source File: CustomWebflowConfigurer.java From CAS with Apache License 2.0 | 5 votes |
/** * 绑定自定义的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 6
Source File: CustomWebflowConfigurer.java From CAS with Apache License 2.0 | 5 votes |
/** * 绑定自定义的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 7
Source File: CustomWebflowConfigurer.java From CAS with Apache License 2.0 | 5 votes |
/** * 绑定自定义的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 8
Source File: CustomWebflowConfigurer.java From CAS with Apache License 2.0 | 5 votes |
/** * 绑定自定义的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: CustomWebflowConfigurer.java From CAS with Apache License 2.0 | 5 votes |
/** * 绑定自定义的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 10
Source File: CustomWebflowConfigurer.java From CAS with Apache License 2.0 | 5 votes |
/** * 绑定自定义的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 |
/** * 绑定自定义的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: ValidateWebflowConfigurer.java From sso with MIT License | 5 votes |
/** * 登录校验流程 */ 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 13
Source File: CustomWebflowConfigurer.java From sso with MIT License | 5 votes |
/** * 绑定输入信息 * * @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: CasMultiFactorWebflowConfigurer.java From cas-mfa with Apache License 2.0 | 5 votes |
/** * 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()); }