diff --git a/docs/docs_src/getting_started/fastapi/my_fastagency_app/docker/Dockerfile b/docs/docs_src/getting_started/fastapi/my_fastagency_app/docker/Dockerfile index d2c2ef95..a2a3e74f 100644 --- a/docs/docs_src/getting_started/fastapi/my_fastagency_app/docker/Dockerfile +++ b/docs/docs_src/getting_started/fastapi/my_fastagency_app/docker/Dockerfile @@ -18,11 +18,18 @@ RUN pip install --upgrade pip && pip install --no-cache-dir -e "." RUN adduser --disabled-password --gecos '' appuser \ && chown -R appuser /app \ && chown -R appuser:appuser /etc/nginx/conf.d /var/log/nginx /var/lib/nginx \ - && touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid + && touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid \ + # Allow binding to ports > 1024 without root + && sed -i 's/listen 80/listen 9999/g' /etc/nginx/sites-available/default \ + && sed -i 's/listen \[::\]:80/listen \[::\]:9999/g' /etc/nginx/sites-available/default \ + # Create required directories with correct permissions + && mkdir -p /var/cache/nginx /var/run \ + && chown -R appuser:appuser /var/cache/nginx /var/run USER appuser -EXPOSE 8000 8008 8888 +# ToDo: Fix exposing ports +# EXPOSE 8000 8008 8888 CMD ["/app/run_fastagency.sh"] diff --git a/docs/docs_src/getting_started/fastapi/my_fastagency_app/docker/content/nginx.conf.template b/docs/docs_src/getting_started/fastapi/my_fastagency_app/docker/content/nginx.conf.template index 7279f13c..c55a5bc4 100644 --- a/docs/docs_src/getting_started/fastapi/my_fastagency_app/docker/content/nginx.conf.template +++ b/docs/docs_src/getting_started/fastapi/my_fastagency_app/docker/content/nginx.conf.template @@ -19,7 +19,6 @@ server { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect off; proxy_buffering off; diff --git a/docs/docs_src/getting_started/mesop/my_fastagency_app/docker/Dockerfile b/docs/docs_src/getting_started/mesop/my_fastagency_app/docker/Dockerfile index edce91fe..6c48bf49 100644 --- a/docs/docs_src/getting_started/mesop/my_fastagency_app/docker/Dockerfile +++ b/docs/docs_src/getting_started/mesop/my_fastagency_app/docker/Dockerfile @@ -18,11 +18,18 @@ RUN pip install --upgrade pip && pip install --no-cache-dir -e "." RUN adduser --disabled-password --gecos '' appuser \ && chown -R appuser /app \ && chown -R appuser:appuser /etc/nginx/conf.d /var/log/nginx /var/lib/nginx \ - && touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid + && touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid \ + # Allow binding to ports > 1024 without root + && sed -i 's/listen 80/listen 9999/g' /etc/nginx/sites-available/default \ + && sed -i 's/listen \[::\]:80/listen \[::\]:9999/g' /etc/nginx/sites-available/default \ + # Create required directories with correct permissions + && mkdir -p /var/cache/nginx /var/run \ + && chown -R appuser:appuser /var/cache/nginx /var/run USER appuser -EXPOSE 8000 8008 8888 +# ToDo: Fix exposing ports +# EXPOSE 8000 8008 8888 CMD ["/app/run_fastagency.sh"] diff --git a/docs/docs_src/getting_started/mesop/my_fastagency_app/docker/content/nginx.conf.template b/docs/docs_src/getting_started/mesop/my_fastagency_app/docker/content/nginx.conf.template index 7279f13c..c55a5bc4 100644 --- a/docs/docs_src/getting_started/mesop/my_fastagency_app/docker/content/nginx.conf.template +++ b/docs/docs_src/getting_started/mesop/my_fastagency_app/docker/content/nginx.conf.template @@ -19,7 +19,6 @@ server { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect off; proxy_buffering off; diff --git a/docs/docs_src/getting_started/nats_n_fastapi/my_fastagency_app/docker/Dockerfile b/docs/docs_src/getting_started/nats_n_fastapi/my_fastagency_app/docker/Dockerfile index 068e4c1e..f2fa97bc 100644 --- a/docs/docs_src/getting_started/nats_n_fastapi/my_fastagency_app/docker/Dockerfile +++ b/docs/docs_src/getting_started/nats_n_fastapi/my_fastagency_app/docker/Dockerfile @@ -18,11 +18,18 @@ RUN pip install --upgrade pip && pip install --no-cache-dir -e "." RUN adduser --disabled-password --gecos '' appuser \ && chown -R appuser /app \ && chown -R appuser:appuser /etc/nginx/conf.d /var/log/nginx /var/lib/nginx \ - && touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid + && touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid \ + # Allow binding to ports > 1024 without root + && sed -i 's/listen 80/listen 9999/g' /etc/nginx/sites-available/default \ + && sed -i 's/listen \[::\]:80/listen \[::\]:9999/g' /etc/nginx/sites-available/default \ + # Create required directories with correct permissions + && mkdir -p /var/cache/nginx /var/run \ + && chown -R appuser:appuser /var/cache/nginx /var/run USER appuser -EXPOSE 8000 8008 8888 +# ToDo: Fix exposing ports +# EXPOSE 8000 8008 8888 CMD ["/app/run_fastagency.sh"] diff --git a/docs/docs_src/getting_started/nats_n_fastapi/my_fastagency_app/docker/content/nginx.conf.template b/docs/docs_src/getting_started/nats_n_fastapi/my_fastagency_app/docker/content/nginx.conf.template index 7279f13c..c55a5bc4 100644 --- a/docs/docs_src/getting_started/nats_n_fastapi/my_fastagency_app/docker/content/nginx.conf.template +++ b/docs/docs_src/getting_started/nats_n_fastapi/my_fastagency_app/docker/content/nginx.conf.template @@ -19,7 +19,6 @@ server { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect off; proxy_buffering off; diff --git a/docs/docs_src/user_guide/ui/mesop/main_mesop_basic_auth.py b/docs/docs_src/user_guide/ui/mesop/main_mesop_basic_auth.py index 69211d92..9660557a 100644 --- a/docs/docs_src/user_guide/ui/mesop/main_mesop_basic_auth.py +++ b/docs/docs_src/user_guide/ui/mesop/main_mesop_basic_auth.py @@ -90,8 +90,8 @@ def simple_workflow( # TODO: Replace the allowed_users with the desired usernames and hashed passwords # The hashed passwords can be generated using online tools like https://bcrypt.online allowed_users={ - "harish@airt.ai": "$2y$10$4aH/.C.WritjZAYskA0Dq.htlFDJTa49UuxSVUlp9JCa2K3PgUkaG", - "davor@airt.ai": "$2y$10$Yz9GuF/bWmRFmnXFkauOwePT/U.VSUHdpMOX7GPB8GiklJE4HJZmG" + "harish@airt.ai": "$2y$10$4aH/.C.WritjZAYskA0Dq.htlFDJTa49UuxSVUlp9JCa2K3PgUkaG", # nosemgrep + "davor@airt.ai": "$2y$10$Yz9GuF/bWmRFmnXFkauOwePT/U.VSUHdpMOX7GPB8GiklJE4HJZmG" # nosemgrep } ) diff --git a/fastagency/ui/mesop/auth/basic_auth/basic_auth.py b/fastagency/ui/mesop/auth/basic_auth/basic_auth.py index bf536763..6bccb84a 100644 --- a/fastagency/ui/mesop/auth/basic_auth/basic_auth.py +++ b/fastagency/ui/mesop/auth/basic_auth/basic_auth.py @@ -40,10 +40,7 @@ def is_authorized(self, username: str, password: str) -> bool: return False password_hash = self.allowed_users[username] - if not self._verify_password(password, password_hash): - return False - - return True + return self._verify_password(password, password_hash) def on_auth_changed(self, e: mel.WebEvent) -> None: state = me.state(State) diff --git a/tests/docs_src/test_import.py b/tests/docs_src/test_import.py index e78c34e2..b20cb687 100644 --- a/tests/docs_src/test_import.py +++ b/tests/docs_src/test_import.py @@ -14,6 +14,7 @@ # Constants for module paths MESOP_AUTH_MODULES = { "docs_src.user_guide.ui.mesop.main_mesop_firebase_auth", + "docs_src.user_guide.ui.mesop.main_mesop_basic_auth", } MESOP_NON_AUTH_MODULES = {