Harmonize user session creation #50194
Labels
0. Needs triage
Pending check for reproducibility or if it fits our roadmap
feature: authentication
♻️ refactor
Refactor code (not a bug fix, not a feature just refactoring)
Context
While implementing Oidc support in global scale, we checked how Saml was supported. The GSS master node actually listens to
OCP\User\Events\BeforeUserLoggedInEvent
. This event is emitted when authenticating via user_saml because the user session is created by user_saml's IApacheBackend user backend. This can be considered as a trick as a user backend should implement IApacheBackend only to deal with authentication during API requests using headers or session variables to get credentials.The user_oidc app has a different approach to create the user session on login, it manipulates the user session:
This actually does not dispatch
OCP\User\Events\BeforeUserLoggedInEvent
so we had to manually dispatch it.Suggestion
It would be nice to find a way to make sure all the apps implementing a user backend emit the correct events and complete the login process correctly. Event dispatching could be moved somewhere in the
IUserSession
implementation for example.The goal would be to prevent breaking apps that took OC_User::loginWithApache as inspiration to implement their login logic when there is a change in the server.
cc @juliusknorr
The text was updated successfully, but these errors were encountered: