Last active
June 29, 2017 21:16
-
-
Save RackerWilliams/3740f5e177a207ad98aed64e5b638ce4 to your computer and use it in GitHub Desktop.
XML attribute mapping rule with complex XPath
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
<?xml version="1.0" encoding="UTF-8"?> | |
<mapping xmlns="http://docs.rackspace.com/identity/api/ext/MappingRules" | |
xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
version="RAX-1"> | |
<rules> | |
<rule> | |
<remote> | |
<attribute multiValue="true" | |
path=" | |
(: | |
If the number of seconds is even, then the role should be | |
nova:admin and lbaas:admin | |
Otherwise the roles should be nova:observe and lbaas:observer. | |
:) | |
if ((xs:integer(seconds-from-time(current-time())) mod 2) = 0) | |
then ('nova:admin','lbaas:admin') | |
else ('nova:observer','lbaas:observer') | |
"/> | |
</remote> | |
<local> | |
<user> | |
<name value="{D}"/> | |
<email value="{D}"/> | |
<expire value="{D}"/> | |
<domain value="78334"/> | |
<roles value="{0}"/> | |
</user> | |
</local> | |
</rule> | |
</rules> | |
</mapping> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment