Skip to content

Allow domain control calidation by email. New methods: #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions cert_manager/dcv.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,27 @@ def start_validation_cname(self, domain: str):

return result.json()

def start_validation_email(self, domain: str):
"""Start Domain Control Validation using Email method.

:param string domain: The domain to validate
:return response: List of valid email addresses
"""

url = self._url("validation", "start", "domain", "email")
data = {"domain": domain}

try:
result = self._client.post(url, data=data)
except HTTPError as exc:
status_code = exc.response.status_code
if status_code == HTTPStatus.BAD_REQUEST:
err_response = exc.response.json()
raise ValueError(err_response["description"]) from exc
raise exc

return result.json()

def submit_validation_cname(self, domain: str):
"""Finish Domain Control Validation using the CNAME method.

Expand All @@ -111,3 +132,30 @@ def submit_validation_cname(self, domain: str):
raise exc

return result.json()

def submit_validation_email(self, domain: str, email: str):
"""Finish Domain Control Validation using the email method.

:param string domain: The domain to validate
:param string email: validation email sent to

:return response: a dictionary containing
status: The status of the validation
orderStatus: The status of the validation request
message: An optional message to help with debugging
"""

url = self._url("validation", "submit", "domain", "email")
data = {"domain": domain,
"email": email}

try:
result = self._client.post(url, data=data)
except HTTPError as exc:
status_code = exc.response.status_code
if status_code == HTTPStatus.BAD_REQUEST:
err_response = exc.response.json()
raise ValueError(err_response["description"]) from exc
raise exc

return result.json()
Loading