Configuring a Custom Username Format for SAML Applications in Okta
Last Updated:
Overview
Configuring a custom username format, such as <DOMAIN>\<username>, for Security Assertion Markup Language (SAML) applications in Okta requires modifying the application sign-on settings and defining custom SAML attribute statements. Administrators must customize attributes using the Okta Expression Language (OEL) to ensure the correct username format passes to the application during authentication.
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Security Assertion Markup Language (SAML) Applications
- Custom Username Format
Solution
How is a custom username format configured?
Modify the application username format in the Okta Admin Console and apply an Okta Expression Language (OEL) statement to customize the attribute.
- In the Okta Admin Console, navigate to Applications > Applications.
- Select the SAML application.
- Select the Sign On tab and select Edit.
- Choose Custom from the Application username format dropdown menu.
- Enter the OEL statement to customize the attributes.
- The following OEL statement example converts a username like
<ExampleUser@example.com>into a<DOMAIN>\<exampleuser>format."<PUTYOURDOMAINHERE>" + "\" + String.toLowerCase(String.substringBefore(user.login, '@'))
- The following OEL statement example converts a username like
The Custom SAML Attribute Statements Require Configuration in the Profile Editor
Identify the user attribute variable name in the Profile Editor and add the custom attribute to the SAML application settings.
- In the Okta Admin Console, navigate to Directory > Profile Editor.
- Examine the User (default) profile to identify the variable name of the user attribute. For example, the user attribute for the username combines the profile variable name with the username variable name, resulting in
user.login.
- Navigate to Applications > Applications and select the SAML application.
- Select the Sign On tab and scroll to the Attribute Statements section.
- Expand the Show legacy configuration section and select Edit.
- Enter the name of the SAML attribute in the Name field and the variable for the user attribute in the Value field within the Profile Attribute Statements section.
- Select Save to finalize the changes.
