thepug / Mod-Http-Pre-Bind

An ejabberd module that pre binds an anonymous sasl session, returning the authenticated session.
http://code.stanziq.com
Other
47 stars 17 forks source link

mod_http_pre_bind for ejabberd.

When using anonymous users the authentication process through BOSH can take a second or two. These seconds can be saved by doing all of the authentication and bosh session setup on one call. mod_http_pre_bind does this and returns a jid, sid, and rid of a valid BOSH session.

It requires mod_http_bind. Modifications are needed to src/web/ejabberd_http_bind.erl. The start, http_get, http_put, handle_session_start, and prepare_response functions need to be made public in the module code. This prebind module simply calls those functions to initiate and handle a session.

To build run the build.sh script and install the resulting beam files in your ejabberd ebin directory.

Install both in ejabberd.cfg.

{5288, ejabberd_http, [ http_bind, web_admin, {request_handlers, [{["http-pre-bind"], mod_http_pre_bind}]} ]}

%% %% Modules enabled in all ejabberd virtual hosts. %% {modules, [ {mod_http_bind, []}, {mod_http_pre_bind, []},

Example post and response:

POST

Response: <body xmlns='http://jabber.org/protocol/httpbind'
sid='892efca20cea238958f0603f89a6f8472ef790fe'
rid='1234568'>
<iq xmlns='jabber:client'
id='_bind_auth_2'
type='result'>

22720631691260831658412599@example.com/37436661951260831658614586