sjyangkevin commented on code in PR #77138:
URL: https://github.com/apache/airflow/pull/77138#discussion_r4623977515
##########
providers/fab/src/airflow/providers/fab/auth_manager/security_manager/override.py:
##########
@@ -614,6 +623,17 @@ def _hash_password(self, password: str) -> str:
method = current_app.config.get("FAB_PASSWORD_HASH_METHOD", "scrypt")
return generate_password_hash(password, method=method)
+ def set_user_password(self, user: User, password: str) -> None:
+ """
+ Set a new password and invalidate the tokens and sessions issued under
the old one.
+
+ Nothing is committed: the caller persists both changes together,
normally with
+ ``update_user``.
+ """
+ user.password = self._hash_password(password)
+ # Incremented in SQL so that concurrent password changes cannot write
the same value.
+ user.token_generation = self.user_model.token_generation + 1
Review Comment:
Thanks for pointing this out. `reset_password` and
`FABAuthManagerUsers.update_user` now remove the user from
`FabAuthManager.cache` once the change is committed. If I understand correctly,
a password reset through the CLI would still have the TTL window, because the
cache belongs to each process and the CLI doesn't share it with the API server.
--
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]