Documentation

authx.php

Table of Contents

Functions

authx_login()  : array{contactId: int, userId: ?int, flow: string, credType: string, useSession: bool}
Perform a system login.
_authx_uf()  : AuthxInterface
_authx_redact()  : mixed
For parameter-based authentication, this option will hide parameters.
_authx_reload()  : mixed
Reload the current page-view.
authx_civicrm_config()  : mixed
Implements hook_civicrm_config().
authx_civicrm_install()  : mixed
Implements hook_civicrm_install().
authx_civicrm_enable()  : mixed
Implements hook_civicrm_enable().
authx_civicrm_permission()  : mixed
Implements hook_civicrm_permission().

Functions

authx_login()

Perform a system login.

authx_login(array{flow: ?string, useSession: ?bool, principal: ?array, cred: ?string} $details) : array{contactId: int, userId: ?int, flow: string, credType: string, useSession: bool}

This is useful for backend scripts that need to switch to a specific user.

As needed, this will update the Civi session and CMS data.

Parameters
$details : array{flow: ?string, useSession: ?bool, principal: ?array, cred: ?string}

Describe the authentication process with these properties:

  • string $flow (default 'script'); The type of authentication flow being used Ex: 'param', 'header', 'auto'
  • bool $useSession (default FALSE) If TRUE, then the authentication should be persistent (in a session variable). If FALSE, then the authentication should be ephemeral (single page-request).

And then ONE of these properties to describe the user/principal:

  • string $cred The credential, as formatted in the 'Authorization' header. Ex: 'Bearer 12345', 'Basic ASDFFDSA=='
  • array $principal Description of a validated principal. Must include 'contactId', 'userId', xor 'user'
Tags
throws
AuthxException
Return values
array{contactId: int, userId: ?int, flow: string, credType: string, useSession: bool}

An array describing the authenticated session.

_authx_redact()

For parameter-based authentication, this option will hide parameters.

_authx_redact(array<string|int, mixed> $keys) : mixed

This is mostly a precaution, hedging against the possibility that some routes make broad use of $_GET or $_PARAMS.

Parameters
$keys : array<string|int, mixed>

_authx_reload()

Reload the current page-view.

_authx_reload(string $route, string $queryString) : mixed
Parameters
$route : string
$queryString : string

authx_civicrm_permission()

Implements hook_civicrm_permission().

authx_civicrm_permission(mixed &$permissions) : mixed
Parameters
$permissions : mixed
Tags
see
CRM_Utils_Hook::permission()

        
On this page

Search results