当前位置: 首页>>代码示例>>Python>>正文


Python challenges.HTTP01属性代码示例

本文整理汇总了Python中acme.challenges.HTTP01属性的典型用法代码示例。如果您正苦于以下问题:Python challenges.HTTP01属性的具体用法?Python challenges.HTTP01怎么用?Python challenges.HTTP01使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在acme.challenges的用法示例。


在下文中一共展示了challenges.HTTP01属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: supported_challb

# 需要导入模块: from acme import challenges [as 别名]
# 或者: from acme.challenges import HTTP01 [as 别名]
def supported_challb(authorization):
    """Find supported challenge body.

    This plugin supports only `http-01`, so CA must offer it as a
    single-element combo. If this is not the case this function returns
    `None`.

    Returns:
      `acme.messages.ChallengeBody` with `http-01` challenge or `None`.
    """
    for combo in authorization.body.combinations:
        first_challb = authorization.body.challenges[combo[0]]
        if len(combo) == 1 and isinstance(
                first_challb.chall, challenges.HTTP01):
            return first_challb
    return None 
开发者ID:kuba,项目名称:simp_le,代码行数:18,代码来源:simp_le.py

示例2: supported_challb

# 需要导入模块: from acme import challenges [as 别名]
# 或者: from acme.challenges import HTTP01 [as 别名]
def supported_challb(authorization):
    """Find supported challenge body.

    This plugin supports only `http-01`, so CA must offer it as a
    single-element combo. If this is not the case this function returns
    `None`.

    Returns:
      `acme.messages.ChallengeBody` with `http-01` challenge or `None`.
    """
    if authorization.body.combinations is None:
        for challenge in authorization.body.challenges:
            if isinstance(challenge.chall, challenges.HTTP01):
                return challenge
    else:
        for combo in authorization.body.combinations:
            first_challb = authorization.body.challenges[combo[0]]
            if len(combo) == 1 and isinstance(
                    first_challb.chall, challenges.HTTP01):
                return first_challb
    return None 
开发者ID:zenhack,项目名称:simp_le,代码行数:23,代码来源:simp_le.py

示例3: get_chall_pref

# 需要导入模块: from acme import challenges [as 别名]
# 或者: from acme.challenges import HTTP01 [as 别名]
def get_chall_pref(self, domain):
        # pylint: disable=missing-docstring,no-self-use,unused-argument
        return [challenges.HTTP01] 
开发者ID:dlapiduz,项目名称:certbot-s3front,代码行数:5,代码来源:authenticator.py

示例4: test_start_responding

# 需要导入模块: from acme import challenges [as 别名]
# 或者: from acme.challenges import HTTP01 [as 别名]
def test_start_responding(self, token):
        """
        Calling ``start_responding`` makes an appropriate resource available.
        """
        challenge = challenges.HTTP01(token=token)
        response = challenge.response(RSA_KEY_512)

        responder = HTTP01Responder()

        challenge_resource = Resource()
        challenge_resource.putChild(b'acme-challenge', responder.resource)
        root = Resource()
        root.putChild(b'.well-known', challenge_resource)
        client = StubTreq(root)

        encoded_token = challenge.encode('token')
        challenge_url = URL(host=u'example.com', path=[
            u'.well-known', u'acme-challenge', encoded_token]).asText()

        self.assertThat(client.get(challenge_url),
                        succeeded(MatchesStructure(code=Equals(404))))

        responder.start_responding(u'example.com', challenge, response)
        self.assertThat(client.get(challenge_url), succeeded(MatchesAll(
            MatchesStructure(
                code=Equals(200),
                headers=AfterPreprocessing(
                    methodcaller('getRawHeaders', b'content-type'),
                    Equals([b'text/plain']))),
            AfterPreprocessing(methodcaller('content'), succeeded(
                Equals(response.key_authorization.encode('utf-8'))))
        )))

        # Starting twice before stopping doesn't break things
        responder.start_responding(u'example.com', challenge, response)
        self.assertThat(client.get(challenge_url),
                        succeeded(MatchesStructure(code=Equals(200))))

        responder.stop_responding(u'example.com', challenge, response)
        self.assertThat(client.get(challenge_url),
                        succeeded(MatchesStructure(code=Equals(404)))) 
开发者ID:twisted,项目名称:txacme,代码行数:43,代码来源:test_challenges.py

示例5: get_chall_pref

# 需要导入模块: from acme import challenges [as 别名]
# 或者: from acme.challenges import HTTP01 [as 别名]
def get_chall_pref(self, unused_domain):  # pylint: disable=no-self-use
        """Return list of challenge preferences."""
        return [challenges.HTTP01] 
开发者ID:Gandi,项目名称:letsencrypt-gandi,代码行数:5,代码来源:shs.py

示例6: get_chall_pref

# 需要导入模块: from acme import challenges [as 别名]
# 或者: from acme.challenges import HTTP01 [as 别名]
def get_chall_pref(self, domain):
        return [challenges.HTTP01] 
开发者ID:tsuru,项目名称:rpaas,代码行数:4,代码来源:le_authenticator.py

示例7: test_answer_challenge

# 需要导入模块: from acme import challenges [as 别名]
# 或者: from acme.challenges import HTTP01 [as 别名]
def test_answer_challenge(self):
        """
        `~txacme.client.Client.answer_challenge` responds to a challenge and
        returns the updated challenge.
        """
        key_authorization = u'blahblahblah'
        uri = u'https://example.org/acme/authz/1/0'
        sequence = RequestSequence(
            [_nonce_response(
                u'https://example.org/acme/authz/1/0',
                b'Nonce'),
             (MatchesListwise([
                 Equals(b'POST'),
                 Equals(uri),
                 Equals({}),
                 ContainsDict({b'Content-Type': Equals([JSON_CONTENT_TYPE])}),
                 on_jws(Equals({
                     u'resource': u'challenge',
                     u'type': u'http-01',
                     }))]),
              (http.OK,
               {b'content-type': JSON_CONTENT_TYPE,
                b'replay-nonce': b64encode(b'Nonce2'),
                b'link': b'<https://example.org/acme/authz/1>;rel="up"',
                },
               _json_dumps({
                   u'uri': uri,
                   u'type': u'http-01',
                   u'status': u'processing',
                   u'token': u'DGyRejmCefe7v4NfDGDKfA',
               })))],
            self.expectThat)
        client = self.useFixture(
            ClientFixture(sequence, key=RSA_KEY_512)).client
        with sequence.consume(self.fail):
            self.assertThat(
                client.answer_challenge(
                    messages.ChallengeBody(
                        uri=uri,
                        chall=challenges.HTTP01(token=b'blahblah'),
                        status=messages.STATUS_PENDING),
                    challenges.HTTP01Response(
                        key_authorization=key_authorization)),
                succeeded(MatchesStructure(
                    body=MatchesStructure(),
                    authzr_uri=Equals(
                        u'https://example.org/acme/authz/1'),
                ))) 
开发者ID:twisted,项目名称:txacme,代码行数:50,代码来源:test_client.py


注:本文中的acme.challenges.HTTP01属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。