simplesamlphp / saml2

SimpleSAMLphp low-level SAML2 PHP library
https://www.simplesamlphp.org
GNU Lesser General Public License v2.1
284 stars 135 forks source link

PHP SimpleSAML Throwing an ERROR #342

Closed AdnanLatif closed 1 year ago

AdnanLatif commented 1 year ago

I am using PHP SimpleSAML for one of my projects. I already configured it with some other projects. But now I am facing the issue.

I am using it with CodeIgniter 4. Below is the code snippet. The code snippet works on two other projects without changes in spaces.

require_once ('/var/simplesamlphp/lib/_autoload.php');
public function getEmployeeInformation(){

        try {

            $auth = new \SimpleSAML\Auth\Simple('default-sp');
            $auth->requireAuth();
            \SimpleSAML\Session::getSessionFromRequest()->cleanup();
            $attrs = $auth->getAttributes();
            return $attrs;
        } catch (Exception $e) {
            $simplesamlError = $e->getMessage();
            log_message('ERROR', 'SimpleSamlPHP call error: ' . $simplesamlError);
            throw new Exception('SimpleSamlPHP call error: ' . $simplesamlError);
        }

    }
$auth->requireAuth(); at that it throws an error 
(SimpleSAML_exception_handler)
1 vendor/symfony/error-handler/ErrorHandler.php:607 (Symfony\Component\ErrorHandler\ErrorHandler::handleException)
0 [builtin] (N/A)
Caused by: Exception: The POST data we should restore was lost.
tvdijen commented 1 year ago

The POST-data is stored into the PHP session and then recovered later. If the recovery of the POST-data fails, it means you probably have an issue with your PHP session (storage).

What is your store.type setting set to in config.php? If it's phpsession, you should probably go over your PHP Session config (php.ini) and perhaps you can compare them with the other projects that do work?

AdnanLatif commented 1 year ago

Yes, you are right we are using 'store.type' => 'phpsession', I compared all the ini files where it is working but still getting the same error. We are using it with CodeIgniter 4 and Codeigniter using its own session. Which are behind the scene PHP sessions.

tvdijen commented 1 year ago

I have no idea what 'CodeIgniter' is, but since you have working projects, you have to look for the solution in your own specific environment. I don't think anyone here is able to help you.

And, I can't stress this enough, this is an issue tracker, not a support forum.