mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 08:45:22 +02:00
* spelling: action * spelling: artifacts * spelling: asymmetric * spelling: attempts * spelling: bizarre * spelling: certbot * spelling: certificate * spelling: certainly * spelling: challenge * spelling: client * spelling: collated * spelling: correct * spelling: considered * spelling: custom * spelling: distinguish * spelling: encoding * spelling: enhancement * spelling: equivalent * spelling: execution * spelling: existence * spelling: failed * spelling: handshake * spelling: hyphen * spelling: initialized * spelling: initialization * spelling: interpretation * spelling: letsencrypt * spelling: multiline * spelling: multipart * spelling: necessary * spelling: otherwise * spelling: output * spelling: overridden * spelling: positives * spelling: preferable * spelling: progress * spelling: recommended * spelling: referring * spelling: relativity * spelling: request * spelling: requiring * spelling: separate * spelling: source * spelling: specified * spelling: standard * spelling: successfully * spelling: unparseable * spelling: useful
62 lines
1.6 KiB
Python
62 lines
1.6 KiB
Python
"""Client annotated ACME challenges.
|
|
|
|
Please use names such as ``achall`` to distinguish from variables "of type"
|
|
:class:`acme.challenges.Challenge` (denoted by ``chall``)
|
|
and :class:`.ChallengeBody` (denoted by ``challb``)::
|
|
|
|
from acme import challenges
|
|
from acme import messages
|
|
from certbot import achallenges
|
|
|
|
chall = challenges.DNS(token='foo')
|
|
challb = messages.ChallengeBody(chall=chall)
|
|
achall = achallenges.DNS(chall=challb, domain='example.com')
|
|
|
|
Note, that all annotated challenges act as a proxy objects::
|
|
|
|
achall.token == challb.token
|
|
|
|
"""
|
|
import logging
|
|
|
|
from acme import challenges
|
|
from acme import jose
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
# pylint: disable=too-few-public-methods
|
|
|
|
|
|
class AnnotatedChallenge(jose.ImmutableMap):
|
|
"""Client annotated challenge.
|
|
|
|
Wraps around server provided challenge and annotates with data
|
|
useful for the client.
|
|
|
|
:ivar challb: Wrapped `~.ChallengeBody`.
|
|
|
|
"""
|
|
__slots__ = ('challb',)
|
|
acme_type = NotImplemented
|
|
|
|
def __getattr__(self, name):
|
|
return getattr(self.challb, name)
|
|
|
|
|
|
class KeyAuthorizationAnnotatedChallenge(AnnotatedChallenge):
|
|
"""Client annotated `KeyAuthorizationChallenge` challenge."""
|
|
__slots__ = ('challb', 'domain', 'account_key')
|
|
|
|
def response_and_validation(self, *args, **kwargs):
|
|
"""Generate response and validation."""
|
|
return self.challb.chall.response_and_validation(
|
|
self.account_key, *args, **kwargs)
|
|
|
|
|
|
class DNS(AnnotatedChallenge):
|
|
"""Client annotated "dns" ACME challenge."""
|
|
__slots__ = ('challb', 'domain')
|
|
acme_type = challenges.DNS
|