CAS: améliore traitement erreur si réponse XML invalide

This commit is contained in:
Emmanuel Viennet 2025-01-14 17:26:05 +01:00
parent 5f5f464eb0
commit 7c6a3503a0
2 changed files with 5 additions and 3 deletions

View File

@ -2,10 +2,12 @@
Routes for CAS authentication
Modified for ScoDoc
"""
import re
import ssl
from urllib.error import URLError
from urllib.request import urlopen
from xml.parsers.expat import ExpatError
import flask
from flask import current_app, request
@ -170,8 +172,8 @@ def validate(ticket):
if "cas:authenticationSuccess" in xml_from_dict["cas:serviceResponse"]
else False
)
except ValueError:
current_app.logger.error("CAS returned unexpected result")
except (ValueError, ExpatError) as exc:
current_app.logger.error(f"CAS returned unexpected result: {exc}")
if cas_error_callback:
cas_error_callback("réponse invalide du serveur CAS")
except URLError:

View File

@ -3,7 +3,7 @@
"Infos sur version ScoDoc"
SCOVERSION = "9.7.52"
SCOVERSION = "9.7.53"
SCONAME = "ScoDoc"