Skip to content

Require authentication for SCIM requests #19009

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

Draft
wants to merge 2 commits into
base: feature/62107-add-scim-server-api
Choose a base branch
from

Conversation

NobodysNightmare
Copy link
Contributor

@NobodysNightmare NobodysNightmare commented May 23, 2025

Handling authentication through our regular warden strategies. Doing this required to make warden available to the Rails stack as well. This was not super straight-forward, because of load order issues:

  • Requiring a Rails middleware must be done before initialization finished
  • Our warden config was so far done after initialization
  • static_routes were defined in lib, which is automatically reloaded, but auto-reloading code is now allowed during initialization
    • lib_static which is autoloaded_once is fine during init

Ticket

https://community.openproject.org/work_packages/62592/activity

Notes

I'd like to avoid overwriting internal scimitar methods entirely. I opened an upstream issue in that regard, maybe this opens some ideas for API changes: pond/scimitar#158

Dependencies

@NobodysNightmare NobodysNightmare marked this pull request as draft May 23, 2025 15:00
@NobodysNightmare NobodysNightmare changed the title WIP: Require authentication for SCIM requests Require authentication for SCIM requests May 23, 2025
@NobodysNightmare NobodysNightmare force-pushed the feature/62107-add-scim-server-api branch from 76d2f38 to e88d87a Compare May 26, 2025 06:11
@NobodysNightmare NobodysNightmare force-pushed the scim-authentication branch 2 times, most recently from 260dd42 to 8836987 Compare May 26, 2025 08:11
This will be required to use warden for our SCIM endpoints as well,
which are implemented in rails controllers. Since Rails controllers do
not support mounting rack middlewares partially (the way that e.g. Grape does),
the mounting of warden needed to be moved.

This was not super straight-forward, because of load order issues:

* Requiring a Rails middleware must be done before initialization finished
* Our warden config was so far done _after_ initialization
* static_routes were defined in lib, which is automatically reloaded,
  but auto-reloading code is not allowed during initialization
    * lib_static which is autoloaded_once is fine during init,
      this is also where the rest of warden authentication is defined

Additionally warden was configured to not handle HTTP 401 responses generated
by the upstream app itself. Warden will only be responsible for its own authentication
failures and it's still possible to invoke the warden failure app by throwing the :warden
symbol, but the application keeps its capability of responding with custom 401 responses.
Handling authentication through our regular warden strategies.

Permissions-wise the only thing we can check for is whether the authenticated
user is an admin. Though this will require us to grant admin privileges to
all SCIM clients, which might be more than we want to do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant