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

Capture authentication context data #4246

Closed
10 tasks done
sergei-maertens opened this issue Apr 30, 2024 · 0 comments · Fixed by #4265, #4272, #4339, #4421 or #4441
Closed
10 tasks done

Capture authentication context data #4246

sergei-maertens opened this issue Apr 30, 2024 · 0 comments · Fixed by #4265, #4272, #4339, #4421 or #4441

Comments

@sergei-maertens
Copy link
Member

sergei-maertens commented Apr 30, 2024

Part of #3623

Currently the "machtigen" context data is stored as a simple JSON field, which doesn't capture everything that should be captured, and the shape is also not well documented. For this, some changes are needed:

  • Patch our OIDC library so that we can map properties with . characters too
  • Release new version of mozilla-django-oidc-db
  • Investigate removing the "django-solo" nature of the OIDC config model(s) (and do more with JSONField for config)
  • Establish structure of authentication context in models (authentication.AuthInfo)
    • Record/translate means (digid/eherkenning/...)
    • Record LOA
    • Record authorizee
    • Record representee
    • Record mandate context (service(s), role...)
  • Implement AuthInfo.to_auth_context_data() method and validate that against the JSON schema's (for robustness)
  • Extract necessary claims/context data in authentication plugins and save the data
  • Add context var to Objects API registration v1
  • Add registration var to Objects API registration v2
  • Update static variables to read from the appropriate place(s)
  • Update prefill to read from the appropriate place(s)
@sergei-maertens sergei-maertens added this to the Release 2.7.0 milestone Apr 30, 2024
@sergei-maertens sergei-maertens self-assigned this Apr 30, 2024
@sergei-maertens sergei-maertens moved this to In Progress in Development Apr 30, 2024
sergei-maertens added a commit that referenced this issue May 3, 2024
Simplified the entire authentication request flow where the user
gets redirect to the relevant identity provider.

There is now a single 'view' implementation that takes a config
class/model to use which can be used to directly obtain the
redirect target instead of having to go through multiple
redirects on our own URLs.

The view takes care of input sanitation and managing the
authentication state.

This substantially cleans up the inheritance/mixin chains for
the OIDC flows and makes the code easier to follow.
sergei-maertens added a commit that referenced this issue May 3, 2024
The plugin is now able to figure out the final redirect target to the
identity provider in one pass rather than having to perform multiple
redirects.

This also removes the ability of users to tamper with URLs in the
sergei-maertens added a commit that referenced this issue May 3, 2024
The tests were testing the implementation details way too much,
so they've been updated by removing the fluff and asserting
the functional aspects instead.
sergei-maertens added a commit that referenced this issue May 3, 2024
This is a temporary fix, the next steps will refactor the callback
view so there's a single URL/entrypoint and that view will load
the config to use from the session. But for now, the test suite
must pass while we refactor the init phase.
sergei-maertens added a commit that referenced this issue May 6, 2024
The plugin is now able to figure out the final redirect target to the
identity provider in one pass rather than having to perform multiple
redirects.

This also removes the ability of users to tamper with URLs in the
sergei-maertens added a commit that referenced this issue May 6, 2024
The tests were testing the implementation details way too much,
so they've been updated by removing the fluff and asserting
the functional aspects instead.
sergei-maertens added a commit that referenced this issue May 6, 2024
This is a temporary fix, the next steps will refactor the callback
view so there's a single URL/entrypoint and that view will load
the config to use from the session. But for now, the test suite
must pass while we refactor the init phase.
sergei-maertens added a commit that referenced this issue May 6, 2024
These separate modules serve no shared purpose anymore, instead we
can move the configuration directly into the model classes.
sergei-maertens added a commit that referenced this issue May 6, 2024
* Moved the eHerkenning tests to the proper module
* Restructured the auth flow tests similarly to the
  remaining tests
sergei-maertens added a commit that referenced this issue May 6, 2024
The refactor changed some locations where translation strings are
defined.
sergei-maertens added a commit that referenced this issue May 6, 2024
The DigiD/eHerkenning OIDC callback view(s) should not set any
token refresh parameters, since there is no middleware hooked
up to perform this refresh anyway. In its current form, it is
even conflicting with the admin OIDC refresh settings.
sergei-maertens added a commit that referenced this issue May 6, 2024
Simplified the entire authentication request flow where the user
gets redirect to the relevant identity provider.

There is now a single 'view' implementation that takes a config
class/model to use which can be used to directly obtain the
redirect target instead of having to go through multiple
redirects on our own URLs.

The view takes care of input sanitation and managing the
authentication state.

This substantially cleans up the inheritance/mixin chains for
the OIDC flows and makes the code easier to follow.
sergei-maertens added a commit that referenced this issue May 6, 2024
The plugin is now able to figure out the final redirect target to the
identity provider in one pass rather than having to perform multiple
redirects.

This also removes the ability of users to tamper with URLs in the
sergei-maertens added a commit that referenced this issue Jul 2, 2024
Updating the values of the choices means we need to update the values
of existing form definitions and variables, otherwise the code will
get non-matching equality comparisons.
sergei-maertens added a commit that referenced this issue Jul 2, 2024
authorised_person is a confusing value when the authorizee is actually
a company identified by KVK or RSIN, so we rename the value to
authorizee instead.
sergei-maertens added a commit that referenced this issue Jul 2, 2024
The TODO was handled in previous commits and can be removed.
@sergei-maertens sergei-maertens moved this from In Progress to Implemented in Development Jul 2, 2024
sergei-maertens added a commit that referenced this issue Jul 2, 2024
The value will need to be updated too, but that will involve some
migrations and import shims to update the prefill configuration.
sergei-maertens added a commit that referenced this issue Jul 2, 2024
…ext data

The legacy machtigen data-structure is deprecated, instead, we check
more strictly for a BSN in a mandate context set by authentication.
sergei-maertens added a commit that referenced this issue Jul 2, 2024
Updating the values of the choices means we need to update the values
of existing form definitions and variables, otherwise the code will
get non-matching equality comparisons.
sergei-maertens added a commit that referenced this issue Jul 2, 2024
authorised_person is a confusing value when the authorizee is actually
a company identified by KVK or RSIN, so we rename the value to
authorizee instead.
sergei-maertens added a commit that referenced this issue Jul 2, 2024
The TODO was handled in previous commits and can be removed.
sergei-maertens added a commit that referenced this issue Jul 2, 2024
The value will need to be updated too, but that will involve some
migrations and import shims to update the prefill configuration.
sergei-maertens added a commit that referenced this issue Jul 2, 2024
…ext data

The legacy machtigen data-structure is deprecated, instead, we check
more strictly for a BSN in a mandate context set by authentication.
sergei-maertens added a commit that referenced this issue Jul 2, 2024
Updating the values of the choices means we need to update the values
of existing form definitions and variables, otherwise the code will
get non-matching equality comparisons.
sergei-maertens added a commit that referenced this issue Jul 2, 2024
authorised_person is a confusing value when the authorizee is actually
a company identified by KVK or RSIN, so we rename the value to
authorizee instead.
sergei-maertens added a commit that referenced this issue Jul 2, 2024
The TODO was handled in previous commits and can be removed.
@github-project-automation github-project-automation bot moved this from Implemented to Done in Development Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment