mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-07-08 03:21:05 +00:00
perf: modify custom_sso.py
This commit is contained in:
@@ -64,7 +64,9 @@ class CustomSSOLoginAPIView(AuthMixin, RetrieveAPIView):
|
||||
|
||||
def authenticate(self, **query_params):
|
||||
try:
|
||||
userinfo: dict = custom_sso_authenticate_method(**query_params)
|
||||
userinfo, error = custom_sso_authenticate_method(**query_params)
|
||||
if error:
|
||||
return None, error
|
||||
self.next_url = userinfo.get('next_url', '/')
|
||||
except Exception as e:
|
||||
error = f'Custom SSO authenticate error: {e}'
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
from django.conf import settings
|
||||
|
||||
from pydantic import json
|
||||
import requests_unixsocket
|
||||
|
||||
__all__ = ['request_jdmc']
|
||||
|
||||
|
||||
def request_jdmc(method='GET', path='', data=None, timeout=(5, 60)):
|
||||
def request_jdmc(method='GET', path='', timeout=(5, 60), **kwargs):
|
||||
''' path: JDMC API path, e.g. /jdmc/api/v1/apps/license '''
|
||||
url = settings.JDMC_BASE_URL + path
|
||||
with requests_unixsocket.Session() as session:
|
||||
response = session.request(method, url, data=data, timeout=timeout)
|
||||
response = session.request(method, url, timeout=timeout, **kwargs)
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user