Commit 5079f28
Change JWT encryption from HMAC to RSA with rotating keys (#37)
* Enhance Docker and JWT handling: update Dockerfile to install OpenSSL, modify jwt_helper to use RSA keys, and add entrypoint script for key generation
* Implement JWT key rotation: add endpoint to rotate keys, update key management in jwt_helper, and modify .gitignore for key files
* Refactor JWT key handling: remove hardcoded key loading, utilize dynamic key retrieval in token generation
* Add timestamp logging for key creation in JWT rotation
* Change route to be more RESTful
* Remove JWT_SECRET_KEY from config and add script for cleaning up expired JWT keys
* Refactor JWT tests to use public key for encoding/decoding and enhance sample token generation
* Remove redundant sample_person_id fixture from test_refresh.py
* Refactor key cleanup script to use dynamic expiry days from JWT configuration
* Refactor JWT handling by moving related functions and classes to a new jwtoken module, removing deprecated admin routes and cleanup scripts.
* Refactor JWT key handling by consolidating functions into common module and removing deprecated keys_id module
* Refactor JWT test suite by removing obsolete test files and consolidating test fixtures into a new structure
* Clarify entrypoint script comment to specify starting the API
* Optimize payload generation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add key management functionality and refactor key paths
- Introduced key rotation logic to ensure keys directory and active_kid.txt file exist.
- Updated key paths in the rotate_keys function to use constants from the new config file.
- Created a new config file for JWT key management constants.
- Refactored keys_cleanup.py to use the new CREATED_AT_FILE constant.
* Refactor Dockerfile to remove entrypoint script and directly run key rotation before starting the app; update keys_rotation.py for improved key management and error handling.
* Add OpenSSL installation steps for Linux, macOS, and Windows in Pytest CI workflow
* Fix variable name inconsistency for key directory in jwtoken and keys_rotation modules
* Refactor Dockerfile to use entrypoint script for key rotation and app startup; add entrypoint.sh for improved process management.
* Reorganize Dockerfile to copy entrypoint script before exposing Flask port; ensure proper permissions are set for execution.
* Remove entrypoint script copy command from Dockerfile; streamline application setup.
* Update ENTRYPOINT in Dockerfile to use entrypoint.sh for improved process management
* Update ENTRYPOINT in Dockerfile to use entrypoint.sh for improved process management
* Refactor app.py to use ACTIVE_KID_FILE constant for key existence check; improve code readability.
* Remove OpenSSL installation step for macOS in Pytest CI workflow; clarify that it's pre-installed.
* Refactor datetime usage in token generation and logging setup; improve consistency and readability.
* Remove entrypoint.sh and update ENTRYPOINT in Dockerfile to directly run app.py; streamline container startup process.
* Add curl to fix healthcheck and remove cached libraries to save up space
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 78d9142 commit 5079f28
File tree
30 files changed
+499
-181
lines changed- .devcontainer
- .github/workflows
- config
- jwtoken
- routes
- tests
- test_jwtoken
- test_jwt
- test_routes
- test_authentication
- utility/jwtoken
30 files changed
+499
-181
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
36 | 46 | | |
37 | 47 | | |
38 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
25 | | - | |
26 | | - | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
This file was deleted.
File renamed without changes.
0 commit comments