How to transform a multi-value attribute claims into a single string claim in AAD
Using the multi-values users.AssignedRoles attribute as a claim, creates a saml response like below
<Attribute>
<Attribute Name="AssignedRoles">
<AttributeValue>Sales</AttributeValue>
<AttributeValue>Orders</AttributeValue>
</Attribute>
Is it possible to transform this multi-valued attribute into a custom claim, where the values of the multi-valued attribute have been concatenated or joined into a single string, such as below.
<Attribute>
<Attribute Name="CustomAssignedRoles">
<AttributeValue>Sales:Orders</AttributeValue>
</Attribute>
This is something that is possible in ADFS using claim issuance transform rules. I'm hoping similar functionality is available in AAD.
e.g. of ADFS Claim issuance policy https://aws.amazon.com/blogs/big-data/federate-access-to-amazon-redshift-query-editor-v2-with-active-directory-federation-services-ad-fs-part-3/
- Follow the same steps as in the previous section to create the rule
Marketing
, using the following code for the custom rule:
c:[Type == "http://temp/variable", Value =~ "(?i)^RSDB-marketing"]
=> add(Type = "http://temp/marketing", Value = RegExReplace(c.Value, "RSDB-", ""));
```
1. Create the rule `MarketingNotExists` using the following code:
NOT EXISTS([Type == "http://temp/variable", Value =~ "RSDB-marketing"]) => add(Type = "http://temp/marketing", Value = "");
```
- Create the rule
sales
using the following code:
c:[Type == "http://temp/variable", Value =~ "(?i)^RSDB-sales"]
=> add(Type = "http://temp/sales", Value = RegExReplace(c.Value, "RSDB-", ""));
```
1. Create the rule `SalesNotExists` using the following code:
NOT EXISTS([Type == "http://temp/variable", Value =~ "RSDB-sales"])
=> add(Type = "http://temp/sales", Value = ""); ```
- Create the rule
RedshiftDbGroups
using the following code:
c:[Type == "http://temp/marketing"] && c2:[Type == "http://temp/sales"] => issue(Type = "https://aws.amazon.com/SAML/Attributes/customAssignedRoles", Value = c.Value + ":" + c2.Value);
```
