{
  "category": "User Attribute Based",
  "name": "Role Based",
  "img": "./images/user.gif",
  "code": [
    "function onInitialRequest(context) {",
    "   executeStep({",
    "       id: '1',",
    "       on: {",
    "           success: function (context) {",
    "               // Extracting authenticated subject from the first step",
    "               var user = context.steps[1].subject;",
    "               // Checking if the user is assigned for the given role",
    "               var isAdmin = hasRole(user, 'ROLE-NAME-PLACEHOLDER');",
    "               Log.info(user.username + ' Has Admin Role: ' + isAdmin);",
    "               if (isAdmin) {",
    "                   executeStep({id: '2'});",
    "	                executeStep({id: '3'});",
    "               }",
    "           }",
    "       }",
    "   });",
    "}"
  ],
  "help": "Define conditional authentication based on user role.",
  "helpLink": "https://docs.wso2.com/display/IS560/WSO2+Identity+Server+Documentation"
}

{
  "category": "User Attribute Based",
  "name": "Role Based",
  "img": "./images/user.gif",
  "code": [
    "function onInitialRequest(context) {",
    "   executeStep({",
    "       id: '1',",
    "       on: {",
    "           success: function (context) {",
    "               // Extracting authenticated subject from the first step",
    "               var user = context.steps[1].subject;",
    "               // Checking if the user is assigned for the given role",
    "               var isAdmin = hasRole(user, 'admin');",
    "               Log.info(user.username + ' Has Admin Role: ' + isAdmin);",
    "               if (isAdmin) {",
    "                   executeStep({id: '2'});",
    "	                executeStep({id: '3'});",
    "               }",
    "           }",
    "       }",
    "   });",
    "}"
  ],
  "help": "Define conditional authentication based on user role.",
  "helpLink": "https://docs.wso2.com/display/IS560/WSO2+Identity+Server+Documentation"
}

Change placeholder with example value
Change placeholder with example value

