Ejemplo n.º 1
0
    /**
     * {@inheritdoc}
     */
    public function cleanup(AuthorizationChallenge $authorizationChallenge)
    {
        $checkUrl = $this->extractor->getCheckUrl($authorizationChallenge);
        $this->output->writeln(sprintf(<<<'EOF'
                    You can now safely remove the challenge's file at %s

EOF
, $checkUrl));
    }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function isValid(AuthorizationChallenge $authorizationChallenge)
 {
     $checkUrl = $this->extractor->getCheckUrl($authorizationChallenge);
     $checkContent = $this->extractor->getCheckContent($authorizationChallenge);
     try {
         return $checkContent === trim($this->client->get($checkUrl)->getBody()->getContents());
     } catch (ClientException $e) {
         return false;
     }
 }
Ejemplo n.º 3
0
 public function testGetCheckUrl()
 {
     $domain = 'foo.com';
     $token = 'randomToken';
     $stubChallenge = $this->prophesize(AuthorizationChallenge::class);
     $extractor = new HttpDataExtractor();
     $stubChallenge->getDomain()->willReturn($domain);
     $stubChallenge->getToken()->willReturn($token);
     $this->assertEquals('http://' . $domain . '/.well-known/acme-challenge/' . $token, $extractor->getCheckUrl($stubChallenge->reveal()));
 }