view mod_auth_custom_http/README.markdown @ 4888:dc7c9ae15f43

mod_rest: Ensure mod_http is loaded before API demo Fixes an error as it tried to use module:http_url() which doesn't exist before mod_http is loaded
author Kim Alvefur <zash@zash.se>
date Tue, 08 Feb 2022 13:51:41 +0100
parents f90cf59bee8e
children
line wrap: on
line source

---
summary: HTTP Authentication using custom JSON protocol
...

Introduction
============

To authenticate users, this module does a `POST` request to a configured
URL with a JSON payload. It is not async so requests block the server
until answered.

Configuration
=============

``` lua
VirtualHost "example.com"
authentication = "custom_http"
auth_custom_http = {
  post_url = "http://api.example.com/auth";
}
```

Protocol
========

The JSON payload consists of an object with `username` and `password`
members:

    {"username":"john","password":"secr1t"}

The module expects the response body to be exactly `true` if the
username and password are correct.