0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Spring Securityがhttpリクエストヘッダーやレスポンスヘッダーにキー設定あるのか

Posted at

HTTPリクエスト/レスポンスヘッダーにどのように関与するかについては、公式ドキュメントにしっかり記載されています。ただし、「キーを設定する」という表現ではなく、セキュリティヘッダーを追加・制御するという形で記述されています。

Spring Securityがレスポンスヘッダーに追加する内容(公式)

ヘッダー名 内容 デフォルト
Cache-Control no-cache, no-store, max-age=0, must-revalidate 有効
Pragma no-cache 有効
Expires 0 有効
X-Content-Type-Options nosniff 有効
X-Frame-Options DENY 有効
Strict-Transport-Security max-age=31536000 ; includeSubDomains HTTPS時に有効
Content-Security-Policy 任意(設定時) 無効(手動設定必要)

Spring Securityがリクエストヘッダーを検査する内容(公式)

Authorization ヘッダーについて:

Spring Securityは、Authorization ヘッダー(Bearer TokenやBasic認証)を解析して、認証情報を取得します。

CSRF トークンのヘッダー送信:

フロントエンドは X-CSRF-TOKEN や X-XSRF-TOKEN ヘッダーにトークンを入れてリクエストします。

補足:公式ドキュメントの探し方

「Exploits」セクションにヘッダーの記述あり

「HTTP Security」セクションに詳細なDSLの使い方あり

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?