powered by Jive Software

Enabling anonymous pubsub subscriptions

Does anyone know of a way to enable anonymous pubsub subscritions (not presence subscriptions)?

I’m looking for maybe a setting or something to enable it. I’ve looked through documentation a good bit and googled my eyes out, but all I find are forums posts asking the same thing.

I was able to dig into the Openfire source code a bit and found something interesting:

From: https://geni-imf.renci.org/trac/browser/openfire/openfire/src/java/org/jivesoftw are/openfire/pubsub/PubSubEngine.java

483 private void subscribeNode(PubSubService service, IQ iq, Element childElement, Element subscribeElement)

527 // Check if the subscriber is an anonymous user

528 if (!UserManager.getInstance().isRegisteredUser(subscriberJID)) {

529 // Anonymous users cannot subscribe to the node. Return forbidden error

530 sendErrorPacket(iq, PacketError.Condition.forbidden, null);

531 return;

532 }

I’m not sure which version of Openfire this is from, but it seems like it’s only allowing registered users subscribe to pubsub nodes. Does anyone know if there’s been an update that allows anonymous users to subscribe to pubsub nodes?

Any help is much apprciated.

You have answered your own question

As subscriptions are persistent and have to be stored in the openfire DB, it makes sense to ensure that only registered users can do this. One way around this is to develop a plugin that acts as a proxy and uses the built-in admin user to subscribe on behalf of anonymous users.

Can you expand on the built-in admin user?

Does it have the ability to tell Openfire “send messages from X pubsub node to Y user”?

Would it have the ability to directly insert the subscription into the database for the anonymous user?

Or is the admin user treated like any other user? (Would need to subscribe to nodes and re-route messages to the anonymous users)

If it is treated like any other user, I could just make a chat bot that anonymous users send messages to that basically say “send messages from X node to me” instead of writing a plug-in.

It could be any user. I always use the admin user as it is always created (unless you are using a custom user handler) and it has pre-configured permissions.

Yes, any registered user with required permissions will work. A bot would work provided it can route IQ responses and pubsub MESSAGE events back to the originating anonymous user.