Activate user upon SAML sign in
What does this MR do and why?
This MR updates the find_user
method in EE::Gitlab::Auth::Saml::User
so that we can activate potentially blocked SAML users if the sign up user cap has not been reached yet.
This activation is already initially done in this worker following the creation a User
. However, as outlined by the related issue, this async process led to a race condition which created some confusion around the real state of the user, after SAML sign up (see analysis here)
Because of this confusion, there's value in doing this activation synchronously. In that regards, this MR mainly does two things:
- it extracts logic from the worker into
EE::User
. - it leverages that logic in the related EE SAML module.
If the new user is activated as part of this find_user
method in the SAML module, then the perform_async
of this worker is skipped.
Screenshots or screen recordings
video_capture-2021-11-09_16.17.03.mkv
How to set up and validate locally
- Setup
- Set up SAML locally.
- Make sure you use HTTPS locally.
- For authentication, use the
test-saml-idp
Docker image (instructions here)
- Go to the login page, you should see a button for authentication via SAML. Click on it.
- If you're using
test-saml-idp
as mentioned above, user isuser1
, password isuser1pass
. - Upon submission, you should be logged in right away.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #338980 (closed)