예제 #1
0
 def from_json(cls, jobj):
     if jobj not in cls.POSSIBLE_NAMES:  # pylint: disable=unsupported-membership-test
         raise jose.DeserializationError('{0} not recognized'.format(
             cls.__name__))
     return cls.POSSIBLE_NAMES[jobj]
예제 #2
0
 def nonce(value):  # pylint: disable=missing-docstring,no-self-argument
     try:
         return jose.decode_b64jose(value)
     except jose.DeserializationError as error:
         # TODO: custom error
         raise jose.DeserializationError("Invalid nonce: {0}".format(error))
예제 #3
0
 def from_json(cls, value):
     if value not in cls.POSSIBLE_NAMES:
         raise jose.DeserializationError(
             '{0} not recognized'.format(cls.__name__))
     return cls.POSSIBLE_NAMES[value]
예제 #4
0
 def decode(self, value):
     if value != self.resource_type:
         raise jose.DeserializationError(
             'Wrong resource type: {0} instead of {1}'.format(
                 value, self.resource_type))
     return value
예제 #5
0
 def default_decoder(cls, value):
     try:
         return pyrfc3339.parse(value)
     except ValueError as error:
         raise jose.DeserializationError(error)
예제 #6
0
 def decode(self, value):
     if value != self.value:
         raise jose.DeserializationError('Expected {0!r}'.format(
             self.value))
     return self.value
예제 #7
0
파일: jws.py 프로젝트: kcolford/letsencrypt
 def nonce(value: str) -> bytes:  # type: ignore[misc]  # pylint: disable=no-self-argument,missing-function-docstring
     try:
         return jose.decode_b64jose(value)
     except jose.DeserializationError as error:
         # TODO: custom error
         raise jose.DeserializationError("Invalid nonce: {0}".format(error))
예제 #8
0
 def from_json(cls, jobj: str) -> '_Constant':
     if jobj not in cls.POSSIBLE_NAMES:  # pylint: disable=unsupported-membership-test
         raise jose.DeserializationError(f'{cls.__name__} not recognized')
     return cls.POSSIBLE_NAMES[jobj]