Skip to content

Instantly share code, notes, and snippets.

@RackerWilliams
Created June 29, 2017 21:11
Show Gist options
  • Save RackerWilliams/73fcc5fdbab0153e42b3af00ebcbee9d to your computer and use it in GitHub Desktop.
Save RackerWilliams/73fcc5fdbab0153e42b3af00ebcbee9d to your computer and use it in GitHub Desktop.
JSON attribute mapping rule with a complex XPath
{
"mapping": {
"rules": [
{
"remote": [
{
"path": "(:\n If the number of seconds is even, then the role should be\n nova:admin and lbaas:admin\n\n Otherwise the roles should be nova:observe and lbaas:observer.\n:)\nif ((xs:integer(seconds-from-time(current-time())) mod 2) = 0)\n then ('nova:admin','lbaas:admin')\n else ('nova:observer','lbaas:observer')\n",
"multiValue": true
}
],
"local": {
"user": {
"domain": "78334",
"name": "{D}",
"email": "{D}",
"roles": "{0}",
"expire": "{D}"
}
}
}
],
"version": "RAX-1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment