From 6ba33fd99abc0cf6b5a3ad1a83de19cfa17b6470 Mon Sep 17 00:00:00 2001 From: Nikolay Kiryanov Date: Wed, 12 Jun 2024 02:25:26 +0300 Subject: [PATCH] Simplest possible readme --- README.md | 8 ++++++++ src/a12n/fixtures.py | 1 + src/app/conf/settings.py | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..330f97b --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +### websockets-notifications demo + +#### How to set JWK public key to validate jwt tokens +One of the options: +1. By setting the key as an environment variable named `JWT_PUBLIC_KEY`. +2. By placing the key in a file named `jwt_public_key.pem` inside the `secrets` folder in repo root. + +If both options are set, the application will not start. diff --git a/src/a12n/fixtures.py b/src/a12n/fixtures.py index a143689..d7b9370 100644 --- a/src/a12n/fixtures.py +++ b/src/a12n/fixtures.py @@ -7,6 +7,7 @@ @pytest.fixture def jwt_private_key(): + """For test purposes only. The running application should not access the private key.""" return """-----BEGIN PRIVATE KEY----- MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQCp2c5sLjs1QCo4 4K87M6DiLQrFlpN7abut9B71r6tZu2QnZM25qQ3t5GyG+/ZRUY/i5IoQp7fnq/gb diff --git a/src/app/conf/settings.py b/src/app/conf/settings.py index ae19d35..b5c1409 100644 --- a/src/app/conf/settings.py +++ b/src/app/conf/settings.py @@ -14,7 +14,7 @@ class Settings(BaseSettings): WEBSOCKETS_PORT: int WEBSOCKETS_PATH: str - JWT_PUBLIC_KEY: str = Field(validation_alias=AliasChoices("jwt_public_key", "JWT_PUBLIC_KEY")) + JWT_PUBLIC_KEY: str = Field(validation_alias=AliasChoices("jwt_public_key.pem", "JWT_PUBLIC_KEY")) DEBUG: bool = False LOG_LEVEL: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "WARNING"