derricksmith / phpsaml

GLPI Plugin - SAML integration using the Onelogin SAML Library
MIT License
32 stars 24 forks source link

Signature validation failed. SAML Response rejected #111

Closed SilvaFernando closed 1 year ago

SilvaFernando commented 2 years ago

Hi, i have problems with version 1.2.1 in GLPI 10.0.3 - Signature validation failed. SAML Response rejected

I'm using Azure AD Follow logs in php-errors.log

[2022-10-18 23:03:55] glpiphplog.CRITICAL: *** Uncaught Exception Twig\Error\LoaderError: The "../../../templates" directory does not exist ("/usr/share/glpi/../../../templates"). in /usr/share/glpi/vendor/twig/twig/src/Loader/FilesystemLoader.php at line 92 Backtrace : ...or/twig/twig/src/Loader/FilesystemLoader.php:78 Twig\Loader\FilesystemLoader->addPath() ...or/twig/twig/src/Loader/FilesystemLoader.php:45 Twig\Loader\FilesystemLoader->setPaths() ...pi/src/Application/View/TemplateRenderer.php:71 Twig\Loader\FilesystemLoader->construct() ...i/src/Application/View/TemplateRenderer.php:134 Glpi\Application\View\TemplateRenderer->construct() /usr/share/glpi/src/Html.php:1396 Glpi\Application\View\TemplateRenderer::getInstance() /usr/share/glpi/src/Html.php:2143 Html::includeHeader() /usr/share/glpi/plugins/phpsaml/front/acs.php:61 Html::nullHeader()

[2022-10-18 23:04:01] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "REQUEST_URI" in /usr/share/glpi/plugins/phpsaml/setup.php at line 145 Backtrace : src/Plugin.php:294 plugin_init_phpsaml() src/Plugin.php:248 Plugin::load() inc/includes.php:86 Plugin->init() front/cron.php:41 include()

[2022-10-18 23:04:01] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "REQUEST_URI" in /usr/share/glpi/plugins/phpsaml/setup.php at line 145 Backtrace : src/Plugin.php:294 plugin_init_phpsaml() src/Plugin.php:248 Plugin::load() inc/includes.php:86 Plugin->init() front/cron.php:41 include()

[2022-10-18 23:04:01] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "REQUEST_URI" in /usr/share/glpi/plugins/phpsaml/setup.php at line 161 Backtrace : src/Plugin.php:1491 plugin_post_init_phpsaml() src/Plugin.php:251 Plugin::doHook() inc/includes.php:86 Plugin->init() front/cron.php:41 include()

[2022-10-18 23:04:01] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "REQUEST_URI" in /usr/share/glpi/plugins/phpsaml/setup.php at line 161 Backtrace : src/Plugin.php:1491 plugin_post_init_phpsaml() src/Plugin.php:251 Plugin::doHook() inc/includes.php:86 Plugin->init() front/cron.php:41 include()

[2022-10-18 23:05:01] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "REQUEST_URI" in /usr/share/glpi/plugins/phpsaml/setup.php at line 145 Backtrace : src/Plugin.php:294 plugin_init_phpsaml() src/Plugin.php:248 Plugin::load() inc/includes.php:86 Plugin->init() front/cron.php:41 include()

[2022-10-18 23:05:01] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "REQUEST_URI" in /usr/share/glpi/plugins/phpsaml/setup.php at line 145 Backtrace : src/Plugin.php:294 plugin_init_phpsaml() src/Plugin.php:248 Plugin::load() inc/includes.php:86 Plugin->init() front/cron.php:41 include()

derricksmith commented 2 years ago

on line 145 in setup.php, if you change

if (isset($_SERVER['REQUEST_URI']) && (strpos($_SERVER['REQUEST_URI'], 'plugins/phpsaml/front/config.php') || strpos($_SERVER['REQUEST_URI'], 'plugins\phpsaml\front\config.php'))){

to

if (array_key_exists( 'REQUEST_URI', $_SERVER ) && (strpos($_SERVER['REQUEST_URI'], 'plugins/phpsaml/front/config.php') || strpos($_SERVER['REQUEST_URI'], 'plugins\phpsaml\front\config.php'))){

does it resolve the issue?

SilvaFernando commented 1 year ago

Hi @derricksmith.

Sorry, i'm testing tthis now, and error on line 146 stoped, now i have just on line 162: image image

Thanks @derricksmith for your help.

SilvaFernando commented 1 year ago

Hi @derricksmith.

This issue is solved, on line 162 i commented this:

   #if (strpos($_SERVER['REQUEST_URI'], 'front/logout.php') || strpos($_SERVER['REQUEST_URI'], 'front\logout.php')){

And add this: if (array_key_exists( 'REQUEST_URI', $_SERVER ) && (strpos($_SERVER['REQUEST_URI'], 'plugins/phpsaml/front/logout.php') || strpos($_SERVER['REQUEST_URI'], 'plugins\phpsaml\front\logout.php'))){

After this I don't have more error in my PHP-errors log.

I think, this corretions can be merged on plugin, if you appove.

Thanks.