mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-31 06:46:24 +00:00
feat(auth): sso 生成的地址重复访问的时候,重定向到用户指定的 next 地址
This commit is contained in:
@@ -73,12 +73,12 @@ class SSOViewSet(AuthMixin, JmsGenericViewSet):
|
||||
token.save()
|
||||
except (ValueError, SSOToken.DoesNotExist):
|
||||
self.send_auth_signal(success=False, reason='authkey_invalid')
|
||||
return HttpResponseRedirect(reverse('authentication:login'))
|
||||
return HttpResponseRedirect(next_url)
|
||||
|
||||
# 判断是否过期
|
||||
if (utcnow().timestamp() - token.date_created.timestamp()) > settings.AUTH_SSO_AUTHKEY_TTL:
|
||||
self.send_auth_signal(success=False, reason='authkey_timeout')
|
||||
return HttpResponseRedirect(reverse('authentication:login'))
|
||||
return HttpResponseRedirect(next_url)
|
||||
|
||||
user = token.user
|
||||
login(self.request, user, 'authentication.backends.api.SSOAuthentication')
|
||||
|
Reference in New Issue
Block a user