Skip to content

BasicCredential

github-actions edited this page Mar 29, 2026 · 1 revision

Class BasicCredential.

Represents the parsed credential pair for HTTP Basic Authentication. This credential consists of a username and password encoded as Base64(username:password) in the Authorization header.

Implementations handling this class MUST treat the password as a sensitive secret. It MUST NOT be logged, exposed, or transmitted insecurely. The username MAY be considered non-sensitive depending on application rules, but the password MUST always be protected.

Instances of this class SHALL be returned by

  • See: \FastForward\Http\Message\Header\Authorization\FastForward\Http\Message\Header\Authorization::parse() when the header contains a valid Basic Authentication value.

Properties

username

public string $username

password

public string $password

Methods

__construct

Creates a new Basic Authentication credential.

public __construct(string $username, string $password): mixed

The username and password MUST be extracted exactly as decoded from the HTTP Authorization header. The password parameter is annotated with #[\SensitiveParameter] to ensure that stack traces, debugging tools, and error handlers do not accidentally reveal its value.

Parameters:

Parameter Type Description
$username string the username provided by the client
$password string the plaintext password provided by the client

Clone this wiki locally