ChickenBenny commented on code in PR #76746:
URL: https://github.com/apache/airflow/pull/76746#discussion_r4595031627


##########
providers/fab/src/airflow/providers/fab/auth_manager/security_manager/override.py:
##########
@@ -2559,6 +2559,12 @@ def auth_user_remote_user(self, username) -> User | None:
                 email=username + "@email.notfound",
                 role=self.find_role(self.auth_user_registration_role),
             )
+            if user is None:
+                # a parallel first request for the same REMOTE_USER can win 
the insert

Review Comment:
   Yeah, good catch! I fixed it in this PR. LDAP is actually the worse one, 
since there's an LDAP bind and search between `find_user` and `add_user`.
   
   All three paths (LDAP, OAuth, REMOTE_USER) now share a small 
`_register_user_on_login` helper, so nobody has to remember the fallback next 
time. If `add_user` fails, it looks the user up again and uses that user if 
it's active. It also logs an INFO line when that happens, so the ERROR from 
`add_user` doesn't look like a failed login.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to