summaryrefslogtreecommitdiff
path: root/plugins/htpasswd/BridgeHtpasswd.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/htpasswd/BridgeHtpasswd.php')
-rw-r--r--plugins/htpasswd/BridgeHtpasswd.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/htpasswd/BridgeHtpasswd.php b/plugins/htpasswd/BridgeHtpasswd.php
new file mode 100644
index 0000000..51b6a94
--- /dev/null
+++ b/plugins/htpasswd/BridgeHtpasswd.php
@@ -0,0 +1,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);
+ }
+}