Commit aef44dd
committed
feat!: refactor swagger API authentication (0xfurai#210)
* feat: refactor swagger API authentication
- Updated security definitions in Swagger and Go files to replace BearerAuth with JwtAuth.
- Simplified API key and JWT authentication across various controllers and middleware.
- Removed unauthorized response handling from API documentation.
- Enhanced API key management documentation for clarity.
- Updated frontend SDK to reflect changes in API key and JWT authentication methods.
* refactor(auth_chain): update logging level for missing authentication headers
- Changed log level from Warn to Debug for missing authentication headers in AllAuth method to reduce log noise.
- Minor formatting adjustment in the code for improved readability.
* refactor(auth_chain): change logging levels for authentication routing
- Updated log level from Info to Debug for API key and JWT authentication routing to reduce log verbosity.
- Changed log level from Debug to Warn for missing authentication headers to highlight critical issues more effectively.
* fix(api_key): standardize error messages for invalid API keys
- Updated error messages in the ValidateKey method to use lowercase "invalid API key" for consistency.
* fix(api_key): update context usage in API key validation
- Changed the context parameter in the ValidateKey method call from the gin context to the request context for improved consistency and reliability in API key validation.
* feat(api_key): add comprehensive tests for API key service and middleware
- Introduced unit tests for the API key service, covering key creation, validation, expiration handling, and usage limits.
- Added middleware tests to ensure proper authentication flow and error handling for missing or invalid API keys.
- Implemented a mock service for testing middleware interactions, enhancing test coverage and reliability.
* feat(api_key): add integration tests for API key service functionality
- Introduced a new integration test suite for the API key service, covering key creation, validation, expiration handling, and usage limits.
- Implemented tests for middleware interactions with real HTTP requests to ensure proper authentication flow.
- Enhanced test coverage by validating key usage count updates and handling of expired keys.1 parent f9ed82c commit aef44dd
File tree
23 files changed
+1777
-399
lines changed- apps
- server
- docs
- src
- modules
- api_key
- auth
- maintenance
- middleware
- monitor
- notification_channel
- proxy
- setting
- status_page
- tag
- web/src/api
- @tanstack
23 files changed
+1777
-399
lines changedLarge diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1367 | 1367 | | |
1368 | 1368 | | |
1369 | 1369 | | |
1370 | | - | |
| 1370 | + | |
1371 | 1371 | | |
1372 | 1372 | | |
1373 | 1373 | | |
1374 | 1374 | | |
1375 | 1375 | | |
1376 | 1376 | | |
1377 | 1377 | | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
1381 | | - | |
1382 | 1378 | | |
1383 | 1379 | | |
1384 | 1380 | | |
1385 | 1381 | | |
1386 | 1382 | | |
1387 | | - | |
| 1383 | + | |
1388 | 1384 | | |
1389 | 1385 | | |
1390 | 1386 | | |
1391 | 1387 | | |
1392 | 1388 | | |
1393 | 1389 | | |
1394 | | - | |
| 1390 | + | |
1395 | 1391 | | |
1396 | 1392 | | |
1397 | 1393 | | |
| |||
1410 | 1406 | | |
1411 | 1407 | | |
1412 | 1408 | | |
1413 | | - | |
1414 | | - | |
1415 | | - | |
1416 | | - | |
1417 | 1409 | | |
1418 | 1410 | | |
1419 | 1411 | | |
1420 | 1412 | | |
1421 | 1413 | | |
1422 | | - | |
| 1414 | + | |
1423 | 1415 | | |
1424 | 1416 | | |
1425 | 1417 | | |
| |||
1435 | 1427 | | |
1436 | 1428 | | |
1437 | 1429 | | |
1438 | | - | |
1439 | | - | |
1440 | | - | |
1441 | | - | |
1442 | 1430 | | |
1443 | 1431 | | |
1444 | 1432 | | |
| |||
1448 | 1436 | | |
1449 | 1437 | | |
1450 | 1438 | | |
1451 | | - | |
| 1439 | + | |
1452 | 1440 | | |
1453 | 1441 | | |
1454 | 1442 | | |
| |||
1467 | 1455 | | |
1468 | 1456 | | |
1469 | 1457 | | |
1470 | | - | |
1471 | | - | |
1472 | | - | |
1473 | | - | |
1474 | 1458 | | |
1475 | 1459 | | |
1476 | 1460 | | |
| |||
1480 | 1464 | | |
1481 | 1465 | | |
1482 | 1466 | | |
1483 | | - | |
| 1467 | + | |
1484 | 1468 | | |
1485 | 1469 | | |
1486 | 1470 | | |
| |||
1511 | 1495 | | |
1512 | 1496 | | |
1513 | 1497 | | |
1514 | | - | |
1515 | | - | |
1516 | | - | |
1517 | | - | |
1518 | 1498 | | |
1519 | 1499 | | |
1520 | 1500 | | |
| |||
1524 | 1504 | | |
1525 | 1505 | | |
1526 | 1506 | | |
1527 | | - | |
| 1507 | + | |
1528 | 1508 | | |
1529 | 1509 | | |
1530 | 1510 | | |
| |||
1567 | 1547 | | |
1568 | 1548 | | |
1569 | 1549 | | |
| 1550 | + | |
| 1551 | + | |
1570 | 1552 | | |
1571 | 1553 | | |
1572 | 1554 | | |
| |||
1596 | 1578 | | |
1597 | 1579 | | |
1598 | 1580 | | |
| 1581 | + | |
| 1582 | + | |
1599 | 1583 | | |
1600 | 1584 | | |
1601 | 1585 | | |
| |||
1625 | 1609 | | |
1626 | 1610 | | |
1627 | 1611 | | |
| 1612 | + | |
| 1613 | + | |
1628 | 1614 | | |
1629 | 1615 | | |
1630 | 1616 | | |
| |||
1691 | 1677 | | |
1692 | 1678 | | |
1693 | 1679 | | |
| 1680 | + | |
| 1681 | + | |
1694 | 1682 | | |
1695 | 1683 | | |
1696 | 1684 | | |
| |||
2056 | 2044 | | |
2057 | 2045 | | |
2058 | 2046 | | |
2059 | | - | |
| 2047 | + | |
| 2048 | + | |
2060 | 2049 | | |
2061 | 2050 | | |
2062 | 2051 | | |
| |||
2086 | 2075 | | |
2087 | 2076 | | |
2088 | 2077 | | |
2089 | | - | |
| 2078 | + | |
| 2079 | + | |
2090 | 2080 | | |
2091 | 2081 | | |
2092 | 2082 | | |
| |||
2344 | 2334 | | |
2345 | 2335 | | |
2346 | 2336 | | |
2347 | | - | |
| 2337 | + | |
| 2338 | + | |
2348 | 2339 | | |
2349 | 2340 | | |
2350 | 2341 | | |
| |||
2374 | 2365 | | |
2375 | 2366 | | |
2376 | 2367 | | |
2377 | | - | |
| 2368 | + | |
| 2369 | + | |
2378 | 2370 | | |
2379 | 2371 | | |
2380 | 2372 | | |
| |||
2732 | 2724 | | |
2733 | 2725 | | |
2734 | 2726 | | |
2735 | | - | |
| 2727 | + | |
| 2728 | + | |
2736 | 2729 | | |
2737 | 2730 | | |
2738 | 2731 | | |
| |||
2773 | 2766 | | |
2774 | 2767 | | |
2775 | 2768 | | |
2776 | | - | |
| 2769 | + | |
| 2770 | + | |
2777 | 2771 | | |
2778 | 2772 | | |
2779 | 2773 | | |
| |||
2803 | 2797 | | |
2804 | 2798 | | |
2805 | 2799 | | |
2806 | | - | |
| 2800 | + | |
| 2801 | + | |
2807 | 2802 | | |
2808 | 2803 | | |
2809 | 2804 | | |
| |||
2975 | 2970 | | |
2976 | 2971 | | |
2977 | 2972 | | |
2978 | | - | |
| 2973 | + | |
| 2974 | + | |
2979 | 2975 | | |
2980 | 2976 | | |
2981 | 2977 | | |
| |||
3016 | 3012 | | |
3017 | 3013 | | |
3018 | 3014 | | |
3019 | | - | |
| 3015 | + | |
| 3016 | + | |
3020 | 3017 | | |
3021 | 3018 | | |
3022 | 3019 | | |
| |||
3046 | 3043 | | |
3047 | 3044 | | |
3048 | 3045 | | |
3049 | | - | |
| 3046 | + | |
| 3047 | + | |
3050 | 3048 | | |
3051 | 3049 | | |
3052 | 3050 | | |
| |||
3215 | 3213 | | |
3216 | 3214 | | |
3217 | 3215 | | |
3218 | | - | |
| 3216 | + | |
| 3217 | + | |
3219 | 3218 | | |
3220 | 3219 | | |
3221 | 3220 | | |
| |||
3242 | 3241 | | |
3243 | 3242 | | |
3244 | 3243 | | |
3245 | | - | |
| 3244 | + | |
| 3245 | + | |
3246 | 3246 | | |
3247 | 3247 | | |
3248 | 3248 | | |
| |||
3277 | 3277 | | |
3278 | 3278 | | |
3279 | 3279 | | |
3280 | | - | |
| 3280 | + | |
| 3281 | + | |
3281 | 3282 | | |
3282 | 3283 | | |
3283 | 3284 | | |
| |||
3314 | 3315 | | |
3315 | 3316 | | |
3316 | 3317 | | |
3317 | | - | |
| 3318 | + | |
| 3319 | + | |
3318 | 3320 | | |
3319 | 3321 | | |
3320 | 3322 | | |
| |||
3344 | 3346 | | |
3345 | 3347 | | |
3346 | 3348 | | |
3347 | | - | |
| 3349 | + | |
| 3350 | + | |
3348 | 3351 | | |
3349 | 3352 | | |
3350 | 3353 | | |
| |||
3372 | 3375 | | |
3373 | 3376 | | |
3374 | 3377 | | |
3375 | | - | |
| 3378 | + | |
| 3379 | + | |
3376 | 3380 | | |
3377 | 3381 | | |
3378 | 3382 | | |
| |||
3399 | 3403 | | |
3400 | 3404 | | |
3401 | 3405 | | |
3402 | | - | |
| 3406 | + | |
| 3407 | + | |
3403 | 3408 | | |
3404 | 3409 | | |
3405 | 3410 | | |
| |||
3438 | 3443 | | |
3439 | 3444 | | |
3440 | 3445 | | |
3441 | | - | |
| 3446 | + | |
| 3447 | + | |
3442 | 3448 | | |
3443 | 3449 | | |
3444 | 3450 | | |
| |||
3583 | 3589 | | |
3584 | 3590 | | |
3585 | 3591 | | |
3586 | | - | |
| 3592 | + | |
| 3593 | + | |
3587 | 3594 | | |
3588 | 3595 | | |
3589 | 3596 | | |
| |||
3613 | 3620 | | |
3614 | 3621 | | |
3615 | 3622 | | |
3616 | | - | |
| 3623 | + | |
| 3624 | + | |
3617 | 3625 | | |
3618 | 3626 | | |
3619 | 3627 | | |
| |||
3774 | 3782 | | |
3775 | 3783 | | |
3776 | 3784 | | |
3777 | | - | |
| 3785 | + | |
| 3786 | + | |
| 3787 | + | |
| 3788 | + | |
| 3789 | + | |
| 3790 | + | |
| 3791 | + | |
3778 | 3792 | | |
3779 | 3793 | | |
3780 | 3794 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
48 | 53 | | |
49 | 54 | | |
50 | 55 | | |
| |||
0 commit comments