Search in sources :

Example 1 with AbstractAction

use of org.springframework.webflow.action.AbstractAction in project cas by apereo.

the class Pac4jWebflowConfigurer method createStopWebflowViewState.

private void createStopWebflowViewState(final Flow flow) {
    final ViewState state = createViewState(flow, DelegatedClientAuthenticationAction.STOP_WEBFLOW, DelegatedClientAuthenticationAction.VIEW_ID_STOP_WEBFLOW);
    state.getEntryActionList().add(new AbstractAction() {

        @Override
        protected Event doExecute(final RequestContext requestContext) throws Exception {
            final HttpServletRequest request = WebUtils.getHttpServletRequest(requestContext);
            final HttpServletResponse response = WebUtils.getHttpServletResponse(requestContext);
            final Optional<ModelAndView> mv = DelegatedClientAuthenticationAction.hasDelegationRequestFailed(request, response.getStatus());
            mv.ifPresent(modelAndView -> modelAndView.getModel().forEach((k, v) -> requestContext.getFlowScope().put(k, v)));
            return null;
        }
    });
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ActionState(org.springframework.webflow.engine.ActionState) FlowDefinitionRegistry(org.springframework.webflow.definition.registry.FlowDefinitionRegistry) AbstractAction(org.springframework.webflow.action.AbstractAction) HttpServletResponse(javax.servlet.http.HttpServletResponse) Flow(org.springframework.webflow.engine.Flow) FlowBuilderServices(org.springframework.webflow.engine.builder.support.FlowBuilderServices) Action(org.springframework.webflow.execution.Action) DecisionState(org.springframework.webflow.engine.DecisionState) RequestContext(org.springframework.webflow.execution.RequestContext) ModelAndView(org.springframework.web.servlet.ModelAndView) HttpServletRequest(javax.servlet.http.HttpServletRequest) ViewState(org.springframework.webflow.engine.ViewState) DelegatedClientAuthenticationAction(org.apereo.cas.support.pac4j.web.flow.DelegatedClientAuthenticationAction) Optional(java.util.Optional) WebUtils(org.apereo.cas.web.support.WebUtils) Event(org.springframework.webflow.execution.Event) Optional(java.util.Optional) Event(org.springframework.webflow.execution.Event) HttpServletResponse(javax.servlet.http.HttpServletResponse) ViewState(org.springframework.webflow.engine.ViewState) RequestContext(org.springframework.webflow.execution.RequestContext) AbstractAction(org.springframework.webflow.action.AbstractAction)

Aggregations

Optional (java.util.Optional)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 DelegatedClientAuthenticationAction (org.apereo.cas.support.pac4j.web.flow.DelegatedClientAuthenticationAction)1 WebUtils (org.apereo.cas.web.support.WebUtils)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1 AbstractAction (org.springframework.webflow.action.AbstractAction)1 FlowDefinitionRegistry (org.springframework.webflow.definition.registry.FlowDefinitionRegistry)1 ActionState (org.springframework.webflow.engine.ActionState)1 DecisionState (org.springframework.webflow.engine.DecisionState)1 Flow (org.springframework.webflow.engine.Flow)1 ViewState (org.springframework.webflow.engine.ViewState)1 FlowBuilderServices (org.springframework.webflow.engine.builder.support.FlowBuilderServices)1 Action (org.springframework.webflow.execution.Action)1 Event (org.springframework.webflow.execution.Event)1 RequestContext (org.springframework.webflow.execution.RequestContext)1