UserList
Less than 1 minute
UserList
class UserList implements \Hazaar\Warlock\Server\Auth\AuthenticatorProperties
users
An associative array of username => password pairs for authentication.
private array $usersNote: In a production environment, you should store hashed passwords instead of plain text for security reasons. This example uses plain text for simplicity and demonstration purposes only.
Methods
__construct
UserList constructor.
public __construct(array $users): voidParameters
| Parameter | Type | Description |
|---|---|---|
$users | array | an associative array of username => password pairs for authentication |
authenticate
Authenticate a client using the provided username and password.
public authenticate(string $username, string $password, ?Client $client): boolParameters
| Parameter | Type | Description |
|---|---|---|
$username | string | the username provided by the client |
$password | string | the password provided by the client |
$client | Client |
exists
Check whether a user exists in the authentication database.
public exists(string $username): boolParameters
| Parameter | Type | Description |
|---|---|---|
$username | string | the username to look up |
addUser
Add a new user with the specified password.
public addUser(string $username, string $password): boolParameters
| Parameter | Type | Description |
|---|---|---|
$username | string | the username of the new user |
$password | string | the password for the new user |
removeUser
Remove an existing user.
public removeUser(string $username): boolParameters
| Parameter | Type | Description |
|---|---|---|
$username | string | the username of the user to remove |
listUsers
List all existing users.
public listUsers(): voidGenerated by Hazaar API Doc Generator on Fri, 05 Jun 2026 06:08:15 +0000