1.前端页面写法
<a href="javascript:;" onclick="logoutBackground()">退出</a>
2.js
/** * 退出后台 */ function logoutBackground() { $.get("/admin/logout", function (msg) { if (msg === "true") { window.location.href = "/userlogin";//自定义静态页面路径 } else { alert("退出异常!"); } }); }
3.security配置
//登出操作 .logout().logoutUrl("/admin/logout") .logoutSuccessHandler((request, response, authentication) -> { PrintWriter writer = response.getWriter(); writer.write("true"); writer.close(); }).permitAll()
原文地址:https://www.cnblogs.com/pengwenfeng/p/9902732.html
时间: 2024-10-09 01:15:32