annotate mod_register_json.wiki @ 344:980a177b8a19

editing the wiki to reflect changes
author maranda3985@gmail.com
date Mon, 29 Apr 2013 21:02:29 +0000
parents 41d03be9ac76
children 73b078aeaf84
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
1 #summary Token based JSON registration & verification servlet.
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
2 #labels Stage-Stable
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
3
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
4 = Introduction =
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
5
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
6 This module let's you activate a httpserver interface to handle data from webforms with POST and Base64 encoded JSON.
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
7
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
8 = Implementation Details =
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
9
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
10 Example Request format:
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
11
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
12 {{{
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
13 POST /your_register_base_url HTTP/1.1
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
14 Host: yourserveraddress.com:yourchoosenport
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
15 Content-Type: application/encoded
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
16 Content-Transfer-Encoding: base64
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
17
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
18 eyJ1c2VybmFtZSI6InVzZXJuYW1lb2ZjaG9pY2UiLCJwYXNzd29yZCI6InRoZXVzZXJwYXNzd29yZCIsImlwIjoidGhlcmVtb3RlYWRkcm9mdGhldXNlciIsIm1haWwiOiJ1c2VybWFpbEB1c2VybWFpbGRvbWFpbi50bGQiLCJhdXRoX3Rva2VuIjoieW91cmF1dGh0b2tlbm9mY2hvaWNlIn0=
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
19 }}}
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
20
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
21 Where the encoded content is this (example) JSON Array:
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
22
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
23 <code language="javascript">
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
24 {"username":"usernameofchoice","password":"theuserpassword","ip":"theremoteaddroftheuser","mail":"usermail@usermaildomain.tld","auth_token":"yourauthtokenofchoice"}
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
25 </code>
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
26
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
27 Your form implementation needs to pass *all* parameters, the auth_token is needed to prevent misuses, if the request is successfull the server will answer with status code 200 and with the body of the response containing the token which your web app can send via e-mail to the user to complete the registration.
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
28
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
29 The module for now stores a hash of the user's mail address to help slow down duplicated registrations.
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
30
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
31 It's strongly encouraged to have the web server communicate with the servlet via https.
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
32
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
33 = Usage =
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
34
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
35 Copy the module file into your prosody modules directory.
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
36 Add the module your vhost of choice modules_enabled.
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
37
185
9aab3736b3ca Added hint.
maranda3985@gmail.com
parents: 184
diff changeset
38 Hint: pairing with mod_register_url is helpful, to allow server registrations only via your webform.
9aab3736b3ca Added hint.
maranda3985@gmail.com
parents: 184
diff changeset
39
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
40 Optional configuration directives:
229
9278544faffb correction to code block.
maranda@lightwitch.org
parents: 228
diff changeset
41 <code language="lua">
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
42 reg_servlet_base = "/base-path/" -- Base path of the plugin (default is register_account)
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
43 reg_servlet_secure = true -- Have the plugin only process requests on https (default is true)
187
4a6c1e35788c Fixed an error.
maranda3985@gmail.com
parents: 186
diff changeset
44 reg_servlet_ttime = seconds -- Specifies the time (in seconds) between each request coming from the same remote address.
228
818b1135d3e3 corrected wording.
maranda@lightwitch.org
parents: 191
diff changeset
45 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.
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
46 reg_servlet_wl = { "1.2.3.4", "4.3.2.1" } -- The ip addresses in this list will be ignored by the throttling.
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
47 reg_servlet_filtered_mails = { ".*banneddomain.tld", ".*deamailprovider.tld" } -- allows filtering of mail addresses via Lua patterns.
229
9278544faffb correction to code block.
maranda@lightwitch.org
parents: 228
diff changeset
48 </code>
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
49
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
50 = Compatibility =
184
ad1b7e71c32e Created wiki page through web user interface.
maranda3985@gmail.com
parents:
diff changeset
51
344
980a177b8a19 editing the wiki to reflect changes
maranda3985@gmail.com
parents: 278
diff changeset
52 * 0.9