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)