SocialiteProviders / Providers

A Collection of Providers for Laravel Socialite
https://socialiteproviders.com
MIT License
506 stars 445 forks source link

SocialiteProviders\Saml2\Provider::getFirstAssertion(): Return value must be of type LightSaml\Model\Assertion\Assertion #1248

Open Koni-DFX opened 3 months ago

Koni-DFX commented 3 months ago

Hi,

we are encountering an error when attempting to use SAML2 authentication with LibreNMS.

The Error Message is:

SocialiteProviders\Saml2\Provider::getFirstAssertion(): Return value must be of type LightSaml\Model\Assertion\Assertion, null returned {"exception":"[object] (TypeError(code: 0): SocialiteProviders\\Saml2\\Provider::getFirstAssertion(): Return value must be of type LightSaml\\Model\\Assertion\\Assertion, null returned at /librenms/vendor/socialiteproviders/saml2/Provider.php:482)"}

System Information:

LibreNMS Version: librenms-24.7.0v0/librenms-24.8.0v0
Operating System: OpenBSD 7.5
PHP Version: php-8.2.22
socialiteproviders/saml2 4.7.2
litesaml/lightsaml v4.2.0

SAML2 Setup Details:

We have configured the SAML2 authentication by following these steps:

LibreNMS Configuration: We executed the following commands to configure SAML2:
lnms config:set auth.socialite.redirect false
lnms config:set auth.socialite.register true
lnms config:set auth.socialite.configs.saml2.listener "\SocialiteProviders\Saml2\Saml2ExtendSocialite"
lnms config:set auth.socialite.configs.saml2.metadata "$(cat metadata-file.xml)"
lnms config:set auth.socialite.configs.saml2.sp_default_binding_method urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST lnms config:clear`

services.php Configuration: We added the following SAML2 configuration to our services.php file:

   'saml2' => [     'sp_certificate' => file_get_contents('/etc/saml2/certs/certs/our-cert.crt'),       
      'sp_private_key' => file_get_contents('/etc/saml2/certs/private/our-key.pem'),       
      'sp_sign_assertions' => true, // or false to disable assertion signing     'sp_acs' =>  
      'auth/saml2/callback',     'listener' => '\SocialiteProviders\Saml2\Saml2ExtendSocialite',   
    l],

app.php Configuration: Additionally, we modified app.php as follows:

       'providers' => ServiceProvider::defaultProviders()->merge([     
       Laravel\Socialite\SocialiteServiceProvider::class,       
       \SocialiteProviders\Manager\ServiceProvider::class, ... ])`