{"id":5439,"date":"2022-04-21T22:11:58","date_gmt":"2022-04-21T14:11:58","guid":{"rendered":"http:\/\/123.57.164.21\/?p=5439"},"modified":"2022-04-21T22:11:58","modified_gmt":"2022-04-21T14:11:58","slug":"%e4%bb%80%e4%b9%88%e6%98%af%e5%8d%95%e7%82%b9%e7%99%bb%e5%bd%95sso","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=5439","title":{"rendered":"\u4ec0\u4e48\u662f\u5355\u70b9\u767b\u5f55(SSO)"},"content":{"rendered":"\n<p>\u8f6c\u8f7d\uff1ahttps:\/\/github.com\/ZhongFuCheng3y\/3y<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">\u524d\u8a00<\/h6>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5728\u524d\u9635\u5b50\u6709\u4e2a\u8bfb\u8005\u6765\u6211\u8fd9\u6295\u7a3f\uff0c\u662f\u4f7f\u7528JWT\u5b9e\u73b0\u5355\u70b9\u767b\u5f55\u7684\uff08\u4f46\u662f\u6587\u7ae0\u4e2d\u5e76\u6ca1\u6709\u4ecb\u7ecd\u4ec0\u4e48\u662f\u5355\u70b9\u767b\u5f55\uff09\uff0c\u6240\u4ee5\u6211\u89c9\u5f97\u662f\u65f6\u5019\u6765\u6574\u7406\u4e00\u4e0b\u4e86\u3002<\/p>\n\n\n\n<ul><li><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzI4Njg5MDA5NA==&amp;mid=2247485189&amp;idx=1&amp;sn=44e9558f3a03f9c5e1ec539e1a10dbe2&amp;chksm=ebd74604dca0cf126c64586b448ee8c7bccd51545d7a27d06b21bc75a2e390f961d7cafac375&amp;token=1875959808&amp;lang=zh_CN&amp;scene=21#wechat_redirect\">\u7b80\u5355\u4ee3\u7801\u5b9e\u73b0JWT(json web token)\u5b8c\u6210SSO\u5355\u70b9\u767b\u5f55<\/a><\/li><\/ul>\n\n\n\n<h6 class=\"wp-block-heading\">\u4e00\u3001\u4ec0\u4e48\u662f\u5355\u70b9\u767b\u5f55\uff1f<\/h6>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5355\u70b9\u767b\u5f55\u7684\u82f1\u6587\u540d\u53eb\u505a\uff1aSingle Sign On\uff08\u7b80\u79f0<strong>SSO<\/strong>\uff09\u3002<\/p>\n\n\n\n<p>\u5728<strong>\u521d\u5b66\/\u4ee5\u524d<\/strong>\u7684\u65f6\u5019\uff0c\u4e00\u822c\u6211\u4eec\u5c31<strong>\u5355\u7cfb\u7edf<\/strong>\uff0c\u6240\u6709\u7684\u529f\u80fd\u90fd\u5728\u540c\u4e00\u4e2a\u7cfb\u7edf\u4e0a\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-86-1024x510.png\" alt=\"\" class=\"wp-image-5440\" width=\"534\" height=\"266\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-86-1024x510.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-86-300x149.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-86-768x383.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-86-830x413.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-86-230x115.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-86-350x174.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-86-480x239.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-86.png 1080w\" sizes=\"(max-width: 534px) 100vw, 534px\" \/><\/figure><\/div>\n\n\n\n<p>\u540e\u6765\uff0c\u6211\u4eec\u4e3a\u4e86<strong>\u5408\u7406\u5229\u7528\u8d44\u6e90\u548c\u964d\u4f4e\u8026\u5408\u6027<\/strong>\uff0c\u4e8e\u662f\u628a\u5355\u7cfb\u7edf<strong>\u62c6\u5206<\/strong>\u6210\u591a\u4e2a\u5b50\u7cfb\u7edf\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-87-1024x439.png\" alt=\"\" class=\"wp-image-5441\" width=\"501\" height=\"214\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-87-1024x439.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-87-300x128.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-87-768x329.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-87-830x356.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-87-230x99.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-87-350x150.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-87-480x206.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-87.png 1144w\" sizes=\"(max-width: 501px) 100vw, 501px\" \/><\/figure><\/div>\n\n\n\n<p>\u6bd4\u5982\u963f\u91cc\u7cfb\u7684<strong>\u6dd8\u5b9d\u548c\u5929\u732b<\/strong>\uff0c\u5f88\u660e\u663e\u5730\u6211\u4eec\u53ef\u4ee5\u77e5\u9053\u8fd9\u662f\u4e24\u4e2a\u7cfb\u7edf\uff0c\u4f46\u662f\u4f60\u5728\u4f7f\u7528\u7684\u65f6\u5019\uff0c\u767b\u5f55\u4e86\u5929\u732b\uff0c\u6dd8\u5b9d\u4e5f\u4f1a\u81ea\u52a8\u767b\u5f55\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-88-1024x614.png\" alt=\"\" class=\"wp-image-5442\" width=\"404\" height=\"241\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-88-1024x614.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-88-300x180.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-88-830x498.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-88-230x138.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-88-350x210.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-88-480x288.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-88.png 1210w\" sizes=\"(max-width: 404px) 100vw, 404px\" \/><\/figure><\/div>\n\n\n\n<p>\u7b80\u5355\u6765\u8bf4\uff0c\u5355\u70b9\u767b\u5f55\u5c31\u662f<strong>\u5728\u591a\u4e2a\u7cfb\u7edf\u4e2d\uff0c\u7528\u6237\u53ea\u9700\u4e00\u6b21\u767b\u5f55\uff0c\u5404\u4e2a\u7cfb\u7edf\u5373\u53ef\u611f\u77e5\u8be5\u7528\u6237\u5df2\u7ecf\u767b\u5f55\u3002<\/strong><\/p>\n\n\n\n<h6 class=\"wp-block-heading\">\u4e8c\u3001\u56de\u987e\u5355\u7cfb\u7edf\u767b\u5f55<\/h6>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5728\u6211\u521d\u5b66JavaWeb\u7684\u65f6\u5019\uff0c\u767b\u5f55\u548c\u6ce8\u518c\u662f\u6211\u505a\u5f97\u6700\u591a\u7684\u4e00\u4e2a\u529f\u80fd\u4e86\uff08\u521d\u5b66Servlet\u7684\u65f6\u5019\u505a\u8fc7\u3001\u5b66SpringMVC\u7684\u65f6\u5019\u505a\u8fc7\u3001\u8ddf\u7740\u505a\u9879\u76ee\u7684\u65f6\u5019\u505a\u8fc7\u2026\uff09\uff0c\u53cd\u6b63\u6211\u4e5f\u6570\u4e0d\u6e05\u6211\u505a\u4e86\u591a\u5c11\u6b21\u767b\u5f55\u548c\u6ce8\u518c\u7684\u529f\u80fd\u4e86\u2026\u8fd9\u91cc\u7b80\u5355\u8bb2\u8ff0\u4e00\u4e0b\u6211\u4eec\u521d\u5b66\u65f6\u662f\u600e\u4e48\u505a\u767b\u5f55\u529f\u80fd\u7684\u3002<\/p>\n\n\n\n<p>\u4f17\u6240\u5468\u77e5\uff0cHTTP\u662f<strong>\u65e0\u72b6\u6001<\/strong>\u7684\u534f\u8bae\uff0c\u8fd9\u610f\u5473\u7740<strong>\u670d\u52a1\u5668\u65e0\u6cd5\u786e\u8ba4\u7528\u6237\u7684\u4fe1\u606f<\/strong>\u3002\u4e8e\u662f\u4e4e\uff0cW3C\u5c31\u63d0\u51fa\u4e86\uff1a\u7ed9\u6bcf\u4e00\u4e2a\u7528\u6237\u90fd\u53d1\u4e00\u4e2a\u901a\u884c\u8bc1\uff0c\u65e0\u8bba\u8c01\u8bbf\u95ee\u7684\u65f6\u5019\u90fd\u9700\u8981\u643a\u5e26\u901a\u884c\u8bc1\uff0c\u8fd9\u6837\u670d\u52a1\u5668\u5c31\u53ef\u4ee5\u4ece\u901a\u884c\u8bc1\u4e0a\u786e\u8ba4\u7528\u6237\u7684\u4fe1\u606f\u3002\u901a\u884c\u8bc1\u5c31\u662f<strong>Cookie<\/strong>\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u8bf4Cookie\u662f\u68c0\u67e5\u7528\u6237\u8eab\u4e0a\u7684\u201d\u901a\u884c\u8bc1\u201c\u6765\u786e\u8ba4\u7528\u6237\u7684\u8eab\u4efd\uff0c\u90a3\u4e48Session\u5c31\u662f\u901a\u8fc7\u68c0\u67e5\u670d\u52a1\u5668\u4e0a\u7684\u201d\u5ba2\u6237\u660e\u7ec6\u8868\u201c\u6765\u786e\u8ba4\u7528\u6237\u7684\u8eab\u4efd\u7684\u3002<strong>Session\u76f8\u5f53\u4e8e\u5728\u670d\u52a1\u5668\u4e2d\u5efa\u7acb\u4e86\u4e00\u4efd\u201c\u5ba2\u6237\u660e\u7ec6\u8868\u201d<\/strong>\u3002<\/p>\n\n\n\n<p>HTTP\u534f\u8bae\u662f\u65e0\u72b6\u6001\u7684\uff0cSession\u4e0d\u80fd\u4f9d\u636eHTTP\u8fde\u63a5\u6765\u5224\u65ad\u662f\u5426\u4e3a\u540c\u4e00\u4e2a\u7528\u6237\u3002\u4e8e\u662f\u4e4e\uff1a\u670d\u52a1\u5668\u5411\u7528\u6237\u6d4f\u89c8\u5668\u53d1\u9001\u4e86\u4e00\u4e2a\u540d\u4e3aJESSIONID\u7684Cookie\uff0c\u5b83\u7684\u503c\u662fSession\u7684id\u503c\u3002<strong>\u5176\u5b9eSession\u662f\u4f9d\u636eCookie\u6765\u8bc6\u522b\u662f\u5426\u662f\u540c\u4e00\u4e2a\u7528\u6237<\/strong>\u3002<\/p>\n\n\n\n<p>\u6240\u4ee5\uff0c\u4e00\u822c\u6211\u4eec\u5355\u7cfb\u7edf\u5b9e\u73b0\u767b\u5f55\u4f1a\u8fd9\u6837\u505a\uff1a<\/p>\n\n\n\n<ul><li><strong>\u767b\u5f55<\/strong>\uff1a\u5c06\u7528\u6237\u4fe1\u606f\u4fdd\u5b58\u5728Session\u5bf9\u8c61\u4e2d<ul><li>\u5982\u679c\u5728Session\u5bf9\u8c61\u4e2d\u80fd\u67e5\u5230\uff0c\u8bf4\u660e\u5df2\u7ecf\u767b\u5f55<\/li><li>\u5982\u679c\u5728Session\u5bf9\u8c61\u4e2d\u67e5\u4e0d\u5230\uff0c\u8bf4\u660e\u6ca1\u767b\u5f55\uff08\u6216\u8005\u5df2\u7ecf\u9000\u51fa\u4e86\u767b\u5f55\uff09<\/li><\/ul><\/li><li><strong>\u6ce8\u9500\uff08\u9000\u51fa\u767b\u5f55\uff09<\/strong>\uff1a\u4eceSession\u4e2d\u5220\u9664\u7528\u6237\u7684\u4fe1\u606f<\/li><li><strong>\u8bb0\u4f4f\u6211\uff08\u5173\u95ed\u6389\u6d4f\u89c8\u5668\u540e\uff0c\u91cd\u65b0\u6253\u5f00\u6d4f\u89c8\u5668\u8fd8\u80fd\u4fdd\u6301\u767b\u5f55\u72b6\u6001\uff09<\/strong>\uff1a\u914d\u5408Cookie\u6765\u7528<\/li><\/ul>\n\n\n\n<p>\u6211\u4e4b\u524dDemo\u7684\u4ee3\u7801\uff0c\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u6237\u767b\u9646\n *\/\n@PostMapping(value = \"\/user\/session\", produces = {\"application\/json;charset=UTF-8\"})\npublic Result login(String mobileNo, String password, String inputCaptcha, HttpSession session, HttpServletResponse response) {\n\n    \/\/\u5224\u65ad\u9a8c\u8bc1\u7801\u662f\u5426\u6b63\u786e\n    if (WebUtils.validateCaptcha(inputCaptcha, \"captcha\", session)) {\n\n        \/\/\u5224\u65ad\u6709\u6ca1\u6709\u8be5\u7528\u6237\n        User user = userService.userLogin(mobileNo, password);\n        if (user != null) {\n            \/*\u8bbe\u7f6e\u81ea\u52a8\u767b\u9646\uff0c\u4e00\u4e2a\u661f\u671f.  \u5c06token\u4fdd\u5b58\u5728\u6570\u636e\u5e93\u4e2d*\/\n            String loginToken = WebUtils.md5(new Date().toString() + session.getId());\n            user.setLoginToken(loginToken);\n            User user1 = userService.userUpload(user);\n\n            session.setAttribute(\"user\", user1);\n\n            CookieUtil.addCookie(response,\"loginToken\",loginToken,604800);\n\n            return ResultUtil.success(user1);\n\n        } else {\n            return ResultUtil.error(ResultEnum.LOGIN_ERROR);\n        }\n    } else {\n        return ResultUtil.error(ResultEnum.CAPTCHA_ERROR);\n    }\n\n}\n\n\/**\n * \u7528\u6237\u9000\u51fa\n *\/\n@DeleteMapping(value = \"\/session\", produces = {\"application\/json;charset=UTF-8\"})\npublic Result logout(HttpSession session,HttpServletRequest request,HttpServletResponse response ) {\n\n    \/\/\u5220\u9664session\u548ccookie\n    session.removeAttribute(\"user\");\n\n    CookieUtil.clearCookie(request, response, \"loginToken\");\n\n    return ResultUtil.success();\n}\n\/**\n* @author ozc\n* @version 1.0\n* &lt;p>\n* \u62e6\u622a\u5668\uff1b\u5b9e\u73b0\u81ea\u52a8\u767b\u9646\u529f\u80fd\n*\/\npublic class UserInterceptor implements HandlerInterceptor {\n\n\n@Autowired\nprivate UserService userService;\n\npublic boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws Exception {\n    User sessionUser = (User) request.getSession().getAttribute(\"user\");\n\n    \/\/ \u5df2\u7ecf\u767b\u9646\u4e86\uff0c\u653e\u884c\n    if (sessionUser != null) {\n        return true;\n    } else {\n        \/\/\u5f97\u5230\u5e26\u8fc7\u6765cookie\u662f\u5426\u5b58\u5728\n        String loginToken = CookieUtil.findCookieByName(request, \"loginToken\");\n        if (StringUtils.isNotBlank(loginToken)) {\n            \/\/\u5230\u6570\u636e\u5e93\u67e5\u8be2\u6709\u6ca1\u6709\u8be5Cookie\n            User user = userService.findUserByLoginToken(loginToken);\n            if (user != null) {\n                request.getSession().setAttribute(\"user\", user);\n                return true;\n            } else {\n                \/\/\u6ca1\u6709\u8be5Cookie\u4e0e\u4e4b\u5bf9\u5e94\u7684\u7528\u6237(Cookie\u4e0d\u5339\u914d)\n                CookieUtil.clearCookie(request, response, \"loginToken\");\n                return false;\n            }\n        } else {\n\n            \/\/\u6ca1\u6709cookie\u3001\u4e5f\u6ca1\u6709\u767b\u9646\u3002\u662findex\u8bf7\u6c42\u83b7\u53d6\u7528\u6237\u4fe1\u606f\uff0c\u53ef\u4ee5\u653e\u884c\n            if (request.getRequestURI().contains(\"session\")) {\n                return true;\n            }\n\n            \/\/\u6ca1\u6709cookie\u51ed\u8bc1\n            response.sendRedirect(\"\/login.html\");\n            return false;\n        }\n    }<\/pre>\n\n\n\n<p>\u603b\u7ed3\u4e00\u4e0b\u4e0a\u9762\u4ee3\u7801\u7684\u601d\u8def\uff1a<\/p>\n\n\n\n<ul><li>\u7528\u6237\u767b\u5f55\u65f6\uff0c\u9a8c\u8bc1\u7528\u6237\u7684\u8d26\u6237\u548c\u5bc6\u7801<\/li><li>\u751f\u6210\u4e00\u4e2aToken\u4fdd\u5b58\u5728\u6570\u636e\u5e93\u4e2d\uff0c\u5c06Token\u5199\u5230Cookie\u4e2d<\/li><li>\u5c06\u7528\u6237\u6570\u636e\u4fdd\u5b58\u5728Session\u4e2d<\/li><li>\u8bf7\u6c42\u65f6\u90fd\u4f1a\u5e26\u4e0aCookie\uff0c\u68c0\u67e5\u6709\u6ca1\u6709\u767b\u5f55\uff0c\u5982\u679c\u5df2\u7ecf\u767b\u5f55\u5219\u653e\u884c<\/li><\/ul>\n\n\n\n<p>\u5982\u679c\u6ca1\u770b\u61c2\u7684\u540c\u5b66\uff0c\u5efa\u8bae\u56de\u987eSession\u548cCookie\u548cHTTP\uff1a<\/p>\n\n\n\n<ul><li><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzI4Njg5MDA5NA==&amp;mid=2247484755&amp;idx=6&amp;sn=3a370551b0ee800f3bcad8ff37a72b9d&amp;scene=21#wechat_redirect\">\u4ecb\u7ecd\u4f1a\u8bdd\u6280\u672f\u3001Cookie\u7684API\u3001\u8be6\u89e3\u3001\u5e94\u7528<\/a><\/li><li><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzI4Njg5MDA5NA==&amp;mid=2247484755&amp;idx=7&amp;sn=fb35232f3c15e2b4336498ac9f8804f1&amp;scene=21#wechat_redirect\">Session\u4ecb\u7ecd\u3001API\u3001\u751f\u547d\u5468\u671f\u3001\u5e94\u7528\u3001\u4e0eCookie\u533a\u522b<\/a><\/li><li><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzI4Njg5MDA5NA==&amp;mid=2247484979&amp;idx=2&amp;sn=abe78c7ce58c15cb8b2e26602802e096&amp;scene=21#wechat_redirect\">\u4ec0\u4e48\u662fHTTP<\/a><\/li><\/ul>\n\n\n\n<h6 class=\"wp-block-heading\">\u4e09\u3001\u591a\u7cfb\u7edf\u767b\u5f55\u7684\u95ee\u9898\u4e0e\u89e3\u51b3<\/h6>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"81\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-90-1024x81.png\" alt=\"\" class=\"wp-image-5444\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-90-1024x81.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-90-300x24.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-90-768x61.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-90-830x66.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-90-230x18.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-90-350x28.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-90-480x38.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-90.png 1260w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u5355\u7cfb\u7edf\u767b\u5f55\u529f\u80fd\u4e3b\u8981\u662f\u7528Session\u4fdd\u5b58\u7528\u6237\u4fe1\u606f\u6765\u5b9e\u73b0\u7684\uff0c\u4f46\u6211\u4eec\u6e05\u695a\u7684\u662f\uff1a\u591a\u7cfb\u7edf\u5373\u53ef\u80fd\u6709\u591a\u4e2aTomcat\uff0c\u800cSession\u662f\u4f9d\u8d56\u5f53\u524d\u7cfb\u7edf\u7684Tomcat\uff0c\u6240\u4ee5\u7cfb\u7edfA\u7684Session\u548c\u7cfb\u7edfB\u7684Session\u662f<strong>\u4e0d\u5171\u4eab<\/strong>\u7684\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-91-1024x309.png\" alt=\"\" class=\"wp-image-5445\" width=\"542\" height=\"163\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-91-1024x309.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-91-300x91.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-91-768x232.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-91-830x251.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-91-230x69.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-91-350x106.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-91-480x145.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-91.png 1206w\" sizes=\"(max-width: 542px) 100vw, 542px\" \/><\/figure><\/div>\n\n\n\n<p>\u89e3\u51b3\u7cfb\u7edf\u4e4b\u95f4Session\u4e0d\u5171\u4eab\u95ee\u9898\u6709\u4e00\u4e0b\u51e0\u79cd\u65b9\u6848\uff1a<\/p>\n\n\n\n<ul><li>Tomcat\u96c6\u7fa4Session\u5168\u5c40\u590d\u5236\uff08\u96c6\u7fa4\u5185\u6bcf\u4e2atomcat\u7684session\u5b8c\u5168\u540c\u6b65\uff09\u3010\u4f1a\u5f71\u54cd\u96c6\u7fa4\u7684\u6027\u80fd\u5462\uff0c\u4e0d\u5efa\u8bae\u3011<\/li><li>\u6839\u636e\u8bf7\u6c42\u7684IP\u8fdb\u884c<strong>Hash\u6620\u5c04<\/strong>\u5230\u5bf9\u5e94\u7684\u673a\u5668\u4e0a\uff08\u8fd9\u5c31\u76f8\u5f53\u4e8e\u8bf7\u6c42\u7684IP\u4e00\u76f4\u4f1a\u8bbf\u95ee\u540c\u4e00\u4e2a\u670d\u52a1\u5668\uff09\u3010\u5982\u679c\u670d\u52a1\u5668\u5b95\u673a\u4e86\uff0c\u4f1a\u4e22\u5931\u4e86\u4e00\u5927\u90e8\u5206Session\u7684\u6570\u636e\uff0c\u4e0d\u5efa\u8bae\u3011<\/li><li>\u628aSession\u6570\u636e\u653e\u5728Redis\u4e2d\uff08\u4f7f\u7528Redis\u6a21\u62dfSession\uff09\u3010<strong>\u5efa\u8bae<\/strong>\u3011<ul><li>\u5982\u679c\u8fd8\u4e0d\u4e86\u89e3Redis\u7684\u540c\u5b66\uff0c\u5efa\u8bae\u79fb\u6b65\uff08<a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzI4Njg5MDA5NA==&amp;mid=2247484609&amp;idx=1&amp;sn=4c053236699fde3c2db1241ab497487b&amp;scene=21#wechat_redirect\">Redis\u5408\u96c6<\/a>\uff09<\/li><\/ul><\/li><\/ul>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u5c06\u767b\u5f55\u529f\u80fd<strong>\u5355\u72ec\u62bd\u53d6<\/strong>\u51fa\u6765\uff0c\u505a\u6210\u4e00\u4e2a\u5b50\u7cfb\u7edf\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-92-1024x425.png\" alt=\"\" class=\"wp-image-5446\" width=\"523\" height=\"216\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-92-1024x425.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-92-300x124.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-92-768x319.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-92-830x344.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-92-230x95.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-92-350x145.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-92-480x199.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-92.png 1152w\" sizes=\"(max-width: 523px) 100vw, 523px\" \/><\/figure><\/div>\n\n\n\n<p>SSO\uff08\u767b\u5f55\u7cfb\u7edf\uff09\u7684\u903b\u8f91\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/ \u767b\u5f55\u529f\u80fd(SSO\u5355\u72ec\u7684\u670d\u52a1)\n@Override\npublic TaotaoResult login(String username, String password) throws Exception {\n\n    \/\/\u6839\u636e\u7528\u6237\u540d\u67e5\u8be2\u7528\u6237\u4fe1\u606f\n    TbUserExample example = new TbUserExample();\n    Criteria criteria = example.createCriteria();\n    criteria.andUsernameEqualTo(username);\n    List&lt;TbUser> list = userMapper.selectByExample(example);\n    if (null == list || list.isEmpty()) {\n        return TaotaoResult.build(400, \"\u7528\u6237\u4e0d\u5b58\u5728\");\n    }\n    \/\/\u6838\u5bf9\u5bc6\u7801\n    TbUser user = list.get(0);\n    if (!DigestUtils.md5DigestAsHex(password.getBytes()).equals(user.getPassword())) {\n        return TaotaoResult.build(400, \"\u5bc6\u7801\u9519\u8bef\");\n    }\n    \/\/\u767b\u5f55\u6210\u529f\uff0c\u628a\u7528\u6237\u4fe1\u606f\u5199\u5165redis\n    \/\/\u751f\u6210\u4e00\u4e2a\u7528\u6237token\n    String token = UUID.randomUUID().toString();\n    jedisCluster.set(USER_TOKEN_KEY + \":\" + token, JsonUtils.objectToJson(user));\n    \/\/\u8bbe\u7f6esession\u8fc7\u671f\u65f6\u95f4\n    jedisCluster.expire(USER_TOKEN_KEY + \":\" + token, SESSION_EXPIRE_TIME);\n    return TaotaoResult.ok(token);\n}\n\n<\/pre>\n\n\n\n<p>\u5176\u4ed6\u5b50\u7cfb\u7edf\u767b\u5f55\u65f6\uff0c<strong>\u8bf7\u6c42SSO\uff08\u767b\u5f55\u7cfb\u7edf\uff09\u8fdb\u884c\u767b\u5f55\uff0c\u5c06\u8fd4\u56de\u7684token\u5199\u5230Cookie\u4e2d<\/strong>\uff0c\u4e0b\u6b21\u8bbf\u95ee\u65f6\u5219\u628aCookie\u5e26\u4e0a\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public TaotaoResult login(String username, String password, \n        HttpServletRequest request, HttpServletResponse response) {\n    \/\/\u8bf7\u6c42\u53c2\u6570\n    Map&lt;String, String> param = new HashMap&lt;>();\n    param.put(\"username\", username);\n    param.put(\"password\", password);\n    \/\/\u767b\u5f55\u5904\u7406\n    String stringResult = HttpClientUtil.doPost(REGISTER_USER_URL + USER_LOGIN_URL, param);\n    TaotaoResult result = TaotaoResult.format(stringResult);\n    \/\/\u767b\u5f55\u51fa\u9519\n    if (result.getStatus() != 200) {\n        return result;\n    }\n    \/\/\u767b\u5f55\u6210\u529f\u540e\u628a\u53d6token\u4fe1\u606f\uff0c\u5e76\u5199\u5165cookie\n    String token = (String) result.getData();\n    \/\/\u5199\u5165cookie\n    CookieUtils.setCookie(request, response, \"TT_TOKEN\", token);\n    \/\/\u8fd4\u56de\u6210\u529f\n    return result;\n\n}<\/pre>\n\n\n\n<p>\u603b\u7ed3\uff1a<\/p>\n\n\n\n<ul><li>SSO\u7cfb\u7edf\u751f\u6210\u4e00\u4e2atoken\uff0c\u5e76\u5c06\u7528\u6237\u4fe1\u606f\u5b58\u5230Redis\u4e2d\uff0c\u5e76\u8bbe\u7f6e\u8fc7\u671f\u65f6\u95f4<\/li><li>\u5176\u4ed6\u7cfb\u7edf\u8bf7\u6c42SSO\u7cfb\u7edf\u8fdb\u884c\u767b\u5f55\uff0c\u5f97\u5230SSO\u8fd4\u56de\u7684token\uff0c\u5199\u5230Cookie\u4e2d<\/li><li>\u6bcf\u6b21\u8bf7\u6c42\u65f6\uff0cCookie\u90fd\u4f1a\u5e26\u4e0a\uff0c\u62e6\u622a\u5668\u5f97\u5230token\uff0c\u5224\u65ad\u662f\u5426\u5df2\u7ecf\u767b\u5f55<\/li><\/ul>\n\n\n\n<p>\u5230\u8fd9\u91cc\uff0c\u5176\u5b9e\u6211\u4eec\u4f1a\u53d1\u73b0\u5176\u5b9e\u5c31\u4e24\u4e2a\u53d8\u5316\uff1a<\/p>\n\n\n\n<ul><li><strong>\u5c06\u767b\u9646\u529f\u80fd\u62bd\u53d6\u4e3a\u4e00\u4e2a\u7cfb\u7edf\uff08SSO\uff09\uff0c\u5176\u4ed6\u7cfb\u7edf\u8bf7\u6c42SSO\u8fdb\u884c\u767b\u5f55<\/strong><\/li><li><strong>\u672c\u6765\u5c06\u7528\u6237\u4fe1\u606f\u5b58\u5230Session\uff0c\u73b0\u5728\u5c06\u7528\u6237\u4fe1\u606f\u5b58\u5230Redis<\/strong><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"70\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-93-1024x70.png\" alt=\"\" class=\"wp-image-5447\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-93-1024x70.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-93-300x20.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-93-768x52.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-93-830x56.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-93-230x16.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-93-350x24.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-93-480x33.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-93.png 1264w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u4e0a\u9762\u6211\u4eec\u89e3\u51b3\u4e86Session\u4e0d\u80fd\u5171\u4eab\u7684\u95ee\u9898\uff0c\u4f46\u5176\u5b9e\u8fd8\u6709\u53e6\u4e00\u4e2a\u95ee\u9898\u3002<strong>Cookie\u662f\u4e0d\u80fd\u8de8\u57df\u7684<\/strong><\/p>\n\n\n\n<p>\u6bd4\u5982\u8bf4\uff0c\u6211\u4eec\u8bf7\u6c42<code>&lt;https:\/\/www.google.com\/&gt;<\/code>\u65f6\uff0c\u6d4f\u89c8\u5668\u4f1a\u81ea\u52a8\u628a<code>google.com<\/code>\u7684Cookie\u5e26\u8fc7\u53bb\u7ed9<code>google<\/code>\u7684\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u4f1a\u628a<code>&lt;https:\/\/www.baidu.com\/&gt;<\/code>\u7684Cookie\u5e26\u8fc7\u53bb\u7ed9<code>google<\/code>\u7684\u670d\u52a1\u5668\u3002<\/p>\n\n\n\n<p>\u8fd9\u5c31\u610f\u5473\u7740\uff0c<strong>\u7531\u4e8e\u57df\u540d\u4e0d\u540c<\/strong>\uff0c\u7528\u6237\u5411\u7cfb\u7edfA\u767b\u5f55\u540e\uff0c\u7cfb\u7edfA\u8fd4\u56de\u7ed9\u6d4f\u89c8\u5668\u7684Cookie\uff0c\u7528\u6237\u518d\u8bf7\u6c42\u7cfb\u7edfB\u7684\u65f6\u5019\u4e0d\u4f1a\u5c06\u7cfb\u7edfA\u7684Cookie\u5e26\u8fc7\u53bb\u3002<\/p>\n\n\n\n<p>\u9488\u5bf9Cookie\u5b58\u5728\u8de8\u57df\u95ee\u9898\uff0c\u6709\u51e0\u79cd\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n\n\n\n<ol><li>\u670d\u52a1\u7aef\u5c06Cookie\u5199\u5230\u5ba2\u6237\u7aef\u540e\uff0c\u5ba2\u6237\u7aef\u5bf9Cookie\u8fdb\u884c\u89e3\u6790\uff0c\u5c06Token\u89e3\u6790\u51fa\u6765\uff0c\u6b64\u540e\u8bf7\u6c42\u90fd\u628a\u8fd9\u4e2aToken\u5e26\u4e0a\u5c31\u884c\u4e86<\/li><li>\u591a\u4e2a\u57df\u540d\u5171\u4eabCookie\uff0c\u5728\u5199\u5230\u5ba2\u6237\u7aef\u7684\u65f6\u5019\u8bbe\u7f6eCookie\u7684domain\u3002<\/li><li>\u5c06Token\u4fdd\u5b58\u5728SessionStroage\u4e2d\uff08\u4e0d\u4f9d\u8d56Cookie\u5c31\u6ca1\u6709\u8de8\u57df\u7684\u95ee\u9898\u4e86\uff09<\/li><\/ol>\n\n\n\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u5df2\u7ecf\u53ef\u4ee5\u5b9e\u73b0\u5355\u70b9\u767b\u5f55\u4e86\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"75\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-94-1024x75.png\" alt=\"\" class=\"wp-image-5449\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-94-1024x75.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-94-300x22.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-94-768x56.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-94-830x61.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-94-230x17.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-94-350x26.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-94-480x35.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-94.png 1278w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u8bf4\u5230\u5355\u70b9\u767b\u5f55\uff0c\u5c31\u80af\u5b9a\u4f1a\u89c1\u5230\u8fd9\u4e2a\u540d\u8bcd\uff1aCAS \uff08Central Authentication Service\uff09\uff0c\u4e0b\u9762\u8bf4\u8bf4CAS\u662f\u600e\u4e48\u641e\u7684\u3002<\/p>\n\n\n\n<p><strong>\u5982\u679c\u5df2\u7ecf\u5c06\u767b\u5f55\u5355\u72ec\u62bd\u53d6\u6210\u7cfb\u7edf\u51fa\u6765<\/strong>\uff0c\u6211\u4eec\u8fd8\u80fd\u8fd9\u6837\u73a9\u3002\u73b0\u5728\u6211\u4eec\u6709\u4e24\u4e2a\u7cfb\u7edf\uff0c\u5206\u522b\u662f<code>www.java3y.com<\/code>\u548c<code>www.java4y.com<\/code>\uff0c\u4e00\u4e2aSSO<code>www.sso.com<\/code><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-95-1024x604.png\" alt=\"\" class=\"wp-image-5450\" width=\"523\" height=\"308\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-95-1024x604.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-95-300x177.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-95-768x453.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-95-830x489.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-95-230x136.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-95-350x206.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-95-480x283.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-95.png 1130w\" sizes=\"(max-width: 523px) 100vw, 523px\" \/><\/figure><\/div>\n\n\n\n<p>\u9996\u5148\uff0c\u7528\u6237\u60f3\u8981\u8bbf\u95ee\u7cfb\u7edfA<code>www.java3y.com<\/code>\u53d7\u9650\u7684\u8d44\u6e90(\u6bd4\u5982\u8bf4\u8d2d\u7269\u8f66\u529f\u80fd\uff0c\u8d2d\u7269\u8f66\u529f\u80fd\u9700\u8981\u767b\u5f55\u540e\u624d\u80fd\u8bbf\u95ee)\uff0c\u7cfb\u7edfA<code>www.java3y.com<\/code>\u53d1\u73b0\u7528\u6237\u5e76\u6ca1\u6709\u767b\u5f55\uff0c\u4e8e\u662f<strong>\u91cd\u5b9a\u5411\u5230sso\u8ba4\u8bc1\u4e2d\u5fc3\uff0c\u5e76\u5c06\u81ea\u5df1\u7684\u5730\u5740\u4f5c\u4e3a\u53c2\u6570<\/strong>\u3002\u8bf7\u6c42\u7684\u5730\u5740\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    www.sso.com?service=www.java3y.com<\/pre>\n\n\n\n<p>sso\u8ba4\u8bc1\u4e2d\u5fc3\u53d1\u73b0\u7528\u6237\u672a\u767b\u5f55\uff0c\u5c06\u7528\u6237\u5f15\u5bfc\u81f3\u767b\u5f55\u9875\u9762\uff0c\u7528\u6237\u8fdb\u884c\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\u8fdb\u884c\u767b\u5f55\uff0c\u7528\u6237\u4e0e\u8ba4\u8bc1\u4e2d\u5fc3\u5efa\u7acb<strong>\u5168\u5c40\u4f1a\u8bdd\uff08\u751f\u6210\u4e00\u4efdToken\uff0c\u5199\u5230Cookie\u4e2d\uff0c\u4fdd\u5b58\u5728\u6d4f\u89c8\u5668\u4e0a\uff09<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-96-1024x718.png\" alt=\"\" class=\"wp-image-5451\" width=\"487\" height=\"340\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-96-1024x718.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-96-300x210.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-96-830x582.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-96-230x161.png 230w\" sizes=\"(max-width: 487px) 100vw, 487px\" \/><\/figure><\/div>\n\n\n\n<p>\u968f\u540e\uff0c\u8ba4\u8bc1\u4e2d\u5fc3<strong>\u91cd\u5b9a\u5411\u56de\u7cfb\u7edfA<\/strong>\uff0c\u5e76\u628aToken\u643a\u5e26\u8fc7\u53bb\u7ed9\u7cfb\u7edfA\uff0c\u91cd\u5b9a\u5411\u7684\u5730\u5740\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    www.java3y.com?token=xxxxxxx<\/pre>\n\n\n\n<p>\u63a5\u7740\uff0c\u7cfb\u7edfA\u53bbsso\u8ba4\u8bc1\u4e2d\u5fc3\u9a8c\u8bc1\u8fd9\u4e2aToken\u662f\u5426\u6b63\u786e\uff0c\u5982\u679c\u6b63\u786e\uff0c\u5219\u7cfb\u7edfA\u548c\u7528\u6237\u5efa\u7acb\u5c40\u90e8\u4f1a\u8bdd\uff08<strong>\u521b\u5efaSession<\/strong>\uff09\u3002\u5230\u6b64\uff0c\u7cfb\u7edfA\u548c\u7528\u6237\u5df2\u7ecf\u662f\u767b\u5f55\u72b6\u6001\u4e86\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-97-1024x566.png\" alt=\"\" class=\"wp-image-5452\" width=\"544\" height=\"301\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-97-1024x566.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-97-300x166.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-97-768x424.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-97-830x459.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-97-230x127.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-97-350x193.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-97-480x265.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-97.png 1234w\" sizes=\"(max-width: 544px) 100vw, 544px\" \/><\/figure><\/div>\n\n\n\n<p>\u6b64\u65f6\uff0c\u7528\u6237\u60f3\u8981\u8bbf\u95ee\u7cfb\u7edfB<code>www.java4y.com<\/code>\u53d7\u9650\u7684\u8d44\u6e90(\u6bd4\u5982\u8bf4\u8ba2\u5355\u529f\u80fd\uff0c\u8ba2\u5355\u529f\u80fd\u9700\u8981\u767b\u5f55\u540e\u624d\u80fd\u8bbf\u95ee)\uff0c\u7cfb\u7edfB<code>www.java4y.com<\/code>\u53d1\u73b0\u7528\u6237\u5e76\u6ca1\u6709\u767b\u5f55\uff0c\u4e8e\u662f<strong>\u91cd\u5b9a\u5411\u5230sso\u8ba4\u8bc1\u4e2d\u5fc3\uff0c\u5e76\u5c06\u81ea\u5df1\u7684\u5730\u5740\u4f5c\u4e3a\u53c2\u6570<\/strong>\u3002\u8bf7\u6c42\u7684\u5730\u5740\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    www.sso.com?service=www.java4y.com<\/pre>\n\n\n\n<p>\u6ce8\u610f\uff0c\u56e0\u4e3a\u4e4b\u524d\u7528\u6237\u4e0e\u8ba4\u8bc1\u4e2d\u5fc3<code>www.sso.com<\/code>\u5df2\u7ecf\u5efa\u7acb\u4e86\u5168\u5c40\u4f1a\u8bdd\uff08\u5f53\u65f6\u5df2\u7ecf\u628aCookie\u4fdd\u5b58\u5230\u6d4f\u89c8\u5668\u4e0a\u4e86\uff09\uff0c\u6240\u4ee5\u8fd9\u6b21\u7cfb\u7edfB<strong>\u91cd\u5b9a\u5411<\/strong>\u5230\u8ba4\u8bc1\u4e2d\u5fc3<code>www.sso.com<\/code>\u662f\u53ef\u4ee5\u5e26\u4e0aCookie\u7684\u3002<\/p>\n\n\n\n<p>\u8ba4\u8bc1\u4e2d\u5fc3<strong>\u6839\u636e\u5e26\u8fc7\u6765\u7684Cookie<\/strong>\u53d1\u73b0\u5df2\u7ecf\u4e0e\u7528\u6237\u5efa\u7acb\u4e86\u5168\u5c40\u4f1a\u8bdd\u4e86\uff0c\u8ba4\u8bc1\u4e2d\u5fc3<strong>\u91cd\u5b9a\u5411\u56de\u7cfb\u7edfB<\/strong>\uff0c\u5e76\u628aToken\u643a\u5e26\u8fc7\u53bb\u7ed9\u7cfb\u7edfB\uff0c\u91cd\u5b9a\u5411\u7684\u5730\u5740\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    www.java4y.com?token=xxxxxxx<\/pre>\n\n\n\n<p>\u63a5\u7740\uff0c\u7cfb\u7edfB\u53bbsso\u8ba4\u8bc1\u4e2d\u5fc3\u9a8c\u8bc1\u8fd9\u4e2aToken\u662f\u5426\u6b63\u786e\uff0c\u5982\u679c\u6b63\u786e\uff0c\u5219\u7cfb\u7edfB\u548c\u7528\u6237\u5efa\u7acb\u5c40\u90e8\u4f1a\u8bdd\uff08<strong>\u521b\u5efaSession<\/strong>\uff09\u3002\u5230\u6b64\uff0c\u7cfb\u7edfB\u548c\u7528\u6237\u5df2\u7ecf\u662f\u767b\u5f55\u72b6\u6001\u4e86\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-98-1024x555.png\" alt=\"\" class=\"wp-image-5453\" width=\"535\" height=\"290\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-98-1024x555.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-98-300x163.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-98-768x417.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-98-830x450.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-98-230x125.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-98-350x190.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-98-480x260.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/04\/\u56fe\u7247-98.png 1298w\" sizes=\"(max-width: 535px) 100vw, 535px\" \/><\/figure><\/div>\n\n\n\n<p>\u770b\u5230\u8fd9\u91cc\uff0c\u5176\u5b9eSSO\u8ba4\u8bc1\u4e2d\u5fc3\u5c31\u7c7b\u4f3c\u4e00\u4e2a<strong>\u4e2d\u8f6c\u7ad9<\/strong>\u3002<\/p>\n\n\n\n<p>\u53c2\u8003\u8d44\u6599\uff1a<\/p>\n\n\n\n<ul><li>https:\/\/www.cnblogs.com\/EzrealLiu\/p\/5559255.html<\/li><li>http:\/\/www.cnblogs.com\/ywlaker\/p\/6113927.html<\/li><li>https:\/\/blog.csdn.net\/javaloveiphone\/article\/details\/52439613<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\uff1ahttps:\/\/github.com\/ZhongFuCheng3y\/3y \u524d\u8a00 \u5728\u524d\u9635\u5b50\u6709\u4e2a\u8bfb\u8005\u6765\u6211\u8fd9\u6295 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/5439"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5439"}],"version-history":[{"count":2,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/5439\/revisions"}],"predecessor-version":[{"id":5454,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/5439\/revisions\/5454"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}