By: Bernardo Santos user 19 Feb 2019 at 3:21 a.m. CST

7 Responses
Bernardo Santos gravatar
Hello there, I'm continuing using the provided SCIM Client which has been quite helpful. :) However, I'm experiencing this weird behaviour: Whilist creating a user, I format the UserResource object as described by the literature and examples. When using the createUser method, everything is working perfectly and I'm able to check in the GUI that the user has been correctly created (custom attributes and all) but the reply from the method returns the user without those attributes. Considering that all the logs from Gluu also confirm the successful creation of the User, I don't know what could possibly be the issue. Thanks in advance and best regards,

By Jose Gonzalez staff 19 Feb 2019 at 6:01 a.m. CST

Jose Gonzalez gravatar
Hi, Can you provide some sample code to see how you are crafting the request? Also the corresponding response returned (ie `response.readEntity(String.class))` ? Creation method has optional parameters `attributes` and `excludedAttributes` that allow to tweak what it is actually returned. When you supply none of them, by default most of attributes are returned, including those belonging to user extension.

By Bernardo Santos user 19 Feb 2019 at 6:09 a.m. CST

Bernardo Santos gravatar
Hi Jose, thanks for the quick reply: here's my request: ``` ..... String include = "userName, password, displayName, urn:ietf:params:scim:schemas:extension:gluu:2.0:User:scimCustom"; ..... UserResource newUser = new UserResource(); newUser.setActive(false); newUser.setUserName(****); newUser.setPassword(****); newUser.setDisplayName(****); CustomAttributes cAttribute = new CustomAttributes(USER_EXT_SCHEMA_ID); imsiAttribute.setAttribute("scimCustom", ****); newUser.addCustomAttributes(cAttribute); Response createResponse = client.createUser(newUser, include, null); ``` and the response: ``` response: {"schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],"id":"@!0AA1.9602.378B.D2AB!0001!135C.1AC0!0000!2916.5FB1.471C.E492","userName":"20834123456789","displayName":"Device 2083****6789"} ``` when trying to obtain the custom attributes through: `user.getCustomAttributes(USER_EXT_SCHEMA_ID)` it gives null. Thanks again,

By Jose Gonzalez staff 19 Feb 2019 at 10:44 a.m. CST

Jose Gonzalez gravatar
Hi, Per spec `password` won't be returned, See RFC7643. Also you can check this fact in your user schema document at `https://your-host/identity/restv1/scim/v2/Schemas/urn:ietf:params:scim:schemas:core:2.0:User` With regard to the custom attribute, check if it appears in `https://your-host/identity/restv1/scim/v2/Schemas/urn:ietf:params:scim:schemas:extension:gluu:2.0:User`. If not, double check the way you added your `scimCustom` you can see the value of your custom attribute being set, right ? ( LDAP or GUI)

By Bernardo Santos user 19 Feb 2019 at 10:51 a.m. CST

Bernardo Santos gravatar
Hello, the password makes perfect sense not returning, of course. My custom attribute shows up the extended user schema and the newUser shows up in the LDAP/GUI with the attribute and properly set. Even if I use the search method by filtering with the custom attribute, it works perfectly. Only the creation response seems affected. Thanks again,

By Jose Gonzalez staff 19 Feb 2019 at 1:50 p.m. CST

Jose Gonzalez gravatar
I used your code and was able to replicate. Added an [issue](https://github.com/GluuFederation/oxTrust/issues/1529) for it. Hopefully the fix will be included in CE 3.1.6 which will be out soon. Meanwhile, just pass `null` for `include` variable. The custom attributes are returned in that case. Thanks for reporting.

By Jose Gonzalez staff 19 Feb 2019 at 6:25 p.m. CST

Jose Gonzalez gravatar
PS. If you don't like nulls, you can do `newUser.getSchemas().add(USER_EXT_SCHEMA_ID);` after `newUser` instantiation. This way you won't have to change your code when migrating to 3.1.6

By Bernardo Santos user 20 Feb 2019 at 2:45 a.m. CST

Bernardo Santos gravatar
Hello, thanks for the work around tip. I'll apply it so it's ready for 3.1.6. Best regards,