Created
April 24, 2019 20:30
-
-
Save saltukalakus/2d8396eb87799b35b89fecfd00274e77 to your computer and use it in GitHub Desktop.
Insert the groups which starts with a case insensitive keyword into the ID token with an Auth0 rule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (user, context, callback) { | |
const namespace = 'https://acme.com/'; | |
const KEY_WORD = "ruler"; // Any groups which start with Ruler is inserted. | |
function selectGroups(group) { | |
return group.toLowerCase().indexOf(KEY_WORD) === 0; | |
} | |
context.idToken[namespace + 'groups'] = user.groups && | |
user.groups.filter(selectGroups); | |
callback(null, user, context); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment