OCSInventory-NG / OCSInventory-ocsreports

Webconsole for OCS Inventory NG
https://www.ocsinventory-ng.org
GNU General Public License v2.0
230 stars 151 forks source link

[BUG] CAS authentication doesn't work #1571

Closed LANFDETROY closed 10 months ago

LANFDETROY commented 1 year ago

OCS Inventory version : 2.12.1

Hello, I have installed OCS Inventory NG server, and try to setup CAS authentication but it doen't work. It works on version 2.11.1

On my server I modified the file /usr/share/ocsinventory-reports/ocsreports/backend/require/cas.config.php with the settings of my CAS server. Then i set this option in /usr/share/ocsinventory-reports/ocsreports/var.php:

define('AUTH_TYPE', 6);

And then I restart my Apache2 webserver. But I get a blank page instead of CAS authentication

Lea9250 commented 12 months ago

Hi @LANFDETROY,

The cas.config.php file has been removed since the 2.10.0 release. Did you set up the CAS authentication within the administration console ? If so, do you have any errors in the apache log ?

Regards, Léa

LANFDETROY commented 11 months ago

Hi,

I put the information concerning my CAS server on the web interface in the "CAS Configuration" section. I have no errors in the Apache logs.

xpoppy commented 11 months ago

Thats's my Apache error log on the same iusse.

PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function phpCAS::client(), 4 passed in /usr/share/ocsinventory-reports/ocsreports/backend/AUTH/methode/cas.php on line 46 and at least 5 expected in /usr/share/ocsinventory-reports/ocsreports/vendor/jasig/phpcas/source/CAS.php:348\nStack trace:\n#0 /usr/share/ocsinventory-reports/ocsreports/backend/AUTH/methode/cas.php(46): phpCAS::client()\n#1 /usr/share/ocsinventory-reports/ocsreports/backend/AUTH/auth.php(48): require_once('/usr/share/ocsi...')\n#2 /usr/share/ocsinventory-reports/ocsreports/require/header.php(321): require_once('/usr/share/ocsi...')\n#3 /usr/share/ocsinventory-reports/ocsreports/index.php(44): require('/usr/share/ocsi...')\n#4 {main}\n thrown in /usr/share/ocsinventory-reports/ocsreports/vendor/jasig/phpcas/source/CAS.php on line 348

Seems that CAS.php has modified client method

Regards

kheimon commented 11 months ago

Per https://github.com/apereo/phpCAS/blob/master/docs/Upgrading, phpCAS after 1.5.0 wants a 5th argument for the service base URL string when constructing the $cas client class. Callbacks point to the client class constructor in backend/AUTH/method/cas.php

LANFDETROY commented 10 months ago

I added cas_baseurl to the interface but I still got the same error. An idea ?

kheimon commented 10 months ago

Changing line 46 of ocsreports/backend/AUTH/method/cas.php to $cas->client(CAS_VERSION_2_0, $config['CAS_HOST'], (int)$config['CAS_PORT'], $config['CAS_URI'], $config['CAS_BASEURL']); seems to work on my homelab, but haven't been able to test behind a reverse proxy yet.