我在用
Central Authentication System (CAS)
用我的
Django
服务。用户由远程服务器进行身份验证,而不是
德扬戈
自我验证。我也变了
Authentication Backend
详情如下:
class CASBackend(BaseBackend):
def authenticate(self, request, username=None, password=None):
payload = get_cas_payload(request)
user, _ = User.objects.get_or_create(username=payload['username'])
def get_user(self, user_id):
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist:
return None
在admin中创建新对象时,我遇到以下错误:
django.db.utils.IntegrityError: null value in column "user_id" violates not-null constraint
这与日志条目有关。我错过了什么吗?