Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-10332

Add ID_TOKEN_LOGOUT support for general OpenID connect server, e.g. Keycloak

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.17.0
    • 1.19.0
    • Core UI
    • None
    • NiFi 1.17.0, Keycloak 18.0.1

    Description

      I deploy a NiFi 1.170 and authenticate with OpenID connect. Authentication server is Keycloak 18.0.1.

      I can log in and I can use UI properly.

      But when I logout. I get an error, can not redirect to NiFi UI or keycloak login UI

      https://36.133.55.100:8943/realms/zznode/protocol/openid-connect/logout?post_logout_redirect_uri=https%3A%2F%2F36.138.166.203%3A18089%2Fhb3-dmz-repos-000-nifi%2Fnifi-api%2F..%2Fnifi%2Flogout-complete

      I made some investigation into source code. I found NiFi only support ID_TOKEN_LOGOUT for okta service. Keycloak and other Authentication server can not be supported.

      Keycloak say it is compliance OpenID connect spec.

      I modified a few lines of source code. Let it support ID_TOKEN_LOGOUT for keycloak. Now I can log out NiFi and redirect to keycloak login UI, and than login NiFi again.

      I suggest making nifi to support ID_TOKEN_LOGOUT in later version for general OpenID connect server.

      I modified the file, https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OIDCAccessResource.java

      start from line 403

          private String determineLogoutMethod(String oidcDiscoveryUrl) {
              Matcher accessTokenMatcher = REVOKE_ACCESS_TOKEN_LOGOUT_FORMAT.matcher(oidcDiscoveryUrl);
              Matcher idTokenMatcher = ID_TOKEN_LOGOUT_FORMAT.matcher(oidcDiscoveryUrl);
       
              if (accessTokenMatcher.find()) {
                  return REVOKE_ACCESS_TOKEN_LOGOUT;
              } else {
                  return ID_TOKEN_LOGOUT;
              }
          }
       
      

       

      Attachments

        Issue Links

          Activity

            People

              thenatog Nathan Gough
              macdoor615 macdoor615
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h