작업대기 시리얼라이저부터 해야함
This commit is contained in:
0
ansible/__init__.py
Normal file
0
ansible/__init__.py
Normal file
3
ansible/admin.py
Normal file
3
ansible/admin.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
6
ansible/apps.py
Normal file
6
ansible/apps.py
Normal file
@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class AnsibleConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'ansible'
|
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)
|
0
ansible/migrations/__init__.py
Normal file
0
ansible/migrations/__init__.py
Normal file
3
ansible/models.py
Normal file
3
ansible/models.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
3
ansible/tests.py
Normal file
3
ansible/tests.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
3
ansible/views.py
Normal file
3
ansible/views.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
Reference in New Issue
Block a user