Thursday, 28 March 2019

How To Configure TLS & Okta Authentication for Apache NiFi

Configure TLS for NiFi

NiFi cannot support any authentication mechanisms unless it is configured to utilize TLS. Note that following these instructions will also change the port that NiFi runs on to TCP 9443.
  1. Back up your existing file on each node in the NiFi cluster.
  2. Download the NiFi Toolkit for your release of NiFi @ and extract it on each node.
  3. Navigate to the toolkit’s bin directory (e.g. /opt/nifi-toolkit/bin/)
  4. Run to generate a truststore, keystore, and updated file with the following syntax:
./ standalone -f <path/to/current/> -n <server_fqdn>
  1. Copy the resultant keystore.jkstruststore.jks, and files to the NiFi instance’s conf/ directory.
  2. Restart NiFi with the following command:
bin/ restart

Create the NiFi Application in Okta

  1. Log in to Okta as an Application Administrator user
  2. Go to Applications -> Add Application
  3. Choose “Web” and click Next
  4. Specify a Name for the application
  5. For “Base URI” specify the URI of NiFi (e.g. https://<nifi_fqdn>:9443/)
  6. For “Login redirect URIs” specify https://<nifi_fqdn>:9443/nifi-api/access/oidc/callback
  7. Click “Done
    1. Note: The UI may hang. If so, just go to the Applications page and your application should now appear
  8. Click on your application, and go to the “General” tab
  9. Copy the “Client ID” and “Client secret” values for later use.


Configure NiFi to use Okta Authentication

  1. Identify the OIDC Discovery URL for your Okta instance
    1. This is a combination of your existing Okta Instance ID, and several static values. For example, if your Okta instance URL is, your Instance ID is

      Combine this with the following URL format to get the OIDC Discovery URL:

  2. Edit conf/
    1. Find the “# OpenId Connect SSO Properties #” section
    2. Set the value of “” to the value identified in Step 1.
    3. Set “” and “” to the values obtained in the ”Create the NiFi Application in Okta” section.
    4. Save your changes, and quit, out of the editor.

      Example configuration:
# OpenId Connect SSO Properties # secs secs

  1. Edit conf/authorizers.xml
    1. Find the first <userGroupProvider> section, and update <property name="Initial User Identity 1"></property> to include the user ID of your desired administrator, e.g.
       <property name="Users File">./conf/users.xml</property>
       <property name="Legacy Authorized Users File"></property>

       <property name="Initial User Identity 1"></property>

    1. Find the <accessPolicyProvider> section, and update <property name="Initial Admin Identity"></property> to include the user ID of your desired administrator, e.g.
       <property name="User Group Provider">file-user-group-provider</property>
       <property name="Authorizations File">./conf/authorizations.xml</property>
       <property name="Initial Admin Identity"></property>
       <property name="Legacy Authorized Users File"></property>

       <property name="Node Identity 1"></property>

    1. Save your changes, and quit, out of the editor.
  1. Restart NiFi with bin/ restart.