// 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
{
if (defaultAccessDeniedUrl != null)
{
AccessDeniedHandlerImpl defaultAccessDeniedHandler
= new AccessDeniedHandlerImpl();
defaultAccessDeniedHandler.setErrorPage(defaultAccessDeniedUrl);
defaultAccessDeniedHandler.handle(request, response, accessDeniedException);
}
else
{
super.handle(request, response, accessDeniedException);