### Body

When user is logged in with a valid session and deactivated, refreshing the browser/reusing the session leads to an infinite redirection loop (which is stopped quickly by browser detecting the situation).

## Steps to Produce:

Make sure you are using two different browsers.
In Browser A:

Login as the normal user.

In Browser B:
1. Login as admin.
2. Go to Security > List Users
3. Disable a user by unchecking this box:
![image](https://github.com/apache/airflow/assets/595491/0c1af0c2-2203-466f-8329-cf03aa138695)

4. Now in browser A, refresh the page.
You'll see a message like this:
![image](https://github.com/apache/airflow/assets/595491/5d9292c7-1364-46c0-8d26-5426a095112e)
In the server logs, you'll see that a lot of requests have been made to the server.
![image](https://github.com/apache/airflow/assets/595491/0599869a-a2bd-48a4-9f68-5789f24bfa16)

# Expected behaviour

There should be no infinite redirection, but the request for the inactive user should be rejected and the user should be redirected to the login page.


### Committer

- [X] I acknowledge that I am a maintainer/committer of the Apache Airflow project.
response.headers["X-Frame-Options"] = "DENY"
        return response
    app.after_request(apply_caching)
def init_api_experimental_auth(app):
    """Load authentication backends."""
    auth_backends = "airflow.api.auth.backend.default"
    try:
        auth_backends = conf.get("api", "auth_backends")
    except AirflowConfigException:
        pass
    app.api_auth = []
    try:
        for backend in auth_backends.split(","):
            auth = import_module(backend.strip())
            auth.init_app(app)
            app.api_auth.append(auth)
    except ImportError as err:
        log.critical("Cannot import %s for API authentication due to: %s", backend, err)
        raise AirflowException(err)
def init_check_user_active(app):
    @app.before_request
    def check_user_active():
        if get_auth_manager().is_logged_in() and not g.user.is_active:
            return redirect(get_auth_manager().get_url_logout())