List of usage examples for org.springframework.security.web.authentication LoginUrlAuthenticationEntryPoint commence
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException
From source file:org.cloudfoundry.identity.uaa.security.CsrfAwareEntryPointAndDeniedHandler.java
protected void internalHandle(HttpServletRequest request, HttpServletResponse response, Exception exception) throws IOException, ServletException { AuthenticationException authEx = (exception instanceof AuthenticationException) ? (AuthenticationException) exception : new InternalAuthenticationServiceException("Access denied.", exception); if (wantJson(request)) { response.setStatus(HttpServletResponse.SC_FORBIDDEN); response.setContentType(MediaType.APPLICATION_JSON_VALUE); response.getWriter().append(String.format("{\"error\":\"%s\"}", exception.getMessage())); } else {/*from w ww .j a va2s. co m*/ LoginUrlAuthenticationEntryPoint entryPoint = getLoginUrlAuthenticationEntryPoint(exception); entryPoint.commence(request, response, authEx); } }