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

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;
 }
}

Last updated