Exemplo n.º 1
0
    /**
     * {@inheritdoc}
     */
    public function cleanup(AuthorizationChallenge $authorizationChallenge)
    {
        $recordName = $this->extractor->getRecordName($authorizationChallenge);
        $this->output->writeln(sprintf(<<<'EOF'
You can now cleanup your DNS by removing the domain <comment>_acme-challenge.%s.</comment>
EOF
, $recordName));
    }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function isValid(AuthorizationChallenge $authorizationChallenge)
 {
     $recordName = $this->extractor->getRecordName($authorizationChallenge);
     $recordValue = $this->extractor->getRecordValue($authorizationChallenge);
     foreach (dns_get_record($recordName, DNS_TXT) as $record) {
         if (in_array($recordValue, $record['entries'])) {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 3
0
 public function testGetRecordValue()
 {
     $payload = 'randomPayload';
     $encodedPayload = 'encodedSHA256Payload';
     $mockEncoder = $this->prophesize(Base64SafeEncoder::class);
     $stubChallenge = $this->prophesize(AuthorizationChallenge::class);
     $extractor = new DnsDataExtractor($mockEncoder->reveal());
     $stubChallenge->getPayload()->willReturn($payload);
     $mockEncoder->encode(hash('sha256', $payload, true))->willReturn($encodedPayload);
     $this->assertEquals($encodedPayload, $extractor->getRecordValue($stubChallenge->reveal()));
 }