Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-14044

Change Anonymous API Authentication To A Declared User

    XMLWordPrintableJSON

Details

    Description

      When using api.authenticate=false, REST requests to the Ambari APIs don't need to contain any user information. As a result, new code being placed which assumes an authenticated user will throw NPE exceptions:

            // Ensure that the authenticated user has authorization to get this information
            if (!isUserAdministrator && !AuthorizationHelper.getAuthenticatedName().equalsIgnoreCase(userName)) {
              throw new AuthorizationException();
            }
      
      java.lang.NullPointerException
      	at org.apache.ambari.server.controller.internal.ActiveWidgetLayoutResourceProvider.getResources(ActiveWidgetLayoutResourceProvider.java:156)
      	at org.apache.ambari.server.controller.internal.ClusterControllerImpl$ExtendedResourceProviderWrapper.queryForResources(ClusterControllerImpl.java:946)
      	at org.apache.ambari.server.controller.internal.ClusterControllerImpl.getResources(ClusterControllerImpl.java:132)
      	at org.apache.ambari.server.api.query.QueryImpl.doQuery(QueryImpl.java:512)
      	at org.apache.ambari.server.api.query.QueryImpl.queryForResources(QueryImpl.java:381)
      	at org.apache.ambari.server.api.query.QueryImpl.execute(QueryImpl.java:217)
      

      Recommend changing this option to something like

      api.authenticated.user=admin
      

      This will preserve the existing functionality while allowing the new code to continue to assume authenticated users.

      Attachments

        1. AMBARI-14044_trunk_02.patch
          27 kB
          Robert Levas
        2. AMBARI-14044_trunk_01.patch
          28 kB
          Robert Levas

        Issue Links

          Activity

            People

              rlevas Robert Levas
              rlevas Robert Levas
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: