public static function getInstance($callback, $realm = 'Restricted Area', $message = 'No unauthorized access allowed') { if (!self::$instance) { self::$instance = new DigestAuthentication($callback, $realm, $message); } return self::$instance; }
/** * testNoDigestResponse method * * @return void */ public function testNoDigestResponse() { $this->HttpSocket->nextHeader = false; $this->HttpSocket->request['uri']['path'] = '/admin'; $auth = array('user' => 'admin', 'pass' => '1234'); DigestAuthentication::authentication($this->HttpSocket, $auth); $this->assertFalse(isset($this->HttpSocket->request['header']['Authorization'])); }
public static function getHTTPAuth() { $query = new SelectQuery('User'); $query->field('password')->filter('`username` = ?'); //It's tricky, because the password is not stored in plain text. //Use the hash as the password for HTTP Auth requests return DigestAuthentication::getInstance(array($query, 'fetchColumn')); }