blob: 62ac1f46c73e4df411dc3e72934f41f2b7500fbe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<?php
/**
* Implements EjabberdAuthBridge.
*/
class BridgeHtpasswd extends EjabberdAuthBridge {
function __construct($data, $config) {
$this->data = $data;
$this->config = $config;
}
function getData($server) {
return array_key_exists($server, $this->data) ? $this->data[$server] : $this->data[NULL];
}
function isuser($username, $server) {
return array_key_exists($username, $this->getData($server));
}
function auth($username, $server, $password) {
return $this->isuser($username, $server) && htpasswd_check($password, $this->getData($server)[$username], $this->config);
}
}
|