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

Refactor OIDC integration for DigiD/eHerkenning - init flow #4265

Merged
merged 9 commits into from
May 6, 2024

Conversation

sergei-maertens
Copy link
Member

@sergei-maertens sergei-maertens commented May 3, 2024

Closes #4246 partly

Changes

  • Refactored the OIDC authentication request flow
  • Updated tests & also cleaned them up a bit/made them easier to follow

Checklist

Check off the items that are completed or not relevant.

  • Impact on features

    • Checked copying a form
    • Checked import/export of a form
    • Config checks in the configuration overview admin page
    • Problem detection in the admin email digest is handled
  • Release management

    • I have labelled the PR as "needs-backport" accordingly
  • I have updated the translations assets (you do NOT need to provide translations)

    • Ran ./bin/makemessages.sh
    • Ran ./bin/compilemessages_js.sh
  • Commit hygiene

    • Commit messages refer to the relevant Github issue
    • Commit messages explain the "why" of change, not the how

@sergei-maertens sergei-maertens force-pushed the feature/4246-record-auth-context branch from f199e3a to f1cf127 Compare May 6, 2024 07:19
@sergei-maertens sergei-maertens changed the title Refactor OIDC integration for DigiD/eHerkenning Refactor OIDC integration for DigiD/eHerkenning - init flow May 6, 2024
Copy link

codecov bot commented May 6, 2024

Codecov Report

Attention: Patch coverage is 97.61905% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 96.13%. Comparing base (fefada5) to head (232c866).

Files Patch % Lines
src/digid_eherkenning_oidc_generics/views.py 95.74% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4265      +/-   ##
==========================================
- Coverage   96.13%   96.13%   -0.01%     
==========================================
  Files         733      731       -2     
  Lines       23538    23529       -9     
  Branches     2760     2762       +2     
==========================================
- Hits        22629    22620       -9     
+ Misses        642      641       -1     
- Partials      267      268       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sergei-maertens sergei-maertens requested a review from stevenbal May 6, 2024 09:34
@sergei-maertens sergei-maertens marked this pull request as ready for review May 6, 2024 09:34
@sergei-maertens sergei-maertens force-pushed the feature/4246-record-auth-context branch from 55792fa to ac49266 Compare May 6, 2024 11:58
Copy link
Contributor

@stevenbal stevenbal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just a few questions/remarks

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.
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
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.
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.
These separate modules serve no shared purpose anymore, instead we
can move the configuration directly into the model classes.
* Moved the eHerkenning tests to the proper module
* Restructured the auth flow tests similarly to the
  remaining tests
@sergei-maertens sergei-maertens force-pushed the feature/4246-record-auth-context branch from ac49266 to 232c866 Compare May 6, 2024 14:27
@sergei-maertens sergei-maertens requested a review from stevenbal May 6, 2024 14:27
@sergei-maertens sergei-maertens merged commit 1df1807 into master May 6, 2024
27 checks passed
@sergei-maertens sergei-maertens deleted the feature/4246-record-auth-context branch May 6, 2024 15:30
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.

Capture authentication context data
2 participants