Search code examples
androidxmppopenfire

Add more fields to user registration in xmpp openfire


I am trying to register a new user over openfire , so far i am able to register it over server but i want to add some more fields like phone , address in the user registration form

as of now there is only a provision of setting username, fullname, password and email at the time of registering a user over server.

But I want to add more fields, how can i do that?

I'm using these dependencies, other way to add more fields?

compile 'org.igniterealtime.smack:smack-tcp:4.1.0'
compile 'org.igniterealtime.smack:smack-android-extensions:4.1.0'
compile 'org.igniterealtime.smack:smack-im:4.1.0'

Solution

  • You could provision new users in Openfire via calls to the Openfire REST API plugin. When using the Create User, you can specify custom properties to add. Those custom props will show up on the user's custom properties in Openfire, not the vcard. The custom props can also be retrieved via a REST GET for the user.

    I've found this works well in most scenarios. All custom props are stored as string (varchar in database). I ran into some problems when storing and retrieving encoded binaries in a custom prop, mostly around default database field definition limits (5000 SQL Server?) and when retrieving a list of users and their data, it took longer because of those custom properties always coming back.

    https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#create-a-user

    Example payload for creating a user with two custom properties

    {
        "username": "admin",
        "password": "p4ssword",
        "name": "Administrator",
        "email": "[email protected]",
        "properties": {
            "property": [
                {
                    "@key": "console.rows_per_page",
                    "@value": "user-summary=8"
                },
                {
                    "@key": "console.order",
                    "@value": "session-summary=1"
                }
            ]
        }
    }