use of org.springframework.webflow.engine.Transition in project cas by apereo.
the class AbstractCasWebflowConfigurer method createTransitionForState.
@Override
public Transition createTransitionForState(final TransitionableState state, final String criteriaOutcome, final String targetState, final boolean removeExisting, final Map<String, Object> attributes, final Action... actions) {
try {
if (removeExisting) {
var transition = (Transition) null;
do {
transition = (Transition) state.getTransition(criteriaOutcome);
if (transition != null) {
state.getTransitionSet().remove(transition);
}
} while (transition != null);
}
val transition = createTransition(criteriaOutcome, targetState, actions);
attributes.forEach((key, value) -> transition.getAttributes().put(key, value));
state.getTransitionSet().add(transition);
LOGGER.trace("Added transition [{}] to the state [{}]", transition.getId(), state.getId());
return transition;
} catch (final Exception e) {
LoggingUtils.error(LOGGER, e);
}
return null;
}
use of org.springframework.webflow.engine.Transition in project cas by apereo.
the class PasswordlessAuthenticationWebflowConfigurer method createStateAcceptPasswordless.
/**
* Create state accept passwordless.
*
* @param flow the flow
*/
protected void createStateAcceptPasswordless(final Flow flow) {
val acceptAction = createEvaluateAction(CasWebflowConstants.ACTION_ID_ACCEPT_PASSWORDLESS_AUTHN);
val acceptState = createActionState(flow, CasWebflowConstants.STATE_ID_ACCEPT_PASSWORDLESS_AUTHENTICATION, acceptAction);
createTransitionForState(acceptState, CasWebflowConstants.TRANSITION_ID_AUTHENTICATION_FAILURE, CasWebflowConstants.STATE_ID_PASSWORDLESS_DISPLAY);
val submission = getState(flow, CasWebflowConstants.STATE_ID_REAL_SUBMIT, ActionState.class);
val transition = (Transition) submission.getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS);
val targetStateId = transition.getTargetStateId();
createTransitionForState(acceptState, CasWebflowConstants.TRANSITION_ID_SUCCESS, targetStateId);
}
use of org.springframework.webflow.engine.Transition in project cas by apereo.
the class OidcAuthenticationContextWebflowEventResolverTests method initialize.
@BeforeEach
@Override
public void initialize() throws Exception {
super.initialize();
this.context = new MockRequestContext();
val request = new MockHttpServletRequest();
request.setRemoteAddr("385.86.151.11");
request.setLocalAddr("295.88.151.11");
request.addHeader(HttpRequestUtils.USER_AGENT_HEADER, "MSIE");
request.addParameter(OAuth20Constants.ACR_VALUES, TestMultifactorAuthenticationProvider.ID);
ClientInfoHolder.setClientInfo(new ClientInfo(request));
val response = new MockHttpServletResponse();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, response));
val targetResolver = new DefaultTargetStateResolver(TestMultifactorAuthenticationProvider.ID);
val transition = new Transition(new DefaultTransitionCriteria(new LiteralExpression(TestMultifactorAuthenticationProvider.ID)), targetResolver);
context.getRootFlow().getGlobalTransitionSet().add(transition);
WebUtils.putServiceIntoFlowScope(context, CoreAuthenticationTestUtils.getWebApplicationService());
TestMultifactorAuthenticationProvider.registerProviderIntoApplicationContext(applicationContext);
WebUtils.putAuthentication(CoreAuthenticationTestUtils.getAuthentication(), context);
}
use of org.springframework.webflow.engine.Transition 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));
}
use of org.springframework.webflow.engine.Transition in project cas by apereo.
the class AbstractCasWebflowConfigurer method createTransition.
@Override
public Transition createTransition(final Expression criteriaOutcomeExpression, final String targetState) {
final TransitionCriteria criteria;
if (criteriaOutcomeExpression.toString().equals(WildcardTransitionCriteria.WILDCARD_EVENT_ID)) {
criteria = WildcardTransitionCriteria.INSTANCE;
} else {
criteria = new DefaultTransitionCriteria(criteriaOutcomeExpression);
}
final DefaultTargetStateResolver resolver = new DefaultTargetStateResolver(targetState);
final Transition t = new Transition(criteria, resolver);
return t;
}
Aggregations