Erlang/OTP Forums

Author Message

<  Ejabberd mailing list  ~  user registration via HTTP

Guest
Posted: Tue Dec 22, 2009 4:39 am Reply with quote
Guest
I need to let new users register ejabberd accounts via the browser-based xmpp client I'm coding.

Some constraints:

I can't use PHP (etc) to talk to ejabberd, as there is no server-side to my app beyond ejabberd; it's 100% client-side javascript.

I don't wish to allow in-band registration, as I only want users of my browser app to have access to ejabberd.

Thanks!

Liam


Post received from mailinglist
Guest
Posted: Tue Dec 22, 2009 4:17 pm Reply with quote
Guest
Liam wrote:
> I need to let new users register ejabberd accounts via the browser-based
> xmpp client I'm coding.
>
> Some constraints:
>
> I can't use PHP (etc) to talk to ejabberd, as there is no server-side to
> my app beyond ejabberd; it's 100% client-side javascript.
>
> I don't wish to allow in-band registration, as I only want users of my
> browser app to have access to ejabberd.
>

Sounds like you need to break your constraints. You can either have
users go to a different URL to do registration, or use apache proxying
to ejabberd, thus allowing you to use php.

We use apache proxying to punjab to talk via xmpp to ejabberd. We found
this more reliable than apache proxying to mod_http_bind in ejabberd.
_______________________________________________
ejabberd mailing list
ejabberd@jabber.ru
http://lists.jabber.ru/mailman/listinfo/ejabberd
Post received from mailinglist
Guest
Posted: Wed Dec 23, 2009 12:07 am Reply with quote
Guest
Would the XML RPC module allow this? Couldn't I call it via javascript XmlHttpRequest?

If so, anyone have javascript code calling ejabberd thru XML RPC?

Liam

On Mon, Dec 21, 2009 at 8:39 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
I need to let new users register ejabberd accounts via the browser-based xmpp client I'm coding.

Some constraints:

I can't use PHP (etc) to talk to ejabberd, as there is no server-side to my app beyond ejabberd; it's 100% client-side javascript.

I don't wish to allow in-band registration, as I only want users of my browser app to have access to ejabberd.

Thanks!

Liam




Post received from mailinglist
Guest
Posted: Wed Dec 23, 2009 1:51 am Reply with quote
Guest
There're many js xml-rpc library you could use. xml-rpc is a rather easy protocol and you could do it in js.

We have much experience on ejabber's xml-rpc.

I'm the owner of iJab, an ajax-based xmpp client and iJabBar, a facebook style web chat bar.
code.google.com/p/ijab/


2009/12/23 Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)>
Quote:
Would the XML RPC module allow this? Couldn't I call it via javascript XmlHttpRequest?

If so, anyone have javascript code calling ejabberd thru XML RPC?

Liam


On Mon, Dec 21, 2009 at 8:39 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
I need to let new users register ejabberd accounts via the browser-based xmpp client I'm coding.

Some constraints:

I can't use PHP (etc) to talk to ejabberd, as there is no server-side to my app beyond ejabberd; it's 100% client-side javascript.

I don't wish to allow in-band registration, as I only want users of my browser app to have access to ejabberd.

Thanks!

Liam






_______________________________________________
ejabberd mailing list
ejabberd@jabber.ru (ejabberd@jabber.ru)
http://lists.jabber.ru/mailman/listinfo/ejabberd




Post received from mailinglist
Guest
Posted: Wed Dec 23, 2009 9:57 pm Reply with quote
Guest
So the XML RPC module needs a separate erlang component, which requires compilation...

From ejabberd_xmlrpc README:

- Install XMLRPC-Erlang
wget http://www.ejabberd.im/files/contributions/xmlrpc-1.13-ipr2.tgz
tar -xzvf xmlrpc-1.13-ipr2.tgz
cd xmlrpc-1.13/src
make

My development box is WinXP. Will that install procedure work there? Is there a "binary" release?

I'm using strophe, so I plan to build XMLRPC requests with its Builder class instead of adding yet another js lib to my app. Anyone else done so?

Liam


On Tue, Dec 22, 2009 at 4:07 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
Would the XML RPC module allow this? Couldn't I call it via javascript XmlHttpRequest?

If so, anyone have javascript code calling ejabberd thru XML RPC?

Liam


On Mon, Dec 21, 2009 at 8:39 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
I need to let new users register ejabberd accounts via the browser-based xmpp client I'm coding.

Some constraints:

