Documentation

AuthxRequestBuilder
in package

(TEST HELPER/EXPERIMENTAL) This class helps with building test-scenarios where we use different authx flows/credentials.

It is based on refactoring test code. It still includes some test-specific bits (like knowledge of the "demo" user).

Table of Contents

Properties

$creds  : mixed
$flows  : mixed

Methods

__construct()  : mixed
addCred()  : mixed
addFlow()  : mixed
applyAuth()  : RequestInterface
Apply authentication options to a prepared HTTP request.
applyFlow()  : RequestInterface
Apply authentication options to a prepared HTTP request.
createCred()  : string
Create a credential of the given type on behalf of the given contact
credApikey()  : mixed
credJwt()  : mixed
authAuto()  : Request
Add query parameter ("&_authx=<CRED>&_authxSes=1").
authLogin()  : mixed
authParam()  : Request
Add query parameter ("&_authx=<CRED>").
credPass()  : string
getDemoCID()  : int

Properties

Methods

addCred()

public addCred(string $credType, callable $credFunc) : mixed
Parameters
$credType : string
$credFunc : callable

addFlow()

public addFlow(string $flowType, callable $flowFunc) : mixed
Parameters
$flowType : string
$flowFunc : callable

applyAuth()

Apply authentication options to a prepared HTTP request.

public applyAuth(RequestInterface $request, string $credType, string $flowType, int $cid) : RequestInterface
Parameters
$request : RequestInterface

The original HTTP request (without any authentication options).

$credType : string

Ex: 'pass', 'jwt', 'api_key'

$flowType : string

Ex: 'param', 'header', 'xheader'

$cid : int

Authenticate as a specific contact (contact ID#).

Return values
RequestInterface

The new HTTP request (with authentication options).

applyFlow()

Apply authentication options to a prepared HTTP request.

public applyFlow(RequestInterface $request, string $flowType, string $credValue) : RequestInterface
Parameters
$request : RequestInterface

The original HTTP request (without any authentication options).

$flowType : string

Ex: 'param', 'header', 'xheader'

$credValue : string

Ex: 'Bearer ABCD1234'

Return values
RequestInterface

The new HTTP request (with authentication options).

createCred()

Create a credential of the given type on behalf of the given contact

public createCred(string $credType, int $cid) : string
Parameters
$credType : string
$cid : int
Return values
string

credJwt()

public credJwt(mixed $cid[, mixed $expired = FALSE ]) : mixed
Parameters
$cid : mixed
$expired : mixed = FALSE

authAuto()

Add query parameter ("&_authx=<CRED>&_authxSes=1").

protected authAuto(Request $request, string $cred) : Request
Parameters
$request : Request
$cred : string

The credential add to the request (e.g. "Basic ASDF==" or "Bearer FDSA").

Return values
Request

authLogin()

protected authLogin(Request $request, mixed $cred) : mixed
Parameters
$request : Request
$cred : mixed

authParam()

Add query parameter ("&_authx=<CRED>").

protected authParam(Request $request, string $cred) : Request
Parameters
$request : Request
$cred : string

The credential add to the request (e.g. "Basic ASDF==" or "Bearer FDSA").

Return values
Request

credPass()

protected credPass(int $cid) : string
Parameters
$cid : int
Return values
string

The credential add to the request (e.g. "Basic ASDF==" or "Bearer FDSA").


        
On this page

Search results