This is because the SAML mappings are always read from the user
object only. In the first line of your mapping, you have set "user_id"
- so when the actual mapping happens later the mapper will look for user.user_id
. But there is no user.client_metadata.ChannelName
so the latter part of the mapping does not work.
A trick here is to attach the attributes to the user
object temporarily. For example:
user.client_metadata = client_metadata;
Now, when you specify client_metadata.ChannelName
in the mapping, the mapper will later check for user.client_metadata.ChannelName
which actually exists, so it’ll work.
This does not update the actual user profile. It’s just a temporary assignment that gets discarded later.