cburschka / ejabberd-auth-php

Extendable system of bridging ejabberd with PHP authentication systems.
21 stars 11 forks source link

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

Closed lol-deb closed 6 years ago

lol-deb commented 6 years ago

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.

cburschka commented 6 years ago

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.

lol-deb commented 6 years ago

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!

cburschka commented 6 years ago

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:

plugin1:
  class: '\Ermarian\EjabberdAuth\Bridge\HttpBridge'
  config:
    url: 'http://example.com/path-to-plugin.php'
  hosts:
    - '*'
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.
}
lol-deb commented 6 years ago

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.