> For the complete documentation index, see [llms.txt](https://trillo.gitbook.io/trillo-workbench/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trillo.gitbook.io/trillo-workbench/openid-connect-oidc-for-identity/okta-integration.md).

# Okta Integration

To integrate Okta Identity with Trillo Workbench, the first step involves setting up an Okta account. This process is handled conveniently on the Okta website, as described below.

## Registering applications with Okta

Refer to the following page on the Okta website for registering a new application.

[Create an OIDC Web App in the Okta Admin Console](https://support.okta.com/help/s/article/create-an-oidc-web-app-in-dashboard?language=en_US)

## Writing Mapping Function

Okta function for mapping the user profile is shown below.

```
public class OktaUserProfileMapper implements Loggable, TrilloFunction {

  public Object handle(ScriptParameter scriptParameter) {

    try {
      return _handle(scriptParameter);
    } catch (Exception e) {
      log().error("Failed", e);
      return Result.getFailedResult(e.getMessage());
    }
  }

  @SuppressWarnings("unchecked")
  private Object _handle(ScriptParameter scriptParameter) {
    Map<String, Object> idpUser = (Map<String, Object>)scriptParameter.getV();
    Map<String, Object> trilloUser = mapUserProfile(idpUser);
    return trilloUser;
  }
  
  private Map<String, Object> mapUserProfile(Map<String, Object> idpUser) {
    Map<String, Object> trilloUser = new LinkedHashMap<String, Object>();
    trilloUser.put("firstName", idpUser.get("given_name"));
    trilloUser.put("lastName", idpUser.get("family_name"));
    trilloUser.put("externalId", idpUser.get("sub"));
    trilloUser.put("emailAddress", idpUser.get("email"));
    return trilloUser;
 }
}
```