I can't use PHP (etc) to talk to ejabberd, as there is no server-side to my app beyond ejabberd; it's 100% client-side javascript.

I don't wish to allow in-band registration, as I only want users of my browser app to have access to ejabberd.

Thanks!

Liam








Post received from mailinglist
Guest
Posted: Thu Dec 24, 2009 7:51 am Reply with quote
Guest
I didn't compile xmlrpc module on Windows and I don't know it could or not.

You could do xml rpc request yourself by XMLHttpRequest.


Zhan

2009/12/24 Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)>
Quote:
So the XML RPC module needs a separate erlang component, which requires compilation...

From ejabberd_xmlrpc README:

- Install XMLRPC-Erlang
wget http://www.ejabberd.im/files/contributions/xmlrpc-1.13-ipr2.tgz
tar -xzvf xmlrpc-1.13-ipr2.tgz
cd xmlrpc-1.13/src
make

My development box is WinXP. Will that install procedure work there? Is there a "binary" release?

I'm using strophe, so I plan to build XMLRPC requests with its Builder class instead of adding yet another js lib to my app. Anyone else done so?

Liam



On Tue, Dec 22, 2009 at 4:07 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
Would the XML RPC module allow this? Couldn't I call it via javascript XmlHttpRequest?

If so, anyone have javascript code calling ejabberd thru XML RPC?

Liam


On Mon, Dec 21, 2009 at 8:39 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
I need to let new users register ejabberd accounts via the browser-based xmpp client I'm coding.

Some constraints:

I can't use PHP (etc) to talk to ejabberd, as there is no server-side to my app beyond ejabberd; it's 100% client-side javascript.

I don't wish to allow in-band registration, as I only want users of my browser app to have access to ejabberd.

Thanks!

Liam










_______________________________________________
ejabberd mailing list
ejabberd@jabber.ru (ejabberd@jabber.ru)
http://lists.jabber.ru/mailman/listinfo/ejabberd





Post received from mailinglist
Guest
Posted: Thu Dec 24, 2009 3:20 pm Reply with quote
Guest
2009/12/23 Liam <ejabberd@networkimprov.net>:
> So the XML RPC module needs a separate erlang component, which requires
> compilation...
>
> From ejabberd_xmlrpc README:
>
> - Install XMLRPC-Erlang
> wget http://www.ejabberd.im/files/contributions/xmlrpc-1.13-ipr2.tgz
> tar -xzvf xmlrpc-1.13-ipr2.tgz
> cd xmlrpc-1.13/src
> make
>
> My development box is WinXP. Will that install procedure work there?
> Is there a "binary" release?

In this case yes, xmlrpc-1.13-compiled.zip is provided in
http://www.ejabberd.im/ejabberd_xmlrpc

Remember that the same erlang version must be used to compile and run
*.beam files (R12, R13, ...). FYI, ejabberd 2.* binary installers from
ProcessOne include Erlang R12.

For future works, you may be interested in improving your development
machine: install a virtual machine program (like VirtualBox) and
inside it install a Free OS (like Debian). You can compile erlang
files into *.beam there, then copy and use them in your main WinXP.



---
Badlop
ProcessOne
_______________________________________________
ejabberd mailing list
ejabberd@jabber.ru
http://lists.jabber.ru/mailman/listinfo/ejabberd
Post received from mailinglist
Guest
Posted: Thu Dec 24, 2009 3:30 pm Reply with quote
Guest
Any time I want a simple HTTP interface for an ejabberd function I
write a new HTTP request handler module. It's pretty easy. Here's an
example. It has not been updated for exmpp. It is activated by adding
the request handler to the ejabberd_http port config, such as
{["message"], http_message}. I do this in the web admin but you can
also put it in your config file.

This module expects an authenticated POST containing a valid message
stanza. If the HTTP request does not contain a valid Authorization
header the response is a 403. A bad username/password gets a 401. You
would probably want to remove that check but I included it so that
this code can be used for authenticated actions.

Forgive me for the sloppy and vestigial parts of the code. It works
for me. Our developers use this interface to send themselves debug
messages from web servers. It's easier than tailing logs on hundreds
of web servers simultaneously. Smile

-module(http_message).
-author('andy@automattic.com').
-include("jlib.hrl").
-include("ejabberd_http.hrl").
-include("ejabberd.hrl").
-export([process/2]).

