How can I map attributes inside an array in the user profile when Auth0 is the SAML IdP?

Question:

How can I map attributes within an array in the user profile to SAML response when Auth0 is the SAML IdP?

Answer:

We have a sample for mapping the SAML attributes on this link. The solution works for most cases. However, if the required attributes are within an array in the user profile, then using array notation doesn’t help to map the attributes.

The resolution is to assign the attributes in the array to a temporary attribute on the user object and then use the temporary attribute to map to SAML in the rule.

E.g., I have a fictitious user profile below in which the user location is inside an array. The rule sample shows how to map this location information in the SAML response.