By: Simon Devlin user 24 Aug 2016 at 6:14 a.m. CDT

4 Responses
Simon Devlin gravatar
Hi, I've enabled user self registration (including setting to active). Is there a more comprehensive example on how to set (or add fields) to a user at registration? I'm specifically interested in adding a custom attribute to each user and setting that to a value at registration (in this case it's a single value custom attribute that's released to a SP via shibboleth) E.g. myCustomAttribute = "some_single_string" Again, I realise that this is straying into Support Contract territory, and I'm pushing to get that sort. Thanks

By Mohib Zico staff 24 Aug 2016 at 6:24 a.m. CDT

Mohib Zico gravatar
Hi Simon, [Configure Registration from Attributes](https://gluu.org/docs/oxtrust/configuration/#manage-registration) is the feature where you can define specific attributes for registration page.

By William Lowe user 24 Aug 2016 at 8:25 a.m. CDT

William Lowe gravatar
Simon, One thing to note is that if possible, we recommend handling registration in your app locally, then pushing the information to the Gluu Server via SCIM. This will give you much more control and flexibility in defining the exact registration process you want users to go through. In fact, we're getting ready to push updates to this support app that will follow the same guidance. Thanks, Will

By Simon Devlin user 24 Aug 2016 at 8:29 a.m. CDT

Simon Devlin gravatar
Hi Mohib, That's not quite the effect I'm after. What you've described allows the user to complete more information during registration (and I can indeed add my custom attribute to the list as you've described). What I want to do, is set the value as part of the user registration script. It's a field that should be set for these users, but which they should not be able to set themselves as it's used downstream for an application permission. In the end I had a look at the [source for gluuCustomPerson.java](https://github.com/GluuFederation/oxTrust/blob/e03407f0133ffbd3dd9d0c1c585a2b0c9ed45d96/server/src/main/java/org/gluu/oxtrust/model/GluuCustomPerson.java) to figure out what operations are permitted then added the following to the preRegistration element of the User Registration custom script. ``` user.setAttribute("myCustomAttributeName","myStringValue") ``` Works like a charm :) William, That sounds good for longer term but would have been a pain for a like-for-like swap from ADFS (my case)

By William Lowe user 24 Aug 2016 at 8:30 a.m. CDT

William Lowe gravatar
Great. Thanks for the feedback, Simon.