Remove duplicated properties from dynamic client registration responses #1369
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some properties are not included in the request object, but are included in the response. Customizations might want to allow the request to specify those properties, and they can do so in the extensions dictionary. We want to echo back to the user any extension values that they set, but also avoid duplicating values between the elements of the Extensions dictionary and properties on the response model itself.
If a value is added to the extensions that also is a property of the response object, then both values will be serialized. This at best is redundant, and at worst results in conflicting values.
For example, if a customization used
Request.Extensions["client_secret"] to set the Response.ClientSecret, we don't want to copy Request.Extensions["client_secret"] to Response.Extensions["client_secret"], because that will result in two redundant "client_secret" properties in the serialized response. And if a customization hasn't used Request.Extensions["client_secret"] to set Response.ClientSecret, we still don't want to copy Request.Extensions["client_secret"] to
Response.Extensions["client_secret"], because that would result in two "client_secret" properties with inconsistent values in the serialized response.
Thus, after we copy the Extensions from the request to the response, we remove any values from the Extensions that also have specific properties on the response object. We don't need to try to remove values from the Extensions that have specific properties in the request object, because those values will get bound to the properties, not the Extensions.
Alternatively, we could just avoid copying anything from request.Extensions to response.Extensions.