コード例 #1
0
ファイル: ProviderAbstract.php プロジェクト: k42b3/psx-ws
 protected function doCheckAuthentication()
 {
     try {
         $extractor = new ResExtractor();
         $request = $extractor->extract($this->data);
         if ($this->onCheckAuthentication($request) === true) {
             $body = OpenId::keyValueEncode(array('ns' => self::NS, 'is_valid' => 'true'));
         } else {
             throw new Exception('Authentication not successful');
         }
     } catch (\Exception $e) {
         $body = OpenId::keyValueEncode(array('ns' => self::NS, 'is_valid' => 'false'));
     }
     $this->response->getBody()->write($body);
 }
コード例 #2
0
ファイル: OpenIdTest.php プロジェクト: k42b3/psx-ws
 public function testOpenIDKeyValue()
 {
     $expect = array('mode' => 'error', 'error' => 'This is an example message');
     $str = 'mode:error' . "\n" . 'error:This is an example message' . "\n";
     $this->assertEquals($str, OpenId::keyValueEncode($expect));
     $this->assertEquals($expect, OpenId::keyValueDecode($str));
 }