Documentation

Http extends AbstractAuth
in package

Http auth class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

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

license

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

version
3.3.0

Table of Contents

AUTH_BASIC  = 'BASIC'
HTTP auth type constants
AUTH_BEARER  = 'BEARER'
AUTH_DIGEST  = 'DIGEST'
AUTH_FORM_DATA  = 'FORM_DATA'
AUTH_REFRESH  = 'REFRESH'
AUTH_URL_DATA  = 'URL_DATA'
NOT_VALID  = 0
Constant for auth result
VALID  = 1
$bearerToken  : string
Auth bearer token
$contentType  : string
Auth content type
$password  : string
Authentication password
$refreshToken  : string
Auth refresh token
$refreshTokenName  : string
Auth refresh token name
$result  : int
Authentication result
$scheme  : array<string|int, mixed>
Scheme values
$stream  : Stream
Auth client stream
$type  : string
Auth type
$username  : string
Authentication username
__construct()  : mixed
Constructor
authenticate()  : int
Method to authenticate
createDigest()  : string
Create auth digest header string
getBearerToken()  : string
Get the bearer token
getContentType()  : string
Get content type
getPassword()  : string
Get the password
getRefreshToken()  : string
Get the refresh token
getRefreshTokenName()  : string
Get the refresh token name
getResult()  : int
Get the authentication result
getResultResponse()  : array<string|int, mixed>
Get result response
getScheme()  : array<string|int, mixed>
Get the auth scheme
getStream()  : Stream
Get stream
getType()  : string
Get the auth type
getUsername()  : string
Get the username
hasBearerToken()  : bool
Has bearer token
hasContentType()  : bool
Has content type
hasRefreshToken()  : bool
Has refresh token
hasRefreshTokenName()  : bool
Has refresh token name
hasScheme()  : bool
Has an auth scheme
hasStream()  : bool
Has stream
hasType()  : bool
Has auth type
initRequest()  : void
Initialize the auth request
isValid()  : bool
Determine if the authentication attempt was valid
parseScheme()  : string
Parse the scheme
setBearerToken()  : Http
Set the bearer token
setContentType()  : Http
Set content type
setContentTypeAsMultipartForm()  : Http
Set content type as multipart form
setContentTypeAsUrlForm()  : Http
Set content type as URL form
setPassword()  : AbstractAuth
Set the password
setRefreshToken()  : Http
Set the refresh token
setRefreshTokenName()  : Http
Set the refresh token name
setStream()  : Http
Set stream
setType()  : Http
Set type
setUsername()  : AbstractAuth
Set the username
stream()  : Stream
Get stream (alias method)
validate()  : int
Method to validate authentication
verify()  : bool
Method to verify a password against a hash

Constants

AUTH_BASIC

HTTP auth type constants

public mixed AUTH_BASIC = 'BASIC'

AUTH_BEARER

public mixed AUTH_BEARER = 'BEARER'

AUTH_DIGEST

public mixed AUTH_DIGEST = 'DIGEST'

AUTH_FORM_DATA

public mixed AUTH_FORM_DATA = 'FORM_DATA'

AUTH_REFRESH

public mixed AUTH_REFRESH = 'REFRESH'

AUTH_URL_DATA

public mixed AUTH_URL_DATA = 'URL_DATA'

NOT_VALID

Constant for auth result

public int NOT_VALID = ""

Properties

$bearerToken

Auth bearer token

protected string $bearerToken = null

$contentType

Auth content type

protected string $contentType = null

$password

Authentication password

protected string $password = null

$refreshToken

Auth refresh token

protected string $refreshToken = null

$refreshTokenName

Auth refresh token name

protected string $refreshTokenName = 'refresh'

$scheme

Scheme values

protected array<string|int, mixed> $scheme = []

$stream

Auth client stream

protected Stream $stream = null

$type

Auth type

protected string $type = null

$username

Authentication username

protected string $username = null

Methods

__construct()

Constructor

public __construct([mixed $stream = null ][, string $type = null ][, string $method = 'POST' ]) : mixed

