Auth
in package
HTTP auth header class
Tags
Table of Contents
Properties
- $authHeader : Header|null
- Auth header object
- $digest : Digest|null
- Digest
- $header : string
- Auth header name
- $password : string|null
- Auth password
- $scheme : string|null
- Auth scheme
- $token : string|null
- Auth token
- $username : string|null
- Auth username
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- To string
- createAuthHeader() : Header
- Create auth header
- createBasic() : Auth
- Create basic auth
- createBearer() : Auth
- Create bearer auth
- createDigest() : Auth
- Create digest auth
- createKey() : Auth
- Create key auth
- getAuthHeader() : Header
- Get auth header value object
- getAuthHeaderAsArray() : array<string|int, mixed>
- Get auth header value as an array
- getAuthHeaderAsString() : string
- Get auth header value as a string
- getDigest() : Digest
- Get digest
- getHeader() : string
- Get the header
- getPassword() : string
- Get the password
- getScheme() : string
- Get the scheme
- getToken() : string
- Get the token
- getUsername() : string
- Get the $username
- hasAuthHeader() : bool
- Has auth header
- hasDigest() : bool
- Has digest
- hasPassword() : bool
- Has password
- hasScheme() : bool
- Has scheme
- hasToken() : bool
- Has token
- hasUsername() : bool
- Has $username
- isBasic() : bool
- Determine if the auth is basic
- isBearer() : bool
- Determine if the auth is bearer
- isDigest() : bool
- Determine if the auth is digest
- parse() : Auth
- Parse header
- setDigest() : Auth
- Set digest
- setHeader() : Auth
- Set the header
- setPassword() : Auth
- Set the password
- setScheme() : Auth
- Set the scheme
- setToken() : Auth
- Set the token
- setUsername() : Auth
- Set the $username
Properties
$authHeader
Auth header object
protected
Header|null
$authHeader
= null
$digest
Digest
protected
Digest|null
$digest
= null
$header
Auth header name
protected
string
$header
= 'Authorization'
$password
Auth password
protected
string|null
$password
= null
$scheme
Auth scheme
protected
string|null
$scheme
= null
$token
Auth token
protected
string|null
$token
= null
$username
Auth username
protected
string|null
$username
= null
Methods
__construct()
Constructor
public
__construct([string $header = 'Authorization' ][, string|null $scheme = null ][, string|null $token = null ][, string|null $username = null ][, string|null $password = null ][, Digest|null $digest = null ]) : mixed
Instantiate the auth object
Parameters
- $header : string = 'Authorization'
- $scheme : string|null = null
- $token : string|null = null
- $username : string|null = null
- $password : string|null = null
- $digest : Digest|null = null
__toString()
To string
public
__toString() : string
Return values
stringcreateAuthHeader()
Create auth header
public
createAuthHeader() : Header
Tags
Return values
HeadercreateBasic()
Create basic auth
public
static createBasic(string $username, string $password) : Auth
Parameters
- $username : string
- $password : string
Return values
AuthcreateBearer()
Create bearer auth
public
static createBearer(string $token) : Auth
Parameters
- $token : string
Return values
AuthcreateDigest()
Create digest auth
public
static createDigest(Digest $digest) : Auth
Parameters
- $digest : Digest
Return values
AuthcreateKey()
Create key auth
public
static createKey(string $token[, string $header = 'Authorization' ][, string|null $scheme = null ]) : Auth
Parameters
- $token : string
- $header : string = 'Authorization'
- $scheme : string|null = null
Return values
AuthgetAuthHeader()
Get auth header value object
public
getAuthHeader() : Header
Return values
HeadergetAuthHeaderAsArray()
Get auth header value as an array
public
getAuthHeaderAsArray([bool $assoc = true ]) : array<string|int, mixed>
Parameters
- $assoc : bool = true
Tags
Return values
array<string|int, mixed>getAuthHeaderAsString()
Get auth header value as a string
public
getAuthHeaderAsString([bool $crlf = false ]) : string
Parameters
- $crlf : bool = false
Tags
Return values
stringgetDigest()
Get digest
public
getDigest() : Digest
Return values
DigestgetHeader()
Get the header
public
getHeader() : string
Return values
stringgetPassword()
Get the password
public
getPassword() : string
Return values
stringgetScheme()
Get the scheme
public
getScheme() : string
Return values
stringgetToken()
Get the token
public
getToken() : string
Return values
stringgetUsername()
Get the $username
public
getUsername() : string
Return values
stringhasAuthHeader()
Has auth header
public
hasAuthHeader() : bool
Return values
boolhasDigest()
Has digest
public
hasDigest() : bool
Return values
boolhasPassword()
Has password
public
hasPassword() : bool
Return values
boolhasScheme()
Has scheme
public
hasScheme() : bool
Return values
boolhasToken()
Has token
public
hasToken() : bool
Return values
boolhasUsername()
Has $username
public
hasUsername() : bool
Return values
boolisBasic()
Determine if the auth is basic
public
isBasic() : bool
Return values
boolisBearer()
Determine if the auth is bearer
public
isBearer() : bool
Return values
boolisDigest()
Determine if the auth is digest
public
isDigest() : bool
Return values
boolparse()
Parse header
public
static parse(mixed $header[, array<string|int, mixed> $options = [] ]) : Auth
Parameters
- $header : mixed
- $options : array<string|int, mixed> = []
Tags
Return values
AuthsetDigest()
Set digest
public
setDigest(Digest $digest) : Auth
Parameters
- $digest : Digest
Return values
AuthsetHeader()
Set the header
public
setHeader(string $header) : Auth
Parameters
- $header : string
Return values
AuthsetPassword()
Set the password
public
setPassword(string $password) : Auth
Parameters
- $password : string
Return values
AuthsetScheme()
Set the scheme
public
setScheme(string $scheme) : Auth
Parameters
- $scheme : string
Return values
AuthsetToken()
Set the token
public
setToken(string $token) : Auth
Parameters
- $token : string
Return values
AuthsetUsername()
Set the $username
public
setUsername(string $username) : Auth
Parameters
- $username : string