默认情况下,spring security如果检测到未登录,会返回一个登录页面。对于前后端分离的项目,我们一般是希望能返回自定义的JSON数据。这时候,就需要继承类LoginUrlAuthenticationEntryPoint,并重写其
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException
方法。(未完待续)