use of org.apereo.cas.authentication.AuthenticationException in project cas by apereo.
the class AbstractAuthenticationAction method doExecute.
@Override
protected Event doExecute(final RequestContext requestContext) throws Exception {
final String agent = WebUtils.getHttpServletRequestUserAgent();
final GeoLocationRequest geoLocation = WebUtils.getHttpServletRequestGeoLocation();
if (!adaptiveAuthenticationPolicy.apply(agent, geoLocation)) {
final String msg = "Adaptive authentication policy does not allow this request for " + agent + " and " + geoLocation;
final Map<String, Class<? extends Exception>> map = Collections.singletonMap(UnauthorizedAuthenticationException.class.getSimpleName(), UnauthorizedAuthenticationException.class);
final AuthenticationException error = new AuthenticationException(msg, map, Collections.emptyMap());
return new Event(this, CasWebflowConstants.TRANSITION_ID_AUTHENTICATION_FAILURE, new LocalAttributeMap(CasWebflowConstants.TRANSITION_ID_ERROR, error));
}
final Event serviceTicketEvent = this.serviceTicketRequestWebflowEventResolver.resolveSingle(requestContext);
if (serviceTicketEvent != null) {
fireEventHooks(serviceTicketEvent, requestContext);
return serviceTicketEvent;
}
final Event finalEvent = this.initialAuthenticationAttemptWebflowEventResolver.resolveSingle(requestContext);
fireEventHooks(finalEvent, requestContext);
return finalEvent;
}
Aggregations