Add siret attribute and mapper to Keycloak #577
Merged
+114
−7
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.
Purpose
Improve developer experience by making local dev resemble production conditions more closely.
Proposal
We can now find organization data as provided by ProConnect in
user_info
, specifically SIRET.Also in this PR:
Add
OIDC_ORGANIZATION_REGISTRATION_ID_FIELD
to local dev settingsOtherwise local development would be blind to registration ID fields (e.g. SIRET)… and these will become more important as we start dealing with a variety of organizations both private and public (such as French communes).
Expose organization registration ID field (e.g. SIRET) in /users/me endpoint
This is mostly to have a convenient way of testing the delivered feature, via an API-oriented E2E test. This isn't entirely satisfactory: as this is a very important feature, we should be able to unit test it. The E2E test depends on technical details such as the fact that we use Keycloak to simulate the ProConnect flow.
Add
jq
to Python dev dependencies, so we can perform "surgery" on JSON responsesThis is necessary for several backend tests that query the
/users
endpoint. These tests retrieve a JSON object and test for strict equality. But strict equality is much more stringent than what these tests intend to assert ! We only want to assert that queries for a given set of users will return all the users, and only those users, that the query designates. We are not interested in, for instance, the exact registration IDs of each of the users' organizations. (It is a matter for a more focused unit test to test, for instance, that the User serializer returns certain Organization fields.)Also, if we tested against the actual, exact registration IDs of organizations, then our tests would become dependent on the order in which they are run, which is unacceptable.