geopython / GeoHealthCheck

Service Status and QoS Checker for OGC Web Services
https://geohealthcheck.org
MIT License
84 stars 71 forks source link

g.user.is_authenticated() error in app.py REQUIRE_WEBAPP_AUTH enabled #334

Closed justb4 closed 3 years ago

justb4 commented 4 years ago

Describe the bug When web auth is required an error occurs when g.user.is_authenticated(). This comes from Flask-Login as the function is now an attribute g.user.is_authenticated

To Reproduce Steps to reproduce the behavior, e.g.:

  1. Configure GHC with GQ_REQUIRE_WEBAPP_AUTH: True
  2. Go to app
  3. Expect login prompt
  4. Seeing Internal Server Error

Expected Behavior Expect login prompt

Screenshots or Logfiles Log shows:

  File "/GeoHealthCheck/GeoHealthCheck/app.py", line 112, in before_request
    g.user.is_authenticated(),  # This is from Flask-Login
TypeError: 'bool' object is not callable

Context (please complete the following information):

If running with Docker:

Additional context This was already an error when moving from Py2 to Py3. E.g. in all Jinja2 templates we had to change g.user.is_authenticated() to g.user.is_authenticated as the function was changed to an attribute in Flask-Login. Was introduced in 0.3.0: https://github.com/maxcountryman/flask-login/blob/master/CHANGES#L30 See also: https://stackoverflow.com/questions/33062109/typeerror-bool-object-is-not-callable-g-user-is-authenticated

justb4 commented 3 years ago

Solved with PR #335.