Check if payload contains sensitive information.
(self, payload)
| 39 | self._jwe = JsonWebEncryption(algorithms, private_headers=private_headers) |
| 40 | |
| 41 | def check_sensitive_data(self, payload): |
| 42 | """Check if payload contains sensitive information.""" |
| 43 | for k in payload: |
| 44 | # check claims key name |
| 45 | if k in self.SENSITIVE_NAMES: |
| 46 | raise InsecureClaimError(k) |
| 47 | |
| 48 | # check claims values |
| 49 | v = payload[k] |
| 50 | if isinstance(v, str) and self.SENSITIVE_VALUES.search(v): |
| 51 | raise InsecureClaimError(k) |
| 52 | |
| 53 | def encode(self, header, payload, key, check=True): |
| 54 | """Encode a JWT with the given header, payload and key. |
no test coverage detected