[
{
"remote": [
{
"<condition>"
}
],
"local": [
{
"<user> or <group> or <groups>"
}
]
}
]
The following examples illustrate how to use the empty, any_one_of, and not_any_of conditions in an identity conversion rule.
[
{
"local": [
{
"user": {
"name": "{0} {1}"
}
},
{
"group": {
"name": "{2}"
}
}
],
"remote": [
{
"type": "FirstName"
},
{
"type": "LastName"
},
{
"type": "Group"
}
]
}
]
In this example, the username of a federated user will be "the value of the first remote attribute+space+the value of the second remote attribute" in the cloud system, that is, FirstName LastName. The group to which the user belongs is the value of the third remote attribute Group. This attribute has only one value.
If the following assertion (simplified for easy understanding) is received, the username of the federated user will be John Smith in the cloud system and the user will only belong to the admin group.
{FirstName: John}
{LastName: Smith}
{Groups: admin}
If a federated user will belong to multiple user groups in the cloud system, the identity conversion rule can be configured as follows:
[
{
"local": [
{
"user": {
"name": "{0} {1}"
}
},
{
"groups": "{2}"
}
],
"remote": [
{
"type": "FirstName"
},
{
"type": "LastName"
},
{
"type": "Groups"
}
]
}
]
In this example, the username of a federated user will be "the value of the first remote attribute+space+the value of the second remote attribute" in the cloud system, that is, FirstName LastName. The groups to which the user belongs are the value of the third remote attribute Groups.
If the following assertion is received, the username of the federated user will be John Smith in the cloud system and the user will belong to the admin and manager groups.
{FirstName: John}
{LastName: Smith}
{Groups: [admin, manager]}
[
{
"local": [
{
"user": {
"name": "{0}"
}
},
{
"group": {
"name": "admin"
}
}
],
"remote": [
{
"type": "UserName"
},
{
"type": "Groups",
"any_one_of": [
"idp_admin"
]
}
]
}
]
The username of the federated user in the cloud system is the value of the first remote attribute, that is, UserName. The federated user belongs to the admin group. This rule takes effect only for users who are members of the idp_admin group in the identity provider system.
If a federated user will belong to multiple user groups in the cloud system, the identity conversion rule can be configured as follows:
[
{
"local": [
{
"user": {
"name": "{0}"
}
},
{
"groups": "[\"admin\",\"manager\"]"
}
],
"remote": [
{
"type": "UserName"
},
{
"type": "Groups",
"any_one_of": [
"idp_admin"
]
}
]
}
]
The username of the federated user in the cloud system is the value of the first remote attribute, that is, UserName. The federated user belongs to the admin and manager groups. This rule takes effect only for users who are members of the idp_admin group in the identity provider system.
{UserName: John Smith}
{Groups: [idp_user, idp_admin, idp_agency]}
{UserName: John Smith}
{Groups: [idp_user, idp_agency]}
[
{
"local": [
{
"user": {
"name": "{0}"
}
},
{
"group": {
"name": "admin"
}
}
],
"remote": [
{
"type": "UserName"
},
{
"type": "Groups",
"any_one_of": [
".*@mail.com$"
],
"regex": true
}
]
}
]
This rule takes effect for any user whose username ends with @mail.com. The username of each applicable federated user is UserName in the cloud system and the user belongs to the admin group.
[
{
"local": [
{
"user": {
"name": "{0}"
}
},
{
"group": {
"name": "admin"
}
}
],
"remote": [
{
"type": "UserName"
},
{
"type": "Groups",
"not_any_of": [
"idp_user"
]
},
{
"type": "Groups",
"not_any_of": [
"idp_agent"
]
}
]
}
]
This rule takes effect only for the federated users who do not belong to the idp_user or idp_agent user group in the identity provider system. The username of each applicable federated user is UserName in the cloud system and the user belongs to the admin group. The preceding rule is equivalent to the following:
[
{
"local": [
{
"user": {
"name": "{0}"
}
},
{
"group": {
"name": "admin"
}
}
],
"remote": [
{
"type": "UserName"
},
{
"type": "Groups",
"not_any_of": [
"idp_user",
"idp_agent"
]
}
]
}
]
If multiple rules are combined, the methods for matching usernames and user groups are different.
The name of a federated user will be the username matched in the first rule that takes effect, and the user will belong to all groups matched in all rules that take effect. A federated user can log in only if at least one rule takes effect to match the username.
For easy understanding, username and user group rules can be configured separately.
[
{
"local": [
{
"user": {
"name": "{0}"
}
}
],
"remote": [
{
"type": "UserName"
}
]
},
{
"local": [
{
"group": {
"name": "admin"
}
}
],
"remote": [
{
"type": "Groups",
"any_one_of": [
"idp_admin"
]
}
]
}
]
In this example, the rules take effect for users in the idp_admin group. The username of each applicable federated user is UserName in the cloud system and the user belongs to the admin group.
The following assertion indicates that user John Smith is a member of the idp_admin group in the identity provider system and therefore meets the rules. The username of this user will be John Smith in the cloud system, and the user will belong to the admin group.
{UserName: John Smith}
{Groups: [idp_user, idp_admin, idp_agency]}