/** * Common logic for OAuth failed. (Note that the default logic doesn't pass the failure through so as to not mess * with the current authentication.) * * @param request The request. * @param response The response. * @param failure The failure. * @throws ServletException in the case of an underlying Servlet API exception * @throws IOException in the case of general IO exceptions */ protected void fail(HttpServletRequest request, HttpServletResponse response, OAuthRequestFailedException failure) throws IOException, ServletException { try { //attempt to set the last exception. request.getSession().setAttribute(OAUTH_FAILURE_KEY, failure); } catch (Exception e) { //fall through.... } if (LOG.isDebugEnabled()) { LOG.debug(failure); } if (getOAuthFailureHandler() != null) { getOAuthFailureHandler().handle(request, response, failure); } else { throw failure; } }
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { for (Entry<Class<? extends AccessDeniedException>, AccessDeniedHandler> entry : handlers .entrySet()) { Class<? extends AccessDeniedException> handlerClass = entry.getKey(); if (handlerClass.isAssignableFrom(accessDeniedException.getClass())) { AccessDeniedHandler handler = entry.getValue(); handler.handle(request, response, accessDeniedException); return; } } defaultHandler.handle(request, response, accessDeniedException); }
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { for (Entry<RequestMatcher, AccessDeniedHandler> entry : this.handlers .entrySet()) { RequestMatcher matcher = entry.getKey(); if (matcher.matches(request)) { AccessDeniedHandler handler = entry.getValue(); handler.handle(request, response, accessDeniedException); return; } } defaultHandler.handle(request, response, accessDeniedException); }
/** * Forward to accessDeniedHandler. * * @param request * the request * @param response * HTTP Response * @param ae * the ae */ private void sendAccessDenied(final HttpServletRequest request, final HttpServletResponse response, final AccessDeniedException ae) { if (this.accessDeniedHandler != null) { try { this.accessDeniedHandler.handle(request, response, ae); return; } catch (final IOException e) { DelegatingNegotiateSecurityFilter.LOGGER.warn("IOException invoking accessDeniedHandler: {}", e.getMessage()); DelegatingNegotiateSecurityFilter.LOGGER.trace("", e); } catch (final ServletException e) { DelegatingNegotiateSecurityFilter.LOGGER.warn("ServletException invoking accessDeniedHandler: {}", e.getMessage()); DelegatingNegotiateSecurityFilter.LOGGER.trace("", e); } } // fallback this.sendUnauthorized(response, true); }
/** * Forward to accessDeniedHandler. * * @param request * the request * @param response * HTTP Response * @param ae * the ae */ private void sendAccessDenied(final HttpServletRequest request, final HttpServletResponse response, final AccessDeniedException ae) { if (this.accessDeniedHandler != null) { try { this.accessDeniedHandler.handle(request, response, ae); return; } catch (final IOException e) { DelegatingNegotiateSecurityFilter.LOGGER.warn("IOException invoking accessDeniedHandler: {}", e.getMessage()); DelegatingNegotiateSecurityFilter.LOGGER.trace("", e); } catch (final ServletException e) { DelegatingNegotiateSecurityFilter.LOGGER.warn("ServletException invoking accessDeniedHandler: {}", e.getMessage()); DelegatingNegotiateSecurityFilter.LOGGER.trace("", e); } } // fallback this.sendUnauthorized(response, true); }
/** * Forward to accessDeniedHandler. * * @param request * the request * @param response * HTTP Response * @param ae * the ae */ private void sendAccessDenied(final HttpServletRequest request, final HttpServletResponse response, final AccessDeniedException ae) { if (this.accessDeniedHandler != null) { try { this.accessDeniedHandler.handle(request, response, ae); return; } catch (final IOException e) { DelegatingNegotiateSecurityFilter.LOGGER.warn("IOException invoking accessDeniedHandler: {}", e.getMessage()); DelegatingNegotiateSecurityFilter.LOGGER.trace("", e); } catch (final ServletException e) { DelegatingNegotiateSecurityFilter.LOGGER.warn("ServletException invoking accessDeniedHandler: {}", e.getMessage()); DelegatingNegotiateSecurityFilter.LOGGER.trace("", e); } } // fallback this.sendUnauthorized(response, true); }
/** * Forward to accessDeniedHandler. * * @param request * the request * @param response * HTTP Response * @param ae * the ae */ private void sendAccessDenied(final HttpServletRequest request, final HttpServletResponse response, final AccessDeniedException ae) { if (this.accessDeniedHandler != null) { try { this.accessDeniedHandler.handle(request, response, ae); return; } catch (final IOException e) { DelegatingNegotiateSecurityFilter.LOGGER.warn("IOException invoking accessDeniedHandler: {}", e.getMessage()); DelegatingNegotiateSecurityFilter.LOGGER.trace("", e); } catch (final ServletException e) { DelegatingNegotiateSecurityFilter.LOGGER.warn("ServletException invoking accessDeniedHandler: {}", e.getMessage()); DelegatingNegotiateSecurityFilter.LOGGER.trace("", e); } } // fallback this.sendUnauthorized(response, true); }
exception); accessDeniedHandler.handle(request, response, (AccessDeniedException) exception);