Auth
extends AbstractAuth
in package
Azure storage auth class
This class is ported over from the discontinued Azure Storage PHP library at https://github.com/Azure/azure-storage-php (EOL: 3/17/2024)
Tags
Table of Contents
Properties
- $accountKey : string|null
- Account key
- $accountName : string|null
- Account name
- $includedHeaders : array<string|int, mixed>
- The included headers
Methods
- __construct() : mixed
- Constructor.
- formatHeaders() : array<string|int, mixed>
- Convert a http headers array into a uniformed format for further process
- getAccountKey() : string|null
- Get account key
- getAccountName() : string|null
- Get account name
- getAuthorizationHeader() : string
- Returns authorization header to be included in the request.
- getBaseUri() : string
- Get account key
- hasAccountKey() : bool
- Has account key
- hasAccountName() : bool
- Has account name
- setAccountKey() : AbstractAuth
- Set account key
- setAccountName() : AbstractAuth
- Set account name
- signRequest() : Request
- Adds authentication header to the request headers.
- startsWith() : bool
- Checks if the passed $string starts with $prefix
- tryGetValue() : mixed
- Returns the specified value of the $key passed from $array and in case that this $key doesn't exist, the default value is returned.
- tryGetValueInsensitive() : mixed
- Returns the specified value of the $key passed from $array and in case that this $key doesn't exist, the default value is returned. The key matching is done in a case-insensitive manner.
- computeCanonicalizedHeaders() : array<string|int, mixed>
- Computes canonicalized headers for headers array.
- computeCanonicalizedResource() : string
- Computes canonicalized resources from URL.
- computeCanonicalizedResourceForTable() : string
- Computes canonicalized resources from URL using Table formar
- computeSignature() : string
- Computes the authorization signature for blob and queue shared key.
Properties
$accountKey
Account key
protected
string|null
$accountKey
= null
$accountName
Account name
protected
string|null
$accountName
= null
$includedHeaders
The included headers
protected
array<string|int, mixed>
$includedHeaders
= ['content-encoding', 'content-language', 'content-length', 'content-md5', 'content-type', 'date', 'if-modified-since', 'if-match', 'if-none-match', 'if-unmodified-since', 'range']
Methods
__construct()
Constructor.
public
__construct(string $accountName, string $accountKey) : mixed
Parameters
- $accountName : string
- $accountKey : string
formatHeaders()
Convert a http headers array into a uniformed format for further process
public
static formatHeaders(array<string|int, mixed> $headers) : array<string|int, mixed>
Parameters
- $headers : array<string|int, mixed>
Return values
array<string|int, mixed>getAccountKey()
Get account key
public
getAccountKey() : string|null
Return values
string|nullgetAccountName()
Get account name
public
getAccountName() : string|null
Return values
string|nullgetAuthorizationHeader()
Returns authorization header to be included in the request.
public
getAuthorizationHeader(array<string|int, mixed> $headers, string $url, array<string|int, mixed> $queryParams, string $httpMethod) : string
Parameters
- $headers : array<string|int, mixed>
- $url : string
- $queryParams : array<string|int, mixed>
- $httpMethod : string
Return values
stringgetBaseUri()
Get account key
public
getBaseUri() : string
Return values
stringhasAccountKey()
Has account key
public
hasAccountKey() : bool
Return values
boolhasAccountName()
Has account name
public
hasAccountName() : bool
Return values
boolsetAccountKey()
Set account key
public
setAccountKey(string $accountKey) : AbstractAuth
Parameters
- $accountKey : string
Return values
AbstractAuthsetAccountName()
Set account name
public
setAccountName(string $accountName) : AbstractAuth
Parameters
- $accountName : string
Return values
AbstractAuthsignRequest()
Adds authentication header to the request headers.
public
signRequest(Request $request) : Request
Parameters
- $request : Request
Return values
RequeststartsWith()
Checks if the passed $string starts with $prefix
public
static startsWith(string $string, string $prefix[, bool $ignoreCase = false ]) : bool
Parameters
- $string : string
- $prefix : string
- $ignoreCase : bool = false
Return values
booltryGetValue()
Returns the specified value of the $key passed from $array and in case that this $key doesn't exist, the default value is returned.
public
static tryGetValue(array<string|int, mixed> $array, mixed $key[, mixed $default = null ]) : mixed
Parameters
- $array : array<string|int, mixed>
- $key : mixed
- $default : mixed = null
tryGetValueInsensitive()
Returns the specified value of the $key passed from $array and in case that this $key doesn't exist, the default value is returned. The key matching is done in a case-insensitive manner.
public
static tryGetValueInsensitive(string $key, array<string|int, mixed> $haystack[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $haystack : array<string|int, mixed>
- $default : mixed = null
computeCanonicalizedHeaders()
Computes canonicalized headers for headers array.
protected
computeCanonicalizedHeaders(array<string|int, mixed> $headers) : array<string|int, mixed>
Parameters
- $headers : array<string|int, mixed>
Return values
array<string|int, mixed>computeCanonicalizedResource()
Computes canonicalized resources from URL.
protected
computeCanonicalizedResource(string $url, array<string|int, mixed> $queryParams) : string
Parameters
- $url : string
- $queryParams : array<string|int, mixed>
Return values
stringcomputeCanonicalizedResourceForTable()
Computes canonicalized resources from URL using Table formar
protected
computeCanonicalizedResourceForTable(string $url, array<string|int, mixed> $queryParams) : string
Parameters
- $url : string
- $queryParams : array<string|int, mixed>
Return values
stringcomputeSignature()
Computes the authorization signature for blob and queue shared key.
protected
computeSignature(array<string|int, mixed> $headers, string $url, array<string|int, mixed> $queryParams, string $httpMethod) : string
Parameters
- $headers : array<string|int, mixed>
- $url : string
- $queryParams : array<string|int, mixed>
- $httpMethod : string