mirror of https://github.com/jumpserver/jumpserver
fix(authentication): 修复同时开启radius, openid引起的问题
parent
e461fbdf50
commit
8913aacd1e
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model, authenticate
|
||||||
from radiusauth.backends import RADIUSBackend, RADIUSRealmBackend
|
from radiusauth.backends import RADIUSBackend, RADIUSRealmBackend
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
@ -38,16 +38,12 @@ class CreateUserMixin:
|
||||||
return [], False, False
|
return [], False, False
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def authenticate(self, *args, **kwargs):
|
|
||||||
# 校验用户时,会传入public_key参数,父类authentication中不接受public_key参数,所以要pop掉
|
|
||||||
# TODO:需要优化各backend的authenticate方法,django进行调用前会检测各authenticate的参数
|
|
||||||
kwargs.pop('public_key', None)
|
|
||||||
return super().authenticate(*args, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class RadiusBackend(CreateUserMixin, RADIUSBackend):
|
class RadiusBackend(CreateUserMixin, RADIUSBackend):
|
||||||
pass
|
def authenticate(self, request, username=None, password=None, **kwargs):
|
||||||
|
return super().authenticate(request, username=username, password=password)
|
||||||
|
|
||||||
|
|
||||||
class RadiusRealmBackend(CreateUserMixin, RADIUSRealmBackend):
|
class RadiusRealmBackend(CreateUserMixin, RADIUSRealmBackend):
|
||||||
pass
|
def authenticate(self, request, username=None, password=None, realm=None, **kwargs):
|
||||||
|
return super().authenticate(request, username=username, password=password, realm=realm)
|
||||||
|
|
Loading…
Reference in New Issue