-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PUT requests are incorrectly returning 204 #35
Comments
Now fixed in v3.2.3, please verify |
User updates are now failing. Looks like an error is occurring when reading the email object returned. Type is set to "work" in the response object for getUser()- conversion is failing. Here is a sample error file (scrubbed for sensitivity): 2021-04-07T14:18:05.591 plugin-myplugin debug: name -> [object Object] |
Your request works fine using plugin-loki having id, userName and externalId replaced with "bjensen" Seems your plugin gives an exception when accessing Complex attributes like emails, phoneNumbers, addresses, entitlements,... (but not roles) are sent to plugin as "type converted objects" You will get something like below (emails.home exist on user but not included in the new PUT)
So, you might have to do something like:
After successfully modifyUser, SCIM gateway will call your plugin method getGroupMembers for retrieving all groups to be included in response. If you don't use groups or have not implemented any logic, this method should return an empty array e.g.: return [] |
The issue seems to be tied to whether emails is passed as an array object when there is only a single object. I was able to resolve the issue in my plugin by first validating whether the emails element isArray but this doesn't seem like it should be necessary. Should't it always be an array? |
For PUT SCIM Gateway will do following:
gives following emails array:
You should first verify that your getUser (no query attributes) returns the fully user object according to SCIM If emails are not according to SCIM, then this problem will also be included in the #3 modifyUser sent to plugin. Your code then have to deal with the format you previously used. |
Not sure if my prior post was clear and if we talked passed each other on this issue. For your #1 comment above, when getUser() is called, if my plug-in returned emails as an array then scimgateway.js throws an exception trying to do a toLowerCase(). I have not tried to personally track down exactly where or why this happens but this appears to be an issue with scimgateway.js. This does not happen on PATCH requests, only PUT requests. My plugin returns something like this which from what I read from your comments above should be correct since its per SCIM specification: On your comment #3, "gateway will always send emails as "type converted object" to plugin as long as type is use. I presume that is what caused my initial error which I've mitigated by checking if the emails element is an array first. However, how does the gateway send this to the plugin if there are multiple emails? I don't have to support this use case at this time and I have the issue mitigated so more of a curious request. Also, curious why you don't just pass through the array which at face value to me as a newbie seems more straightforward and expected. |
Multiple emails will be:
But you cannot have more than one work email Reason for objects instead of array is simplicity of checking attributes included. SCIM Gateway actually only cares about some few mandatory SCIM attributes Do your client and plugin use type or not? If getUser response includes type, but not the PUT, I have reproduced the following error: Merged object then includes emails having objects with and without type "type converted object" logic checks the first object in array for type. If type then all objects will be I assume you have a mix of type and none-type in the getUser response and the PUT request? |
I validated your presumption that we are seeing type come in as null from the client / IdP on the PUT command. I'm not sure why this is the case and we will be submitting a case for that item to be investigated. Honestly, would prefer if this type conversion wasn't occurring and would be nice if we were just able to provide the object to send back but understand that's not how this implementation was designed. |
Object sent back is not "type converted". Back must be according to SCIM or your client. v3.2.5 is almost ready and will soon be published. In this version a "blank type" will be converted to type="undefined" (plugin will newer get an array) You may also override this "type converted object" logic by a new configuration setting
Note, endpointMapper logic do not currently support excludeTypeConvert, but you are not using endpointMapper (see plugin-ldap and plugin-azure) Type converted or not, in your case you have a problem when user was created/modified with emails.work and then later on using a PUT having emails only (without type=work). You then have two different incoming SCIM attributes that should be mapped to the same endpoint attribute |
v3.2.5 have now been published
This new version should not give error message mention in this issue.
scim.skipTypeConvert = true
|
modifyUser does not work correctly for PUT requests. It always returns a 204. That is only a valid response for PATCH requests. Per spec, a PUT request must return a 200 with the entire resource within the response body".
"Unless otherwise specified, a successful PUT operation returns a 200
OK response code and the entire resource within the response body,
enabling the client to correlate the client's and the service
provider's views of the updated resource."
The text was updated successfully, but these errors were encountered: