mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-08 18:59:47 +00:00
fix: 过期用户退出登录
This commit is contained in:
@@ -8,7 +8,7 @@ from django.core.cache import cache
|
||||
from django.utils.translation import ugettext as _
|
||||
from six import text_type
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.backends import ModelBackend
|
||||
from django.contrib.auth.backends import ModelBackend as DJModelBackend
|
||||
from rest_framework import HTTP_HEADER_ENCODING
|
||||
from rest_framework import authentication, exceptions
|
||||
from common.auth import signature
|
||||
@@ -25,6 +25,11 @@ def get_request_date_header(request):
|
||||
return date
|
||||
|
||||
|
||||
class ModelBackend(DJModelBackend):
|
||||
def user_can_authenticate(self, user):
|
||||
return user.is_valid
|
||||
|
||||
|
||||
class AccessKeyAuthentication(authentication.BaseAuthentication):
|
||||
"""App使用Access key进行签名认证, 目前签名算法比较简单,
|
||||
app注册或者手动建立后,会生成 access_key_id 和 access_key_secret,
|
||||
|
Reference in New Issue
Block a user