List of usage examples for org.springframework.security.web.access AccessDeniedHandlerImpl handle
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException
From source file:org.socialsignin.springsocial.security.signin.SpringSocialSecurityAccessDeniedHandler.java
@Override public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { // Save the request so we can provide user with a continue link after provider connection requestCache.saveRequest(request, response); // Attempt to determine a set of provider ids which are required for this request which the current user has not yet connected with Set<String> requiredProviderIds = getRequiredProviderIds(request); if (requiredProviderIds != null && !requiredProviderIds.isEmpty()) { // If we have found a set of provider ids which the user needs to connect with for this request, select one of them and send the user to the connect/<provider> page AccessDeniedHandlerImpl providerSpecificAccessDeniedHandler = new AccessDeniedHandlerImpl(); request.setAttribute(REQUIRED_PROVIDERS_REQUEST_ATTRIBUTE_NAME, requiredProviderIds); providerSpecificAccessDeniedHandler .setErrorPage(connectWithProviderUrlPrefix + "/" + requiredProviderIds.iterator().next()); providerSpecificAccessDeniedHandler.handle(request, response, accessDeniedException); } else {/*www . j a v a 2 s. c om*/ if (defaultAccessDeniedUrl != null) { AccessDeniedHandlerImpl defaultAccessDeniedHandler = new AccessDeniedHandlerImpl(); defaultAccessDeniedHandler.setErrorPage(defaultAccessDeniedUrl); defaultAccessDeniedHandler.handle(request, response, accessDeniedException); } else { super.handle(request, response, accessDeniedException); } } }