imulab / go-scim

Building blocks for servers implementing Simple Cloud Identity Management v2
MIT License
145 stars 56 forks source link

400 returned instead of 409 on non-unique userName #65

Closed plamenGo closed 4 years ago

plamenGo commented 4 years ago

When a non-unique userName is used in a POST to /Users, the code returns 400, but should return 409 as per the RFC: https://tools.ietf.org/html/rfc7644

If the service provider determines that the creation of the requested resource conflicts with existing resources (e.g., a "User" resource with a duplicate "userName"), the service provider MUST return HTTP status code 409 (Conflict) with a "scimType" error code of "uniqueness", as per Section 3.12.

go-scim returns this error message with the 400: {"level":"error","error":"invalidValue: value of 'userName' is not unique","time":"2020-05-01T13:37:36-04:00","message":"error when creating resource"}

plamenGo commented 4 years ago

PR: https://github.com/imulab/go-scim/pull/66

imulab commented 4 years ago

fixed and closed.