use of org.pac4j.core.exception.http.WithContentAction in project cas by apereo.
the class BaseDelegatedAuthenticationController method getResultingView.
/**
* Gets resulting view.
*
* @param client the client
* @param webContext the web context
* @param ticket the ticket
* @return the resulting view
* @throws Exception the exception
*/
protected View getResultingView(final IndirectClient client, final WebContext webContext, final TransientSessionTicket ticket) throws Exception {
client.init();
val actionResult = getRedirectionAction(client, webContext, ticket);
if (actionResult.isPresent()) {
val action = actionResult.get();
LOGGER.debug("Determined final redirect action for client [{}] as [{}]", client, action);
if (action instanceof WithLocationAction) {
val foundAction = WithLocationAction.class.cast(action);
val builder = new URIBuilder(foundAction.getLocation());
val url = builder.toString();
LOGGER.debug("Redirecting client [{}] to [{}] based on identifier [{}]", client.getName(), url, ticket.getId());
return new RedirectView(url);
}
if (action instanceof WithContentAction) {
val seeOtherAction = WithContentAction.class.cast(action);
return new DynamicHtmlView(seeOtherAction.getContent());
}
}
LOGGER.warn("Unable to determine redirect action for client [{}]", client);
return null;
}
Aggregations