mirror of
https://github.com/haiwen/seahub.git
synced 2025-10-21 10:51:17 +00:00
@@ -50,7 +50,6 @@ class Saml2Backend(ModelBackend):
|
||||
|
||||
def authenticate(self, session_info=None, attribute_mapping=None, create_unknown_user=True, org_id=None, **kwargs):
|
||||
if session_info is None or attribute_mapping is None:
|
||||
logger.error('Session info or attribute mapping are None')
|
||||
return None
|
||||
|
||||
name_id = session_info.get('name_id', '')
|
||||
|
@@ -276,6 +276,10 @@ def assertion_consumer_service(request, org_id=None, attribute_mapping=None, cre
|
||||
oq_cache.delete(session_id)
|
||||
session_info = response.session_info()
|
||||
attribute_mapping = attribute_mapping or SAML_ATTRIBUTE_MAPPING
|
||||
if not attribute_mapping:
|
||||
logger.error('ADFS attribute mapping is not valid.')
|
||||
return render_error(request, login_failed_error_msg)
|
||||
|
||||
|
||||
# saml2 connect
|
||||
relay_state = request.POST.get('RelayState', '/saml/complete/')
|
||||
@@ -314,6 +318,7 @@ def assertion_consumer_service(request, org_id=None, attribute_mapping=None, cre
|
||||
return HttpResponseRedirect(relay_state)
|
||||
|
||||
if not session_info:
|
||||
logger.error('ADFS session info is not valid.')
|
||||
return render_error(request, login_failed_error_msg)
|
||||
|
||||
name_id = session_info.get('name_id', '')
|
||||
|
@@ -414,6 +414,9 @@ def latest_entry(request, file_uuid, filename):
|
||||
filepath = os.path.join(parent_path, filename)
|
||||
filepath = os.path.normpath(filepath)
|
||||
file_obj = seafile_api.get_dirent_by_path(repo_id, filepath)
|
||||
if not file_obj:
|
||||
logger.warning(f'file {filepath} not found')
|
||||
return None
|
||||
dt = datetime.fromtimestamp(file_obj.mtime)
|
||||
return dt
|
||||
except Exception as e:
|
||||
|
Reference in New Issue
Block a user