Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refact(authz): build authz middleware using FastAPI-specific fn #21

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions bento_reference_service/authz.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import re
from bento_lib.auth.middleware.fastapi import FastApiAuthMiddleware
from .config import get_config
from .logger import get_logger
Expand All @@ -9,11 +8,4 @@

# Non-standard middleware setup so that we can import the instance and use it for dependencies too
config = get_config() # TODO: Find a way to DI this
authz_middleware = FastApiAuthMiddleware.build_from_pydantic_config(
config,
get_logger(config),
exempt_request_patterns=(
(r"GET", re.escape(config.service_docs_path)),
(r"GET", re.escape(config.service_openapi_path)),
),
)
authz_middleware = FastApiAuthMiddleware.build_from_fastapi_pydantic_config(config, get_logger(config))
Loading