fix(auth): Fix admin user authentication for /users/db-health endpoin… #422

Merged
suraimu-team merged 1 commits from fix/admin-cookie-jwt into dev-1.8.0 2025-10-20 18:01:58 +00:00
suraimu-team commented 2025-10-20 08:44:35 +00:00 (Migrated from github.com)

…t by adding cookie JWT support

Fixed authentication issue for admin users accessing the /users/db-health endpoint:

  • Added JWT token extraction from cookies (req.cookies?.jwt)
  • Added support for Bearer token from Authorization header
  • Improved error handling for missing and invalid tokens
  • Ensured consistent authentication flow for admin users

Changes made:

  • Check for JWT token in req.cookies?.jwt
  • Support Bearer token from Authorization header
  • Return 401 error when token is missing
  • Return 401 error when token validation fails

Fixes: https://github.com/Termix-SSH/Support/issues/12

Overview

Short summary of what this PR does

  • Added: ...
  • Updated: ...
  • Removed: ...
  • Fixed: ...

Changes Made

Detailed explanation of changes (if needed)

  • ...

Related Issues

Link any issues this PR addresses

  • Closes #ISSUE_NUMBER
  • Related to #ISSUE_NUMBER

Screenshots / Demos

(Optional: add before/after screenshots, GIFs, or console output)

Checklist

  • Code follows project style guidelines
  • Supports mobile and desktop UI/app (if applicable)
  • I have read Contributing.md
…t by adding cookie JWT support Fixed authentication issue for admin users accessing the /users/db-health endpoint: - Added JWT token extraction from cookies (req.cookies?.jwt) - Added support for Bearer token from Authorization header - Improved error handling for missing and invalid tokens - Ensured consistent authentication flow for admin users Changes made: - Check for JWT token in req.cookies?.jwt - Support Bearer token from Authorization header - Return 401 error when token is missing - Return 401 error when token validation fails Fixes: https://github.com/Termix-SSH/Support/issues/12 # Overview _Short summary of what this PR does_ - [ ] Added: ... - [ ] Updated: ... - [ ] Removed: ... - [ ] Fixed: ... # Changes Made _Detailed explanation of changes (if needed)_ - ... # Related Issues _Link any issues this PR addresses_ - Closes #ISSUE_NUMBER - Related to #ISSUE_NUMBER # Screenshots / Demos _(Optional: add before/after screenshots, GIFs, or console output)_ # Checklist - [ ] Code follows project style guidelines - [ ] Supports mobile and desktop UI/app (if applicable) - [ ] I have read [Contributing.md](https://github.com/Termix-SSH/Termix/blob/main/CONTRIBUTING.md)
LukeGus commented 2025-10-20 17:18:37 +00:00 (Migrated from github.com)

Thanks. I'll review it and merge it into v1.8.0 launching in about a week or two.

Thanks. I'll review it and merge it into v1.8.0 launching in about a week or two.
Sign in to join this conversation.