Documentation

AuthConfig
in package

Container for authorization config.

getUserPswd(), getTrustedHeaderRole() and getClient() methods allow easy test doubles generation

Tags
author

zozlak

Table of Contents

Constants

DEFAULT_AUTH_TTL  = 60
DEFAULT_PSWD_COST  = 10

Properties

$academicRole  : string
$aclReadProperty  : string
$adminRole  : string
$authTtl  : int
$defaultAuth  : array<string|int, mixed>
$passBasicAuth  : bool
$passwordCost  : int
$publicRole  : string
$roleTrustedHeader  : string

Methods

__construct()  : mixed
fromConfig()  : self
getClient()  : Client
Returns a guzzle client setting the HTTP basic authorization: - if non-empty credentials are passed as a parameter, they are used as they are - otherwise if $this->passBasicAuth is set, the request HTTP basic credentials are used (also if they are not set or empty) - otherwise $this->defaultAuth credentials are used (also if they are empty)
getTrustedHeaderRole()  : string
getUserPswd()  : array{0: string, 1: string}

Constants

DEFAULT_AUTH_TTL

public mixed DEFAULT_AUTH_TTL = 60

DEFAULT_PSWD_COST

public mixed DEFAULT_PSWD_COST = 10

Properties

$academicRole read-only

public string $academicRole = ''

$aclReadProperty read-only

public string $aclReadProperty

$adminRole read-only

public string $adminRole = ''

$authTtl read-only

public int $authTtl = self::DEFAULT_AUTH_TTL

$defaultAuth read-only

public array<string|int, mixed> $defaultAuth = ['', '']

$passBasicAuth read-only

public bool $passBasicAuth = false

$passwordCost read-only

public int $passwordCost = self::DEFAULT_PSWD_COST

$publicRole read-only

public string $publicRole = ''

$roleTrustedHeader read-only

public string $roleTrustedHeader = ''

Methods

__construct()

public __construct(string $aclReadProperty[, string $publicRole = '' ][, string $academicRole = '' ][, string $roleTrustedHeader = '' ][, string $adminRole = '' ][, int $authTtl = self::DEFAULT_AUTH_TTL ][, int $passwordCost = self::DEFAULT_PSWD_COST ][, bool $passBasicAuth = false ][, array{0: string, 1: string} $defaultAuth = ['', ''] ]) : mixed
Parameters
$aclReadProperty : string
$publicRole : string = ''
$academicRole : string = ''
$roleTrustedHeader : string = ''
$adminRole : string = ''
$authTtl : int = self::DEFAULT_AUTH_TTL
$passwordCost : int = self::DEFAULT_PSWD_COST
$passBasicAuth : bool = false
$defaultAuth : array{0: string, 1: string} = ['', '']

fromConfig()

public static fromConfig(object $config) : self
Parameters
$config : object
Return values
self

getClient()

Returns a guzzle client setting the HTTP basic authorization: - if non-empty credentials are passed as a parameter, they are used as they are - otherwise if $this->passBasicAuth is set, the request HTTP basic credentials are used (also if they are not set or empty) - otherwise $this->defaultAuth credentials are used (also if they are empty)

public getClient([array<string, mixed> $guzzleOpts = [] ]) : Client
Parameters
$guzzleOpts : array<string, mixed> = []
Return values
Client

getTrustedHeaderRole()

public getTrustedHeaderRole() : string
Return values
string

getUserPswd()

public getUserPswd() : array{0: string, 1: string}
Return values
array{0: string, 1: string}

        
On this page

Search results