{"id":3166,"date":"2021-04-05T21:44:43","date_gmt":"2021-04-05T13:44:43","guid":{"rendered":"http:\/\/www.yuguoxy.com\/geekhome\/?p=3166"},"modified":"2026-08-18T11:26:32","modified_gmt":"2026-08-18T03:26:32","slug":"%e5%8d%95%e7%82%b9%e7%99%bb%e5%bd%95%e5%8e%9f%e7%90%86%e4%b8%8e%e7%ae%80%e5%8d%95%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=3166","title":{"rendered":"\u5355\u70b9\u767b\u5f55\u539f\u7406\u4e0e\u7b80\u5355\u5b9e\u73b0"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<p style=\"margin: 1em 0px;\">HTTP \u65e0\u72b6\u6001\uff0c\u5355\u7cfb\u7edf\u9760 <strong style=\"color: #4870ac;\">\u4f1a\u8bdd + Cookie\uff08JSESSIONID\uff09<\/strong> \u8bb0\u4f4f\u767b\u5f55\u3002\u7cfb\u7edf\u4e00\u53d8\u6210\u5e94\u7528\u7fa4\uff0c\u7528\u6237\u5374\u4e0d\u8be5\u6bcf\u4e2a\u5b50\u7cfb\u7edf\u90fd\u767b\u4e00\u6b21\u3001\u518d\u767b\u51fa\u4e00\u6b21\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u540c\u7236\u57df\u5171\u4eab Cookie \u6709\u57df\u540d\u3001\u6280\u672f\u548c\u5b89\u5168\u9650\u5236\uff0c\u6240\u4ee5\u8981 <strong style=\"color: #4870ac;\">SSO<\/strong>\uff1a\u72ec\u7acb\u8ba4\u8bc1\u4e2d\u5fc3\u53d1\u4ee4\u724c\uff0c\u5404\u7cfb\u7edf\u5efa\u5c40\u90e8\u4f1a\u8bdd\uff0c\u767b\u5f55\u4e00\u6b21\u3001\u6ce8\u9500\u4e00\u6b21\u3002\u4e71\u7801\u6587\u4ef6\u540d\u7684\u622a\u56fe\u5730\u5740\u6309\u539f\u6587\u539f\u6837\u4fdd\u7559\u3002<\/p>\n<table style=\"display: table; text-align: left; overflow: auto; border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; overflow-wrap: break-word; word-break: break-all;\" width=\"800\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u5bf9\u6bd4<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u5355\u7cfb\u7edf\u767b\u5f55<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u5355\u70b9\u767b\u5f55<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u72b6\u6001\u5b58\u5728\u54ea<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5404\u7cfb\u7edf\u81ea\u5df1\u7684 Session<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8ba4\u8bc1\u4e2d\u5fc3\u5168\u5c40\u4f1a\u8bdd + \u5404\u7cfb\u7edf\u5c40\u90e8\u4f1a\u8bdd<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6d4f\u89c8\u5668\u51ed\u8bc1<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">JSESSIONID Cookie\uff08\u6309\u57df\uff09<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8df3\u8f6c\u643a\u5e26 token\uff0c\u6821\u9a8c\u6210\u529f\u540e\u518d\u5199\u5c40\u90e8\u4f1a\u8bdd<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8de8\u7cfb\u7edf<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u57df\/\u6280\u672f\u4e0d\u4e00\u81f4\u5c31\u65ad<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u4e0e\u5b50\u7cfb\u7edf\u6280\u672f\u6808\u89e3\u8026<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6ce8\u9500<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6e05\u81ea\u5df1\u7684 Session<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8ba4\u8bc1\u4e2d\u5fc3\u901a\u77e5\u5404\u7cfb\u7edf\u6e05\u5c40\u90e8\u4f1a\u8bdd<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e00\u3001\u5355\u7cfb\u7edf\u767b\u5f55\u673a\u5236<\/h2>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">1\u3001http\u65e0\u72b6\u6001\u534f\u8bae<\/h3>\n<p style=\"margin: 1em 0px;\">web\u5e94\u7528\u91c7\u7528browser\/server\u67b6\u6784\uff0chttp\u4f5c\u4e3a\u901a\u4fe1\u534f\u8bae\u3002http\u662f\u65e0\u72b6\u6001\u534f\u8bae\uff0c\u6d4f\u89c8\u5668\u7684\u6bcf\u4e00\u6b21\u8bf7\u6c42\uff0c\u670d\u52a1\u5668\u4f1a\u72ec\u7acb\u5904\u7406\uff0c\u4e0d\u4e0e\u4e4b\u524d\u6216\u4e4b\u540e\u7684\u8bf7\u6c42\u4ea7\u751f\u5173\u8054\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u7528\u4e0b\u56fe\u8bf4\u660e\uff0c\u4e09\u6b21\u8bf7\u6c42\/\u54cd\u5e94\u5bf9\u4e4b\u95f4\u6ca1\u6709\u4efb\u4f55\u8054\u7cfb<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214040.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3168\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214040.png\" alt=\"20210405214040\" width=\"447\" height=\"431\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u4f46\u8fd9\u4e5f\u540c\u65f6\u610f\u5473\u7740\uff0c\u4efb\u4f55\u7528\u6237\u90fd\u80fd\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\u670d\u52a1\u5668\u8d44\u6e90\uff0c\u5982\u679c\u60f3\u4fdd\u62a4\u670d\u52a1\u5668\u7684\u67d0\u4e9b\u8d44\u6e90\uff0c\u5fc5\u987b\u9650\u5236\u6d4f\u89c8\u5668\u8bf7\u6c42\uff1b\u8981\u9650\u5236\u6d4f\u89c8\u5668\u8bf7\u6c42\uff0c\u5fc5\u987b\u9274\u522b\u6d4f\u89c8\u5668\u8bf7\u6c42\uff0c\u54cd\u5e94\u5408\u6cd5\u8bf7\u6c42\uff0c\u5ffd\u7565\u975e\u6cd5\u8bf7\u6c42\uff1b\u8981\u9274\u522b\u6d4f\u89c8\u5668\u8bf7\u6c42\uff0c\u5fc5\u987b\u6e05\u695a\u6d4f\u89c8\u5668\u8bf7\u6c42\u72b6\u6001\u3002\u65e2\u7136http\u534f\u8bae\u65e0\u72b6\u6001\uff0c\u90a3\u5c31\u8ba9\u670d\u52a1\u5668\u548c\u6d4f\u89c8\u5668\u5171\u540c\u7ef4\u62a4\u4e00\u4e2a\u72b6\u6001\u5427\uff01\u8fd9\u5c31\u662f\u4f1a\u8bdd\u673a\u5236<\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">2\u3001\u4f1a\u8bdd\u673a\u5236<\/h3>\n<p style=\"margin: 1em 0px;\">\u6d4f\u89c8\u5668\u7b2c\u4e00\u6b21\u8bf7\u6c42\u670d\u52a1\u5668\uff0c\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u4f1a\u8bdd\uff0c\u5e76\u5c06\u4f1a\u8bdd\u7684id\u4f5c\u4e3a\u54cd\u5e94\u7684\u4e00\u90e8\u5206\u53d1\u9001\u7ed9\u6d4f\u89c8\u5668\uff0c\u6d4f\u89c8\u5668\u5b58\u50a8\u4f1a\u8bddid\uff0c\u5e76\u5728\u540e\u7eed\u7b2c\u4e8c\u6b21\u548c\u7b2c\u4e09\u6b21\u8bf7\u6c42\u4e2d\u5e26\u4e0a\u4f1a\u8bddid\uff0c\u670d\u52a1\u5668\u53d6\u5f97\u8bf7\u6c42\u4e2d\u7684\u4f1a\u8bddid\u5c31\u77e5\u9053\u662f\u4e0d\u662f\u540c\u4e00\u4e2a\u7528\u6237\u4e86\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u7528\u4e0b\u56fe\u8bf4\u660e\uff0c\u540e\u7eed\u8bf7\u6c42\u4e0e\u7b2c\u4e00\u6b21\u8bf7\u6c42\u4ea7\u751f\u4e86\u5173\u8054<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214120.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3169\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214120.png\" alt=\"20210405214120\" width=\"510\" height=\"467\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u670d\u52a1\u5668\u5728\u5185\u5b58\u4e2d\u4fdd\u5b58\u4f1a\u8bdd\u5bf9\u8c61\uff0c\u6d4f\u89c8\u5668\u600e\u4e48\u4fdd\u5b58\u4f1a\u8bddid\u5462\uff1f\u4f60\u53ef\u80fd\u4f1a\u60f3\u5230\u4e24\u79cd\u65b9\u5f0f<\/p>\n<ol style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem;\">\n<li>\u8bf7\u6c42\u53c2\u6570<\/li>\n<li>cookie<\/li>\n<\/ol>\n<p style=\"margin: 1em 0px;\">\u5c06\u4f1a\u8bddid\u4f5c\u4e3a\u6bcf\u4e00\u4e2a\u8bf7\u6c42\u7684\u53c2\u6570\uff0c\u670d\u52a1\u5668\u63a5\u6536\u8bf7\u6c42\u81ea\u7136\u80fd\u89e3\u6790\u53c2\u6570\u83b7\u5f97\u4f1a\u8bddid\uff0c\u5e76\u501f\u6b64\u5224\u65ad\u662f\u5426\u6765\u81ea\u540c\u4e00\u4f1a\u8bdd\uff0c\u5f88\u660e\u663e\uff0c\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u9760\u8c31\u3002\u90a3\u5c31\u6d4f\u89c8\u5668\u81ea\u5df1\u6765\u7ef4\u62a4\u8fd9\u4e2a\u4f1a\u8bddid\u5427\uff0c\u6bcf\u6b21\u53d1\u9001http\u8bf7\u6c42\u65f6\u6d4f\u89c8\u5668\u81ea\u52a8\u53d1\u9001\u4f1a\u8bddid\uff0ccookie\u673a\u5236\u6b63\u597d\u7528\u6765\u505a\u8fd9\u4ef6\u4e8b\u3002cookie\u662f\u6d4f\u89c8\u5668\u7528\u6765\u5b58\u50a8\u5c11\u91cf\u6570\u636e\u7684\u4e00\u79cd\u673a\u5236\uff0c\u6570\u636e\u4ee5\u201dkey\/value\u201c\u5f62\u5f0f\u5b58\u50a8\uff0c\u6d4f\u89c8\u5668\u53d1\u9001http\u8bf7\u6c42\u65f6\u81ea\u52a8\u9644\u5e26cookie\u4fe1\u606f<\/p>\n<p style=\"margin: 1em 0px;\">tomcat\u4f1a\u8bdd\u673a\u5236\u5f53\u7136\u4e5f\u5b9e\u73b0\u4e86cookie\uff0c\u8bbf\u95eetomcat\u670d\u52a1\u5668\u65f6\uff0c\u6d4f\u89c8\u5668\u4e2d\u53ef\u4ee5\u770b\u5230\u4e00\u4e2a\u540d\u4e3a\u201cJSESSIONID\u201d\u7684cookie\uff0c\u8fd9\u5c31\u662ftomcat\u4f1a\u8bdd\u673a\u5236\u7ef4\u62a4\u7684\u4f1a\u8bddid\uff0c\u4f7f\u7528\u4e86cookie\u7684\u8bf7\u6c42\u54cd\u5e94\u8fc7\u7a0b\u5982\u4e0b\u56fe<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214147.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3170\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214147.png\" alt=\"20210405214147\" width=\"504\" height=\"467\" \/><\/a><\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">3\u3001\u767b\u5f55\u72b6\u6001<\/h3>\n<p style=\"margin: 1em 0px;\">\u6709\u4e86\u4f1a\u8bdd\u673a\u5236\uff0c\u767b\u5f55\u72b6\u6001\u5c31\u597d\u660e\u767d\u4e86\uff0c\u6211\u4eec\u5047\u8bbe\u6d4f\u89c8\u5668\u7b2c\u4e00\u6b21\u8bf7\u6c42\u670d\u52a1\u5668\u9700\u8981\u8f93\u5165\u7528\u6237\u540d\u4e0e\u5bc6\u7801\u9a8c\u8bc1\u8eab\u4efd\uff0c\u670d\u52a1\u5668\u62ff\u5230\u7528\u6237\u540d\u5bc6\u7801\u53bb\u6570\u636e\u5e93\u6bd4\u5bf9\uff0c\u6b63\u786e\u7684\u8bdd\u8bf4\u660e\u5f53\u524d\u6301\u6709\u8fd9\u4e2a\u4f1a\u8bdd\u7684\u7528\u6237\u662f\u5408\u6cd5\u7528\u6237\uff0c\u5e94\u8be5\u5c06\u8fd9\u4e2a\u4f1a\u8bdd\u6807\u8bb0\u4e3a\u201c\u5df2\u6388\u6743\u201d\u6216\u8005\u201c\u5df2\u767b\u5f55\u201d\u7b49\u7b49\u4e4b\u7c7b\u7684\u72b6\u6001\uff0c\u65e2\u7136\u662f\u4f1a\u8bdd\u7684\u72b6\u6001\uff0c\u81ea\u7136\u8981\u4fdd\u5b58\u5728\u4f1a\u8bdd\u5bf9\u8c61\u4e2d\uff0ctomcat\u5728\u4f1a\u8bdd\u5bf9\u8c61\u4e2d\u8bbe\u7f6e\u767b\u5f55\u72b6\u6001\u5982\u4e0b<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">HttpSession session = request.getSession();\nsession.setAttribute(\n\"isLogin\"\n,\ntrue\n);<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u7528\u6237\u518d\u6b21\u8bbf\u95ee\u65f6\uff0ctomcat\u5728\u4f1a\u8bdd\u5bf9\u8c61\u4e2d\u67e5\u770b\u767b\u5f55\u72b6\u6001<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">HttpSession session = request.getSession();\nsession.getAttribute(\n\"isLogin\"\n);<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u5b9e\u73b0\u4e86\u767b\u5f55\u72b6\u6001\u7684\u6d4f\u89c8\u5668\u8bf7\u6c42\u670d\u52a1\u5668\u6a21\u578b\u5982\u4e0b\u56fe\u63cf\u8ff0<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214204.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3171\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214204.png\" alt=\"20210405214204\" width=\"581\" height=\"551\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u6bcf\u6b21\u8bf7\u6c42\u53d7\u4fdd\u62a4\u8d44\u6e90\u65f6\u90fd\u4f1a\u68c0\u67e5\u4f1a\u8bdd\u5bf9\u8c61\u4e2d\u7684\u767b\u5f55\u72b6\u6001\uff0c\u53ea\u6709 isLogin=true \u7684\u4f1a\u8bdd\u624d\u80fd\u8bbf\u95ee\uff0c\u767b\u5f55\u673a\u5236\u56e0\u6b64\u800c\u5b9e\u73b0\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e8c\u3001\u591a\u7cfb\u7edf\u7684\u590d\u6742\u6027<\/h2>\n<p style=\"margin: 1em 0px;\">web\u7cfb\u7edf\u65e9\u5df2\u4ece\u4e45\u8fdc\u7684\u5355\u7cfb\u7edf\u53d1\u5c55\u6210\u4e3a\u5982\u4eca\u7531\u591a\u7cfb\u7edf\u7ec4\u6210\u7684\u5e94\u7528\u7fa4\uff0c\u9762\u5bf9\u5982\u6b64\u4f17\u591a\u7684\u7cfb\u7edf\uff0c\u7528\u6237\u96be\u9053\u8981\u4e00\u4e2a\u4e00\u4e2a\u767b\u5f55\u3001\u7136\u540e\u4e00\u4e2a\u4e00\u4e2a\u6ce8\u9500\u5417\uff1f\u5c31\u50cf\u4e0b\u56fe\u63cf\u8ff0\u7684\u8fd9\u6837<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214221.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3172\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214221.png\" alt=\"20210405214221\" width=\"319\" height=\"434\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">web\u7cfb\u7edf\u7531\u5355\u7cfb\u7edf\u53d1\u5c55\u6210\u591a\u7cfb\u7edf\u7ec4\u6210\u7684\u5e94\u7528\u7fa4\uff0c\u590d\u6742\u6027\u5e94\u8be5\u7531\u7cfb\u7edf\u5185\u90e8\u627f\u62c5\uff0c\u800c\u4e0d\u662f\u7528\u6237\u3002\u65e0\u8bbaweb\u7cfb\u7edf\u5185\u90e8\u591a\u4e48\u590d\u6742\uff0c\u5bf9\u7528\u6237\u800c\u8a00\uff0c\u90fd\u662f\u4e00\u4e2a\u7edf\u4e00\u7684\u6574\u4f53\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u7528\u6237\u8bbf\u95eeweb\u7cfb\u7edf\u7684\u6574\u4e2a\u5e94\u7528\u7fa4\u4e0e\u8bbf\u95ee\u5355\u4e2a\u7cfb\u7edf\u4e00\u6837\uff0c\u767b\u5f55\/\u6ce8\u9500\u53ea\u8981\u4e00\u6b21\u5c31\u591f\u4e86<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214235.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3173\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214235.png\" alt=\"20210405214235\" width=\"368\" height=\"482\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u867d\u7136\u5355\u7cfb\u7edf\u7684\u767b\u5f55\u89e3\u51b3\u65b9\u6848\u5f88\u5b8c\u7f8e\uff0c\u4f46\u5bf9\u4e8e\u591a\u7cfb\u7edf\u5e94\u7528\u7fa4\u5df2\u7ecf\u4e0d\u518d\u9002\u7528\u4e86\uff0c\u4e3a\u4ec0\u4e48\u5462\uff1f<\/p>\n<p style=\"margin: 1em 0px;\">\u5355\u7cfb\u7edf\u767b\u5f55\u89e3\u51b3\u65b9\u6848\u7684\u6838\u5fc3\u662fcookie\uff0ccookie\u643a\u5e26\u4f1a\u8bddid\u5728\u6d4f\u89c8\u5668\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u7ef4\u62a4\u4f1a\u8bdd\u72b6\u6001\u3002\u4f46cookie\u662f\u6709\u9650\u5236\u7684\uff0c\u8fd9\u4e2a\u9650\u5236\u5c31\u662fcookie\u7684\u57df\uff08\u901a\u5e38\u5bf9\u5e94\u7f51\u7ad9\u7684\u57df\u540d\uff09\uff0c\u6d4f\u89c8\u5668\u53d1\u9001http\u8bf7\u6c42\u65f6\u4f1a\u81ea\u52a8\u643a\u5e26\u4e0e\u8be5\u57df\u5339\u914d\u7684cookie\uff0c\u800c\u4e0d\u662f\u6240\u6709cookie<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214250.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3174\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210405214250.png\" alt=\"20210405214250\" width=\"593\" height=\"414\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u65e2\u7136\u8fd9\u6837\uff0c\u4e3a\u4ec0\u4e48\u4e0d\u5c06web\u5e94\u7528\u7fa4\u4e2d\u6240\u6709\u5b50\u7cfb\u7edf\u7684\u57df\u540d\u7edf\u4e00\u5728\u4e00\u4e2a\u9876\u7ea7\u57df\u540d\u4e0b\uff0c\u4f8b\u5982\u201c*.baidu.com\u201d\uff0c\u7136\u540e\u5c06\u5b83\u4eec\u7684cookie\u57df\u8bbe\u7f6e\u4e3a\u201cbaidu.com\u201d\uff0c\u8fd9\u79cd\u505a\u6cd5\u7406\u8bba\u4e0a\u662f\u53ef\u4ee5\u7684\uff0c\u751a\u81f3\u65e9\u671f\u5f88\u591a\u591a\u7cfb\u7edf\u767b\u5f55\u5c31\u91c7\u7528\u8fd9\u79cd\u540c\u57df\u540d\u5171\u4eabcookie\u7684\u65b9\u5f0f\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u7136\u800c\uff0c\u53ef\u884c\u5e76\u4e0d\u4ee3\u8868\u597d\uff0c\u5171\u4eabcookie\u7684\u65b9\u5f0f\u5b58\u5728\u4f17\u591a\u5c40\u9650\u3002\u9996\u5148\uff0c\u5e94\u7528\u7fa4\u57df\u540d\u5f97\u7edf\u4e00\uff1b\u5176\u6b21\uff0c\u5e94\u7528\u7fa4\u5404\u7cfb\u7edf\u4f7f\u7528\u7684\u6280\u672f\uff08\u81f3\u5c11\u662fweb\u670d\u52a1\u5668\uff09\u8981\u76f8\u540c\uff0c\u4e0d\u7136cookie\u7684key\u503c\uff08tomcat\u4e3aJSESSIONID\uff09\u4e0d\u540c\uff0c\u65e0\u6cd5\u7ef4\u6301\u4f1a\u8bdd\uff0c\u5171\u4eabcookie\u7684\u65b9\u5f0f\u662f\u65e0\u6cd5\u5b9e\u73b0\u8de8\u8bed\u8a00\u6280\u672f\u5e73\u53f0\u767b\u5f55\u7684\uff0c\u6bd4\u5982java\u3001php\u3001.net\u7cfb\u7edf\u4e4b\u95f4\uff1b\u7b2c\u4e09\uff0ccookie\u672c\u8eab\u4e0d\u5b89\u5168\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u56e0\u6b64\uff0c\u6211\u4eec\u9700\u8981\u4e00\u79cd\u5168\u65b0\u7684\u767b\u5f55\u65b9\u5f0f\u6765\u5b9e\u73b0\u591a\u7cfb\u7edf\u5e94\u7528\u7fa4\u7684\u767b\u5f55\uff0c\u8fd9\u5c31\u662f\u5355\u70b9\u767b\u5f55<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e09\u3001\u5355\u70b9\u767b\u5f55<\/h2>\n<p style=\"margin: 1em 0px;\">\u4ec0\u4e48\u662f\u5355\u70b9\u767b\u5f55\uff1f\u5355\u70b9\u767b\u5f55\u5168\u79f0Single Sign On\uff08\u4ee5\u4e0b\u7b80\u79f0SSO\uff09\uff0c\u662f\u6307\u5728\u591a\u7cfb\u7edf\u5e94\u7528\u7fa4\u4e2d\u767b\u5f55\u4e00\u4e2a\u7cfb\u7edf\uff0c\u4fbf\u53ef\u5728\u5176\u4ed6\u6240\u6709\u7cfb\u7edf\u4e2d\u5f97\u5230\u6388\u6743\u800c\u65e0\u9700\u518d\u6b21\u767b\u5f55\uff0c\u5305\u62ec\u5355\u70b9\u767b\u5f55\u4e0e\u5355\u70b9\u6ce8\u9500\u4e24\u90e8\u5206<\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">1\u3001\u767b\u5f55<\/h3>\n<p style=\"margin: 1em 0px;\">\u76f8\u6bd4\u4e8e\u5355\u7cfb\u7edf\u767b\u5f55\uff0csso\u9700\u8981\u4e00\u4e2a\u72ec\u7acb\u7684\u8ba4\u8bc1\u4e2d\u5fc3\uff0c\u53ea\u6709\u8ba4\u8bc1\u4e2d\u5fc3\u80fd\u63a5\u53d7\u7528\u6237\u7684\u7528\u6237\u540d\u5bc6\u7801\u7b49\u5b89\u5168\u4fe1\u606f\uff0c\u5176\u4ed6\u7cfb\u7edf\u4e0d\u63d0\u4f9b\u767b\u5f55\u5165\u53e3\uff0c\u53ea\u63a5\u53d7\u8ba4\u8bc1\u4e2d\u5fc3\u7684\u95f4\u63a5\u6388\u6743\u3002\u95f4\u63a5\u6388\u6743\u901a\u8fc7\u4ee4\u724c\u5b9e\u73b0\uff0csso\u8ba4\u8bc1\u4e2d\u5fc3\u9a8c\u8bc1\u7528\u6237\u7684\u7528\u6237\u540d\u5bc6\u7801\u6ca1\u95ee\u9898\uff0c\u521b\u5efa\u6388\u6743\u4ee4\u724c\uff0c\u5728\u63a5\u4e0b\u6765\u7684\u8df3\u8f6c\u8fc7\u7a0b\u4e2d\uff0c\u6388\u6743\u4ee4\u724c\u4f5c\u4e3a\u53c2\u6570\u53d1\u9001\u7ed9\u5404\u4e2a\u5b50\u7cfb\u7edf\uff0c\u5b50\u7cfb\u7edf\u62ff\u5230\u4ee4\u724c\uff0c\u5373\u5f97\u5230\u4e86\u6388\u6743\uff0c\u53ef\u4ee5\u501f\u6b64\u521b\u5efa\u5c40\u90e8\u4f1a\u8bdd\uff0c\u5c40\u90e8\u4f1a\u8bdd\u767b\u5f55\u65b9\u5f0f\u4e0e\u5355\u7cfb\u7edf\u7684\u767b\u5f55\u65b9\u5f0f\u76f8\u540c\u3002\u8fd9\u4e2a\u8fc7\u7a0b\uff0c\u4e5f\u5c31\u662f\u5355\u70b9\u767b\u5f55\u7684\u539f\u7406\uff0c\u7528\u4e0b\u56fe\u8bf4\u660e<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/797930-20161203152650974-276822362.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3175\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/797930-20161203152650974-276822362.png\" alt=\"797930-20161203152650974-276822362\" width=\"737\" height=\"931\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u4e0b\u9762\u5bf9\u4e0a\u56fe\u7b80\u8981\u63cf\u8ff0<\/p>\n<ol style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem;\">\n<li>\u7528\u6237\u8bbf\u95ee\u7cfb\u7edf1\u7684\u53d7\u4fdd\u62a4\u8d44\u6e90\uff0c\u7cfb\u7edf1\u53d1\u73b0\u7528\u6237\u672a\u767b\u5f55\uff0c\u8df3\u8f6c\u81f3sso\u8ba4\u8bc1\u4e2d\u5fc3\uff0c\u5e76\u5c06\u81ea\u5df1\u7684\u5730\u5740\u4f5c\u4e3a\u53c2\u6570<\/li>\n<li>sso\u8ba4\u8bc1\u4e2d\u5fc3\u53d1\u73b0\u7528\u6237\u672a\u767b\u5f55\uff0c\u5c06\u7528\u6237\u5f15\u5bfc\u81f3\u767b\u5f55\u9875\u9762<\/li>\n<li>\u7528\u6237\u8f93\u5165\u7528\u6237\u540d\u5bc6\u7801\u63d0\u4ea4\u767b\u5f55\u7533\u8bf7<\/li>\n<li>sso\u8ba4\u8bc1\u4e2d\u5fc3\u6821\u9a8c\u7528\u6237\u4fe1\u606f\uff0c\u521b\u5efa\u7528\u6237\u4e0esso\u8ba4\u8bc1\u4e2d\u5fc3\u4e4b\u95f4\u7684\u4f1a\u8bdd\uff0c\u79f0\u4e3a\u5168\u5c40\u4f1a\u8bdd\uff0c\u540c\u65f6\u521b\u5efa\u6388\u6743\u4ee4\u724c<\/li>\n<li>sso\u8ba4\u8bc1\u4e2d\u5fc3\u5e26\u7740\u4ee4\u724c\u8df3\u8f6c\u4f1a\u6700\u521d\u7684\u8bf7\u6c42\u5730\u5740\uff08\u7cfb\u7edf1\uff09<\/li>\n<li>\u7cfb\u7edf1\u62ff\u5230\u4ee4\u724c\uff0c\u53bbsso\u8ba4\u8bc1\u4e2d\u5fc3\u6821\u9a8c\u4ee4\u724c\u662f\u5426\u6709\u6548<\/li>\n<li>sso\u8ba4\u8bc1\u4e2d\u5fc3\u6821\u9a8c\u4ee4\u724c\uff0c\u8fd4\u56de\u6709\u6548\uff0c\u6ce8\u518c\u7cfb\u7edf1<\/li>\n<li>\u7cfb\u7edf1\u4f7f\u7528\u8be5\u4ee4\u724c\u521b\u5efa\u4e0e\u7528\u6237\u7684\u4f1a\u8bdd\uff0c\u79f0\u4e3a\u5c40\u90e8\u4f1a\u8bdd\uff0c\u8fd4\u56de\u53d7\u4fdd\u62a4\u8d44\u6e90<\/li>\n<li>\u7528\u6237\u8bbf\u95ee\u7cfb\u7edf2\u7684\u53d7\u4fdd\u62a4\u8d44\u6e90<\/li>\n<li>\u7cfb\u7edf2\u53d1\u73b0\u7528\u6237\u672a\u767b\u5f55\uff0c\u8df3\u8f6c\u81f3sso\u8ba4\u8bc1\u4e2d\u5fc3\uff0c\u5e76\u5c06\u81ea\u5df1\u7684\u5730\u5740\u4f5c\u4e3a\u53c2\u6570<\/li>\n<li>sso\u8ba4\u8bc1\u4e2d\u5fc3\u53d1\u73b0\u7528\u6237\u5df2\u767b\u5f55\uff0c\u8df3\u8f6c\u56de\u7cfb\u7edf2\u7684\u5730\u5740\uff0c\u5e76\u9644\u4e0a\u4ee4\u724c<\/li>\n<li>\u7cfb\u7edf2\u62ff\u5230\u4ee4\u724c\uff0c\u53bbsso\u8ba4\u8bc1\u4e2d\u5fc3\u6821\u9a8c\u4ee4\u724c\u662f\u5426\u6709\u6548<\/li>\n<li>sso\u8ba4\u8bc1\u4e2d\u5fc3\u6821\u9a8c\u4ee4\u724c\uff0c\u8fd4\u56de\u6709\u6548\uff0c\u6ce8\u518c\u7cfb\u7edf2<\/li>\n<li>\u7cfb\u7edf2\u4f7f\u7528\u8be5\u4ee4\u724c\u521b\u5efa\u4e0e\u7528\u6237\u7684\u5c40\u90e8\u4f1a\u8bdd\uff0c\u8fd4\u56de\u53d7\u4fdd\u62a4\u8d44\u6e90<\/li>\n<\/ol>\n<p style=\"margin: 1em 0px;\">\u7528\u6237\u767b\u5f55\u6210\u529f\u4e4b\u540e\uff0c\u4f1a\u4e0esso\u8ba4\u8bc1\u4e2d\u5fc3\u53ca\u5404\u4e2a\u5b50\u7cfb\u7edf\u5efa\u7acb\u4f1a\u8bdd\uff0c\u7528\u6237\u4e0esso\u8ba4\u8bc1\u4e2d\u5fc3\u5efa\u7acb\u7684\u4f1a\u8bdd\u79f0\u4e3a\u5168\u5c40\u4f1a\u8bdd\uff0c\u7528\u6237\u4e0e\u5404\u4e2a\u5b50\u7cfb\u7edf\u5efa\u7acb\u7684\u4f1a\u8bdd\u79f0\u4e3a\u5c40\u90e8\u4f1a\u8bdd\uff0c\u5c40\u90e8\u4f1a\u8bdd\u5efa\u7acb\u4e4b\u540e\uff0c\u7528\u6237\u8bbf\u95ee\u5b50\u7cfb\u7edf\u53d7\u4fdd\u62a4\u8d44\u6e90\u5c06\u4e0d\u518d\u901a\u8fc7sso\u8ba4\u8bc1\u4e2d\u5fc3\uff0c\u5168\u5c40\u4f1a\u8bdd\u4e0e\u5c40\u90e8\u4f1a\u8bdd\u6709\u5982\u4e0b\u7ea6\u675f\u5173\u7cfb<\/p>\n<ol style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem;\">\n<li>\u5c40\u90e8\u4f1a\u8bdd\u5b58\u5728\uff0c\u5168\u5c40\u4f1a\u8bdd\u4e00\u5b9a\u5b58\u5728<\/li>\n<li>\u5168\u5c40\u4f1a\u8bdd\u5b58\u5728\uff0c\u5c40\u90e8\u4f1a\u8bdd\u4e0d\u4e00\u5b9a\u5b58\u5728<\/li>\n<li>\u5168\u5c40\u4f1a\u8bdd\u9500\u6bc1\uff0c\u5c40\u90e8\u4f1a\u8bdd\u5fc5\u987b\u9500\u6bc1<\/li>\n<\/ol>\n<p style=\"margin: 1em 0px;\">\u4f60\u53ef\u4ee5\u901a\u8fc7\u535a\u5ba2\u56ed\u3001\u767e\u5ea6\u3001csdn\u3001\u6dd8\u5b9d\u7b49\u7f51\u7ad9\u7684\u767b\u5f55\u8fc7\u7a0b\u52a0\u6df1\u5bf9\u5355\u70b9\u767b\u5f55\u7684\u7406\u89e3\uff0c\u6ce8\u610f\u89c2\u5bdf\u767b\u5f55\u8fc7\u7a0b\u4e2d\u7684\u8df3\u8f6curl\u4e0e\u53c2\u6570<\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">2\u3001\u6ce8\u9500<\/h3>\n<p style=\"margin: 1em 0px;\">\u5355\u70b9\u767b\u5f55\u81ea\u7136\u4e5f\u8981\u5355\u70b9\u6ce8\u9500\uff0c\u5728\u4e00\u4e2a\u5b50\u7cfb\u7edf\u4e2d\u6ce8\u9500\uff0c\u6240\u6709\u5b50\u7cfb\u7edf\u7684\u4f1a\u8bdd\u90fd\u5c06\u88ab\u9500\u6bc1\uff0c\u7528\u4e0b\u9762\u7684\u56fe\u6765\u8bf4\u660e<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20210405214340.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3176\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20210405214340.png\" alt=\"\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20210405214340\" width=\"710\" height=\"509\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">sso\u8ba4\u8bc1\u4e2d\u5fc3\u4e00\u76f4\u76d1\u542c\u5168\u5c40\u4f1a\u8bdd\u7684\u72b6\u6001\uff0c\u4e00\u65e6\u5168\u5c40\u4f1a\u8bdd\u9500\u6bc1\uff0c\u76d1\u542c\u5668\u5c06\u901a\u77e5\u6240\u6709\u6ce8\u518c\u7cfb\u7edf\u6267\u884c\u6ce8\u9500\u64cd\u4f5c<\/p>\n<p style=\"margin: 1em 0px;\">\u4e0b\u9762\u5bf9\u4e0a\u56fe\u7b80\u8981\u8bf4\u660e<\/p>\n<ol style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem;\">\n<li>\u7528\u6237\u5411\u7cfb\u7edf1\u53d1\u8d77\u6ce8\u9500\u8bf7\u6c42<\/li>\n<li>\u7cfb\u7edf1\u6839\u636e\u7528\u6237\u4e0e\u7cfb\u7edf1\u5efa\u7acb\u7684\u4f1a\u8bddid\u62ff\u5230\u4ee4\u724c\uff0c\u5411sso\u8ba4\u8bc1\u4e2d\u5fc3\u53d1\u8d77\u6ce8\u9500\u8bf7\u6c42<\/li>\n<li>sso\u8ba4\u8bc1\u4e2d\u5fc3\u6821\u9a8c\u4ee4\u724c\u6709\u6548\uff0c\u9500\u6bc1\u5168\u5c40\u4f1a\u8bdd\uff0c\u540c\u65f6\u53d6\u51fa\u6240\u6709\u7528\u6b64\u4ee4\u724c\u6ce8\u518c\u7684\u7cfb\u7edf\u5730\u5740<\/li>\n<li>sso\u8ba4\u8bc1\u4e2d\u5fc3\u5411\u6240\u6709\u6ce8\u518c\u7cfb\u7edf\u53d1\u8d77\u6ce8\u9500\u8bf7\u6c42<\/li>\n<li>\u5404\u6ce8\u518c\u7cfb\u7edf\u63a5\u6536sso\u8ba4\u8bc1\u4e2d\u5fc3\u7684\u6ce8\u9500\u8bf7\u6c42\uff0c\u9500\u6bc1\u5c40\u90e8\u4f1a\u8bdd<\/li>\n<li>sso\u8ba4\u8bc1\u4e2d\u5fc3\u5f15\u5bfc\u7528\u6237\u81f3\u767b\u5f55\u9875\u9762<\/li>\n<\/ol>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u56db\u3001\u90e8\u7f72\u56fe<\/h2>\n<p style=\"margin: 1em 0px;\">\u5355\u70b9\u767b\u5f55\u6d89\u53casso\u8ba4\u8bc1\u4e2d\u5fc3\u4e0e\u4f17\u5b50\u7cfb\u7edf\uff0c\u5b50\u7cfb\u7edf\u4e0esso\u8ba4\u8bc1\u4e2d\u5fc3\u9700\u8981\u901a\u4fe1\u4ee5\u4ea4\u6362\u4ee4\u724c\u3001\u6821\u9a8c\u4ee4\u724c\u53ca\u53d1\u8d77\u6ce8\u9500\u8bf7\u6c42\uff0c\u56e0\u800c\u5b50\u7cfb\u7edf\u5fc5\u987b\u96c6\u6210sso\u7684\u5ba2\u6237\u7aef\uff0csso\u8ba4\u8bc1\u4e2d\u5fc3\u5219\u662fsso\u670d\u52a1\u7aef\uff0c\u6574\u4e2a\u5355\u70b9\u767b\u5f55\u8fc7\u7a0b\u5b9e\u8d28\u662fsso\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u7aef\u901a\u4fe1\u7684\u8fc7\u7a0b\uff0c\u7528\u4e0b\u56fe\u63cf\u8ff0<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20210405214355.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3177\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20210405214355.png\" alt=\"\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20210405214355\" width=\"724\" height=\"561\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">sso\u8ba4\u8bc1\u4e2d\u5fc3\u4e0esso\u5ba2\u6237\u7aef\u901a\u4fe1\u65b9\u5f0f\u6709\u591a\u79cd\uff0c\u8fd9\u91cc\u4ee5\u7b80\u5355\u597d\u7528\u7684httpClient\u4e3a\u4f8b\uff0cweb service\u3001rpc\u3001restful api\u90fd\u53ef\u4ee5<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e94\u3001\u5b9e\u73b0<\/h2>\n<p style=\"margin: 1em 0px;\">\u53ea\u662f\u7b80\u8981\u4ecb\u7ecd\u4e0b\u57fa\u4e8ejava\u7684\u5b9e\u73b0\u8fc7\u7a0b\uff0c\u4e0d\u63d0\u4f9b\u5b8c\u6574\u6e90\u7801\uff0c\u660e\u767d\u4e86\u539f\u7406\uff0c\u6211\u76f8\u4fe1\u4f60\u4eec\u53ef\u4ee5\u81ea\u5df1\u5b9e\u73b0\u3002sso\u91c7\u7528\u5ba2\u6237\u7aef\/\u670d\u52a1\u7aef\u67b6\u6784\uff0c\u6211\u4eec\u5148\u770bsso-client\u4e0esso-server\u8981\u5b9e\u73b0\u7684\u529f\u80fd\uff08\u4e0b\u9762\uff1asso\u8ba4\u8bc1\u4e2d\u5fc3=sso-server\uff09<\/p>\n<p style=\"margin: 1em 0px;\">sso-client<\/p>\n<ol style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem;\">\n<li>\u62e6\u622a\u5b50\u7cfb\u7edf\u672a\u767b\u5f55\u7528\u6237\u8bf7\u6c42\uff0c\u8df3\u8f6c\u81f3sso\u8ba4\u8bc1\u4e2d\u5fc3<\/li>\n<li>\u63a5\u6536\u5e76\u5b58\u50a8sso\u8ba4\u8bc1\u4e2d\u5fc3\u53d1\u9001\u7684\u4ee4\u724c<\/li>\n<li>\u4e0esso-server\u901a\u4fe1\uff0c\u6821\u9a8c\u4ee4\u724c\u7684\u6709\u6548\u6027<\/li>\n<li>\u5efa\u7acb\u5c40\u90e8\u4f1a\u8bdd<\/li>\n<li>\u62e6\u622a\u7528\u6237\u6ce8\u9500\u8bf7\u6c42\uff0c\u5411sso\u8ba4\u8bc1\u4e2d\u5fc3\u53d1\u9001\u6ce8\u9500\u8bf7\u6c42<\/li>\n<li>\u63a5\u6536sso\u8ba4\u8bc1\u4e2d\u5fc3\u53d1\u51fa\u7684\u6ce8\u9500\u8bf7\u6c42\uff0c\u9500\u6bc1\u5c40\u90e8\u4f1a\u8bdd<\/li>\n<\/ol>\n<p style=\"margin: 1em 0px;\">sso-server<\/p>\n<ol style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem;\">\n<li>\u9a8c\u8bc1\u7528\u6237\u7684\u767b\u5f55\u4fe1\u606f<\/li>\n<li>\u521b\u5efa\u5168\u5c40\u4f1a\u8bdd<\/li>\n<li>\u521b\u5efa\u6388\u6743\u4ee4\u724c<\/li>\n<li>\u4e0esso-client\u901a\u4fe1\u53d1\u9001\u4ee4\u724c<\/li>\n<li>\u6821\u9a8csso-client\u4ee4\u724c\u6709\u6548\u6027<\/li>\n<li>\u7cfb\u7edf\u6ce8\u518c<\/li>\n<li>\u63a5\u6536sso-client\u6ce8\u9500\u8bf7\u6c42\uff0c\u6ce8\u9500\u6240\u6709\u4f1a\u8bdd<\/li>\n<\/ol>\n<p style=\"margin: 1em 0px;\">\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u6309\u7167\u539f\u7406\u6765\u4e00\u6b65\u6b65\u5b9e\u73b0sso\u5427\uff01<\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">1\u3001sso-client\u62e6\u622a\u672a\u767b\u5f55\u8bf7\u6c42<\/h3>\n<p style=\"margin: 1em 0px;\">java\u62e6\u622a\u8bf7\u6c42\u7684\u65b9\u5f0f\u6709servlet\u3001filter\u3001listener\u4e09\u79cd\u65b9\u5f0f\uff0c\u6211\u4eec\u91c7\u7528filter\u3002\u5728sso-client\u4e2d\u65b0\u5efaLoginFilter.java\u7c7b\u5e76\u5b9e\u73b0Filter\u63a5\u53e3\uff0c\u5728doFilter()\u65b9\u6cd5\u4e2d\u52a0\u5165\u5bf9\u672a\u767b\u5f55\u7528\u6237\u7684\u62e6\u622a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">public\nvoid\ndoFilter(ServletRequest request, ServletResponse response, FilterChain chain)\nthrows\nIOException, ServletException {\nHttpServletRequest req = (HttpServletRequest) request;\nHttpServletResponse res = (HttpServletResponse) response;\nHttpSession session = req.getSession();\nif\n(session.getAttribute(\n\"isLogin\"\n)) {\nchain.doFilter(request, response);\nreturn\n;\n}\n\/\/\u8df3\u8f6c\u81f3sso\u8ba4\u8bc1\u4e2d\u5fc3\nres.sendRedirect(\n\"sso-server-url-with-system-url\"\n);\n}<\/code><\/pre>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">2\u3001sso-server\u62e6\u622a\u672a\u767b\u5f55\u8bf7\u6c42<\/h3>\n<p style=\"margin: 1em 0px;\">\u62e6\u622a\u4ecesso-client\u8df3\u8f6c\u81f3sso\u8ba4\u8bc1\u4e2d\u5fc3\u7684\u672a\u767b\u5f55\u8bf7\u6c42\uff0c\u8df3\u8f6c\u81f3\u767b\u5f55\u9875\u9762\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u4e0esso-client\u5b8c\u5168\u4e00\u6837<\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">3\u3001sso-server\u9a8c\u8bc1\u7528\u6237\u767b\u5f55\u4fe1\u606f<\/h3>\n<p style=\"margin: 1em 0px;\">\u7528\u6237\u5728\u767b\u5f55\u9875\u9762\u8f93\u5165\u7528\u6237\u540d\u5bc6\u7801\uff0c\u8bf7\u6c42\u767b\u5f55\uff0csso\u8ba4\u8bc1\u4e2d\u5fc3\u6821\u9a8c\u7528\u6237\u4fe1\u606f\uff0c\u6821\u9a8c\u6210\u529f\uff0c\u5c06\u4f1a\u8bdd\u72b6\u6001\u6807\u8bb0\u4e3a\u201c\u5df2\u767b\u5f55\u201d<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">@RequestMapping\n(\n\"\/login\"\n)\npublic\nString login(String username, String password, HttpServletRequest req) {\nthis\n.checkLoginInfo(username, password);\nreq.getSession().setAttribute(\n\"isLogin\"\n,\ntrue\n);\nreturn\n\"success\"\n;\n}<\/code><\/pre>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">4\u3001sso-server\u521b\u5efa\u6388\u6743\u4ee4\u724c<\/h3>\n<p style=\"margin: 1em 0px;\">\u6388\u6743\u4ee4\u724c\u662f\u4e00\u4e32\u968f\u673a\u5b57\u7b26\uff0c\u4ee5\u4ec0\u4e48\u6837\u7684\u65b9\u5f0f\u751f\u6210\u90fd\u6ca1\u6709\u5173\u7cfb\uff0c\u53ea\u8981\u4e0d\u91cd\u590d\u3001\u4e0d\u6613\u4f2a\u9020\u5373\u53ef\uff0c\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">String token = UUID.randomUUID().toString();<\/code><\/pre>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">5\u3001sso-client\u53d6\u5f97\u4ee4\u724c\u5e76\u6821\u9a8c<\/h3>\n<p style=\"margin: 1em 0px;\">sso\u8ba4\u8bc1\u4e2d\u5fc3\u767b\u5f55\u540e\uff0c\u8df3\u8f6c\u56de\u5b50\u7cfb\u7edf\u5e76\u9644\u4e0a\u4ee4\u724c\uff0c\u5b50\u7cfb\u7edf\uff08sso-client\uff09\u53d6\u5f97\u4ee4\u724c\uff0c\u7136\u540e\u53bbsso\u8ba4\u8bc1\u4e2d\u5fc3\u6821\u9a8c\uff0c\u5728LoginFilter.java\u7684doFilter()\u4e2d\u6dfb\u52a0\u51e0\u884c<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">\/\/ \u8bf7\u6c42\u9644\u5e26token\u53c2\u6570\nString token = req.getParameter(\n\"token\"\n);\nif\n(token !=\nnull\n) {\n\/\/ \u53bbsso\u8ba4\u8bc1\u4e2d\u5fc3\u6821\u9a8ctoken\nboolean\nverifyResult =\nthis\n.verify(\n\"sso-server-verify-url\"\n, token);\nif\n(!verifyResult) {\nres.sendRedirect(\n\"sso-server-url\"\n);\nreturn\n;\n}\nchain.doFilter(request, response);\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">verify()\u65b9\u6cd5\u4f7f\u7528httpClient\u5b9e\u73b0\uff0c\u8fd9\u91cc\u4ec5\u7b80\u7565\u4ecb\u7ecd\uff0chttpClient\u8be6\u7ec6\u4f7f\u7528\u65b9\u6cd5\u8bf7\u53c2\u8003\u5b98\u65b9\u6587\u6863<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">HttpPost httpPost =\nnew\nHttpPost(\n\"sso-server-verify-url-with-token\"\n);\nHttpResponse httpResponse = httpClient.execute(httpPost);<\/code><\/pre>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">6\u3001sso-server\u63a5\u6536\u5e76\u5904\u7406\u6821\u9a8c\u4ee4\u724c\u8bf7\u6c42<\/h3>\n<p style=\"margin: 1em 0px;\">\u7528\u6237\u5728sso\u8ba4\u8bc1\u4e2d\u5fc3\u767b\u5f55\u6210\u529f\u540e\uff0csso-server\u521b\u5efa\u6388\u6743\u4ee4\u724c\u5e76\u5b58\u50a8\u8be5\u4ee4\u724c\uff0c\u6240\u4ee5\uff0csso-server\u5bf9\u4ee4\u724c\u7684\u6821\u9a8c\u5c31\u662f\u53bb\u67e5\u627e\u8fd9\u4e2a\u4ee4\u724c\u662f\u5426\u5b58\u5728\u4ee5\u53ca\u662f\u5426\u8fc7\u671f\uff0c\u4ee4\u724c\u6821\u9a8c\u6210\u529f\u540esso-server\u5c06\u53d1\u9001\u6821\u9a8c\u8bf7\u6c42\u7684\u7cfb\u7edf\u6ce8\u518c\u5230sso\u8ba4\u8bc1\u4e2d\u5fc3\uff08\u5c31\u662f\u5b58\u50a8\u8d77\u6765\u7684\u610f\u601d\uff09<\/p>\n<p style=\"margin: 1em 0px;\">\u4ee4\u724c\u4e0e\u6ce8\u518c\u7cfb\u7edf\u5730\u5740\u901a\u5e38\u5b58\u50a8\u5728key-value\u6570\u636e\u5e93\uff08\u5982redis\uff09\u4e2d\uff0credis\u53ef\u4ee5\u4e3akey\u8bbe\u7f6e\u6709\u6548\u65f6\u95f4\u4e5f\u5c31\u662f\u4ee4\u724c\u7684\u6709\u6548\u671f\u3002redis\u8fd0\u884c\u5728\u5185\u5b58\u4e2d\uff0c\u901f\u5ea6\u975e\u5e38\u5feb\uff0c\u6b63\u597dsso-server\u4e0d\u9700\u8981\u6301\u4e45\u5316\u4efb\u4f55\u6570\u636e\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u4ee4\u724c\u4e0e\u6ce8\u518c\u7cfb\u7edf\u5730\u5740\u53ef\u4ee5\u7528\u4e0b\u56fe\u63cf\u8ff0\u7684\u7ed3\u6784\u5b58\u50a8\u5728redis\u4e2d\uff0c\u53ef\u80fd\u4f60\u4f1a\u95ee\uff0c\u4e3a\u4ec0\u4e48\u8981\u5b58\u50a8\u8fd9\u4e9b\u7cfb\u7edf\u7684\u5730\u5740\uff1f\u5982\u679c\u4e0d\u5b58\u50a8\uff0c\u6ce8\u9500\u7684\u65f6\u5019\u5c31\u9ebb\u70e6\u4e86\uff0c\u7528\u6237\u5411sso\u8ba4\u8bc1\u4e2d\u5fc3\u63d0\u4ea4\u6ce8\u9500\u8bf7\u6c42\uff0csso\u8ba4\u8bc1\u4e2d\u5fc3\u6ce8\u9500\u5168\u5c40\u4f1a\u8bdd\uff0c\u4f46\u4e0d\u77e5\u9053\u54ea\u4e9b\u7cfb\u7edf\u7528\u6b64\u5168\u5c40\u4f1a\u8bdd\u5efa\u7acb\u4e86\u81ea\u5df1\u7684\u5c40\u90e8\u4f1a\u8bdd\uff0c\u4e5f\u4e0d\u77e5\u9053\u8981\u5411\u54ea\u4e9b\u5b50\u7cfb\u7edf\u53d1\u9001\u6ce8\u9500\u8bf7\u6c42\u6ce8\u9500\u5c40\u90e8\u4f1a\u8bdd<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20210405214411.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3178\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20210405214411.png\" alt=\"\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20210405214411\" width=\"350\" height=\"165\" \/><\/a><\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">7\u3001sso-client\u6821\u9a8c\u4ee4\u724c\u6210\u529f\u521b\u5efa\u5c40\u90e8\u4f1a\u8bdd<\/h3>\n<p style=\"margin: 1em 0px;\">\u4ee4\u724c\u6821\u9a8c\u6210\u529f\u540e\uff0csso-client\u5c06\u5f53\u524d\u5c40\u90e8\u4f1a\u8bdd\u6807\u8bb0\u4e3a\u201c\u5df2\u767b\u5f55\u201d\uff0c\u4fee\u6539LoginFilter.java\uff0c\u6dfb\u52a0\u51e0\u884c<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">if\n(verifyResult) {\nsession.setAttribute(\n\"isLogin\"\n,\ntrue\n);\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">sso-client\u8fd8\u9700\u5c06\u5f53\u524d\u4f1a\u8bddid\u4e0e\u4ee4\u724c\u7ed1\u5b9a\uff0c\u8868\u793a\u8fd9\u4e2a\u4f1a\u8bdd\u7684\u767b\u5f55\u72b6\u6001\u4e0e\u4ee4\u724c\u76f8\u5173\uff0c\u6b64\u5173\u7cfb\u53ef\u4ee5\u7528java\u7684hashmap\u4fdd\u5b58\uff0c\u4fdd\u5b58\u7684\u6570\u636e\u7528\u6765\u5904\u7406sso\u8ba4\u8bc1\u4e2d\u5fc3\u53d1\u6765\u7684\u6ce8\u9500\u8bf7\u6c42<\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">8\u3001\u6ce8\u9500\u8fc7\u7a0b<\/h3>\n<p style=\"margin: 1em 0px;\">\u7528\u6237\u5411\u5b50\u7cfb\u7edf\u53d1\u9001\u5e26\u6709\u201clogout\u201d\u53c2\u6570\u7684\u8bf7\u6c42\uff08\u6ce8\u9500\u8bf7\u6c42\uff09\uff0csso-client\u62e6\u622a\u5668\u62e6\u622a\u8be5\u8bf7\u6c42\uff0c\u5411sso\u8ba4\u8bc1\u4e2d\u5fc3\u53d1\u8d77\u6ce8\u9500\u8bf7\u6c42<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">String logout = req.getParameter(\n\"logout\"\n);\nif\n(logout !=\nnull\n) {\nthis\n.ssoServer.logout(token);\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">sso\u8ba4\u8bc1\u4e2d\u5fc3\u4e5f\u7528\u540c\u6837\u7684\u65b9\u5f0f\u8bc6\u522b\u51fasso-client\u7684\u8bf7\u6c42\u662f\u6ce8\u9500\u8bf7\u6c42\uff08\u5e26\u6709\u201clogout\u201d\u53c2\u6570\uff09\uff0csso\u8ba4\u8bc1\u4e2d\u5fc3\u6ce8\u9500\u5168\u5c40\u4f1a\u8bdd<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">@RequestMapping\n(\n\"\/logout\"\n)\npublic\nString logout(HttpServletRequest req) {\nHttpSession session = req.getSession();\nif\n(session !=\nnull\n) {\nsession.invalidate();\n\/\/\u89e6\u53d1LogoutListener\n}\nreturn\n\"redirect:\/\"\n;\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">sso\u8ba4\u8bc1\u4e2d\u5fc3\u6709\u4e00\u4e2a\u5168\u5c40\u4f1a\u8bdd\u7684\u76d1\u542c\u5668\uff0c\u4e00\u65e6\u5168\u5c40\u4f1a\u8bdd\u6ce8\u9500\uff0c\u5c06\u901a\u77e5\u6240\u6709\u6ce8\u518c\u7cfb\u7edf\u6ce8\u9500<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">public\nclass\nLogoutListener\nimplements\nHttpSessionListener {\n@Override\npublic\nvoid\nsessionCreated(HttpSessionEvent event) {}\n@Override\npublic\nvoid\nsessionDestroyed(HttpSessionEvent event) {\n\/\/\u901a\u8fc7httpClient\u5411\u6240\u6709\u6ce8\u518c\u7cfb\u7edf\u53d1\u9001\u6ce8\u9500\u8bf7\u6c42\n}\n}<\/code><\/pre>\n<blockquote style=\"display: block; font-size: 0.9em; border-left: 3px solid #4870ac; padding: 0.5em 1em; margin: 0px; background: #f6f8fa; color: #40464f;\">\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1aSSO \u7528\u8ba4\u8bc1\u4e2d\u5fc3\u53d1\u4ee4\u724c\u3001\u5b50\u7cfb\u7edf\u6821\u9a8c\u540e\u5efa\u5c40\u90e8\u4f1a\u8bdd\uff0c\u628a\u300c\u767b\u5f55\u4e00\u6b21\u3001\u5230\u5904\u53ef\u7528\u300d\u4ece\u5171\u4eab Cookie \u91cc\u89e3\u653e\u51fa\u6765\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>HTTP \u65e0\u72b6\u6001\uff0c\u5355\u7cfb\u7edf\u9760 \u4f1a\u8bdd + Cookie\uff08JSESSIONID\uff09 \u8bb0\u4f4f\u767b\u5f55\u3002\u7cfb\u7edf\u4e00\u53d8\u6210\u5e94\u7528\u7fa4\uff0c\u7528\u6237\u5374 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[59,99],"tags":[100,154],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3166"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3166"}],"version-history":[{"count":2,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3166\/revisions"}],"predecessor-version":[{"id":3179,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3166\/revisions\/3179"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}