tituspijean / flarum-ext-auth-ldap

LDAP authentication extension for Flarum, a simple forum software for building great communities.
MIT License
20 stars 12 forks source link

Provide an example config #7

Closed agonzalezmurua closed 6 years ago

agonzalezmurua commented 6 years ago

I'm trying to incorporate this plugin on my company but I can't seem to make it work and the placeholder info isn't helping at all, could you please elaborate more on it?

tituspijean commented 6 years ago

The placeholders are enough for a YunoHost installation, but surely you need other fields.

Can you disclose how you currently connect to your LDAP server and how you search for users? Replace any sensitive information with dummy strings.

agonzalezmurua commented 6 years ago

I'm not using YunoHost, everything is self hosted

A little backstory: I've integrated a GitLab instance with LDAP with an LDAP account before in my company and with wonderful results, now the thing is that the design team needed to communicate information about core design of our application and stuff and needed a platform, Flarum was selected and they asked me if I could integrate it with LDAP.

Logical choice would be to use the GitLab plugin, but the thing is that not everybody is interested in joining GitLab (gerency for example), so I found your plugin and though it adapts almost prefectly.

I had to practically reinstall Flarum because they left a little mess with the PHP configuration (self compiled) and was making conflicts with another instalations because it wasn't using the PHP's ldap module (even tho it was installed) Today I managed to setup Flarum with a standard installation and is using the ldap module.

My problem now is that adldap is asking me to set up a password field

POST http://polygon/auth/ldap

Adldap\Auth\PasswordRequiredException: A password must be specified. in file /var/www/html/vendor/adldap2/adldap2/src/Auth/Guard.php on line 142
Stack trace:
  1. Adldap\Auth\PasswordRequiredException->() /var/www/html/vendor/adldap2/adldap2/src/Auth/Guard.php:142
  2. Adldap\Auth\Guard->validateCredentials() /var/www/html/vendor/adldap2/adldap2/src/Auth/Guard.php:41
  3. Adldap\Auth\Guard->attempt() /var/www/html/vendor/tituspijean/flarum-ext-auth-ldap/src/Controllers/LDAPAuthController.php:60
  4. TitusPiJean\Flarum\Auth\LDAP\Controllers\LDAPAuthController->handle() /var/www/html/vendor/flarum/core/src/Http/Handler/ControllerRouteHandler.php:53
  5. Flarum\Http\Handler\ControllerRouteHandler->__invoke() /var/www/html/vendor/flarum/core/src/Http/Middleware/DispatchRoute.php:69
  6. Flarum\Http\Middleware\DispatchRoute->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:207
  7. Zend\Stratigility\Dispatch->dispatchCallableMiddleware() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:83
  8. Zend\Stratigility\Dispatch->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Next.php:160
  9. Zend\Stratigility\Next->__invoke() /var/www/html/vendor/flarum/core/src/Http/Middleware/SetLocale.php:51
 10. Flarum\Http\Middleware\SetLocale->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:207
 11. Zend\Stratigility\Dispatch->dispatchCallableMiddleware() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:83
 12. Zend\Stratigility\Dispatch->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Next.php:160
 13. Zend\Stratigility\Next->__invoke() /var/www/html/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php:36
 14. Flarum\Http\Middleware\AuthenticateWithSession->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:207
 15. Zend\Stratigility\Dispatch->dispatchCallableMiddleware() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:83
 16. Zend\Stratigility\Dispatch->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Next.php:160
 17. Zend\Stratigility\Next->__invoke() /var/www/html/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php:39
 18. Flarum\Http\Middleware\RememberFromCookie->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:207
 19. Zend\Stratigility\Dispatch->dispatchCallableMiddleware() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:83
 20. Zend\Stratigility\Dispatch->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Next.php:160
 21. Zend\Stratigility\Next->__invoke() /var/www/html/vendor/flarum/core/src/Http/Middleware/StartSession.php:48
 22. Flarum\Http\Middleware\StartSession->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:207
 23. Zend\Stratigility\Dispatch->dispatchCallableMiddleware() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:83
 24. Zend\Stratigility\Dispatch->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Next.php:160
 25. Zend\Stratigility\Next->__invoke() /var/www/html/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php:31
 26. Flarum\Http\Middleware\ParseJsonBody->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:207
 27. Zend\Stratigility\Dispatch->dispatchCallableMiddleware() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:83
 28. Zend\Stratigility\Dispatch->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Next.php:160
 29. Zend\Stratigility\Next->__invoke() /var/www/html/vendor/flarum/core/src/Http/Middleware/HandleErrors.php:61
 30. Flarum\Http\Middleware\HandleErrors->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:207
 31. Zend\Stratigility\Dispatch->dispatchCallableMiddleware() /var/www/html/vendor/zendframework/zend-stratigility/src/Dispatch.php:83
 32. Zend\Stratigility\Dispatch->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/Next.php:160
 33. Zend\Stratigility\Next->__invoke() /var/www/html/vendor/zendframework/zend-stratigility/src/MiddlewarePipe.php:111
 34. Zend\Stratigility\MiddlewarePipe->__invoke() /var/www/html/vendor/flarum/core/src/Http/AbstractServer.php:55
 35. Flarum\Http\AbstractServer->__invoke() /var/www/html/vendor/zendframework/zend-diactoros/src/Server.php:157
 36. Zend\Diactoros\Server->listen() /var/www/html/vendor/flarum/core/src/Http/AbstractServer.php:36
 37. Flarum\Http\AbstractServer->listen() /var/www/html/index.php:16

So yes, I need more fields because I need to authenticate to my LDAP server with a user (I already requested a FlarumUser i.e.)

agonzalezmurua commented 6 years ago

Excuse my previous stacktrace, I never tried to reinstall this extension and it wasn't working correctly.

I seems that I just need to better understand LDAP before reporting these things

tituspijean commented 6 years ago

I am sorry, your unsolicited explanations do not help understand what is your problem. The stacktrace says all: no password was given, so you cannot be authenticated.

Currently, if your base DN is dc=example,dc=com and your username is johndoe, the extension will try to connect to the LDAP server as uid=johndoe,dc=example,dc=com.

Maybe your company identifies its users by their common name (cn), and the uid is an unused number, etc. I cannot guess.

Can you disclose how you currently connect to your LDAP server and how you search for users? Replace any sensitive information with dummy strings.

It can be a simple command line, just enough to send authenticated requests to the LDAP server.

agonzalezmurua commented 6 years ago

After further investigation I’ve discovered the root do the problem.

I’m closing this issue