--- title: WWW-Authenticate slug: Web/HTTP/Headers/WWW-Authenticate tags: - HTTP - HTTP ヘッダー - ヘッダー - リファレンス - レスポンスヘッダー translation_of: Web/HTTP/Headers/WWW-Authenticate --- <div>{{HTTPSidebar}}</div> <p>HTTP の <strong><code>WWW-Authenticate</code></strong> 応答ヘッダーは、リソースへのアクセス権を得るために使われる認証方法を定義します。</p> <p><code>WWW-Authenticate</code> ヘッダーは {{HTTPStatus("401")}} <code>Unauthorized</code> 応答と共に送られます。</p> <table class="properties"> <tbody> <tr> <th scope="row">ヘッダー種別</th> <td>{{Glossary("Response header", "応答ヘッダー")}}</td> </tr> <tr> <th scope="row">{{Glossary("Forbidden header name", "禁止ヘッダー名")}}</th> <td>いいえ</td> </tr> </tbody> </table> <h2 id="Syntax" name="Syntax">構文</h2> <pre class="syntaxbox">WWW-Authenticate: <type> realm=<realm> </pre> <h2 id="Directives" name="Directives">ディレクティブ</h2> <dl> <dt><type></dt> <dd><a href="/ja/docs/Web/HTTP/Authentication#Authentication_schemes">認証の種類</a>。一般的には <a href="/ja/docs/Web/HTTP/Authentication#Basic_authentication_scheme">"Basic"</a> です。 IANA は <a href="http://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml">認証方式の一覧</a>を管理しています。</dd> <dt>realm=<realm></dt> <dd>保護領域の説明です。 realm が指定されていない場合は、クライアントはよく書式化されたホスト名を代わりに表示します。</dd> <dt>charset=<charset></dt> <dd>ユーザー名とパスワードを送信するときのサーバーが推奨するエンコーディング方式をクライアントに伝えます。大文字小文字の区別なしの文字列 "UTF-8" だけが許可されています。これは realm 文字列のエンコーディングとは関係がありません。</dd> </dl> <h2 id="Examples" name="Examples">例</h2> <p>通常、 <code>WWW-Authenticate</code> ヘッダーを含むサーバーの応答は以下のようなものです。</p> <pre>WWW-Authenticate: Basic WWW-Authenticate: Basic realm="Access to the staging site", charset="UTF-8" </pre> <p>Apache や nginx サーバーで HTTP Basic 認証を使用してサイトを保護する方法の例については、 <a href="/ja/docs/Web/HTTP/Authentication">HTTP 認証</a> を参照してください。</p> <h2 id="Specifications" name="Specifications">仕様書</h2> <table class="standard-table"> <thead> <tr> <th scope="col">仕様書</th> <th scope="col">題名</th> </tr> </thead> <tbody> <tr> <td>{{RFC("7235", "WWW-Authenticate", "4.1")}}</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="Browser_compatibility" name="Browser_compatibility">ブラウザーの対応</h2> <p class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力したいのであれば、 <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</p> <p>{{Compat("http.headers.WWW-Authenticate")}}</p> <h2 id="See_also" name="See_also">関連情報</h2> <ul> <li><a href="/ja/docs/Web/HTTP/Authentication">HTTP 認証</a></li> <li>{{HTTPHeader("Authorization")}}</li> <li>{{HTTPHeader("Proxy-Authorization")}}</li> <li>{{HTTPHeader("Proxy-Authenticate")}}</li> <li>{{HTTPStatus("401")}}, {{HTTPStatus("403")}}, {{HTTPStatus("407")}}</li> </ul>