Roster management with Openfire userservice

Been experimenting with ways to manage user rosters in my XMPP environment. Looks like one way would be to employ Openfire’s User Service.

To add an entry to a user’s roster (example modified from plugin documentation):

https://chat.example.com:9091/plugins/userService/userservice?type=add_roster&secret=WXYZ1234&username=pausanias&item_jid=aurelius@chat.example.com&name=Marcus Aurelius&subscription=3

Note: In scripting this, I’d also do a companion operation to add pausanius to aurlelius’s roster.

Some terms: “type” is the operation type, “secret” is a special password assigned to the User Service for use by admins, “item_jid” is the jid of the roster item, and “name” is the nickname to be associated with that roster item. The “subscription” term indicates the type of subscription to be added: “0” is for none, “1” for “to”, “2” for “from” and “3” for both.

This was tested on Openfire 3.9.1 with version 1.4.2 of the User Service. In fact I had trouble with deploying the User Service on Openfire 3.8.2 and had to upgrade to 3.9.1 for it to work.

Removing a roster item basically mirrors the above, with the type of operation changed from “add_roster” to “delete_roster”. Modfication of a roster item (for example, its nickname) would be an “update_roster” type operation.

A couple of things I like about this method: (1) it allows manipulation of rosters by admins, not just by the users themselves (XMPP protocol operations only allow the latter); and (2) it can be done over HTTP (or HTTPS), so it doesn’t require an XMPP client.

The downside is that this facility is only available in Openfire. Reliance on it will create a dependency on that product. But then other methods I’ve tried, like manipulating the back end database tables that store roster information, are also highly product specific.

This entry was posted in Development, System Administration on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).