Hi everyone. I created a new user with SCIM API. This is the my input
POST /identity/restv1/scim/v2/Users HTTP/1.1
Host: login.eis.az
Accept: application/scim+json
Content-Type: application/json
Authorization: Bearer ab8df4bc-ecb6-4a61-8dd9-2c332f1bc059
Cache-Control: no-cache
{
"schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],
"userName":"sakit.a@hotmail.com",
"active":true,
"urn:ietf:params:scim:schemas:extension:gluu:2.0:User":{
"givenName":"Sakit",
"sn":"Atakişiyev",
"middleName":"Ramiz",
"mail":"sakit.a@hotmail.com",
"uid":"sakit.a@hotmail.com",
"userPassword":"1234567",
"gluuStatus":true,
"displayName":"Sakit Ramiz Atakişiyev"
}
}
This is code works and create a new user. As you see from the request I set my new user's gluuStatus
and active
status as true
. But my new user could not login to the system even my user status is active. I need to update my user status active from ui after doing this my user can login. Is it bug or not?
Hi Sakit,
A valid user add json should look like this:
{
"schemas": [ "urn:ietf:params:scim:schemas:core:2.0:User" ],
"userName": "john",
"name": { "familyName": "Smith", "givenName": "Joey" },
"displayName": "Joe Smith",
"userPassword":"1234567",
"active":true,
"emails": [
{
"value": "jsmith@foodmafia.com",
"type": "work",
"primary": true
}
],
"phoneNumbers": [
{ "value": "5 123 8901" }, { "value": "5 123 8902" }
]
}
Thomas Gasmy so to activate the new user I should set at least one primary email. Do I understand correctly?
Why do you think so?
OK. With your example I could not set any custom attribute am I right? To do this I should use urn:ietf:params:scim:schemas:extension:gluu:2.0:User
schema to set any custom attributes to my user. And only difference with your example is I did not set any primary email. So I think that even we set status as active
we must set one primary email. If this is not reqiured why my user could not login after I created. As you see from my example I set user status as active but when my user try to login he/she could not login. For checking I enabled scim_event_handler
dynamic script and print all user info which I send to scim
endpoint. The result is scim set user gluuStatus
attribute as ACTIVE
but when I call user.getStatus()
it prinits None
. If you need I can share the print result.
Hello,
> If this is not reqiured why my user could not login after I created
No required.
Please check the documentation.
Thomas. I already read the documentation. I can create a new user with scim api. Problem is I could not login with my new user to the system.
Follow the step provide in the documentation and you should be able to create users and they will be able to login.
The documentation contains more than one example.
Change your json to look like this:
{
"schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],
"userName":"sakit.a@hotmail.com",
"active":true,
"givenName":"Sakit",
"sn":"Atakişiyev",
"middleName":"Ramiz",
"mail":"sakit.a@hotmail.com",
"uid":"sakit.a@hotmail.com",
"password":"1234567",
"displayName":"Sakit Ramiz Atakişiyev"
}
I did what you said and got the below error
Can not instantiate value of type [map type; class java.util.LinkedHashMap, [simple type, class java.lang.String] -> [simple type, class java.lang.Object]] from JSON String; no single-String constructor/factory method (through reference chain: org.gluu.oxtrust.model.scim2.user.UserResource["givenName"])
I registered a new attribute(for example car_number
etc) in this case to set this attribute how do I change my request input?