Normally you would negotiate with the IdP what user information needs to be included in the SAML assertion and what SAML attributes names etc should be used.
You can ask the IdP to supply the information you require using the SAML attribute names you expect.
If they can't or won't, your code will have to handle the different SAML attributes names etc. Trying different attribute names as per the code you included is a good approach.
Regards ComponentSpace Development
|