Skip to content

Commit

Permalink
Merge pull request #50 from mdsol/fix/asgi-middleware-scope
Browse files Browse the repository at this point in the history
Fixe a use-case when scope path is not set yet
  • Loading branch information
ykitamura-mdsol authored Feb 8, 2024
2 parents 0f3a90a + 2881f42 commit d126996
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.6.4
- Fix `MAuthASGIMiddleware` when accessing `path` when `path` is not set yet.
This appears to only happen on startup.
- Replace the character `\n` on one-liner private keys.

# 1.6.3
- Revert change introduced in v1.6.2 now that Starlette has been updated to
always include `root_path` in `path`.
Expand Down
2 changes: 1 addition & 1 deletion mauth_client/lambda_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def _get_private_key():
except ModuleNotFoundError:
pass

return private_key.replace(" ", "\n").replace("\nRSA\nPRIVATE\nKEY", " RSA PRIVATE KEY")
return private_key.replace("\\n", "\n").replace(" ", "\n").replace("\nRSA\nPRIVATE\nKEY", " RSA PRIVATE KEY")
6 changes: 4 additions & 2 deletions mauth_client/middlewares/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ def __init__(self, app: ASGI3Application, exempt: Optional[set] = None) -> None:
async def __call__(
self, scope: Scope, receive: ASGIReceiveCallable, send: ASGISendCallable
) -> None:
path = scope["path"]
if scope["type"] != "http":
return await self.app(scope, receive, send)

if scope["type"] != "http" or path in self.exempt:
path = scope["path"]
if path in self.exempt:
return await self.app(scope, receive, send)

query_string = scope["query_string"]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mauth-client"
version = "1.6.3"
version = "1.6.4"
description = "MAuth Client for Python"
repository = "https://github.com/mdsol/mauth-client-python"
authors = ["Medidata Solutions <support@mdsol.com>"]
Expand Down

0 comments on commit d126996

Please sign in to comment.