-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #515 from zAlweNy26/user_id_header
Added `user_id` in header
- Loading branch information
Showing
5 changed files
with
35 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
from fastapi.staticfiles import StaticFiles | ||
from fastapi import Request | ||
from cat.api_auth import check_api_key | ||
|
||
class AuthStatic(StaticFiles): | ||
def __init__(self, *args, **kwargs) -> None: | ||
super().__init__(*args, **kwargs) | ||
|
||
async def __call__(self, scope, receive, send) -> None: | ||
reqeust = Request(scope, receive=receive) | ||
check_api_key(reqeust.headers.get("access_token")) | ||
from fastapi.staticfiles import StaticFiles | ||
from fastapi import Request | ||
from cat.headers import check_api_key | ||
|
||
class AuthStatic(StaticFiles): | ||
def __init__(self, *args, **kwargs) -> None: | ||
super().__init__(*args, **kwargs) | ||
|
||
async def __call__(self, scope, receive, send) -> None: | ||
request = Request(scope, receive=receive) | ||
check_api_key(request.headers.get("access_token")) | ||
await super().__call__(scope, receive, send) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters