snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Attempt to login via LDAP throws 500 error on docker 'latest' container in loginViaLdap(), works on older versions

Open sjwk opened this issue 5 years ago • 10 comments

Please confirm you have done the following before posting your bug report:

Describe the bug After pulling the docker container with 'latest' tag, configured for LDAP (AD) authentication, any attempt to login (with correct or incorrect credentials) throws a 500 error. Checking logs or enabling debug mode gives the error as:

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_RECOVERABLE_ERROR) Argument 1 passed to App\Http\Controllers\Auth\LoginController::loginViaLdap() must be an instance of App\Services\LdapAd, instance of Illuminate\Http\Request given, called in /var/www/html/app/Http/Controllers/Auth/LoginController.php on line 224

Reverting back to v5.1.4 tag for the docker container works as expected. Cannot say whether the problem occurs in a non-docker environment

To Reproduce Steps to reproduce the behavior:

  1. update docker container using LDAP authentication to 'latest' tag
  2. Start container
  3. Attempt to login
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Server (please complete the following information):

  • docker 'latest' tag
  • OS: Ubuntu 18.04 (As provided in docker image)
  • Web Server: Apache 2.4.29 (As provided in docker image)
  • PHP Version: 7.2.24 (As provided in docker image)

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 90

Error Messages Argument 1 passed to App\Http\Controllers\Auth\LoginController::loginViaLdap() must be an instance of App\Services\LdapAd, instance of Illuminate\Http\Request given, called in /var/www/html/app/Http/Controllers/Auth/LoginController.php on line 224

Additional context

  • Is this a fresh install or an upgrade? upgrade of docker container
  • What OS and web server you're running Snipe-IT on: Ubuntu 18.04 via docker
  • What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) docker
  • Include what you've done so far in the installation, and if you got any error messages along the way. N/A
  • Indicate whether or not you've manually edited any data directly in the database: No

Add any other context about the problem here.

Please do not post an issue without answering the related questions above. If you have opened a different issue and already answered these questions, answer them again, once for every ticket. It will be next to impossible for us to help you.

sjwk avatar Apr 21 '21 09:04 sjwk

I have a similar problem. When trying to log in, an error occurred Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_RECOVERABLE_ERROR) Argument 1 passed to App\Http\Controllers\Auth\LoginController::loginViaLdap() must be an instance of App\Services\LdapAd, instance of Illuminate\Http\Request given, called in /var/www/snipeit/app/Http/Controllers/Auth/LoginController.php on line 224 I checked it on a test environment. When LDAP was deactivated, no errors were observed, after enabling LDAP, I received the specified error and could not log in. I can't work in the new 5.1.4 version, I had to roll back to 5.1.3

UserGoodtm avatar Apr 21 '21 10:04 UserGoodtm

@UserGoodtm Are you using docker? For me, using snipe/snipe-it:latest (5 hours old) failed, but snipe/snipe-it:v5.1.4 (14 days old) worked, as did 5.1.3. Maybe 'latest' still refers to itself as 5.1.4, but an earlier build of 5.1.4 would work for you?

sjwk avatar Apr 21 '21 10:04 sjwk

@UserGoodtm Ты пользуешься докером? Для меня использование snipe / snipe-it: latest (5 часов назад) не удалось, но snipe / snipe-it: v5.1.4 (14 дней назад) работало, как и 5.1.3. Может быть, «последняя» по-прежнему обозначается как 5.1.4, но вам подойдет более ранняя сборка 5.1.4?

No, I used the standard installer (git)

UserGoodtm avatar Apr 21 '21 10:04 UserGoodtm

We have the same issue, running this on Windows 2016. After upgrade, LDAP gives server 500 on login. When I disable LDAP, everyone can login. I ran the upgrade via GIT.

sjinman avatar Apr 21 '21 15:04 sjinman

We're working on this this morning for you folks. Thanks for the report.

snipe avatar Apr 21 '21 17:04 snipe

I can replicate on my development instance on our development LDAP server. I think I introduced this bug, sorry :(

uberbrady avatar Apr 21 '21 17:04 uberbrady

It looks like a change that was made to try to use a deferred service provider (which would enable users who do not have the php-ldap extension and never plan on using LDAP) to use Snipe-IT without php-ldap, which is how it used to work, but the big LDAP rework for v5 changed that behavior. It introduced issues for people who didn't have the extension and never wanted to install that extension, since they don't use LDAP, and a PR that was merged yesterday was an attempt to fix that.

snipe avatar Apr 21 '21 17:04 snipe

This fix is on master now - can someone pull latest and give it a shot?

snipe avatar Apr 21 '21 17:04 snipe

looks like that did the trick, I pulled the update via GIT and re-enabled LDAP and all is functioning.

sjinman avatar Apr 21 '21 17:04 sjinman

Great! Thanks for following up, and sorry for the inconvenience. :)

snipe avatar Apr 21 '21 17:04 snipe