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)
def __init__(self): required = ("key", "setup", "verify") if any(not hasattr(self, x) for x in required): raise exceptions.InvalidCustomClaim()