Skip to content

Kirby 4.5.0

$auth->user()

Validates the currently logged in user

$auth->user(Kirby\Session\Session|array|null $session = null, bool $allowImpersonation = true): Kirby\Cms\User|null

Parameters

Name Type Default Description
$session Kirby\Session\Session|array|null null
$allowImpersonation bool true If set to false, only the actually
logged in user will be returned

Return type

Kirby\Cms\User|null

Exceptions

Type Description
Throwable If an authentication error occurred

Parent class

Kirby\Cms\Auth