Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion providers/fab/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ PIP package Version required
``apache-airflow-providers-common-compat`` ``>=1.12.0``
``blinker`` ``>=1.6.2``
``flask`` ``>=2.2.1``
``flask-appbuilder`` ``==5.2.0``
``flask-appbuilder`` ``==5.2.1``
``pyjwt`` ``>=2.11.0``
``flask-login`` ``>=0.6.2; python_version < "3.14"``
``flask-login`` ``>=0.6.3; python_version >= "3.14"``
Expand Down
2 changes: 1 addition & 1 deletion providers/fab/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ dependencies = [
# Every time we update FAB version here, please make sure that you review the classes and models in
# `airflow/providers/fab/auth_manager/security_manager/override.py` with their upstream counterparts.
# In particular, make sure any breaking changes, for example any new methods, are accounted for.
"flask-appbuilder==5.2.0", # Whenever updating the version, run test_fab_alignment.py to verify.
"flask-appbuilder==5.2.1", # Whenever updating the version, run test_fab_alignment.py to verify.
# Transitive via flask-appbuilder -> flask-jwt-extended; pinned here so the FAB
# provider keeps installing cleanly when paired with older airflow-core releases
# (the compat-3.0.6 matrix job) whose own pyjwt floor predates `jwt.types.Options`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,36 @@ def del_register_user(self, register_user) -> bool:
def get_all_users(self) -> list[User]:
return self.session.scalars(select(self.user_model)).all()

def on_user_login(self, user) -> None:
"""
Run after a successful user login.

Override to add custom logic (e.g. audit logging). Mirrors
``BaseSecurityManager.on_user_login`` from FAB 5.2.1+.

:param user: The authenticated user model.
"""

def on_user_login_failed(self, user) -> None:
"""
Run after a failed user login attempt.

Override to add custom logic (e.g. audit logging). Mirrors
``BaseSecurityManager.on_user_login_failed`` from FAB 5.2.1+.

:param user: The identified (but not authenticated) user model.
"""

def on_user_logout(self, user) -> None:
"""
Run when a user logs out.

Override to add custom logic (e.g. audit logging). Mirrors
``BaseSecurityManager.on_user_logout`` from FAB 5.2.1+.

:param user: The user model that is logging out.
"""

def update_user_auth_stat(self, user, success=True) -> None:
"""
Update user authentication stats.
Expand All @@ -1569,6 +1599,13 @@ def update_user_auth_stat(self, user, success=True) -> None:
else:
user.fail_login_count += 1
self.update_user(user)
# Fire the auth event hooks added in FAB 5.2.1 (PR #2450) so subclasses
# can plug in audit logging / custom side effects without having to
# override update_user_auth_stat itself.
if success:
self.on_user_login(user)
else:
self.on_user_login_failed(user)

"""
-------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride

# The FAB version that override.py was last aligned with.
EXPECTED_FAB_VERSION = "5.2.0"
EXPECTED_FAB_VERSION = "5.2.1"

# FAB public methods that override.py intentionally does NOT implement.
# Every entry must have a comment explaining why it's excluded.
Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading