diff options
Diffstat (limited to 'files/zh-cn/web/http/headers/proxy-authorization')
-rw-r--r-- | files/zh-cn/web/http/headers/proxy-authorization/index.html | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/files/zh-cn/web/http/headers/proxy-authorization/index.html b/files/zh-cn/web/http/headers/proxy-authorization/index.html new file mode 100644 index 0000000000..f7dafee9a1 --- /dev/null +++ b/files/zh-cn/web/http/headers/proxy-authorization/index.html @@ -0,0 +1,81 @@ +--- +title: Proxy-Authorization +slug: Web/HTTP/Headers/Proxy-Authorization +tags: + - 请求首部 + - 身份验证 + - 首部 +translation_of: Web/HTTP/Headers/Proxy-Authorization +--- +<div>{{HTTPSidebar}}</div> + +<p><strong><code>Proxy-Authorization</code></strong> 是一个请求首部,其中包含了用户代理提供给代理服务器的用于身份验证的凭证。这个首部通常是在服务器返回了 {{HTTPStatus("407")}} <code>Proxy Authentication Required</code> 响应状态码及 {{HTTPHeader("Proxy-Authenticate")}} 首部后发送的。</p> + +<table class="properties"> + <tbody> + <tr> + <th scope="row">Header type</th> + <td>{{Glossary("Request header")}}</td> + </tr> + <tr> + <th scope="row">{{Glossary("Forbidden header name")}}</th> + <td>no</td> + </tr> + </tbody> +</table> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">Proxy-Authorization: <type> <credentials></pre> + +<h2 id="指令">指令</h2> + +<dl> + <dt><type></dt> + <dd><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#Authentication_schemes">身份验证类型</a>。一个常见的类型是 <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#Basic_authentication_scheme">"基本验证"。</a>IANA 机构维护了 <a href="http://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml">一系列的身份验证机制</a>。</dd> + <dt><credentials></dt> + <dd>凭证的构成方式如下: + <ul> + <li>将用户名和密码用冒号拼接(aladdin:opensesame)。</li> + <li>将拼接生成的字符串使用 <a href="/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding">base64</a> 编码方式进行编码(YWxhZGRpbjpvcGVuc2VzYW1l)。</li> + </ul> + + <div class="note"> + <p><strong>注意:</strong> Base64 编码方式不是用来加密或者获取摘要的!这种方法的安全性相当于将凭证使用明文发送(base64 是一种可逆编码方式)。在使用基本身份验证方式的时候推荐与 HTTPS 搭配使用。</p> + </div> + </dd> +</dl> + +<h2 id="示例">示例</h2> + +<pre>Proxy-Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Title</th> + </tr> + <tr> + <td>{{RFC("7235", "Proxy-Authorization", "4.4")}}</td> + <td>HTTP/1.1: Authentication</td> + </tr> + <tr> + <td>{{RFC("7617")}}</td> + <td>The 'Basic' HTTP Authentication Scheme</td> + </tr> + </tbody> +</table> + +<h2 id="相关内容">相关内容</h2> + +<ul> + <li><a href="/en-US/docs/Web/HTTP/Authentication">HTTP authentication</a></li> + <li>{{HTTPHeader("Proxy-Authenticate")}}</li> + <li>{{HTTPHeader("WWW-Authenticate")}}</li> + <li>{{HTTPHeader("Authorization")}}</li> + <li>{{HTTPStatus("401")}}, {{HTTPStatus("403")}}, {{HTTPStatus("407")}}</li> +</ul> |