will lead to the error. In the logs, the following exception is raised :
12:22:08.910 [reactor-tcp-nio-2] [] ERROR i.g.a.g.h.s.s.impl.UserServiceImpl - An error occurs while trying to create a userio.r2dbc.postgresql.ExceptionFactory$PostgresqlDataIntegrityViolationException: duplicate key value violates unique constraint "nps_users_pkey" at io.r2dbc.postgresql.ExceptionFactory.createException(ExceptionFactory.java:92) at io.r2dbc.postgresql.ExceptionFactory.handleErrorResponse(ExceptionFactory.java:111) at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:176) at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onNext(FluxFilterFuseable.java:337) at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107) at reactor.core.publisher.FluxPeekFuseable$PeekConditionalSubscriber.onNext(FluxPeekFuseable.java:854) ...
Expected behaviour :
do an additional check on the externalId existance in addition of the username to provide a valid status.
Describe the bug :
When creating a user with /scim endpoint and pass duplicate externalId, the following error is raised
{ "status" : "500", "detail" : "An error occurs while trying to create a user", "schemas" : ["urn:ietf:params:scim:api:messages:2.0:Error"] }
To Reproduce :
Steps to reproduce the behaviour: Run the following command :
curl --location --request POST 'https://[fqdn]/auth/nps-dev/scim/Users' --header 'Authorization: Bearer ' --header 'Content-Type: application/json;charset=UTF-8' --data-raw '{ "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User", "urn:ietf:params:scim:schemas:extension:custom:2.0:User"], "externalId": "[duplicate-external-id]", "userName": "[username]", "password": "[password]", "emails": [
{ "primary": true, "value": "[email]" }
], "urn:ietf:params:scim:schemas:extension:custom:2.0:User": { "channel": "digital", "mobile_number": "[mobile]" }}'
will lead to the error. In the logs, the following exception is raised :
12:22:08.910 [reactor-tcp-nio-2] [] ERROR i.g.a.g.h.s.s.impl.UserServiceImpl - An error occurs while trying to create a userio.r2dbc.postgresql.ExceptionFactory$PostgresqlDataIntegrityViolationException: duplicate key value violates unique constraint "nps_users_pkey" at io.r2dbc.postgresql.ExceptionFactory.createException(ExceptionFactory.java:92) at io.r2dbc.postgresql.ExceptionFactory.handleErrorResponse(ExceptionFactory.java:111) at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:176) at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onNext(FluxFilterFuseable.java:337) at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107) at reactor.core.publisher.FluxPeekFuseable$PeekConditionalSubscriber.onNext(FluxPeekFuseable.java:854) ...
Expected behaviour :
do an additional check on the externalId existance in addition of the username to provide a valid status.
Desktop :