예제 #1
0
 public function testOpenidWrapperRunModeIdResDbStoreNonceInvalid()
 {
     $_GET = self::$requestCheckAuthenticationGet;
     $_GET['openid_mode'] = 'id_res';
     $nonce = '123456';
     $_GET['openid_return_to'] = ezcAuthenticationUrl::appendQuery($_GET['openid_return_to'], 'nonce', $nonce);
     $options = new ezcAuthenticationOpenidOptions();
     $options->store = new ezcAuthenticationOpenidDbStore($this->db);
     $credentials = new ezcAuthenticationIdCredentials(self::$url);
     $filter = new ezcAuthenticationOpenidWrapper($options);
     $result = $filter->run($credentials);
     $this->assertEquals(ezcAuthenticationOpenidFilter::STATUS_NONCE_INCORRECT, $result);
 }
예제 #2
0
 public function testOpenidWrapperAssociateDhSha1Gmp()
 {
     if (!ezcBaseFeatures::hasExtensionSupport('openssl')) {
         $this->markTestSkipped('PHP must be compiled with --with-openssl.');
     }
     if (!ezcBaseFeatures::hasExtensionSupport('gmp')) {
         $this->markTestSkipped('PHP must be compiled with --with-gmp.');
     }
     $lib = ezcAuthenticationMath::createBignumLibrary('gmp');
     $private = $lib->rand(self::$p);
     $private = $lib->add($private, 1);
     $public = $lib->powmod(self::$q, $private, self::$p);
     $params = array('openid.mode' => 'associate', 'openid.assoc_type' => 'HMAC-SHA1', 'openid.dh_modulus' => urlencode(base64_encode($lib->btwoc(self::$p))), 'openid.dh_gen' => 2, urlencode(base64_encode($lib->btwoc(self::$q))), 'openid.dh_consumer_public' => urlencode(base64_encode($lib->btwoc($public))));
     $filter = new ezcAuthenticationOpenidWrapper();
     $result = $filter->associate(self::$provider, $params);
     $this->assertNotEquals(false, $result);
     $this->assertEquals(true, isset($result['assoc_handle']));
     $this->assertEquals(true, isset($result['mac_key']));
 }