Skip to content

Commit

Permalink
Feat/allow userinfo anoymos (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
RaoHai authored Nov 22, 2024
2 parents df8f859 + 6352688 commit c84b836
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion server/auth/cors_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ async def dispatch(self, request: Request, call_next: Callable[[Request], Awaita
def mutate_cors_headers(self, request: Request, response: Response):
requested_origin = request.headers.get('origin')
headers = response.headers

headers["Access-Control-Allow-Origin"] = requested_origin
return headers
5 changes: 3 additions & 2 deletions server/auth/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
]

ANONYMOUS_USER_ALLOW_LIST = [
"/api/auth/userinfo",
"/api/chat/qa",
"/api/chat/stream_qa",
]
Expand Down Expand Up @@ -52,8 +53,8 @@ async def oauth(self, request: Request):

async def dispatch(self, request: Request, call_next: Callable[[Request], Awaitable[Response]]) -> Response:
try:
if ENVRIMENT == "development":
return await call_next(request)
# if ENVRIMENT == "development":
# return await call_next(request)

# Auth 相关的直接放过
if request.url.path.startswith("/api/auth"):
Expand Down

0 comments on commit c84b836

Please sign in to comment.