Exemple #1
0
    def _verify(self, payload):
        key = self.get_key()
        value = payload.get(key)
        valid_claim = self.verify(value)
        if not isinstance(valid_claim, bool):
            raise exceptions.InvalidCustomClaim()

        if valid_claim is False:
            message = "Invalid claim: {}".format(key)
            raise exceptions.InvalidCustomClaimError(message=message)
Exemple #2
0
 def __init__(self):
     required = ("key", "setup", "verify")
     if any(not hasattr(self, x) for x in required):
         raise exceptions.InvalidCustomClaim()