From 7926f7d75e3fe2a1419f93fe84c5132af6641949 Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Thu, 9 Feb 2023 11:20:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9OAuth2=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E7=9A=84=E6=B3=A8=E9=94=80=E5=9C=B0=E5=9D=80=E4=B8=BA?= =?UTF-8?q?=E9=9D=9E=E5=BF=85=E5=A1=AB=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/backends/oauth2/views.py | 4 ++-- apps/settings/serializers/auth/oauth2.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/authentication/backends/oauth2/views.py b/apps/authentication/backends/oauth2/views.py index 056f16b31..ad95e29cd 100644 --- a/apps/authentication/backends/oauth2/views.py +++ b/apps/authentication/backends/oauth2/views.py @@ -86,9 +86,9 @@ class OAuth2EndSessionView(View): logger.debug(log_prompt.format('Log out the current user: {}'.format(request.user))) auth.logout(request) - if settings.AUTH_OAUTH2_LOGOUT_COMPLETELY: + next_url = settings.AUTH_OAUTH2_PROVIDER_END_SESSION_ENDPOINT + if settings.AUTH_OAUTH2_LOGOUT_COMPLETELY and next_url: logger.debug(log_prompt.format('Log out OAUTH2 platform user session synchronously')) - next_url = settings.AUTH_OAUTH2_PROVIDER_END_SESSION_ENDPOINT return HttpResponseRedirect(next_url) logger.debug(log_prompt.format('Redirect')) diff --git a/apps/settings/serializers/auth/oauth2.py b/apps/settings/serializers/auth/oauth2.py index a689243ef..46e279969 100644 --- a/apps/settings/serializers/auth/oauth2.py +++ b/apps/settings/serializers/auth/oauth2.py @@ -49,7 +49,7 @@ class OAuth2SettingSerializer(serializers.Serializer): required=True, max_length=1024, label=_('Provider userinfo endpoint') ) AUTH_OAUTH2_PROVIDER_END_SESSION_ENDPOINT = serializers.CharField( - required=False, max_length=1024, label=_('Provider end session endpoint') + required=False, allow_blank=True, max_length=1024, label=_('Provider end session endpoint') ) AUTH_OAUTH2_LOGOUT_COMPLETELY = serializers.BooleanField(required=False, label=_('Logout completely')) AUTH_OAUTH2_USER_ATTR_MAP = serializers.DictField(