SAML Populate Lambda add user group names
-
How would I go about constructing a lamdba to add a list of groups a user belongs to to the samlResponse.assertion?
-
I've figured out how to get the groupids in the response but not translate them into group names.
-
I don't believe this is currently possible.
You typically would have to hard code any values to be translated in a populate lambda (for instance). You could add (hard code) a map or hash of sorts that would translate for you. This would be some integration code in the lambda that says:
Hash.new = { <group_id_uuid> = <group_name> } jwt.group_name = Hash[group_id_uuid]
this is obviously pseudo code, but this may be an option (have not tested).
We have a few open issues related to extending the functionality of lambdas you could upvote as well
- https://github.com/FusionAuth/fusionauth-issues/issues/1429
- https://github.com/FusionAuth/fusionauth-issues/issues/1355
- https://github.com/FusionAuth/fusionauth-issues/issues/267
- https://github.com/FusionAuth/fusionauth-issues/issues/571
Another option would be to add more integration code that calls from your app to fusionauth to get the
common_group_name
based on thegroupId
. So if you have a user that gets authenticated, you would translate thegroupId
at a later time by calling this API endpoint from your app.This may present its own challenges but thought I would mention it as well.
Best of luck; hope this helps!
Thanks,
Josh -
@joshua
Thanks. I've up-voted a few of those open issues.Since I'm trying to make this work for a COTS application I don't have the luxury of injecting another API call.
For now I'm pretending that the groupId being returned is the LDAP distiguished name for the group (I prefixed it in the Lambda with dn=). Then I can trick the application to looking up the group by the LDAP dn instead of name.