Skip to content

Instantly share code, notes, and snippets.

@hadrianhu
Created May 30, 2017 18:33
Show Gist options
  • Save hadrianhu/3a58b9ce79f7e68e85c56c2a2e718cb1 to your computer and use it in GitHub Desktop.
Save hadrianhu/3a58b9ce79f7e68e85c56c2a2e718cb1 to your computer and use it in GitHub Desktop.
/**
* OUTER LOOP - THIS IS THE LOOP OF CLIENT
*/
for (Auth0Client client : clientList) {
log("checking client:" + client.name);
/**
* INNER LOOP - FOR EACH CLIENT YOU ARE LOOPING THROUGHT THE LIST OF RULES
* AND CHECKING THE CLIENT NAME IN THE SCRIPTS FIELD
*/
for (Auth0Rules rule : rulesList) {
//CREATE THE STRING TO CHECK FOR WHICH INCLUDES THE CLIENT NAME
String checkString = "context.clientName === '" + client.name + "'";
//CHECK IF THE RULES FIELD CONTATINS THE CHECK STRING WITH THE APPLICATION NAME
if (rule.script.contains(checkString)) {
log("rule contains checkString:" + checkString);
client.rule = rule;
log("rule set to:" + client);
} else {
// log("rule does not contain not setting..");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment