use of org.springframework.webflow.engine.Transition in project cas by apereo.
the class GraphicalUserAuthenticationWebflowConfigurer method doInitialize.
@Override
protected void doInitialize() {
val flow = getLoginFlow();
if (flow != null) {
val state = getState(flow, CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM, ActionState.class);
val transition = (Transition) state.getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS);
val targetStateId = transition.getTargetStateId();
createTransitionForState(state, TRANSITION_ID_GUA_GET_USERID, STATE_ID_GUA_GET_USERID);
val viewState = createViewState(flow, STATE_ID_GUA_GET_USERID, "gua/casGuaGetUserIdView");
createTransitionForState(viewState, CasWebflowConstants.TRANSITION_ID_SUBMIT, STATE_ID_GUA_DISPLAY_USER_GFX);
val viewStateGfx = createViewState(flow, STATE_ID_GUA_DISPLAY_USER_GFX, "gua/casGuaDisplayUserGraphicsView");
viewStateGfx.getRenderActionList().add(createEvaluateAction(ACTION_ID_DISPLAY_USER_GRAPHICS_BEFORE_AUTHENTICATION));
createTransitionForState(viewStateGfx, CasWebflowConstants.TRANSITION_ID_SUBMIT, STATE_ID_ACCEPT_GUA);
val acceptState = createActionState(flow, STATE_ID_ACCEPT_GUA, createEvaluateAction(ACTION_ID_ACCEPT_USER_GRAPHICS_FOR_AUTHENTICATION));
createStateDefaultTransition(acceptState, targetStateId);
}
}
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 Action... actions) {
val criteria = getTransitionCriteriaForExpression(criteriaOutcomeExpression);
val transition = new Transition(criteria, StringUtils.isNotBlank(targetState) ? new DefaultTargetStateResolver(targetState) : null);
if (actions != null && actions.length > 0) {
val transitionActionCriteria = Arrays.stream(actions).map(ActionTransitionCriteria::new).toArray(ActionTransitionCriteria[]::new);
transition.setExecutionCriteria(new TransitionCriteriaChain(transitionActionCriteria));
}
return transition;
}
use of org.springframework.webflow.engine.Transition in project cas by apereo.
the class AdaptiveMultifactorAuthenticationPolicyEventResolverTests method initialize.
@BeforeEach
public void initialize() {
this.context = new MockRequestContext();
request = new MockHttpServletRequest();
request.setRemoteAddr("185.86.151.11");
request.setLocalAddr("195.88.151.11");
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 GroovyScriptMultifactorAuthenticationPolicyEventResolverTests method initialize.
@BeforeEach
public void initialize() {
this.context = new MockRequestContext();
val request = new MockHttpServletRequest();
request.setRemoteAddr("185.86.151.11");
request.setLocalAddr("195.88.151.11");
request.addHeader(HttpRequestUtils.USER_AGENT_HEADER, "MSIE");
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 RequestSessionAttributeMultifactorAuthenticationPolicyEventResolverTests method verifyOperation.
@Test
public void verifyOperation() {
val context = new MockRequestContext();
val request = new MockHttpServletRequest();
val response = new MockHttpServletResponse();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, response));
val service = RegisteredServiceTestUtils.getRegisteredService();
servicesManager.save(service);
WebUtils.putRegisteredService(context, service);
WebUtils.putAuthentication(RegisteredServiceTestUtils.getAuthentication(), context);
WebUtils.putServiceIntoFlowScope(context, RegisteredServiceTestUtils.getService());
var results = requestSessionAttributeAuthenticationPolicyWebflowEventResolver.resolve(context);
assertNull(results);
val targetResolver = new DefaultTargetStateResolver(TestMultifactorAuthenticationProvider.ID);
val transition = new Transition(new DefaultTransitionCriteria(new LiteralExpression(TestMultifactorAuthenticationProvider.ID)), targetResolver);
context.getRootFlow().getGlobalTransitionSet().add(transition);
TestMultifactorAuthenticationProvider.registerProviderIntoApplicationContext(applicationContext);
request.getSession(true).setAttribute(casProperties.getAuthn().getMfa().getTriggers().getHttp().getSessionAttribute(), TestMultifactorAuthenticationProvider.ID);
results = requestSessionAttributeAuthenticationPolicyWebflowEventResolver.resolve(context);
assertNotNull(results);
assertEquals(1, results.size());
assertEquals(TestMultifactorAuthenticationProvider.ID, results.iterator().next().getId());
}
Aggregations