feat: enhance error reporting for missing user attributes in VisioneCompleteView and add fiscal_number attribute to requested claims
This commit is contained in:
@@ -67,8 +67,25 @@ class VisioneCompleteView(View):
|
||||
)
|
||||
fiscal_code = _normalize_fiscal_code(fiscal_code)
|
||||
subject = user_attrs.get("sub") or user_attrs.get("username")
|
||||
if not state or not issuer or not subject or not fiscal_code:
|
||||
return HttpResponseBadRequest("Missing Visione auth session or user attributes")
|
||||
missing = []
|
||||
if not state:
|
||||
missing.append("visione_state")
|
||||
if not issuer:
|
||||
missing.append("visione_provider_issuer")
|
||||
if not subject:
|
||||
missing.append("subject")
|
||||
if not fiscal_code:
|
||||
missing.append("fiscal_code")
|
||||
if missing:
|
||||
logger.warning(
|
||||
"Visione complete missing required data missing=%s session_keys=%s user_attr_keys=%s",
|
||||
",".join(missing),
|
||||
sorted(request.session.keys()),
|
||||
sorted(user_attrs.keys()) if isinstance(user_attrs, dict) else [],
|
||||
)
|
||||
return HttpResponseBadRequest(
|
||||
f"Missing Visione auth session or user attributes: {', '.join(missing)}"
|
||||
)
|
||||
|
||||
payload = {
|
||||
"state": state,
|
||||
|
||||
@@ -101,7 +101,8 @@ CIE_REQUESTED_CLAIMS = getattr(
|
||||
"given_name": None,
|
||||
"family_name": None,
|
||||
"email": None,
|
||||
"fiscal_number": None
|
||||
"fiscal_number": None,
|
||||
"https://attributes.eid.gov.it/fiscal_number": None,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user