Token fields configuration
18.10.2.2.1. Configuring the fields for a token

To manage a token, the fields of a token need to be configured to appear in the UI. Before configuring the UI, the REST endpoint that provides the data for the UI has to be defined via Generic Token Controller >> Token Endpoint >> Token Repository >> Token Attribute Mapping (the token attribute mapping may be implemented differently if using a customer-specific GenericTokenRepository implementation).

Only the needed fields have to be mapped and all other entries can be left blank. In case you map more fields than required by the UI, this only means that additional data is provided by the REST API.

If the functionality of enabling/disabling a token in the UI is required, the value of Enabled must be mapped to enabled. Otherwise, the buttons do not appear in the UI once the token was saved.

The visible UI fields can be defined in Generic Token Controller >> User Interface >> Components. For example, to access the mapped 'myData' attribute, the corresponding input field is:

56460918.png

The UI refers to the configured attribute mapping by defining the Value setting. In the above example, this is data.attributes.myData. The prefix "data.attributes" is according to IAM's REST interface definition, while "myData" is exactly what was configured in the attribute mapping above.

In this example, the input field also defines that an input is required and what pattern it must fulfill (only alphanumeric strings).

Hint

If you are unsure about how to reference an attribute (e.g. data.attributes.myData) or if your data does not show in the UI, the following procedure may help:

  • Open the configured UI in the browser
  • Open the browser's "developer tools" where you can see what data is exchanged between the browser and the REST API (most browsers support this)
  • Click on the tab of your generic credential controller, so the data for the tab is loaded from the REST API
  • Look at the REST response containing your data

In the above example, the data sent to the client would look as follows (note the "myData" attribute and how it relates to the value "data.attributes.myData" in the above configuration example):

REST Response

{  
   "meta":{...}
   "data":[  
      {  
         "type":"user.token.generic",
         "id":"f088cf40-6995-11e7-9bfb-c241ed9b4fdd",
         "attributes":{  
            "myData":"some data",
            "other":"attribute	"
         }
      }
   ]
}