Skip to content

Commit

Permalink
Feat: 회원가입 API로 접근할 때 Access Token 추출 방식 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
fnzksxl committed Aug 31, 2024
1 parent 9bc44b7 commit 4bd2938
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wtnt/core/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,17 @@ class AttachJWTFromCookieToHeaderMiddleware(MiddlewareMixin):
def __init__(self, get_response):
super().__init__(get_response)
self.NOT_API = ["github/login", "callback/github"]
self.REGISTER = "github/finish"

def process_request(self, request):
path = request.path_info
is_valid = any(api in path for api in self.NOT_API)
is_register = True if self.REGISTER in path else False

if not is_valid:
if request.META.get("HTTP_X_FROM", None) == "web":
if request.COOKIES.get("access"):
request.META["HTTP_AUTHORIZATION"] = f"Bearer {request.COOKIES.get('access', None)}"
if is_register:
if request.COOKIES.get("temp"):
request.META["HTTP_AUTHORIZATION"] = f"Bearer {request.COOKIES.get('temp', None)}"

0 comments on commit 4bd2938

Please sign in to comment.