This article is also available on Liferay Blog
Jabber (XMPP) Integration
This tutorial describes all the necessary steps needed to integrate LIMS Messenger for Liferay to the Jabber (XMPP) server.
Jabber is the original name of the XMPP protocol, an open-standard communications protocol based on XML. Jabber server integration allows users using the LIMS Business/Enterprise edition in their browser windows to chat with other users using desktop clients like Pidgin and iMessages or mobile apps like Xabber. So even though the users are currently not browsing your portal you can reach them on their desktop or smart phone. Note that because of the lack of decent Group Chat support in the XMPP protocol the Jabber Integration works for the Single User Chat conversations only.
Jabber Server Installation
LIMS MUC was tested with 4.0.1 version of Openfire real time collaboration server but you can use any kind of Jabber server as long as it implements the XMPP protocol. The rest of the tutorial will cover all the necessary steps needed to run LIMS on the Openfire server. To install the latest version of Openfire follow the Installation Guide.
As a next step we are going to install the Registration Plugin. This plugin allows admins to configure various actions whenever a new user creates an account. It is necessary for the LIMS user import functionality to work correctly because it allows you to enter the name of the group that all new users will be automatically added to. If you are not planning to use this function you can skip this. For more info scroll to the User Import section.
To install the plugin open the Openfire admin interface and click on the Plugins navigation button. Choose Available plugins and click on the plus button next to the Registration plugin.
Enabling Jabber Integration
Jabber Integration is not enabled by default. To enable it open the Admin Area in the Settings Panel (you need to be an admin to see it) and turn on the Jabber integration switch. If you are not using the Settings Panel override the portlet.properties file in your /lims-muc-portlet/WEB-INF/classes directory with a portlet-ext.properties file in the same directory and set the jabber.enabled property to true.
Security via TLS Encryption
If you followed the tutorial and installed the Openfire server you probably haven't enabled the TLS security yet. To enable it follow the Configure SSL/TLS certificate trust for XMPP with a trusted CA link. If you want to set everything up first and enable the security later on you can turn the Security via TLS encryption OFF and continue this tutorial. However, it's strongly recommended to keep this switch ON otherwise all the messages will be sent via unsecured channel.
User Import to Jabber Server
If this option is enabled, the LIMS portlet will import the user automatically to Jabber after he logs in to the portal. Once the user is imported, he can use any Jabber client using the same screen name and password he uses to log in to the portal. However, his roster will not be populated by his contacts because of the security and performance reasons. In other words, even though the user is imported to the server he has no "friends". So if the user sends a message to any other user from the portal the message will not be sent to the other user's jabber device. However, two users are "friends" if they are within the same group. So if you want the users to be able to chat together go to the Openfire admin interface and select Users/Groups > Groups > Create New Group. Choose a name of the group, lets say "Liferay", and type it to the Group Name input field and click on the Create Group button. This will lead you to the Edit Group page. Select Enable contact list group sharing option and fill in the group's name - Liferay - and check the Share group with additional users checkbox. It should look similar to the picture below.
Now click on the Save Contact List Settings button. As a last step we will tell Openfire to automatically add all new users to the Liferay group so they can chat with each other. If you haven't installed the Registration Plugin yet scroll to the Registration Plugin section.
Go to the Users/Groups > Users > Registration Properties page and check the Enable automatically adding of new users to a group checkbox within the Registration Settings and fill in the default group name within the default group box. Don't forget to click on the Save Settings and Save Group buttons.
Fill in your server host URL or IP address. The localhost (127.0.0.1) is a default. Leave it like this if you run Openfire on the same server as Liferay.
Jabber default port is 5222. You can change it here if your server uses a different one.
Use the Server Name value from Openfire Server > Server Manager > Server Information page.
In Jabber you are able to log in several client programs simultaneously. You don't need to have different Jabber accounts for work and for home. You can chat at home, then go to work, log in again with the same JID and your home Jabber client will not go offline after that. This is because Jabber has a thing named resources. If you want to know more about Jabber resources visit the XMPP wiki - Jabber Resource page.
Note that this property can be set via the portlet-ext.properties only. It allows you to set the Resource Priority. More about resource priorities can be found on the XMPP wiki - Jabber Resource page.
If you set everything up click on the Test Connection button. If everything is ok you should see the following message.
If your Openfire server is not running or you provided wrong inputs you will see the following message.
Last but not least if you haven't enabled TLS encryption on the Openfire and the Security via TLS Encryption is turned on you will see the following message.
Logout/Login to Perform Changes
If you enable Jabber integration all the users have to logout and login again in order to connect to the Jabber server. This is due to the fact that connection with the Jabber server is created during the user login because this is the only moment when Liferay provides us with user's plain password so we can use it during the login process to Openfire.
If the connection with the server is not established you will see the following error notification.
Jabber Buddy List Strategy
If you successfully established the connection to Jabber you may decide to change the buddy list strategy to Jabber. If you do so LIMS will load contacts (and groups) directly from Jabber server and not from Liferay. Note that users that are not on Liferay will not be displayed.
Problems with SSO
If you are using SSO (Single Sign On) mechanism Liferay doesn't dispose of the user's password thus it can't be used to login to the Openfire server and login fails. In the future releases this might be fixed by using SASL authentication with (userName, serverName, serverPassword) triplet instead of the (userName, userPassword) pair. However, in the current release Jabber integration doesn't work with SSO in Liferay.
If the user password on Liferay is different than the password in Openfire the authentication fails. Both passwords must match. However, once the user is authenticated and changes the password LIMS automatically changes the password in Openfire.