작업대기 시리얼라이저부터 해야함
This commit is contained in:
17
ansible/authentication.py
Normal file
17
ansible/authentication.py
Normal 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)
|
Reference in New Issue
Block a user