public Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException {
if (mandatory) {
try {
((HttpServletResponse)response).sendError(HttpServletResponse.SC_FORBIDDEN);
} catch (IOException e) {
throw new ServerAuthException(e);
}
return Authentication.SEND_FAILURE;
} else {
return Authentication.UNAUTHENTICATED;
}