HTTP Basic Authentication Parser

Decode strict Base64 Basic credentials as byte values and separate the first colon, leaving character-set interpretation to the caller.

Description

HTTP Basic credentials encode username and password bytes as Base64.

HTTP Basic credentials encode username and password bytes as Base64. Base64 is reversible encoding, and choosing a text character set is a separate step.1, 2

The returned values include Username bytes, Password bytes. The How section below explains the calculation, input rules and interpretation.

When to use HTTP Basic Authentication Parser

Use HTTP Basic Authentication Parser when you need to evaluate the supplied records under the calculation and evidence rules below. No UTF-8 or other charset interpretation, credential verification or encryption is performed. Leading header whitespace is rejected.

Paste the requested HTTP header field value. Use the field table to distinguish request cookies, media types and authorization credentials.

How to use HTTP Basic Authentication Parser and understand its results

  1. Paste the requested HTTP header field value. Use the field table to distinguish request cookies, media types and authorization credentials.
  2. Enter header using the field table and calculation rules, then run the tool.
  3. Read usernameBytes, passwordBytes. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
headerAuthorization field value.string; maximum length: 1000000Required

Paste an Authorization field value starting case-insensitive Basic followed by spaces/tabs. Decode strict canonical Base64 with required padding and zero unused bits. Require a colon and reject control bytes below 32 or127. Split at first colon; return username/password byte arrays. Empty username/password are allowed; later colons belong to password.

decoded bytes split at first byte58

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
usernameBytesUsername bytes.list of integer; minimum: 0; maximum: 255; minimum entries: 0; maximum entries: 100000
passwordBytesPassword bytes.list of integer; minimum: 0; maximum: 255; minimum entries: 0; maximum entries: 100000
json
{
  "input": {
    "header": "Basic dXNlcjpwYXNz"
  },
  "output": {
    "usernameBytes": [
      117,
      115,
      101,
      114
    ],
    "passwordBytes": [
      112,
      97,
      115,
      115
    ]
  }
}

Limitations and assumptions

No UTF-8 or other charset interpretation, credential verification or encryption is performed. Leading header whitespace is rejected.

Numeric inputs, where present, must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing fields without a declared default, extra fields, wrong value types and violations of the calculation rules are input errors.

Alternative or Complementary methods

Use HTTP Content-Type Parser: A Content-Type field identifies a media type plus optional parameters such as charset or boundary. Parameter name normalization must not alter parameter values. For a complementary task, use Base64 Decoder: Decode canonical Base64 into UTF-8 text.

Further background: RFC 7617: Basic HTTP Authentication Scheme.

References

  1. HTTP Basic Authentication Parser — tool.io

  2. RFC 7617: Basic HTTP Authentication Scheme — IETF

Similar or alternative tools

  • HTTP Content-Type Parser

    A Content-Type field identifies a media type plus optional parameters such as charset or boundary. Parameter name normalization must not alter parameter values.

  • Base64 Decoder

    Decode canonical Base64 into UTF-8 text.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies