Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Fix _mergeClaims to prevent duplication of claims #754

Conversation

HenrikWM
Copy link
Contributor

@HenrikWM HenrikWM commented Feb 8, 2019

This PR fixes #703.

Added failing test with the repro-case from #703, and fixed the duplication of claims when given an array of custom claims from the IdP and expecting a single normalized claims-list as the result.

Ran tests and also performed browser-testing using the VanillaJS-sample projects.

Given you want to merge two lists, when they share one claim but the claim contains common and an extra claim, and another claim in the second claim-object, then you get a result with duplicate claims lists with duplicate claims
Merges the left object with the current right object, then adding to the final result claim.
@brockallen
Copy link
Member

Cool, thanks!

@brockallen brockallen added the bug label Feb 10, 2019
@brockallen brockallen merged commit 510d2c5 into IdentityModel:dev Feb 10, 2019
@brockallen
Copy link
Member

1.7.0-beta.1 has been published to npm, please test and see if it's working for you.

@HenrikWM
Copy link
Contributor Author

Tested custom claims in the VanillaJS-project with the changes in 1.7.0-beta.1 now. Works as expected.

@brockallen
Copy link
Member

FYI, in the upcoming release this PR's behavior will be reverted, but there will be a flag/option to re-enable it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

ResponseValidator _mergeClaims not work as expected
2 participants