Наследование: extends lithium\security\auth\adapter\Http
Пример #1
0
 public function testCheckDigestIsTrue()
 {
     $request = new Request(array('env' => array('PHP_AUTH_DIGEST' => 'qop="auth",nonce="4bca0fbca7bd0",' . 'nc="00000001",cnonce="95b2cd1e179bf5414e52ed62811481cf",' . 'uri="/http_auth",realm="Protected by Lithium",' . 'opaque="d3fb67a7aa4d887ec4bf83040a820a46",username="gwoo",' . 'response="04d7d878c67f289f37e553d2025e3a52"')));
     $http = new MockHttp(array('users' => array('gwoo' => 'li3')));
     $result = $http->check($request);
     $this->assertTrue($result);
     $expected = array();
     $result = $http->headers;
     $this->assertEqual($expected, $result);
 }
Пример #2
0
 public function testCheckDigestIsTrueProcessesAuthAndSucceedsCgi()
 {
     $digest = 'qop="auth",nonce="4bca0fbca7bd0",';
     $digest .= 'nc="00000001",cnonce="95b2cd1e179bf5414e52ed62811481cf",';
     $digest .= 'uri="/http_auth",realm="app",';
     $digest .= 'opaque="d3fb67a7aa4d887ec4bf83040a820a46",username="gwoo",';
     $digest .= 'response="04d7d878c67f289f37e553d2025e3a52"';
     $request = new Request(array('env' => array('HTTP_AUTHORIZATION' => "Digest {$digest}")));
     $http = new MockHttp(array('realm' => 'app', 'users' => array('gwoo' => 'li3')));
     $result = $http->check($request);
     $this->assertNotEmpty($result);
     $expected = array();
     $result = $http->headers;
     $this->assertEqual($expected, $result);
     $request = new Request(array('env' => array('REDIRECT_HTTP_AUTHORIZATION' => "Digest {$digest}")));
     $http = new MockHttp(array('realm' => 'app', 'users' => array('gwoo' => 'li3')));
     $result = $http->check($request);
     $this->assertNotEmpty($result);
     $expected = array();
     $result = $http->headers;
     $this->assertEqual($expected, $result);
 }