Class Digest
Digest authentication adapter for Cake\Http\Client
Generally not directly constructed, but instead used by {@link \Cake\Http\Client} when $options['auth']['type'] is 'digest'
Constants
-
ALGO_MD5 ¶
'MD5'Algorithms
-
ALGO_MD5_SESS ¶
'MD5-sess' -
ALGO_SHA_256 ¶
'SHA-256' -
ALGO_SHA_256_SESS ¶
'SHA-256-sess' -
ALGO_SHA_512_256 ¶
'SHA-512-256' -
ALGO_SHA_512_256_SESS ¶
'SHA-512-256-sess' -
HASH_ALGORITHMS ¶
[self::ALGO_MD5 => 'md5', self::ALGO_SHA_256 => 'sha256', self::ALGO_SHA_512_256 => 'sha512/256', self::ALGO_MD5_SESS => 'md5', self::ALGO_SHA_256_SESS => 'sha256', self::ALGO_SHA_512_256_SESS => 'sha512/256']Algorithms <-> Hash type
-
QOP_AUTH ¶
'auth'QOP
-
QOP_AUTH_INT ¶
'auth-int'
Property Summary
-
$_client protected
Cake\Http\ClientInstance of Cake\Http\Client
-
$algorithm protected
stringAlgorithm
-
$hashType protected
stringHash type
-
$isSessAlgorithm protected
boolIs Sess algorithm
Method Summary
-
__construct() public
Constructor
-
_generateHeader() protected
Generate the header Authorization
-
_getServerInfo() protected
Retrieve information about the authentication
-
authentication() public
Add Authorization header to the request.
-
generateCnonce() protected
-
setAlgorithm() protected
Set algorithm based on credentials
Method Detail
__construct() ¶ public
__construct(Cake\Http\Client $client, array|null $options = null)
Constructor
Parameters
-
Cake\Http\Client$client Http client object.
-
array|null$options optional Options list.
_generateHeader() ¶ protected
_generateHeader(Cake\Http\Client\Request $request, array<string, mixed> $credentials): string
Generate the header Authorization
Parameters
-
Cake\Http\Client\Request$request The request object.
-
array<string, mixed>$credentials Authentication credentials.
Returns
string_getServerInfo() ¶ protected
_getServerInfo(Cake\Http\Client\Request $request, array $credentials): array
Retrieve information about the authentication
Will get the realm and other tokens by performing another request without authentication to get authentication challenge.
Parameters
-
Cake\Http\Client\Request$request The request object.
-
array$credentials Authentication credentials.
Returns
arraymodified credentials.
authentication() ¶ public
authentication(Cake\Http\Client\Request $request, array<string, mixed> $credentials): Cake\Http\Client\Request
Add Authorization header to the request.
Parameters
-
Cake\Http\Client\Request$request The request object.
-
array<string, mixed>$credentials Authentication credentials.
Returns
Cake\Http\Client\RequestThe updated request.
See Also
setAlgorithm() ¶ protected
setAlgorithm(array $credentials): void
Set algorithm based on credentials
Parameters
-
array$credentials authentication params
Returns
void