public class SSOInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
Cookie[] cookies = request.getCookies();
for (Cookie cookie : cookies) {
if (StringUtils.equals(cookie.getName(), "token")) {
// 根据cookie判断登录
String token = cookie.getValue();
xxx
}
}
}
}
Spring拦截器判断登录
最新推荐文章于 2022-02-25 23:55:00 发布