fix: 修改CAS配置项和CAS登录失败问题

pull/6847/head
Michael Bai 2021-09-14 16:38:47 +08:00 committed by Jiangjie.Bai
parent 245367ec29
commit c14c89a758
3 changed files with 8 additions and 3 deletions

View File

@ -212,12 +212,12 @@ class Config(dict):
# Cas 认证
'AUTH_CAS': False,
'CAS_SERVER_URL': "https://example.com/cas/",
'CAS_ROOT_PROXIED_AS': '',
'CAS_ROOT_PROXIED_AS': 'https://example.com',
'CAS_LOGOUT_COMPLETELY': True,
'CAS_VERSION': 3,
'CAS_USERNAME_ATTRIBUTE': 'uid',
'CAS_APPLY_ATTRIBUTES_TO_USER': False,
'CAS_RENAME_ATTRIBUTES': {},
'CAS_RENAME_ATTRIBUTES': {'uid': 'username'},
'CAS_CREATE_USER': True,
'AUTH_SSO': False,

View File

@ -117,6 +117,10 @@ class Setting(models.Model):
# 设置内存值
setattr(settings, name, setting.cleaned_value)
@classmethod
def refresh_AUTH_CAS(cls):
cls.refresh_authentications('AUTH_CAS')
@classmethod
def refresh_AUTH_LDAP(cls):
cls.refresh_authentications('AUTH_LDAP')

View File

@ -1,4 +1,4 @@
import json
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
@ -10,6 +10,7 @@ __all__ = [
class CASSettingSerializer(serializers.Serializer):
AUTH_CAS = serializers.BooleanField(required=False, label=_('Enable CAS Auth'))
CAS_SERVER_URL = serializers.CharField(required=False, max_length=1024, label=_('Server url'))
CAS_ROOT_PROXIED_AS = serializers.CharField(required=False, max_length=1024, label=_('Proxy server url'))
CAS_LOGOUT_COMPLETELY = serializers.BooleanField(required=False, label=_('Logout completely'))
CAS_VERSION = serializers.IntegerField(required=False, label=_('Version'))
CAS_USERNAME_ATTRIBUTE = serializers.CharField(required=False, max_length=1024, label=_('Username attr'))