public function testGetCheckContent()
 {
     $payload = 'randomPayload';
     $stubChallenge = $this->prophesize(AuthorizationChallenge::class);
     $extractor = new HttpDataExtractor();
     $stubChallenge->getPayload()->willReturn($payload);
     $this->assertEquals($payload, $extractor->getCheckContent($stubChallenge->reveal()));
 }
Example #2
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));
    }
Example #3
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;
     }
 }