lua-http-digest
lua-http-digest copied to clipboard
Client side HTTP Digest Authentication for Lua
http-digest
Presentation
Small implementation of HTTP Digest Authentication (client-side) in Lua that mimics the API of LuaSocket.
Only supports auth/MD5, no reuse of client nonce, pull requests welcome.
Dependencies
- luasocket
- md5
Tests require cwtest, a JSON parser and the availability of httpbingo.org.
Usage
See LuaSocket's http.request. Credentials must be contained in the URL. Both the simple and generic interface are supported. Here is an example with the simple interface:
local http_digest = require "http-digest"
local url = "http://user:[email protected]/digest-auth/auth/user/passwd"
local b, c, h = http_digest.request(url)
See the tests for more.
Other compatible http clients (like Copas or LuaSec) can be used as well. To use another http client replace the default one:
local http_digest = require "http-digest"
http_digest.http = require "copas.http"
Contributors
Copyright
- Copyright (c) 2012-2013 Moodstocks SAS
- Copyright (c) 2014-2022 Pierre Chapuis