Commit Graph
25 Commits
Author SHA1 Message Date
Mark Paronyan b7e6c02647 refactor: ruff autofixes 2026-10-17 11:43:36 +03:00
Mark Paronyan fcfa968cc5 feat(api): return token lifetimes and document API keys as bearer tokens 2026-10-07 14:18:18 +03:00
Mark Paronyan b9cdac487c style: sort imports in compute, db and services modules 2026-10-02 12:43:26 +03:00
Mark Paronyan 9f36fb4500 fix(typing): resolve mypy errors in services.authentication 2026-09-28 21:48:40 +03:00
Mark Paronyan a0450b6bce refactor: ruff autofixes 2026-09-27 15:55:10 +03:00
YueGuobin c3145a9f65 mcp: don't run API keys through JWT validation
_resolve_token tried the JWT path before checking for the gns3_ prefix,
so every API-key connection logged a spurious "JWT rejected" ERROR from
get_token_data. Check the prefix first, and downgrade the JWT-rejected
log to WARNING — a rejected token is a client problem, not a server one.
2026-08-21 21:41:47 +08:00
YueGuobin 704b5d80c2 auth: split JWT validation errors by failure cause
get_token_data used to raise the same "Could not validate credentials"
for every JWT-level failure (bad signature, expired, malformed), which
made console WebSocket auth failures impossible to tell apart. Return a
distinct detail per cause and log the underlying exception plus the
unverified header alg value on rejection.
2026-08-21 21:41:47 +08:00
YueGuobin 0e8d0cb87b Add stateless JWT refresh token mechanism
- New config: Controller.jwt_refresh_token_expire_minutes (default 30 days)
- New endpoint: POST /v3/access/users/refresh (public, unauthenticated)
- Login/authenticate responses now include refresh_token
- AuthService: _create_token helper, create_refresh_token, get_token_data
  now parses type claim (token_use) for token classification
- Security: refresh tokens rejected on HTTP + WebSocket access paths;
  /refresh strictly requires type=='refresh'
- Logout works for free via existing token_version mechanism
- Tests: 9 new TestRefreshToken cases, all passing; 34 existing tests
  still pass (no regressions)
2026-06-23 22:39:11 +08:00
YueGuobin 8e9afbcf92 fix: Validate JWT token exp claim — was silently ignored after migration to joserfc
joserfc.jwt.decode() does not validate the exp claim by default,
so expired tokens were accepted indefinitely. Added explicit check
after decoding. See issue #2781.
2026-06-11 22:32:12 +08:00
UmmmAGoodName 4cf8b79692 Fix addressing issue #2005 including tests 2026-04-05 21:51:52 +02:00
grossmj efb84b3063 Add back ValidationError 2024-12-30 15:59:01 +07:00
grossmj 9d6cea665a Replace python-jose library by joserfc 2024-12-30 15:25:24 +07:00
grossmj 4b1068e02f Replace deprecated method datetime.utcnow() 2024-05-18 23:33:26 +07:00
grossmj fa41d9ba75 Use bcrypt directly instead of passlib 2024-03-07 18:17:17 +01:00
grossmj 38388f7ae5 Secure controller to compute communication using HTTP basic authentication 2021-11-18 18:37:10 +10:30
grossmj 9c850e0f2b Move schemas between compute and controller subpackages 2021-04-15 18:12:08 +09:30
grossmj c021e21309 Use black with -l 120 param. 2021-04-13 18:46:50 +09:30
grossmj f928738bd5 Use pyupgrade with --py36-plus param. 2021-04-13 18:37:58 +09:30
grossmj 1b5a5de4bc Generate new config for each test. Fixes tests. 2021-04-12 19:37:59 +09:30
grossmj 30ebae207f Use Pydantic to validate the server config file. 2021-04-12 17:02:23 +09:30
grossmj 170e83e589 Fix tests and update requirements 2021-04-05 17:43:35 +09:30
grossmj 58c1b01439 Add default JWT secret key and fix tests. 2020-12-18 16:51:54 +10:30
grossmj bde706d19a Generate JWT secret key if none is configured in the config file.
Change location of the database.
2020-12-16 18:24:21 +10:30
grossmj d47dcb0d6f User authentication with tests. 2020-12-07 16:52:36 +10:30
grossmj bf7cf862af Refactor tests and start work on database integration. 2020-12-02 18:39:08 +10:30