コード例 #1
0
ファイル: SimpleDnsSolver.php プロジェクト: acmephp/core
    /**
     * {@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));
    }
コード例 #2
0
ファイル: DnsValidator.php プロジェクト: acmephp/core
 /**
  * {@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;
 }
コード例 #3
0
 public function testGetRecordName()
 {
     $domain = 'foo.com';
     $mockEncoder = $this->prophesize(Base64SafeEncoder::class);
     $stubChallenge = $this->prophesize(AuthorizationChallenge::class);
     $extractor = new DnsDataExtractor($mockEncoder->reveal());
     $stubChallenge->getDomain()->willReturn($domain);
     $this->assertEquals('_acme-challenge.' . $domain . '.', $extractor->getRecordName($stubChallenge->reveal()));
 }