mirror of
https://github.com/certbot/certbot.git
synced 2026-05-28 04:34:11 -04:00
Change query_registration() to use _get_v2_account()
This commit is contained in:
parent
5c111d0bd1
commit
246d79b401
3 changed files with 8 additions and 8 deletions
|
|
@ -646,12 +646,8 @@ class ClientV2(ClientBase):
|
|||
Resource.
|
||||
|
||||
"""
|
||||
self.net.account = regr # See certbot/certbot#6258
|
||||
# ACME v2 requires to use a POST-as-GET request (POST an empty JWS) here.
|
||||
# This is done by passing None instead of an empty UpdateRegistration to _post().
|
||||
response = self._post(regr.uri, None)
|
||||
self.net.account = self._regr_from_response(response, uri=regr.uri,
|
||||
terms_of_service=regr.terms_of_service)
|
||||
self.net.account = self._get_v2_account(regr)
|
||||
|
||||
return self.net.account
|
||||
|
||||
def update_registration(self, regr: messages.RegistrationResource,
|
||||
|
|
@ -676,7 +672,8 @@ class ClientV2(ClientBase):
|
|||
only_existing_reg = regr.body.update(only_return_existing=True)
|
||||
response = self._post(self.directory['newAccount'], only_existing_reg)
|
||||
updated_uri = response.headers['Location']
|
||||
new_regr = regr.update(uri=updated_uri)
|
||||
new_regr = regr.update(body=messages.Registration.from_json(response.json()),
|
||||
uri=updated_uri)
|
||||
self.net.account = new_regr
|
||||
return new_regr
|
||||
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ class BackwardsCompatibleClientV2Test(ClientTestBase):
|
|||
self.response.json.return_value = DIRECTORY_V2.to_json()
|
||||
client = self._init()
|
||||
self.response.json.return_value = self.regr.body.to_json()
|
||||
self.response.headers = {'Location': 'https://www.letsencrypt-demo.org/acme/reg/1'}
|
||||
self.assertEqual(self.regr, client.query_registration(self.regr))
|
||||
|
||||
def test_forwarding(self):
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ Certbot adheres to [Semantic Versioning](https://semver.org/).
|
|||
|
||||
### Fixed
|
||||
|
||||
*
|
||||
* The `show_account` now uses the "newAccount" ACME endpoint to fetch the account data, so it
|
||||
doesn't rely on the account URL. This fixes situations where Certbot would use old ACMEv1
|
||||
registration information.
|
||||
|
||||
More details about these changes can be found on our GitHub repo.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue