Search in sources :

Example 1 with BinderConfiguration

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

the class AbstractCasWebflowConfigurer method getViewStateBinderConfiguration.

/**
     * Gets state binder configuration.
     *
     * @param state the state
     * @return the state binder configuration
     */
protected BinderConfiguration getViewStateBinderConfiguration(final ViewState state) {
    final Field field = ReflectionUtils.findField(state.getViewFactory().getClass(), "binderConfiguration");
    ReflectionUtils.makeAccessible(field);
    return (BinderConfiguration) ReflectionUtils.getField(field, state.getViewFactory());
}
Also used : Field(java.lang.reflect.Field) BinderConfiguration(org.springframework.webflow.engine.builder.BinderConfiguration)

Example 2 with BinderConfiguration

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

the class DefaultWebflowConfigurer method createRememberMeAuthnWebflowConfig.

private void createRememberMeAuthnWebflowConfig(final Flow flow) {
    if (casProperties.getTicket().getTgt().getRememberMe().isEnabled()) {
        createFlowVariable(flow, CasWebflowConstants.VAR_ID_CREDENTIAL, RememberMeUsernamePasswordCredential.class);
        final ViewState state = (ViewState) flow.getState(CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM);
        final BinderConfiguration cfg = getViewStateBinderConfiguration(state);
        cfg.addBinding(new BinderConfiguration.Binding("rememberMe", null, false));
    } else {
        createFlowVariable(flow, CasWebflowConstants.VAR_ID_CREDENTIAL, UsernamePasswordCredential.class);
    }
}
Also used : ViewState(org.springframework.webflow.engine.ViewState) BinderConfiguration(org.springframework.webflow.engine.builder.BinderConfiguration)

Example 3 with BinderConfiguration

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

the class PasswordManagementWebflowConfigurer method configure.

private void configure(final Flow flow, final String id) {
    createFlowVariable(flow, FLOW_VAR_ID_PASSWORD, PasswordChangeBean.class);
    final BinderConfiguration binder = createStateBinderConfiguration(Arrays.asList(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.passwordChangeAction);
    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, "casPasswordUpdateSuccess"));
    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 4 with BinderConfiguration

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

the class AbstractCasWebflowConfigurer method createStateBinderConfiguration.

/**
     * Create state model bindings.
     *
     * @param properties the properties
     * @return the binder configuration
     */
protected BinderConfiguration createStateBinderConfiguration(final List<String> properties) {
    final BinderConfiguration binder = new BinderConfiguration();
    properties.forEach(p -> binder.addBinding(new BinderConfiguration.Binding(p, null, true)));
    return binder;
}
Also used : BinderConfiguration(org.springframework.webflow.engine.builder.BinderConfiguration)

Example 5 with BinderConfiguration

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

the class AbstractCasWebflowConfigurer method getViewStateBinderConfiguration.

@Override
public BinderConfiguration getViewStateBinderConfiguration(final ViewState state) {
    val field = ReflectionUtils.findField(state.getViewFactory().getClass(), "binderConfiguration");
    ReflectionUtils.makeAccessible(field);
    return (BinderConfiguration) ReflectionUtils.getField(field, state.getViewFactory());
}
Also used : lombok.val(lombok.val) BinderConfiguration(org.springframework.webflow.engine.builder.BinderConfiguration)

Aggregations

BinderConfiguration (org.springframework.webflow.engine.builder.BinderConfiguration)6 lombok.val (lombok.val)2 ViewState (org.springframework.webflow.engine.ViewState)2 Field (java.lang.reflect.Field)1 ActionState (org.springframework.webflow.engine.ActionState)1 Transition (org.springframework.webflow.engine.Transition)1