use of org.springframework.webflow.action.EventFactorySupport in project cas by apereo.
the class RedirectToServiceAction method finalizeResponseEvent.
/**
* Finalize response event event.
*
* @param requestContext the request context
* @param service the service
* @param response the response
* @return the event
*/
protected Event finalizeResponseEvent(final RequestContext requestContext, final WebApplicationService service, final Response response) {
WebUtils.putServiceResponseIntoRequestScope(requestContext, response);
WebUtils.putServiceOriginalUrlIntoRequestScope(requestContext, service);
val eventId = getFinalResponseEventId(service, response, requestContext);
return new EventFactorySupport().event(this, eventId);
}
use of org.springframework.webflow.action.EventFactorySupport in project cas by apereo.
the class GenericCasWebflowExceptionHandler method handle.
@Override
public Event handle(final Exception exception, final RequestContext requestContext) {
val messageContext = requestContext.getMessageContext();
LOGGER.trace("Unable to translate errors of the authentication exception [{}]. Returning [{}]", exception, CasWebflowExceptionHandler.UNKNOWN);
val message = buildErrorMessageResolver(exception, requestContext);
messageContext.addMessage(message);
return new EventFactorySupport().event(this, CasWebflowExceptionHandler.UNKNOWN);
}
use of org.springframework.webflow.action.EventFactorySupport in project cas by apereo.
the class RenewAuthenticationRequestCheckAction method doExecute.
@Override
protected Event doExecute(final RequestContext requestContext) {
val ssoRequest = SingleSignOnParticipationRequest.builder().requestContext(requestContext).build();
val ssoParticipation = this.singleSignOnParticipationStrategy.supports(ssoRequest) && this.singleSignOnParticipationStrategy.isParticipating(ssoRequest);
if (ssoParticipation) {
return new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_PROCEED);
}
return new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_RENEW);
}
use of org.springframework.webflow.action.EventFactorySupport in project cas by apereo.
the class CheckWebAuthenticationRequestAction method doExecute.
@Override
protected Event doExecute(final RequestContext context) {
val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context);
LOGGER.trace("Checking request content type [{}] against [{}]", request.getContentType(), this.contentType);
val requestContentType = request.getContentType();
if (StringUtils.isNotBlank(requestContentType) && RegexUtils.find(this.contentType, requestContentType)) {
LOGGER.debug("Authentication request via type [{}] is not web-based", this.contentType);
return new EventFactorySupport().no(this);
}
LOGGER.debug("Authenticated request is identified as web-based via type [{}]", requestContentType);
return new EventFactorySupport().yes(this);
}
use of org.springframework.webflow.action.EventFactorySupport in project cas by apereo.
the class DuoSecurityUniversalPromptValidateLoginAction method doExecute.
@Override
protected Event doExecute(final RequestContext requestContext) throws Exception {
val requestParameters = requestContext.getRequestParameters();
if (requestParameters.contains(REQUEST_PARAMETER_CODE) && requestParameters.contains(REQUEST_PARAMETER_STATE)) {
val duoState = requestParameters.get(REQUEST_PARAMETER_STATE, String.class);
LOGGER.trace("Received Duo Security state [{}]", duoState);
var ticket = (TransientSessionTicket) null;
try {
ticket = centralAuthenticationService.getTicket(duoState, TransientSessionTicket.class);
val authentication = ticket.getProperty(Authentication.class.getSimpleName(), Authentication.class);
populateContextWithCredential(requestContext, ticket, authentication);
populateContextWithAuthentication(requestContext, ticket);
populateContextWithService(requestContext, ticket);
return super.doExecute(requestContext);
} catch (final Exception e) {
LoggingUtils.warn(LOGGER, e);
return new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_ERROR);
} finally {
if (ticket != null) {
val flowScope = ticket.getProperty(MutableAttributeMap.class.getSimpleName(), Map.class);
flowScope.forEach((key, value) -> requestContext.getFlowScope().put(key.toString(), value));
val credential = ticket.getProperty(Credential.class.getSimpleName(), Credential.class);
WebUtils.putCredential(requestContext, credential);
}
centralAuthenticationService.deleteTicket(duoState);
}
}
return new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_SKIP);
}
Aggregations