MCPcopy
hub / github.com/authlib/authlib / _validate_crit_headers

Method _validate_crit_headers

authlib/jose/rfc7515/jws.py:295–310  ·  view source on GitHub ↗
(self, header)

Source from the content-addressed store, hash-verified

293 raise InvalidHeaderParameterNameError("crit")
294
295 def _validate_crit_headers(self, header):
296 if "crit" in header:
297 crit_headers = header["crit"]
298 # Type enforcement for robustness and predictable errors
299 if not isinstance(crit_headers, list) or not all(
300 isinstance(x, str) for x in crit_headers
301 ):
302 raise InvalidHeaderParameterNameError("crit")
303 names = self.REGISTERED_HEADER_PARAMETER_NAMES.copy()
304 if self._private_headers:
305 names = names.union(self._private_headers)
306 for k in crit_headers:
307 if k not in names:
308 raise InvalidCritHeaderParameterNameError(k)
309 elif k not in header:
310 raise InvalidCritHeaderParameterNameError(k)
311
312 def _validate_json_jws(self, payload_segment, payload, header_obj, key):
313 protected_segment = header_obj.get("protected")

Callers 4

serialize_compactMethod · 0.95
deserialize_compactMethod · 0.95
_signMethod · 0.95
_validate_json_jwsMethod · 0.95

Tested by

no test coverage detected