AuthenticatorTarget
in package
Table of Contents
Properties
- $contactId : int|null
- (Authenticated) CiviCRM contact ID
- $cred : string
- The raw credential as submitted.
- $credType : string
- (Authenticated) The type of credential.
- $flow : string
- The authentication-flow by which we received the credential.
- $jwt : array<string|int, mixed>|null
- (Authenticated) JWT claims (if applicable).
- $requestPath : string|null
- $siteKey : string
- The raw site-key as submitted (if applicable).
- $userId : int|string|null
- (Authenticated) UF user ID
- $useSession : bool
Methods
- create() : $this
- createAlreadyLoggedIn() : array{flow: string, credType: string, jwt: ?array, useSession: bool, userId: ?int, contactId: ?int}
- Describe the (OK-ish) authentication outcome wherein the same user was already authenticated.
- createRedacted() : array{flow: string, credType: string, jwt: ?array, useSession: bool, userId: ?int, contactId: ?int}
- Create a variant of the authentication record which omits any secret values. It may be useful to examining metadata and outcomes.
- hasPrincipal() : bool
- set() : $this
- setPrincipal() : $this
- Specify the authenticated principal for this request.
Properties
$contactId
(Authenticated) CiviCRM contact ID
public
int|null
$contactId
$cred
The raw credential as submitted.
public
string
$cred
Ex: 'Basic AbCd123=' or 'Bearer xYz.321'
$credType
(Authenticated) The type of credential.
public
string
$credType
Ex: 'pass', 'api_key', 'jwt'
$flow
The authentication-flow by which we received the credential.
public
string
$flow
Ex: 'param', 'header', 'xheader', 'auto', 'script'
$jwt
(Authenticated) JWT claims (if applicable).
public
array<string|int, mixed>|null
$jwt
= NULL
$requestPath
public
string|null
$requestPath
Ex: 'civicrm/dashboard'
$siteKey
The raw site-key as submitted (if applicable).
public
string
$siteKey
$userId
(Authenticated) UF user ID
public
int|string|null
$userId
$useSession
public
bool
$useSession
Methods
create()
public
static create([array<string|int, mixed> $args = [] ]) : $this
Parameters
- $args : array<string|int, mixed> = []
Return values
$thiscreateAlreadyLoggedIn()
Describe the (OK-ish) authentication outcome wherein the same user was already authenticated.
public
createAlreadyLoggedIn() : array{flow: string, credType: string, jwt: ?array, useSession: bool, userId: ?int, contactId: ?int}
Ex: cv ev --user=demo "return authx_login(['principal' => ['user' => 'demo']], false);"
In this example, cv ev --user=demo
does an initial login, and then authx_login()
tries
to login a second time. This is sort of an error for authx_login()
(since it doesn't
really do auth); but it's sort of OK (because the post-conditions are met). It's sort of
a code-smell (because flows with multiple login-calls are ill-advised - and may raise
exceptions with different data).
Return values
array{flow: string, credType: string, jwt: ?array, useSession: bool, userId: ?int, contactId: ?int}createRedacted()
Create a variant of the authentication record which omits any secret values. It may be useful to examining metadata and outcomes.
public
createRedacted() : array{flow: string, credType: string, jwt: ?array, useSession: bool, userId: ?int, contactId: ?int}
The redacted version may be retained in the (real or fake) session and consulted by more fine-grained access-controls.
Return values
array{flow: string, credType: string, jwt: ?array, useSession: bool, userId: ?int, contactId: ?int}hasPrincipal()
public
hasPrincipal() : bool
Return values
boolset()
public
set(array<string|int, mixed> $args) : $this
Parameters
- $args : array<string|int, mixed>
Return values
$thissetPrincipal()
Specify the authenticated principal for this request.
public
setPrincipal(array<string|int, mixed> $args) : $this
Parameters
- $args : array<string|int, mixed>
-
Mix of: 'user', 'userId', 'contactId', 'credType' It is valid to give 'userId' or 'contactId' - the missing one will be filled in via UFMatch (if available).