Skip to content

Remove duplicated properties from dynamic client registration responses#1369

Merged
brockallen merged 1 commit intomainfrom
joe/dcr-extension-cleanup
Jul 17, 2023
Merged

Remove duplicated properties from dynamic client registration responses#1369
brockallen merged 1 commit intomainfrom
joe/dcr-extension-cleanup

Conversation

@josephdecock
Copy link
Copy Markdown
Member

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.

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.
@brockallen brockallen merged commit d477a34 into main Jul 17, 2023
@brockallen brockallen deleted the joe/dcr-extension-cleanup branch July 17, 2023 16:10
@brockallen brockallen added this to the 7.0 milestone Jul 17, 2023
@brockallen brockallen added the bug label Jul 17, 2023
@josephdecock josephdecock mentioned this pull request Jul 30, 2023
@josephdecock josephdecock changed the title DCR - Remove duplicate values from the extensions Remove duplicated properties in dynamic client registration responses Jul 30, 2023
@josephdecock josephdecock changed the title Remove duplicated properties in dynamic client registration responses Remove duplicated properties from dynamic client registration responses Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants