Documentation

Auth
in package

HTTP auth header class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
5.2.0

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

$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
string

createBasic()

Create basic auth

public static createBasic(string $username, string $password) : Auth
Parameters
$username : string
$password : string
Return values
Auth

createBearer()

Create bearer auth

public static createBearer(string $token) : Auth
Parameters
$token : string
Return values
Auth

createDigest()

Create digest auth

public static createDigest(Digest $digest) : Auth
Parameters
$digest : Digest
Return values
Auth

createKey()

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
Auth

getAuthHeader()

Get auth header value object

public getAuthHeader() : Header
Return values
Header

getAuthHeaderAsArray()

Get auth header value as an array

public getAuthHeaderAsArray([bool $assoc = true ]) : array<string|int, mixed>
Parameters
$assoc : bool = true
Tags
throws
Exception
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
throws
Exception
Return values
string

getHeader()

Get the header

public getHeader() : string
Return values
string

getPassword()

Get the password

public getPassword() : string
Return values
string

getScheme()

Get the scheme

public getScheme() : string
Return values
string

getToken()

Get the token

public getToken() : string
Return values
string

getUsername()

Get the $username

public getUsername() : string
Return values
string

hasAuthHeader()

Has auth header

public hasAuthHeader() : bool
Return values
bool

hasDigest()

Has digest

public hasDigest() : bool
Return values
bool

hasPassword()

Has password

public hasPassword() : bool
Return values
bool

hasScheme()

Has scheme

public hasScheme() : bool
Return values
bool

hasToken()

Has token

public hasToken() : bool
Return values
bool

hasUsername()

Has $username

public hasUsername() : bool
Return values
bool

isBasic()

Determine if the auth is basic

public isBasic() : bool
Return values
bool

isBearer()

Determine if the auth is bearer

public isBearer() : bool
Return values
bool

isDigest()

Determine if the auth is digest

public isDigest() : bool
Return values
bool

parse()

Parse header

public static parse(mixed $header[, array<string|int, mixed> $options = [] ]) : Auth
Parameters
$header : mixed
$options : array<string|int, mixed> = []
Tags
throws
Exception|Exception
Return values
Auth

setHeader()

Set the header

public setHeader(string $header) : Auth
Parameters
$header : string
Return values
Auth

setPassword()

Set the password

public setPassword(string $password) : Auth
Parameters
$password : string
Return values
Auth

setScheme()

Set the scheme

public setScheme(string $scheme) : Auth
Parameters
$scheme : string
Return values
Auth

setToken()

Set the token

public setToken(string $token) : Auth
Parameters
$token : string
Return values
Auth

setUsername()

Set the $username

public setUsername(string $username) : Auth
Parameters
$username : string
Return values
Auth

        
On this page

Search results