What SAML attributes are
The NameID says who the user is. Attributes say more about them: name, email, department, groups, roles. They travel in the assertion’s saml:AttributeStatement, each as a saml:Attribute with one or more saml:AttributeValue children.
Apps use attributes to fill in the user’s profile, decide permissions and create accounts on first sign-in. Most SAML integration work after the first successful sign-in is about getting the right attributes, with the right names, to the app.
How an attribute is written
<saml:AttributeStatement>
<saml:Attribute Name="urn:oid:2.5.4.42" FriendlyName="givenName"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
<saml:AttributeValue>Alice</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="Role"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue>user</saml:AttributeValue>
<saml:AttributeValue>billing-viewer</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>Name
The identifier apps match on. It is compared as an exact string. mail, email and urn:oid:0.9.2342.19200300.100.1.3 are three different attributes to an app, even though people mean the same thing.
FriendlyName
An optional, human-readable label. SAML core treats it as a convenience for people, not as part of the attribute’s identity, but some apps and some identity providers match on it anyway.
NameFormat
How to read the name. The three standard values are urn:oasis:names:tc:SAML:2.0:attrname-format:basic for simple names, …:uri for names that are URIs, and …:unspecified. Some apps check it along with the name.
Values
An attribute can have several values, such as one per group. Apps differ in whether they expect several AttributeValue elements or one value with a separator. Several elements is the standard way.
The naming families you will meet
LDAP and X.500 OIDs
Directory attributes have numeric object identifiers. SAML profiles for LDAP write them as urn:oid: plus the OID, with the uri name format and the LDAP name as the friendly name. For example urn:oid:2.5.4.42 is givenName and urn:oid:0.9.2342.19200300.100.1.3 is mail.
eduPerson and research federations
Academic federations use the eduPerson schema in the same urn:oid: form, for example eduPersonPrincipalName and eduPersonScopedAffiliation. Values that carry a scope look like name@scope, where the scope is the home organization’s domain.
OASIS subject identifiers
The SAML V2.0 Subject Identifier Attributes profile defines urn:oasis:names:tc:SAML:attribute:subject-id, the same id for every app, and urn:oasis:names:tc:SAML:attribute:pairwise-id, a different id per app. Both are scoped. They are meant to replace older approaches such as eduPersonTargetedID.
Microsoft claim URIs
Microsoft Entra ID and AD FS name attributes with claim type URIs such as http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress. Apps built for those identity providers often expect these names, even when another identity provider sends the assertion.
Plain names
Many apps simply document names such as email, firstName or groups with the basic format. When an app documents its names, use exactly those.
What this reference does
The tool above lists common attributes in each family with their full name, what they hold, and the Keycloak user property they map to where there is a direct one. Filter by friendly name, OID, claim URI or meaning, and copy a name with one click.
The list is not exhaustive. It covers the names that come up most when connecting apps and identity providers. Check the app’s documentation for anything it lists.
Sending attributes from Keycloak
In Keycloak, a SAML client’s attributes come from protocol mappers, set on the client or on client scopes assigned to it. For each attribute the app needs, add a mapper and set three fields: SAML Attribute Name, Friendly Name and SAML Attribute NameFormat, which is Basic, URI Reference or Unspecified.
| Mapper type | Sends |
|---|---|
| User Property | A built-in user field such as username, email, firstName or lastName |
| User Attribute | A custom user attribute you defined |
| Role list | The user’s roles, by default as an attribute named Role |
| Group list | The user’s groups |
| Hardcoded attribute | The same value for every user |
- Open the client, then its client scopes, then the dedicated scope for the client.
- Add a mapper by configuration and pick the type.
- Set the SAML attribute name to exactly what the app expects, the friendly name if the app wants one, and the name format.
- Sign in and read the assertion with the SAML response decoder to confirm.
Receiving attributes in Keycloak
When Keycloak brokers sign-in through another SAML identity provider, mappers on that identity provider decide what to keep. An Attribute Importer mapper reads an attribute, by its name or its friendly name, into a user property such as email, firstName or lastName, or into a user attribute. Without importers, Keycloak still creates the user, but profile fields may be empty and the first broker login flow may ask the user to fill them in.
Use cases
Connecting a SaaS app
SaaS apps usually publish the exact attribute names they read. Copy them from the app’s SAML setup page into Keycloak mappers, one by one, and match the name format they show.
Accepting a customer’s Entra ID or AD FS
When a customer signs in through their Microsoft identity provider, expect claim URIs. Map emailaddress, givenname and surname to Keycloak’s email, first name and last name with Attribute Importer mappers.
Joining a research federation
Federations expect the urn:oid: names with the uri format, and often scoped values. Set both the OID name and the friendly name, because some members match on one and some on the other.
Common problems
- The attribute arrives but the app ignores it: the name or name format differs from what the app expects, often by case.
- Groups arrive as one value with commas when the app expects one value per group, or the other way around.
- Roles are missing: the client’s scope does not include them, for example because Full scope allowed is off and the roles were not added to the client’s scope.
- Email is empty: the user has no email in the directory, or the importer reads the wrong attribute name.
- The app shows a URI as the user’s name: it reads the attribute Name where it should read the value, or the mapping is reversed.
Privacy
Send each app only the attributes it needs. Every extra attribute is personal data the app stores and must protect. In Keycloak, keep client scopes small and avoid adding broad mappers to every client by default.
Multi-valued attributes
Groups, roles and entitlements usually have several values. The standard way is one saml:AttributeValue element per value, all inside one saml:Attribute. Some apps instead expect one value with a separator, such as a comma, and some expect the same attribute repeated. Check the app’s documentation and its sample assertion.
In Keycloak, the Role list and Group list mappers send one value per role or group. The Role list mapper has a Single Role Attribute option; when on, all roles go in one attribute with one value element each, and when off, each role gets its own attribute element. Decode a real assertion to see which shape you are sending.
Naming attributes for your own app
If you are writing the app, you choose the names. A few rules keep integrations easy:
- Accept the common URI names (the
urn:oid:forms and the Microsoft claim URIs) as well as short names, so customers can connect most identity providers without custom mapping. - Let administrators map names in your app’s SAML settings rather than hard-coding one set.
- Match on Name, not FriendlyName.
- Do not rely on email for identity; use the NameID or a stable id attribute.
- Publish a sample assertion in your documentation that shows every attribute you read.