Adding dynamic application attributes

Dynamic application attributes are attributes which are based on an expression rather then a specific field or value. A example of a dynamic attribute might be a value representing a end users full name, which must be constructed from other elements such as "First name", followed by a space, followed by "Last name" or something similar. Access Gateway can be used to send the result of a dynamic attribute

Topics

Develop expression

Its beneficial to develop and test your expression before adding a new dynamic attribute.

To develop and test a dynamic attribute:

  1. Sign in to your Okta org as an admin.
  2. Select Directory > Profile Editor.
  3. Select the application which requiresthe new dynamic attribute.
  4. In the attributes section, click Add Attribute.
  5. Add a String based attribute, entering appropriate Display and Variable names.
  6. Click Save.
  7. Click Mappings.
  8. Click Okta to <application name>.
  9. Enter the expression which represents the value of the dynamic attribute value.
    For example: String.toUpperCase(user.firstName + " " + user.lastName).
    See the Expressions section for details on creating expressions.
    For example:
  10. In the preview section, select an appropriate user and click Enter.
  11. Examine the result.
    Correct any expression errors and repeat as required.
  12. When complete click Exit Preview.
  13. Copy the finished expression for use in the Add a new dynamic attribute section.
  14. Click Cancel.
  15. The test attribute can now be deleted.

 

Add a new dynamic attribute

  1. Navigate to the Access Gateway Admin UI console.
  2. From the Topology tab or the Applications tab, open the application.
  3. Select the Attributes pane.

    The list of known attributes for the application displays and is similar to:


    . . .
  4. Click Add () in the attribute list header.
    The New Attribute dialog box appears. You may need to scroll the list as new attributes are added at the bottom of the page.
  5. From the Data Source drop-down box, select an IDP .
    Computed attributes can only be used with IDP as a data source.
  6. From the Type drop-down box, select the appropriate target type, either Header or Cookie.
  7. In the Name field, enter the name for the header or cookie value expected by the protected Web Resource.
  8. Select the value in the Field field, and using the delete key, delete its contents.
    Note the error This field is required, will be displayed and can be ignored.
  9. Enter an dynamic attribute expression.
    For example: String.toUpperCase(user.firstName+"_"+user.lastName)
    Tip

    Tip

    Expressions for dynamic attributes must be added by typing the expressing into the Field field and then hitting enter.
    Expressions cannot be cut and pasted into this field.

  10. Click Okay when complete.

Expressions

You can use expressions to concatenate attributes, manipulate strings, convert data types, and more. Expressions within attribute definitions let you construct wholly new values before they are added to headers or cookies.

Okta supports a subset of Spring Expression Language (SpEL) functions. For a comprehensive list of the supported functions, see the Okta Expression Language.

 

Expressions are combinations of:

  • Variables - These are the elements found in your Okta user profile.  Examples include user followed by any of the fields listed.  For example, user.firstName, user.lastName, user.email and a host of others. Note that the list of fields is case sensitive, and that firstName is not the same as firstname or FirstName. For a complete list of user variables sign in to your Okta org and navigate to Directory > Profile Master > Okta Profile.
  • Operations - used to concatenate or otherwise operate on variables. In the example given "+", the plus sign, concatenates two objects together.
  • Functions - used to modify or manipulate variables to achieve a desired result. In the example given, String.toUpperCase returns an all upper case version of its provided input.
    for a complete list of functions see Functions in Okta Expression Language.

Test

Testing computed attributes is most easily done using the Access Gateway sample header application.

To test an expression:

  1. Add a example header application by following the instructions for Add a sample header application.
  2. Modify the application as described in the section Add a new dynamic attribute.
  3. In an incognito or equivalent window connect to Access Gateway as Admin, navigate to the test application and select Goto > SP Initiated.
  4. Login as required.
  5. Examine the result of the computed field.
Important Note

Important

An incognito browser window it used to avoid page caching which can in some instances cause unexpected or stale results.

Related topics

Okta Expression Language