Spring boot + thymeleaf + Security会话过期返回登录界面片段之解决方案
问题的具体情形见【Spring boot + thymeleaf + Shiro 会话过期返回登录界面片段之解决方案】。
前端的处理同【Spring boot + thymeleaf + Shiro 会话过期返回登录界面片段之解决方案】。
spring security的后端集成org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoin,并实现commence方法,详见下图:
将上述的类注册成bean,并添加到security的异常认证器,详细代码如下:
通过以上设置,配置js的前端处理就完成了Spring Security会话过去返回登录界面片段的处理。