mirror of https://github.com/jumpserver/jumpserver
feat(auth): sso 生成的地址重复访问的时候,重定向到用户指定的 next 地址
parent
2c9c64a13f
commit
f596b65ed7
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue