# Attribute definition (addon federation)

## Description

<p class="callout success">The attribute definition page displays all the **auto-generated user attributes**. Those attributes will be the attributes to deliver from the identity providers to the service providers depending on the defined rules.</p>

Soffid has a default implementation for common attributes like FullName or uid, but you can modify it by creating a custom script.

<p class="callout warning">Please note that this screen is available in the federation addon.</p>

## Screen overview

[![image.png](https://bookstack.soffid.com/uploads/images/gallery/2025-08/scaled-1680-/abpJHUudVdSiVQsE-image.png)](https://bookstack.soffid.com/uploads/images/gallery/2025-08/abpJHUudVdSiVQsE-image.png)

## <span data-sheets-root="1">Related objects</span>

- <span data-sheets-root="1">[Attribute definition](https://bookstack.soffid.com/books/soffid-4-reference-guide/page/attribute-definition-addon-federation "Attribute definition (addon federation)") : where the list of possible attributes to be returned in the IdP response is defined</span>
- <span data-sheets-root="1">[Attribute sharing policies](https://bookstack.soffid.com/books/soffid-4-reference-guide/page/attribute-sharing-policies-addon-federation "Attribute sharing policies (addon federation)") : where policies are defined with the attributes to be sent according to the authenticated service provider</span>
- <span data-sheets-root="1">[Identity providers](https://bookstack.soffid.com/books/soffid-4-reference-guide/page/identity-providers-addon-federation "Identity providers (addon federation)") : configuration of the identity providers</span>
- <span data-sheets-root="1">[Service providers](https://bookstack.soffid.com/books/soffid-4-reference-guide/page/service-providers-addon-federation "Service Providers (addon federation)") : configuration of the service providers</span>
- <span data-sheets-root="1">[Metadata](https://bookstack.soffid.com/books/soffid-4-reference-guide/page/metadata "Metadata") : where user attributes are defined</span>

## <span data-sheets-root="1">Standard attributes</span>

- **Name**: a descriptive name.
- **ShortName**: short name to be used by SAML 2 service providers (without blanks).
- **Oid**: OID to be used by SAML 1 and SAML 2 service providers.
- **OpenID name**: OpenID name to be used by OAuth and OpenID connect service provider.
- **Radius identifier**: Radius ID name.
- **Value**: an attribute value. Allows you to define a script to determine the value of the attribute.

## <span data-sheets-root="1">Actions</span>

### <span data-sheets-root="1">Table actions</span>

<table border="1" id="bkmrk-download-csv-file-al" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 25.5038%;"></col><col style="width: 74.4854%;"></col></colgroup><tbody><tr><td>**Download CSV file**</td><td>Allows you to download a csv file with the data included in the table.</td></tr><tr><td>**Import**

</td><td>Allows you to upload a CSV file with the attribute list to add or update them.

First, you need to pick up a CSV file, that CSV has to contain a specific configuration. Then you need to check the content to be loaded, it is allowed to choose if you want or not to load a specific attribute. And finally, you need to select the mappings for each column of the CSV file to import the data correctly and to click the Import button.

</td></tr><tr><td>**Add new**

</td><td>Allows you to add a new attribute. To add a new attribute it will be mandatory to fill in the required fields.

</td></tr><tr><td>**Delete attribute**

</td><td>Allows you to delete one or more attributes by selecting one or more records and next clicking this button. To perform that action, Soffid will ask you for confirmation, you could confirm or cancel the operation.

</td></tr></tbody></table>

### Detail actions

<table border="1" id="bkmrk-apply-changes-%28disk-" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 26.0998%;"></col><col style="width: 73.8894%;"></col></colgroup><tbody><tr><td>**Apply changes (disk button)**

</td><td>Allows you to save the data of a new attribute or to update the data of a specific attribute. To save the data it will be mandatory to fill in the required fields.

</td></tr><tr><td>**Delete parameter**

</td><td>Allows you to delete a specific Soffid parameter. To delete a parameter you can click on the "three points" icon and then click the delete parameter button.

Soffid will ask you for confirmation to perform that action, you could confirm or cancel the operation.

</td></tr><tr><td>**Undo**

</td><td>Allows you to quit without applying any changes.

</td></tr><tr><td>**Apply changes**

</td><td>Allows you to save the data of a new attribute or to update the data of a specific attribute. Once you apply changes, the plugin details page will be closed.

</td></tr></tbody></table>

## Examples

### Scripts

Soffid IdP has a default implementation for common attributes like FullName or uid, but you can modify it by creating a custom script. You can use the custom script to define the value of an attribute.

Examples to define the value of an attribute.

#### Example 1

Return full name in upper case:

```Java
return fullName.toUpperCase();
```

#### Example 2

Send one value if an attribute is blank. Otherwise, its value:

```Java
return
    attributes{"company"} == null ||
    attributes{"company"}.isEmpty() ?
        "Soffid" :
        attributes{"company"}
```

#### Example 3

Use serverService to fech the OU attribute of the account owned by the user in the Active Directory (AD) system:

```JSON
for (account: serverService.getUserAccounts(id, "ad")) {
    return account{"attributes"}{"ou"};
}
return null;
```

#### Example 4

Return the secondary groups of the user.

```
var groups = serviceLocator.getGroupService().findUsersGroupByUserName(userName);
var list = "";
for (var i=0; i<groups.size(); i++) {
  group = groups.get(i);
  if (list.length()>1)
    list = list+",";
  list = list+group.group;
}
return list;
```

#### Example 5

Retrive custom attributes of a holdergroup

```
if (holderGroup!=null) {
  ug = serviceLocator.getGroupService().findUserGroupByUserNameAndGroupName(userName, holderGroup);
  if (ug!=null && ug.attributes!=null && ug.attributes{"customAttribute"}!=null)
    return ug.attributes{"customAttribute"};
}
return null;
```