RequireHTTPLogin (open)

Require basic login/password verification for a page. Aborts on login failure. This allows you to implement trivial authentication for eg feeds and APIs but is not intended as a full-fledged login system for hundreds of users

Syntax

LOADLIB "mod::system/lib/webserver/auth.whlib";

STRING FUNCTION RequireHTTPLogin(STRING realm, RECORD ARRAY accounts, RECORD options)

Parameters

STRING realm

Realm name. This is usually shown in the HTTP Basic auth popup to show what you're logging in to

RECORD ARRAY accounts

Valid accounts

STRING password

Raw password (case sensitive)

STRING passwordkey

Password registry key. This can be set using `wh registry set --password ``

STRING username

Username (case insensitive)

RECORD options

Return value

STRING

Username with which the user logged in. Does not return if login failed but sends a 401 Authorization required instead