Do not send status or resource fields in newOrder payloads for ACMEv2

This commit is contained in:
Joona Hoikkala 2018-07-31 17:08:39 +03:00
parent ee7d5052fd
commit d19698251d
No known key found for this signature in database
GPG key ID: D5AA86BBF9B29A5C
2 changed files with 17 additions and 10 deletions

View file

@ -646,7 +646,7 @@ class ClientV2(ClientBase):
value=name))
order = messages.NewOrder(identifiers=identifiers)
response = self._post(self.directory['newOrder'], order)
body = messages.Order.from_json(response.json())
body = messages.OrderBase.from_json(response.json())
authorizations = []
for url in body.authorizations:
authorizations.append(self._authzr_from_response(self.net.get(url), uri=url))
@ -715,7 +715,7 @@ class ClientV2(ClientBase):
while datetime.datetime.now() < deadline:
time.sleep(1)
response = self.net.get(orderr.uri)
body = messages.Order.from_json(response.json())
body = messages.OrderBase.from_json(response.json())
if body.error is not None:
raise errors.IssuanceError(body.error)
if body.certificate is not None:

View file

@ -509,11 +509,10 @@ class Revocation(jose.JSONObjectWithFields):
reason = jose.Field('reason')
class Order(ResourceBody):
class OrderBase(ResourceBody):
"""Order Resource Body.
:ivar list of .Identifier: List of identifiers for the certificate.
:ivar acme.messages.Status status:
:ivar list of str authorizations: URLs of authorizations.
:ivar str certificate: URL to download certificate as a fullchain PEM.
:ivar str finalize: URL to POST to to request issuance once all
@ -522,8 +521,6 @@ class Order(ResourceBody):
:ivar .Error error: Any error that occurred during finalization, if applicable.
"""
identifiers = jose.Field('identifiers', omitempty=True)
status = jose.Field('status', decoder=Status.from_json,
omitempty=True, default=STATUS_PENDING)
authorizations = jose.Field('authorizations', omitempty=True)
certificate = jose.Field('certificate', omitempty=True)
finalize = jose.Field('finalize', omitempty=True)
@ -534,6 +531,16 @@ class Order(ResourceBody):
def identifiers(value): # pylint: disable=missing-docstring,no-self-argument
return tuple(Identifier.from_json(identifier) for identifier in value)
class Order(OrderBase):
"""Order Resource Body for ACMEv1
:ivar acme.messages.Status status:
"""
status = jose.Field('status', decoder=Status.from_json,
omitempty=True, default=STATUS_PENDING)
class OrderResource(ResourceWithURI):
"""Order Resource.
@ -549,8 +556,8 @@ class OrderResource(ResourceWithURI):
authorizations = jose.Field('authorizations')
fullchain_pem = jose.Field('fullchain_pem', omitempty=True)
@Directory.register
class NewOrder(Order):
"""New order."""
resource_type = 'new-order'
resource = fields.Resource(resource_type)
class NewOrder(OrderBase):
"""New order for ACMEv2"""
resource_type = "new-order"