Page 1 of 1

SAML SSO gives us a error

Posted: Thu May 02, 2024 4:22 am
by jeelman

We use Microsoft as SAML provider, this is working fine.

After we login Debug mode gives us the following error:

UserProfile::setUserName(): Argument #1 ($value) must be of type string, null given, called in \src\AdvancedSecurity.php on line 590

Any idea's what we are doing wrong?
Thx for the support.


Re: SAML SSO gives us a error

Posted: Thu May 02, 2024 9:07 am
by arbei

After login, the user name will be saved to the user profile object. The user name is that you use to login SAML IdP or the email returned by it. The user name should not be null if you can login the Idp. In addition, make sure your user profiles on the SAML IdP has email address and you set up Claims and Attributes returning "user.email" as one of the claims (e.g. as "emailaddress" or "email").


Re: SAML SSO gives us a error

Posted: Thu May 02, 2024 2:46 pm
by jeelman

thx for your response:

Email address is avbl in the response:

 <Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress">
    <AttributeValue>JXXXXXXXX@XXXXXXXXX.com</AttributeValue>
   </Attribute>

Re: SAML SSO gives us a error

Posted: Thu May 02, 2024 8:15 pm
by arbei

Then the email address will be set up in the user profile as the "email" property, and the error should not occur since the source code is like:

// src/AdvancedSecurity.php

                    $profile = $adapter->getUserProfile(); // Hybridauth\User\Profile
                    $usr = $usr ?: $profile->email; // If user is null, email from profile will be used.
                    $userProfile->setUserName($usr) ...

You may add some code to debug, e.g. Log($profile); Log($usr); and check your log file.