# Multivalued attributes

**URL:** <https://devforum.okta.com/t/multivalued-attributes/179>\
**Category:** SAML\
**Created:** [June 21, 2017, 3:28am UTC](https://devforum.okta.com/t/multivalued-attributes/179 "2017-06-21T03:28:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam.B](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Adam.B](https://devforum.okta.com/u/Adam.B)\
**Post date:** [June 21, 2017, 3:28am UTC](https://devforum.okta.com/t/multivalued-attributes/179/1 "2017-06-21T03:28:33Z")

</div>

Hi there.

I’m looking to make a multi-valued attribute based on several isMemberOfGroupName() functions to provide custom output. Because of this, I can’t use the group attribute statement functionality. The closest I’ve been able to get is creating a new array, but I really don’t want an array - I want a multi-valued attribute… like below

> ```
> <saml2:Attribute Name="groups"
> NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
> >
> <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="xs:string"
> >g1</saml2:AttributeValue>
> <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="xs:string"
> >g4</saml2:AttributeValue>
> </saml2:Attribute>
> 
> ```

I’m hoping it’s something silly I’ve overlooked, but I can’t seem to get it to work. Has anyone had any success?

---

<div class="post-metadata">

**Author:** ![Adam.B](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Adam.B](https://devforum.okta.com/u/Adam.B)\
**Post date:** [June 22, 2017, 4:36pm UTC](https://devforum.okta.com/t/multivalued-attributes/179/2 "2017-06-22T16:36:13Z")

</div>

I’ll include the SAML chunk that applies, maybe that’ll shed some light.

“gid” is an attribute statement we’re generating in the application that references the “appuser.gid” value. Appuser.gid is an array using the function:

`> Arrays.flatten(isMemberOfGroupName("adm-test1") ? "test1" : "",isMemberOfGroupName("adm-test2") ? "test2" : "",isMemberOfGroupName("adm-test3") ? "adm-test3" : "")`

I can make an API call and see it right there in the app user profile:

```
> "profile": {
> "gid": [
> "test1",
> "test2",
> ""
> ]

```

I included both the attribute statement, and the group attribute statement for comparison. I’m not sure if it’s the Arrays.flatten() function that’s screwing with it, but I can’t really create an array with anything else that I can see.

> ```
> <saml2:AttributeStatement xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
> <saml2:Attribute Name="**gid"
> NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
> >
> <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="xs:string"
> >test1,test2,</saml2:AttributeValue>
> </saml2:Attribute>
> <saml2:Attribute Name="groupattributestatement"
> NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
> >
> <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="xs:string"
> >adm-test1</saml2:AttributeValue>
> <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="xs:string"
> >adm-test2</saml2:AttributeValue>
> </saml2:Attribute>
> </saml2:AttributeStatement>
> 
> ```

---

<div class="post-metadata">

**Author:** ![mcguinness](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/mcguinness/32/56_2.png) [@mcguinness](https://devforum.okta.com/u/mcguinness)\
**Post date:** [June 30, 2017, 7:03pm UTC](https://devforum.okta.com/t/multivalued-attributes/179/3 "2017-06-30T19:03:44Z")

</div>

What is your Okta Org name you are using? We have an opt-in feature that changes the way we process multi-value SAML attribute statements and might be what you are looking for.

---

<div class="post-metadata">

**Author:** ![mcguinness](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/mcguinness/32/56_2.png) [@mcguinness](https://devforum.okta.com/u/mcguinness)\
**Post date:** [June 30, 2017, 8:05pm UTC](https://devforum.okta.com/t/multivalued-attributes/179/4 "2017-06-30T20:05:55Z")

</div>

For future reference, the Early Access feature flag is called “SAML\_SUPPORT\_ARRAY\_ATTRIBUTES” which Okta support can enable. It serializes any UD Array attribute as a multi-value SAML attribute statement instead of as a CSV. We added a new Okta EL function to convert Array to CSV if you still need that functionality for an existing app.

---

<div class="post-metadata">

**Author:** ![greg](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@greg](https://devforum.okta.com/u/greg)\
**Post date:** [October 30, 2018, 6:45pm UTC](https://devforum.okta.com/t/multivalued-attributes/179/5 "2018-10-30T18:45:03Z")

</div>

Hello! I’m basically trying to do the same thing. I’ve asked Okta support to enable the “SAML\_SUPPORT\_ARRAY\_ATTRIBUTES” and they say that they have, but I’m not sure how to get it to work. I’ve tried using Arrays.flatten(“a”, “b”) as the value of my attribute statement, but I just get the literal string `Arrays.flatten("a", "b")` as the saml2:AttributeValue, rather than two saml2:AttributeValues.

1. How can I verify that the flag has actually been turned on for my account?
2. What should I type into the Value field in the Attribute Statements section of my SAML app to get multiple AttributeValue fields in my SAML assertion?

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 12, 2024, 11:55pm UTC](https://devforum.okta.com/t/multivalued-attributes/179/6 "2024-01-12T23:55:34Z")

</div>


