Skip to content

Commit

Permalink
refact(authz): build authz middleware using FastAPI-specific fn
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Aug 27, 2024
1 parent 77a71d5 commit d8142f3
Showing 1 changed file with 1 addition and 9 deletions.
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))

0 comments on commit d8142f3

Please sign in to comment.