AuthScheme uses ConstantsTrait
Enumeration of standardized HTTP authentication schemes.
Authentication schemes appear as the first token in the value of the
Authorization (RFC 7235) and Proxy-Authorization headers, and as the
first token of WWW-Authenticate / Proxy-Authenticate challenges, e.g.:
Authorization: Bearer eyJhbGciOi...
Authorization: Basic dXNlcjpwYXNz
Authorization: OAuth oauth_consumer_key="...", oauth_token="..."
Schemes are NOT header names — for header names, see HttpHeader.
Casing follows the IANA HTTP Authentication Scheme Registry. Per RFC 7235, schemes are case-insensitive on the wire, but canonical casing is preserved here for interoperability with strict consumers.
References:
- RFC 7235 (HTTP/1.1 Authentication)
- RFC 7617 (Basic)
- RFC 6750 (Bearer)
- RFC 7616 (Digest)
- RFC 5849 (OAuth 1.0a)
- RFC 7486 (HOBA)
- RFC 8120 (Mutual)
- RFC 4559 (Negotiate / SPNEGO)
- RFC 8292 (vapid — Web Push)
Tags
Table of Contents
Constants
- BASIC : string = 'Basic'
- BEARER : string = 'Bearer'
- DIGEST : string = 'Digest'
- HOBA : string = 'HOBA'
- MUTUAL : string = 'Mutual'
- NEGOTIATE : string = 'Negotiate'
- OAUTH : string = 'OAuth'
- SCRAM_SHA_1 : string = 'SCRAM-SHA-1'
- SCRAM_SHA_256 : string = 'SCRAM-SHA-256'
- VAPID : string = 'vapid'
Methods
- prefix() : string
- Returns the scheme followed by a single space, ready to prefix a token value in an Authorization header.
Constants
BASIC
public
string
BASIC
= 'Basic'
BEARER
public
string
BEARER
= 'Bearer'
DIGEST
public
string
DIGEST
= 'Digest'
HOBA
public
string
HOBA
= 'HOBA'
MUTUAL
public
string
MUTUAL
= 'Mutual'
NEGOTIATE
public
string
NEGOTIATE
= 'Negotiate'
OAUTH
public
string
OAUTH
= 'OAuth'
SCRAM_SHA_1
public
string
SCRAM_SHA_1
= 'SCRAM-SHA-1'
SCRAM_SHA_256
public
string
SCRAM_SHA_256
= 'SCRAM-SHA-256'
VAPID
public
string
VAPID
= 'vapid'
Methods
prefix()
Returns the scheme followed by a single space, ready to prefix a token value in an Authorization header.
public
static prefix(string $scheme) : string
Example:
$header = AuthScheme::prefix( AuthScheme::BEARER ) . $token ;
// => "Bearer eyJhbGciOi..."
Parameters
- $scheme : string
-
One of the class constants.
Return values
string —The scheme followed by a single space.