Constants

NOT_VALID

NOT_VALID

Constant for auth result

VALID

VALID

AUTH_BASIC

AUTH_BASIC

HTTP auth constants

AUTH_DIGEST

AUTH_DIGEST

AUTH_BEARER

AUTH_BEARER

AUTH_REFRESH

AUTH_REFRESH

AUTH_DATA

AUTH_DATA

Properties

$result

$result : integer

Authentication result

Type

integer

$username

$username : string

Authentication username

Type

string

$password

$password : string

Authentication password

Type

string

$uri

$uri : string

Auth URI

Type

string

$bearerToken

$bearerToken : string

Auth bearer token

Type

string

$refreshToken

$refreshToken : string

Auth refresh token

Type

string

$refreshTokenName

$refreshTokenName : string

Auth refresh token name

Type

string

$relativeUri

$relativeUri : string

Auth relative URI

Type

string

$method

$method : string

Auth method

Type

string

$type

$type : string

Auth type

Type

string

$scheme

$scheme : array

Scheme values

Type

array

$version

$version : string

HTTP version

Type

string

$code

$code : integer

Response code

Type

integer

$message

$message : string

Response message

Type

string

$headers

$headers : array

Response headers

Type

array

$body

$body : string

Response body

Type

string

Methods

getResult()

getResult() : integer

Get the authentication result

Returns

integer

isValid()

isValid() : boolean

Determine if the authentication attempt was valid

Returns

boolean

getUsername()

getUsername() : string

Get the username

Returns

string

getPassword()

getPassword() : string

Get the password

Returns

string

setUsername()

setUsername(string  $username) : \Pop\Auth\AbstractAuth

Set the username

Parameters

string $username

Returns

\Pop\Auth\AbstractAuth

setPassword()

setPassword(string  $password) : \Pop\Auth\AbstractAuth

Set the password

Parameters

string $password

Returns

\Pop\Auth\AbstractAuth

authenticate()

authenticate(string  $username, string  $password, array  $headers = null, array  $contextOptions = array(), array  $contextParams = null) : integer

Method to authenticate

Parameters

string $username
string $password
array $headers
array $contextOptions
array $contextParams

Returns

integer

__construct()

__construct(string  $uri, string  $method = 'POST', string  $type = null) 

Constructor

Instantiate the Http auth adapter object

Parameters

string $uri
string $method
string $type

Throws

\Pop\Auth\Exception

setBearerToken()

setBearerToken(string  $bearerToken) : \Pop\Auth\Http

Set the bearer token

Parameters

string $bearerToken

Returns

\Pop\Auth\Http

setRefreshToken()

setRefreshToken(string  $refreshToken) : \Pop\Auth\Http

Set the refresh token

Parameters

string $refreshToken

Returns

\Pop\Auth\Http

setRefreshTokenName()

setRefreshTokenName(string  $refreshTokenName) : \Pop\Auth\Http

Set the refresh token name

Parameters

string $refreshTokenName

Returns

\Pop\Auth\Http

getBearerToken()

getBearerToken() : string

Get the bearer token

Returns

string

getRefreshToken()

getRefreshToken() : string

Get the refresh token

Returns

string

getRefreshTokenName()

getRefreshTokenName() : string

Get the refresh token name

Returns

string

getType()

getType() : string

Get the auth type

Returns

string

getScheme()

getScheme() : array

Get the auth scheme

Returns

array

getVersion()

getVersion() : string

Get the HTTP version

Returns

string

getCode()

getCode() : string

Get the HTTP code

Returns

string

getMessage()

getMessage() : string

Get the HTTP message

Returns

string

getHeaders()

getHeaders() : array

Get the HTTP response headers

Returns

array

getHeader()

getHeader(string  $name) : mixed

Get an HTTP response header

Parameters

string $name

Returns

mixed

getBody()

getBody() : string

Get the HTTP response body

Returns

string

validate()

validate(array  $headers = null, array  $contextOptions = array(), array  $contextParams = null) : integer

Method to validate authentication

Parameters

array $headers
array $contextOptions
array $contextParams

Returns

integer

generateRequest()

generateRequest() : void

Generate the request

parseScheme()

parseScheme(string  $wwwAuth) : void

Parse the scheme

Parameters

string $wwwAuth

decodeBody()

decodeBody(string  $body, string  $decode = 'gzip') : string

Decode the body data.

Parameters

string $body
string $decode

Throws

\Pop\Auth\Exception

Returns

string

decodeChunkedBody()

decodeChunkedBody(string  $body) : string

Decode a chunked transfer-encoded body and return the decoded text

Parameters

string $body

Returns

string

verify()

verify(string  $password, string  $hash) : \Pop\Auth\boolean;

Method to verify a password against a hash

Parameters

string $password
string $hash

Returns

\Pop\Auth\boolean;

sendRequest()

sendRequest(array  $context = null, array  $contextParams = null) : void

Send the request

Parameters

array $context
array $contextParams