docs.roxen.comBack to normal mode
DocsRoxenWebServer 3.4System Developer ManualThe Roxen Module API
Copyright  2006, Roxen Internet Software
Suggestions, comments & compliments

Authentication Modules


The MODULE_AUTH API described on this page is likely subject to change in the not too distant future.

array|int auth(array(string) auth, RequestID id)

The auth method of your MODULE_AUTH type module is called when the browser sent either of the Authorization or Proxy-Authorization HTTP headers (see RFC 2617).

The auth argument passed is calculated as header_content/"", but where the second element is base64-decoded (meaning that you will not need to do so yourself). A typical auth array you might receive could look like ({ "Basic", "Aladdin:open sesame" }), where Aladdin would be the user name the client logged in with, and "open sesame" his password.

The three elements in the returned array are, in order:

  1. an int(0..1) signifying authentication failure (0) or success (1)

  2. a string with the username (authenticated or not)

  3. when failed, a string with the password used for the failed authentication attempt, otherwise the integer zero.

See also Roxen.http_auth_required() and Roxen.http_proxy_auth_required().

string user_from_uid(int uid, RequestID|void id)

Return the login name of the user with uid 'uid'.

array(string) userlist(RequestID|void id)

Return an array of all valid user names.

array(string|int) userinfo(string user, RequestID|void id)

Return /etc/passwd-style user information for the user whose login name is 'user'. The returned array consists of:

({ login name,
   crypted password,
   used id,
   group id,
   login shell

All entries should be strings, except uid and gid, which should be integers.