view mod_register_json.wiki @ 239:8b5492ea07d9

corrected typo.
author Marco Cirillo <maranda@lightwitch.org>
date Sat, 03 Dec 2011 16:47:39 +0000
parents 9278544faffb
children 08744edfffba
line wrap: on
line source

#summary mini JSON registration servlet.
#labels Stage-Alpha

= Introduction =

This module let's you activate a httpserver interface to handle data from webforms with POST and JSON.

= Details =

It will accept the following format:

{{{
POST /your_register_base_url HTTP/1.0
Host: yourserveraddress.com:yourchoosenport
Authorization: Basic base64authstring
Content-Type: application/json

{"username":"usernameofchoice","password":"theuserpassword","host":"yourserverorvhostaddress","ip":"theremoteaddroftheuser"}
}}}

It will require a server admin (of the given host) to provide valid credentials to submit data via Basic HTTP auth first.

The ip field is at the moment is required to be present even if unset (""), you will require to set it using the webserver's REMOTE_ADDR global (or similar) to pass the client's ip address should you want to employ throttling/blacklisting/whitelisting of requests.

= Usage =

Copy the module file into your prosody modules directory.
Load the module in your configuration file's global section, that would suffice to run it.

Hint: pairing with mod_register_url is helpful, to allow server registrations only via your webform.

Optional configuration directives:
<code language="lua">
reg_servlet_realm = "Your Realm Name of choice" -- Modifies the name of the authentication realm.
reg_servlet_ports = { { port = 8080, path = "your_register_path" } } -- Allows to configure custom ports see: http://prosody.im/doc/setting_up_bosh
reg_servlet_ttime = seconds -- Specifies the time (in seconds) between each request coming from the same remote address.
reg_servlet_bl = { "1.2.3.4", "4.3.2.1" } -- The ip addresses in this list will be blacklisted and will not be able to submit registrations.
reg_servlet_wl = { "1.2.3.4", "4.3.2.1" } -- The ip addresses in this list will be ignored by the throttling.
</code>

Notes on ports:
Modified to use, prosody's standard ports configuration format, if you don't specify any port via *port =* param, 9280 (non ssl) and 9443 (ssl) will be used.

= Compatibility =

Trunk - Works.

0.8 - Should work.

0.7 - Untested.