Skip to content

Kirby 5.0.4

$auth->currentUserFromBasicAuth()

Returns the logged in user by checking for a basic authentication header with valid credentials

$auth->currentUserFromBasicAuth(Kirby\Http\Request\Auth\BasicAuth|null $auth = null): Kirby\Cms\User|null

Parameters

Name Type Default
$auth Kirby\Http\Request\Auth\BasicAuthornull null

Return types

Kirby\Cms\Userornull

This method modifies the existing $auth object it is applied to and returns it again.

Exceptions

Type Description
Kirby\Exception\InvalidArgumentException if the authorization header is invalid
Kirby\Exception\PermissionException if basic authentication is not allowed

Parent class

Kirby\Cms\Auth