Upgrade to Pro — share decks privately, control downloads, hide ads and more …

BasicBasic認証

 BasicBasic認証

Avatar for sadnessOjisan

sadnessOjisan

August 24, 2024
Tweet

More Decks by sadnessOjisan

Other Decks in Programming

Transcript

  1. The Basic authentication scheme utilizes the Authentication Framework as follows.

    In challenges: o The scheme name is "Basic". o The authentication parameter 'realm' is REQUIRED ([RFC7235], Section 2.2). o The authentication parameter 'charset' is OPTIONAL (see Section 2.1). o No other authentication parameters are defined -- unknown parameters MUST be ignored by recipients, and new parameters can only be defined by revising this specification. ここでいう認証フレームワークとチャレンジとは何か?
  2. RFC9110: HTTP Semantics (Authorization) token68 = 1*( ALPHA / DIGIT

    / "-" / "." / "_" / "~" / "+" / "/" ) *"=" credentials = auth-scheme [ 1*SP ( token68 / #auth-param ) ] Authorization = credentials a-z, A-z, 0-9, 記号 で作られた文字列 QWxhZGRpbjpPcGVuU2VzYW1l https://datatracker.ietf.org/doc/html/rfc9110
  3. RFC9110: HTTP Semantics (Authorization) token68 = 1*( ALPHA / DIGIT

    / "-" / "." / "_" / "~" / "+" / "/" ) *"=" credentials = auth-scheme [ 1*SP ( token68 / #auth-param ) ] Authorization = credentials scheme [space] token68 Bearer fjiweofjewfj
  4. RFC9110: HTTP Semantics (Authorization) token68 = 1*( ALPHA / DIGIT

    / "-" / "." / "_" / "~" / "+" / "/" ) *"=" credentials = auth-scheme [ 1*SP ( token68 / #auth-param ) ] Authorization = credentials Authorization に値をセットする Basic hogehoge==
  5. The Basic authentication scheme utilizes the Authentication Framework as follows.

    In challenges: o The scheme name is "Basic". o The authentication parameter 'realm' is REQUIRED ([RFC7235], Section 2.2). o The authentication parameter 'charset' is OPTIONAL (see Section 2.1). o No other authentication parameters are defined -- unknown parameters MUST be ignored by recipients, and new parameters can only be defined by revising this specification.
  6. Basic 認証の資格情報の作り方 obtains the user-id and password from the user,

    constructs the user-pass by concatenating the user-id, a single colon (":") character, and the password, encodes the user-pass into an octet sequence (see below for a discussion of character encoding schemes), and obtains the basic-credentials by encoding this octet sequence using Base64 ([RFC4648], Section 4) into a sequence of US-ASCII characters ([RFC0020]). userid と password を : で繋ぐ
  7. Basic 認証の資格情報の作り方 obtains the user-id and password from the user,

    constructs the user-pass by concatenating the user-id, a single colon (":") character, and the password, encodes the user-pass into an octet sequence (see below for a discussion of character encoding schemes), and obtains the basic-credentials by encoding this octet sequence using Base64 ([RFC4648], Section 4) into a sequence of US-ASCII characters ([RFC0020]). Base64でエンコードする
  8. サーバーは逆に利用する • Base64でdecode • : 区切りで分割 • 前半が user id,

    後半が password • それを検証して、想定値でなければ 401 を返す