작업대기 시리얼라이저부터 해야함

This commit is contained in:
2025-05-20 08:29:52 +09:00
parent b625e222f4
commit b172945fc5
15 changed files with 381 additions and 0 deletions

17
ansible/authentication.py Normal file
View File

@ -0,0 +1,17 @@
from rest_framework_simplejwt.authentication import JWTAuthentication
from rest_framework_simplejwt.exceptions import InvalidToken
class StatelessUser:
def __init__(self, email):
self.email = email
self.is_authenticated = True
def __str__(self):
return self.email
class StatelessJWTAuthentication(JWTAuthentication):
def get_user(self, validated_token):
email = validated_token.get("email") # msa-django-auth에서 넣어준 필드
if not email:
raise InvalidToken("Token에 'email' 항목이 없습니다.")
return StatelessUser(email=email)