summaryrefslogtreecommitdiff
path: root/plugins/htpasswd/BridgeHtpasswd.php
blob: 51b6a94e8b9b9bbfebef758804a2bdaa4fb7b6fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php

/**
 * Implements EjabberdAuthBridge.
 */
class BridgeHtpasswd extends EjabberdAuthBridge {
  function __construct($data, $config) {
    $this->data = $data;
    $this->config = $config;
  }

  function isuser($username, $server) {
    return array_key_exists($username, $this->data);
  }

  function auth($username, $server, $password) {
    return $this->isuser($username, $server) && htpasswd_check($password, $this->data[$username], $this->config);
  }
}