process(LocalPath, #request{auth = Auth} = Request)->
case get_auth(Auth) of
{User, Domain} ->
out(Request, Request#request.method, LocalPath,
jlib:string_to_jid(User++"@"++Domain));
_ ->
{401, [{"WWW-Authenticate", "basic
realm=\"ejabberd\""}],"Unauthorized"}
end;

process(_LocalPath, _Request) ->
{403, [], "Forbidden"}.

out(Args, 'POST', _Node, From) ->
Payload = xml_stream:parse_element(Args#request.data),
To = xml:get_tag_attr_s("to", Payload),
case ejabberd_router:route(From, jlib:string_to_jid(To), Payload) of
ok ->
{201, [], Payload};
_ ->
{400, [], ""}
end;

out(_, _, _, _) ->
{403, [], "Forbidden"}.

get_auth(Auth) ->
case Auth of
{SJID, P} ->
case jlib:string_to_jid(SJID) of
error ->
unauthorized;
#jid{user = U, server = S} ->
case ejabberd_auth:check_password(U, S, P) of
true ->
{U, S};
false ->
unauthorized
end
end;
_ ->
unauthorized
end.
_______________________________________________
ejabberd mailing list
ejabberd@jabber.ru
http://lists.jabber.ru/mailman/listinfo/ejabberd
Post received from mailinglist
Guest
Posted: Thu Dec 24, 2009 7:50 pm Reply with quote
Guest
Thanks for pointing out the compiled xmlrpc-erlang; sorry I missed that on the ejabberd.im post; you might want to mention it in the readme as well...

There's no installation instructions... Do I simply place the R13 beam files in a new folder in ejabberd/lib/ ?

Also, what would the access_commands config be to allow any caller to call register?

Liam


On Wed, Dec 23, 2009 at 1:57 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
So the XML RPC module needs a separate erlang component, which requires compilation...

>From ejabberd_xmlrpc README:

- Install XMLRPC-Erlang
wget http://www.ejabberd.im/files/contributions/xmlrpc-1.13-ipr2.tgz
tar -xzvf xmlrpc-1.13-ipr2.tgz
cd xmlrpc-1.13/src
make

My development box is WinXP. Will that install procedure work there? Is there a "binary" release?

I'm using strophe, so I plan to build XMLRPC requests with its Builder class instead of adding yet another js lib to my app. Anyone else done so?

Liam



On Tue, Dec 22, 2009 at 4:07 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
Would the XML RPC module allow this? Couldn't I call it via javascript XmlHttpRequest?

If so, anyone have javascript code calling ejabberd thru XML RPC?

Liam


On Mon, Dec 21, 2009 at 8:39 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
I need to let new users register ejabberd accounts via the browser-based xmpp client I'm coding.

Some constraints:

I can't use PHP (etc) to talk to ejabberd, as there is no server-side to my app beyond ejabberd; it's 100% client-side javascript.

I don't wish to allow in-band registration, as I only want users of my browser app to have access to ejabberd.

Thanks!

Liam












Post received from mailinglist
Guest
Posted: Mon Dec 28, 2009 2:20 pm Reply with quote
Guest
2009/12/24 Liam <ejabberd@networkimprov.net>:
> Thanks for pointing out the compiled xmlrpc-erlang; sorry I missed that on
> the ejabberd.im post; you might want to mention it in the readme as well...

Yes, added to README.txt


> There's no installation instructions... Do I simply place the R13 beam files
> in a new folder in ejabberd/lib/ ?

Now it says:

Then you can copy the *.beam files to ejabberd ebin directory,
or add an option like this to the ejabberd start script:
$ erl -pa '/home/jabber/xmlrpc-1.13/ebin' ...


> Also, what would the access_commands config be to allow any caller to call
> register?

In that case you don't need to configure the option. It says:

{access_commands, AccessCommands}
This option allows to define a list of access restrictions.
...
The default value is to not define any restriction: []



---
Badlop
ProcessOne
_______________________________________________
ejabberd mailing list
ejabberd@jabber.ru
http://lists.jabber.ru/mailman/listinfo/ejabberd
Post received from mailinglist
Guest
Posted: Mon Dec 28, 2009 9:44 pm Reply with quote
Guest
There's a bin (but no ebin) directory in my WinXP ejabberd directory... Same as ebin?

I want ANY XMLRPC client to be able to use ONLY the register command... Config for that?

Liam

On Thu, Dec 24, 2009 at 11:50 AM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
Thanks for pointing out the compiled xmlrpc-erlang; sorry I missed that on the ejabberd.im post; you might want to mention it in the readme as well...

There's no installation instructions... Do I simply place the R13 beam files in a new folder in ejabberd/lib/ ?

Also, what would the access_commands config be to allow any caller to call register?

Liam



On Wed, Dec 23, 2009 at 1:57 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
So the XML RPC module needs a separate erlang component, which requires compilation...

>From ejabberd_xmlrpc README:

- Install XMLRPC-Erlang
wget http://www.ejabberd.im/files/contributions/xmlrpc-1.13-ipr2.tgz
tar -xzvf xmlrpc-1.13-ipr2.tgz
cd xmlrpc-1.13/src
make

My development box is WinXP. Will that install procedure work there? Is there a "binary" release?

I'm using strophe, so I plan to build XMLRPC requests with its Builder class instead of adding yet another js lib to my app. Anyone else done so?

Liam



On Tue, Dec 22, 2009 at 4:07 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
Would the XML RPC module allow this? Couldn't I call it via javascript XmlHttpRequest?

If so, anyone have javascript code calling ejabberd thru XML RPC?

Liam


On Mon, Dec 21, 2009 at 8:39 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
I need to let new users register ejabberd accounts via the browser-based xmpp client I'm coding.

Some constraints:

I can't use PHP (etc) to talk to ejabberd, as there is no server-side to my app beyond ejabberd; it's 100% client-side javascript.

I don't wish to allow in-band registration, as I only want users of my browser app to have access to ejabberd.

Thanks!

Liam
















Post received from mailinglist
Guest
Posted: Fri Jan 01, 2010 5:49 am Reply with quote
Guest
It's a pity all the xmlrpc components aren't distributed in a single package...

Now I see ejabberd_xmlrpc isn't distributed as a .beam? Any pointers to one? Or can I compile from WinXP command line?

There's a bin (but no ebin) directory in my WinXP ejabberd directory... Same as ebin?

I want ANY XMLRPC client to be able to use ONLY the register command... Is this the config for that:

Guest
Posted: Mon Jan 04, 2010 7:37 pm Reply with quote
Guest
Can I restrict in-band registration to a single registrar account which the client must log into before creating a new user?

And hey, Isn't web-based user sign-up really common? Why no HTTP interface to this in the main distribution?


On Mon, Dec 21, 2009 at 8:39 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
I need to let new users register ejabberd accounts via the browser-based xmpp client I'm coding.

Some constraints:

I can't use PHP (etc) to talk to ejabberd, as there is no server-side to my app beyond ejabberd; it's 100% client-side javascript.

I don't wish to allow in-band registration, as I only want users of my browser app to have access to ejabberd.

Thanks!

Liam


Post received from mailinglist
Guest
Posted: Mon Jan 04, 2010 9:40 pm Reply with quote
Guest
why not just use BOSH that does all that stuff?BOSH + strophejs = win---
Ivan Porto Carrero



On Mon, Jan 4, 2010 at 8:37 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
Can I restrict in-band registration to a single registrar account which the client must log into before creating a new user?

And hey, Isn't web-based user sign-up really common? Why no HTTP interface to this in the main distribution?



On Mon, Dec 21, 2009 at 8:39 PM, Liam <ejabberd@networkimprov.net (ejabberd@networkimprov.net)> wrote:
Quote:
I need to let new users register ejabberd accounts via the browser-based xmpp client I'm coding.

Some constraints:

I can't use PHP (etc) to talk to ejabberd, as there is no server-side to my app beyond ejabberd; it's 100% client-side javascript.

I don't wish to allow in-band registration, as I only want users of my browser app to have access to ejabberd.

Thanks!

Liam




_______________________________________________
ejabberd mailing list
ejabberd@jabber.ru (ejabberd@jabber.ru)
http://lists.jabber.ru/mailman/listinfo/ejabberd





Post received from mailinglist
Guest
Posted: Tue Jan 05, 2010 5:50 pm Reply with quote
Guest
2010/1/4 Liam <ejabberd@networkimprov.net>:
> Can I restrict in-band registration to a single registrar account which the
> client must log into before creating a new user?

mod_register doesn't implement such option.

Old related ticket:
Option for mod_register: access_registrant.
http://yo.jabber.ru/bugzilla/show_bug.cgi?id=300


> And hey, Isn't web-based user sign-up really common?
> Why no HTTP interface to this in the main distribution?

Related contributed module:
http://www.ejabberd.im/mod_register_web


---
Badlop
ProcessOne
_______________________________________________
ejabberd mailing list
ejabberd@jabber.ru
http://lists.jabber.ru/mailman/listinfo/ejabberd
Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 2
Goto page 1, 2  Next
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum