PubSub capabilities of an external component

I have an external component which acts a proxy for the PubSub feature on OpenFire (3.6.4). However I am unable to create any type of node (collection or leaf) with this component. I get an 403 auth error. How do I enable this capability? Thanks

Here is what I found

In the pubsub module on the PubSubEngine class at the createNode(PubSubService service, IQ iq, Element childElement, Element createElement) method there is condition like this

if (!service.canCreateNode(from) || !UserManager.getInstance().isRegisteredUser(from)) {
sendErrorPacket(iq, PacketError.Condition.forbidden, null);
return;
}

Hence when an external component is checked for this condition, execution goes into the if condition and thus returns a 403. I am not sure if this is part of spec for an external component.

For my requirement I made changes in this code to check if JID passed belongs to an external component and if yes break from the if condition.

In the change log for Openfire 3.2.0 there was a bug record claims to have fixed this problem.

Ref: [JM-931] - Allowed components to create nodes and publish item.

As for the PubSubEngine class, to add the ExternalComponentManager class to the conditional, the ExternalComponentManager class needs to be re-worked. After looking at the code for just a few minutes, it looks as though there is no way to return an instance of the External Component to the PubSubEngine. The only conditional that would come close is the isServiceEnabled() function, but that doesn’t seem like it should be used in this case. The best solution that I can tell (note: I haven’t tried it yet) would be to set a private static instance variable equal to the class, and a getInstance function that returns the instance (see InternalComponentManager.java for the example). Then, we need a boolean function isRegisteredComponent( JID jid ) to check to see if the component has passed the handshake process. And Finally, you can grab the instance in question: ex: ExternalComponentManager.getInstance().isRegisteredComponent(from). Which means that PubSubEngine can check . . . if(!service.canCreateNode(from) || !(UserManager.getInstance().isRegisteredUser(from) || ExternalComponentManager.getInstance.isRegisteredComponent(from))){ … }

Additional note: If this is a viable solution. . .then it may be worth investigating whether adding an InternalComponentManager clause in the conditional so that S2S can also create nodes, (most convienently though an admin UI plugin). . .

Thanks Greg, I did use something similar to your suggestion. I used the hasComponent() method in the InternalComponentManager class.

Any hope of having an official fix for this in the next release?

Thanks,

Pascal

I ran into this same problem. I used a workaround for this part of the code:

!UserManager.getInstance().isRegisteredUser(from))

a component is never a registered user. I also agree this needs to be fixed. I will start on a fix unless someone else is working on this.

I put a patch in the bug report: http://www.igniterealtime.org/community/thread/39978

Thanks for the patch, Ian!

Pascal