Skip to content
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

Remove duplicated properties from dynamic client registration responses #1369

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

josephdecock
Copy link
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 Something isn't working 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
bug Something isn't working release notes done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants