Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Latest commit

 

History

History
33 lines (25 loc) · 919 Bytes

readme.md

File metadata and controls

33 lines (25 loc) · 919 Bytes

This repository is now archived. wsapi_basic_auth was moved to the samples/ folder of the WSAPI repository.


wsapi.basic_auth

A "wrapper function" that provides HTTP basic authentication for WSAPI apps. Example:

function run(wsapi_env)
  return wsapi.basic_auth.run(wsapi_env, "my site", function(wsapi_env)
    local user, pass = wsapi_env.basic_auth.user, wsapi_env.basic_auth.password
    ...
  end)
end

The wsapi_env received is extended with a "basic_auth" field, which is a table containing fields "user" and "password".

Alternatively, a fourth argement may be given, with a function that performs the authentication check.

function run(wsapi_env)
  return wsapi.basic_auth.run(wsapi_env, "my site", my_run, my_check_user_pass)
end

This module was put together by Hisham Muhammad, based on insights on the matter in the lua-l mailing list by Bjorn Kalkbrenner and Raphael Szwarc.