Instantiate the Http auth adapter object

Parameters
$stream : mixed = null
$type : string = null
$method : string = 'POST'
Return values
mixed

authenticate()

Method to authenticate

public authenticate(string $username, string $password[, array<string|int, mixed> $headers = [] ][, array<string|int, mixed> $contextOptions = [] ][, array<string|int, mixed> $contextParams = [] ]) : int
Parameters
$username : string
$password : string
$headers : array<string|int, mixed> = []
$contextOptions : array<string|int, mixed> = []
$contextParams : array<string|int, mixed> = []
Return values
int

createDigest()

Create auth digest header string

public createDigest() : string
Tags
throws
Exception
Return values
string

getBearerToken()

Get the bearer token

public getBearerToken() : string
Return values
string

getContentType()

Get content type

public getContentType() : string
Return values
string

getPassword()

Get the password

public getPassword() : string
Return values
string

getRefreshToken()

Get the refresh token

public getRefreshToken() : string
Return values
string

getRefreshTokenName()

Get the refresh token name

public getRefreshTokenName() : string
Return values
string

getResult()

Get the authentication result

public getResult() : int
Return values
int

getResultResponse()

Get result response

public getResultResponse() : array<string|int, mixed>
Return values
array<string|int, mixed>

getScheme()

Get the auth scheme

public getScheme() : array<string|int, mixed>
Return values
array<string|int, mixed>

getType()

Get the auth type

public getType() : string
Return values
string

getUsername()

Get the username

public getUsername() : string
Return values
string

hasBearerToken()

Has bearer token

public hasBearerToken() : bool
Return values
bool

hasContentType()

Has content type

public hasContentType() : bool
Return values
bool

hasRefreshToken()

Has refresh token

public hasRefreshToken() : bool
Return values
bool

hasRefreshTokenName()

Has refresh token name

public hasRefreshTokenName() : bool
Return values
bool

hasScheme()

Has an auth scheme

public hasScheme() : bool
Return values
bool

hasStream()

Has stream

public hasStream() : bool
Return values
bool

hasType()

Has auth type

public hasType() : bool
Return values
bool

initRequest()

Initialize the auth request

public initRequest() : void
Tags
throws
Exception
Return values
void

isValid()

Determine if the authentication attempt was valid

public isValid() : bool
Return values
bool

parseScheme()

Parse the scheme

public parseScheme(string $wwwAuth) : string
Parameters
$wwwAuth : string
Return values
string

setBearerToken()

Set the bearer token

public setBearerToken(string $bearerToken) : Http
Parameters
$bearerToken : string
Return values
Http

setContentType()

Set content type

public setContentType(string $contentType) : Http
Parameters
$contentType : string
Return values
Http

setContentTypeAsMultipartForm()

Set content type as multipart form

public setContentTypeAsMultipartForm() : Http
Return values
Http

setContentTypeAsUrlForm()

Set content type as URL form

public setContentTypeAsUrlForm() : Http
Return values
Http

setRefreshToken()

Set the refresh token

public setRefreshToken(string $refreshToken) : Http
Parameters
$refreshToken : string
Return values
Http

setRefreshTokenName()

Set the refresh token name

public setRefreshTokenName(string $refreshTokenName) : Http
Parameters
$refreshTokenName : string
Return values
Http

setType()

Set type

public setType(string $type) : Http
Parameters
$type : string
Return values
Http

stream()

Get stream (alias method)

public stream() : Stream
Return values
Stream

validate()

Method to validate authentication

public validate([array<string|int, mixed> $headers = [] ][, array<string|int, mixed> $contextOptions = [] ][, array<string|int, mixed> $contextParams = [] ]) : int
Parameters
$headers : array<string|int, mixed> = []
$contextOptions : array<string|int, mixed> = []
$contextParams : array<string|int, mixed> = []
Return values
int

verify()

Method to verify a password against a hash

public verify(string $password, string $hash) : bool
Parameters
$password : string
$hash : string
Return values
bool

Search results