Skip to content

Commit

Permalink
Simplest possible readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nkiryanov committed Jun 11, 2024
1 parent 52fd08a commit 6ba33fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions src/a12n/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/app/conf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 6ba33fd

Please sign in to comment.