mirror of https://github.com/jumpserver/jumpserver
fix(radius): 修复radius认证失败问题 (#4341)
* fix(radius): 修复radius认证失败问题,添加get_django_user方法参数(django-radius==1.4.0 中添加了额外参数) * fix(radius): 修复radius认证失败问题,重写authenticate方法(django-radius 不接受public_key参数)pull/4350/head
parent
e3dc76f281
commit
5c67f4311d
|
@ -11,7 +11,7 @@ User = get_user_model()
|
|||
|
||||
|
||||
class CreateUserMixin:
|
||||
def get_django_user(self, username, password=None):
|
||||
def get_django_user(self, username, password=None, *args, **kwargs):
|
||||
if isinstance(username, bytes):
|
||||
username = username.decode()
|
||||
try:
|
||||
|
@ -27,6 +27,12 @@ class CreateUserMixin:
|
|||
user.save()
|
||||
return user
|
||||
|
||||
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):
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue