Mercurial > prosody-modules
comparison mod_auth_http_cookie/README.md @ 5975:fe081789f7b5
All community modules: Unify file extention of Markdown files to .md
| author | Menel <menel@snikket.de> |
|---|---|
| date | Tue, 22 Oct 2024 10:26:01 +0200 |
| parents | mod_auth_http_cookie/README.markdown@bae7b0a002ef |
| children |
comparison
equal
deleted
inserted
replaced
| 5974:5a65a632d5b9 | 5975:fe081789f7b5 |
|---|---|
| 1 --- | |
| 2 labels: | |
| 3 - Stage-Alpha | |
| 4 ... | |
| 5 | |
| 6 Introduction | |
| 7 ============ | |
| 8 | |
| 9 This is an experimental authentication module that does an asynchronous | |
| 10 HTTP call to verify username and password. | |
| 11 | |
| 12 This is a (possibly temporary) fork of mod_http_auth_async that adds | |
| 13 support for authentication using a cookie and SASL EXTERNAL. | |
| 14 | |
| 15 Details | |
| 16 ======= | |
| 17 | |
| 18 When a user attempts to authenticate to Prosody, this module takes the | |
| 19 username and password and does a HTTP GET request with [Basic | |
| 20 authentication][rfc7617] to the configured `http_auth_url`. | |
| 21 | |
| 22 Configuration | |
| 23 ============= | |
| 24 | |
| 25 ``` lua | |
| 26 VirtualHost "example.com" | |
| 27 authentication = "http_auth_cookie" | |
| 28 http_auth_url = "http://example.com/auth" | |
| 29 http_cookie_auth_url = "https://example.com/testcookie.php?user=$user" | |
| 30 ``` | |
| 31 | |
| 32 Cookie Authentication | |
| 33 ===================== | |
| 34 | |
| 35 It is possible to link authentication to an existing web application. This | |
| 36 has the benefit that the user logging into the web application in their | |
| 37 browser will automatically log them into their XMPP account. | |
| 38 | |
| 39 There are some prerequisites for this to work: | |
| 40 | |
| 41 - The BOSH or Websocket requests must include the application's cookie in | |
| 42 the headers sent to Prosody. This typically means the web chat code needs | |
| 43 to be served from the same domain as the web application. | |
| 44 | |
| 45 - The web application must have a URL that returns 200 OK when called with | |
| 46 a valid cookie, and returns a different status code if the cookie is invalid | |
| 47 or not currently logged in. | |
| 48 | |
| 49 - The XMPP username for the user must be passed to Prosody by the client, or | |
| 50 returned in the 200 response from the web application. | |
| 51 | |
| 52 Set `http_cookie_auth_url` to the web application URL that is used to check the | |
| 53 cookie. You may use the variables `$host` for the XMPP host and `$user` for the | |
| 54 XMPP username. | |
| 55 | |
| 56 If the `$user` variable is included in the URL, the client must provide the username | |
| 57 via the "authzid" in the SASL EXTERNAL authentication mechanism. | |
| 58 | |
| 59 If the `$user` variable is *not* included in the URL, Prosody expects the web application's response to be the username instead, as UTF-8 text/plain. | |
| 60 | |
| 61 Compatibility | |
| 62 ============= | |
| 63 | |
| 64 Requires Prosody trunk |
