cburschka/ejabberd-auth-php

Not an issue... How to install/use your bridging system ?

Closed this issue · 4 comments

Hello,

I was wondering how to use your code?
Should I do a git clone in /etc/ejabberd? In the web application? / opt?
I can not figure out how to use your code on my system ...

The example path doesn't help me:
extauth_program: ".../ejabberd-auth-php/main"

Sorry if my question is a bit stupid ...
Thank you.

Hi, it's definitely not a stupid question; this is a pretty improvised project with not a good amount of support and documentation. ;)

Last time I looked at it I actually did some refactoring to make it work with composer etc., I'll have to check again how it works and see if I can add some decent install instructions.

Hello, do not worry and thank you for the answer.

Here's what I did:

Cloning in /etc/ejabberd + chown ejabberd.
composer update
This is probably not the ideal to clone into the ejabberd directory as the path of the application seems to be relative ...
But in the other hand cloning into a web server application (/var/www/etc.) would give another problem: The ejabberd access to the files.

I am unable to understand how to configure the various bridges in config.yml ... This is probably the most problematic.

The only one that seems simple to configure is the .htaccess authentication.

I am looking for a bridge ejabberd/phpbb and I was hoping that your Bridge databasebridge.php helps me realize this ...

Anyway, explore your code is interesting!

Oh, I just remembered - the new code (in master) is decoupled from the target CMS (it used to actually load parts of the CMS codebase, which was quite brittle).

So the code now supports only two ways of bridging: by HTTP, and by a direct database access through PDO. Unfortunately, I have only had time to port the Drupal part, so phpbb just hasn't been implemented yet.

You could use the legacy version (1.0 branch, though I'm not sure if the phpBB bridge still works with the current phpBB version). Or if you want to and feel up to it, you could write the PHP implementation yourself; I'd be happy to add it :)

Basically, you'd need either of these two:

  • some phpbb plugin/module/extension (I don't know the phpBB contrib architecture at all, sadly) that accepts a POST request with a password and returns HTTP 200 or HTTP 403 depending on whether the password is right. Then the URL of that plugin can be set in the config.yml.
plugin1:
  class: '\Ermarian\EjabberdAuth\Bridge\HttpBridge'
  config:
    url: 'http://example.com/path-to-plugin.php'
  hosts:
    - '*'
  • a subclass of \Ermarian\EjabberdAuth\DatabaseBridge that implements four required methods (getUserQuery / getPasswordQuery / checkPassword / static create). The first three specify how to query the phpBB database and verify a password against a hash; the static create() function takes a config array (from the yml) and sets up the database connection. It basically looks something like this:
plugin1:
  class: '\xzy\yourclass'
  config:
    host: ''
    user: ''
    password: ''
    database: ''
    // (plus any other configurable stuff)
  hosts:
    - '*'
namespace xyz;

use \Ermarian\EjabberdAuth\Bridge\DatabaseBridge;

class yourclass extends DatabaseBridge {
  public static function create(array $config) {
    return new static(
      new \PDO($config['host'], /* etc */)
    );
  }

  // plus the rest of the implemented methods.
}

Hi,

It's very helpful, thank you very much.

As it is phpbb 3.2 I'll have to adapt (I'm sure they changed the functions...)
I just nedd a php which checks the hash, it should not be too difficult to code.

Kind rgds.