Browse Source

AMBARI-21670. Log Search cleanup: all configurations should be spring managed (oleewere)

oleewere 8 years ago
parent
commit
555f241cf0
57 changed files with 1015 additions and 2178 deletions
  1. 1 1
      ambari-logsearch/ambari-logsearch-logfeeder/build.properties
  2. 1 1
      ambari-logsearch/ambari-logsearch-server/build.properties
  3. 74 353
      ambari-logsearch/ambari-logsearch-server/pom.xml
  4. 1 5
      ambari-logsearch/ambari-logsearch-server/run.sh
  5. 21 160
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/LogSearch.java
  6. 15 9
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/ExternalServerClient.java
  7. 1 1
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
  8. 0 124
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java
  9. 0 79
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/XMLPropertiesHelper.java
  10. 2 2
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApiDocConfig.java
  11. 0 2
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
  12. 61 0
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchConfigMapHolder.java
  13. 83 0
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchHttpConfig.java
  14. 37 0
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchJerseyResourceConfig.java
  15. 95 0
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchServletConfig.java
  16. 173 0
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchSpnegoConfig.java
  17. 86 0
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchSslConfig.java
  18. 3 0
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
  19. 49 0
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/StaticResourceConfiguration.java
  20. 7 3
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/LogSearchConfigConfigurer.java
  21. 39 64
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SslConfigurer.java
  22. 0 65
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/util/WebUtil.java
  23. 19 88
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
  24. 2 2
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/listener/LogSearchSessionListener.java
  25. 0 365
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapProperties.java
  26. 0 58
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapPropertyName.java
  27. 0 115
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapUtil.java
  28. 1 1
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
  29. 0 4
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
  30. 0 187
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
  31. 0 46
      ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapBindAuthenticator.java
  32. 0 1
      ambari-logsearch/ambari-logsearch-server/src/main/resources/default.properties
  33. 38 80
      ambari-logsearch/ambari-logsearch-server/src/main/resources/log4j.xml
  34. 0 116
      ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch-admin-site.xml
  35. 3 3
      ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch.properties
  36. 18 18
      ambari-logsearch/ambari-logsearch-server/src/main/resources/swagger/swagger.html
  37. 1 2
      ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh
  38. 21 47
      ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java
  39. 0 61
      ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java
  40. 1 1
      ambari-logsearch/ambari-logsearch-web/build.properties
  41. 2 2
      ambari-logsearch/ambari-logsearch-web/pom.xml
  42. 2 2
      ambari-logsearch/docker/logsearch-docker.sh
  43. 20 15
      ambari-logsearch/docker/test-config/logsearch/log4j.xml
  44. 1 4
      ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
  45. 1 0
      ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
  46. 13 6
      ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImpl.java
  47. 25 3
      ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
  48. 3 3
      ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/alerts.json
  49. 0 14
      ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
  50. 21 0
      ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml
  51. 7 6
      ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
  52. 0 2
      ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
  53. 5 5
      ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/quicklinks/quicklinks.json
  54. 5 5
      ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImplTest.java
  55. 2 0
      ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
  56. 3 2
      ambari-server/src/test/python/stacks/2.4/configs/default.json
  57. 52 45
      ambari-web/app/data/configs/services/logsearch_properties.js

+ 1 - 1
ambari-logsearch/ambari-logsearch-logfeeder/build.properties

@@ -15,4 +15,4 @@ app.pkg.dir=${app.work.dir}/pkg
 app.dev.war.dir=${app.work.dir}/webapps/logsearch
 app.war.name=logsearch.war
 
-app.target.dir=${builddir}/target/classes/webapps/app
+app.target.dir=${builddir}/target/classes/static

+ 1 - 1
ambari-logsearch/ambari-logsearch-server/build.properties

@@ -20,4 +20,4 @@ app.pkg.dir=${app.work.dir}/pkg
 app.dev.war.dir=${app.work.dir}/webapps/logsearch
 app.war.name=logsearch.war
 
-app.target.dir=${builddir}/target/classes/webapps/app
+app.target.dir=${builddir}/target/classes/static

+ 74 - 353
ambari-logsearch/ambari-logsearch-server/pom.xml

@@ -27,17 +27,17 @@
   <url>http://maven.apache.org</url>
   <name>Ambari Logsearch Server</name>
   <properties>
-    <spring.version>4.2.5.RELEASE</spring.version>
-    <spring.security.version>4.0.4.RELEASE</spring.security.version>
+    <spring.version>4.3.10.RELEASE</spring.version>
+    <spring.security.version>4.2.3.RELEASE</spring.security.version>
     <spring.ldap.version>2.0.4.RELEASE</spring.ldap.version>
-    <jersey.version>2.23.2</jersey.version>
-    <jetty-version>9.2.11.v20150529</jetty-version>
-    <swagger.version>1.5.8</swagger.version>
+    <jersey.version>2.25.1</jersey.version>
+    <jetty.version>9.4.6.v20170531</jetty.version>
+    <swagger.version>1.5.16</swagger.version>
     <spring-data-solr.version>2.0.2.RELEASE</spring-data-solr.version>
     <jjwt.version>0.6.0</jjwt.version>
+    <spring-boot.version>1.5.6.RELEASE</spring-boot.version>
   </properties>
   <profiles>
-    <!-- Dev Profile Start -->
     <profile>
       <id>dev</id>
       <activation>
@@ -67,24 +67,18 @@
               <target>${jdk.version}</target>
             </configuration>
           </plugin>
-          <!-- Exec main class plugin -->
           <plugin>
-            <groupId>org.codehaus.mojo</groupId>
-            <artifactId>exec-maven-plugin</artifactId>
-            <version>1.2.1</version>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-maven-plugin</artifactId>
+            <version>${spring-boot.version}</version>
             <executions>
               <execution>
                 <goals>
-                  <goal>java</goal>
+                  <goal>repackage</goal>
                 </goals>
               </execution>
             </executions>
-            <configuration>
-              <mainClass>org.apache.ambari.logsearch.LogSearch</mainClass>
-              <!-- <arguments> <argument></argument> </arguments> -->
-            </configuration>
           </plugin>
-          <!-- copy-dependencies -->
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-dependency-plugin</artifactId>
@@ -103,7 +97,7 @@
                       <artifactId>ambari-logsearch-web</artifactId>
                       <version>${project.version}</version>
                       <outputDirectory>${project.build.outputDirectory}/</outputDirectory>
-                      <includes>webapps/**</includes>
+                      <includes>static/**</includes>
                     </artifactItem>
                   </artifactItems>
                 </configuration>
@@ -126,8 +120,6 @@
               </execution>
             </executions>
           </plugin>
-          <!-- - -->
-          <!-- ant pacakge -->
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-antrun-plugin</artifactId>
@@ -137,7 +129,6 @@
                 <phase>package</phase>
                 <configuration>
                   <target>
-                    <!-- <taskdef resource="build.properties" classpathref="maven.plugin.classpath" /> -->
                     <ant antfile="build.xml">
                       <target name="package"/>
                     </ant>
@@ -168,243 +159,6 @@
               </execution>
             </executions>
           </plugin>
-          <!-- /ant package -->
-        </plugins>
-      </build>
-    </profile>
-    <!-- Dev Profile End -->
-    <!-- Production Profile Start -->
-    <profile>
-      <id>production</id>
-      <build>
-        <finalName>LogSearch</finalName>
-        <pluginManagement>
-          <plugins>
-            <plugin>
-              <artifactId>maven-compiler-plugin</artifactId>
-              <version>3.0</version>
-            </plugin>
-            <plugin>
-              <artifactId>maven-dependency-plugin</artifactId>
-              <version>2.8</version>
-            </plugin>
-          </plugins>
-        </pluginManagement>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-compiler-plugin</artifactId>
-            <version>3.0</version>
-            <configuration>
-              <source>${jdk.version}</source>
-              <target>${jdk.version}</target>
-            </configuration>
-          </plugin>
-          <!-- Exec main class plugin -->
-          <plugin>
-            <groupId>org.codehaus.mojo</groupId>
-            <artifactId>exec-maven-plugin</artifactId>
-            <version>1.2.1</version>
-            <executions>
-              <execution>
-                <goals>
-                  <goal>java</goal>
-                </goals>
-              </execution>
-            </executions>
-            <configuration>
-              <mainClass>org.apache.ambari.logsearch.LogSearch</mainClass>
-              <!-- <arguments> <argument></argument> </arguments> -->
-            </configuration>
-          </plugin>
-          <!-- copy-dependencies -->
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-dependency-plugin</artifactId>
-            <version>2.8</version>
-            <executions>
-              <execution>
-                <id>copy-dependencies</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>copy-dependencies</goal>
-                </goals>
-                <configuration>
-                  <artifactItems>*</artifactItems>
-                  <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
-                  <outputDirectory>${basedir}/target/libs</outputDirectory>
-                  <overWriteReleases>false</overWriteReleases>
-                  <overWriteSnapshots>false</overWriteSnapshots>
-                  <overWriteIfNewer>true</overWriteIfNewer>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-          <!-- - -->
-          <!-- ant pacakge -->
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-antrun-plugin</artifactId>
-            <version>1.7</version>
-            <executions>
-              <execution>
-                <phase>package</phase>
-                <configuration>
-                  <target>
-                    <!-- <taskdef resource="build.properties" classpathref="maven.plugin.classpath" /> -->
-                    <ant antfile="build.xml">
-                      <target name="package"/>
-                    </ant>
-                  </target>
-                </configuration>
-                <goals>
-                  <goal>run</goal>
-                </goals>
-              </execution>
-              <!-- <execution>
-                <id>Packag Install</id>
-                <phase>generate-resources</phase>
-                <configuration>
-                  <target>
-                    <exec executable="npm">
-                      <arg value="install" />
-                    </exec>
-                  </target>
-                </configuration>
-                <goals>
-                  <goal>run</goal>
-                </goals>
-              </execution>
-              <execution>
-                <id>Js Packaging</id>
-                <phase>generate-resources</phase>
-                <configuration>
-                  <target>
-                    <exec executable="gulp">
-                      <arg value="minify-css" />
-                    </exec>
-                  </target>
-                </configuration>
-                <goals>
-                  <goal>run</goal>
-                </goals>
-              </execution> -->
-            </executions>
-          </plugin>
-          <plugin>
-            <groupId>org.apache.rat</groupId>
-            <artifactId>apache-rat-plugin</artifactId>
-            <configuration>
-              <excludes>
-                <exclude>**/*</exclude>
-              </excludes>
-            </configuration>
-            <executions>
-              <execution>
-                <phase>test</phase>
-                <goals>
-                  <goal>check</goal>
-                </goals>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <!-- Production Profile End -->
-    <profile>
-      <id>skipMinify</id>
-      <activation>
-        <activeByDefault>false</activeByDefault>
-      </activation>
-      <build>
-        <finalName>LogSearch</finalName>
-        <pluginManagement>
-          <plugins>
-            <plugin>
-              <artifactId>maven-compiler-plugin</artifactId>
-              <version>3.0</version>
-            </plugin>
-            <plugin>
-              <artifactId>maven-dependency-plugin</artifactId>
-              <version>2.8</version>
-            </plugin>
-          </plugins>
-        </pluginManagement>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-compiler-plugin</artifactId>
-            <version>3.0</version>
-            <configuration>
-              <source>${jdk.version}</source>
-              <target>${jdk.version}</target>
-            </configuration>
-          </plugin>
-          <!-- Exec main class plugin -->
-          <plugin>
-            <groupId>org.codehaus.mojo</groupId>
-            <artifactId>exec-maven-plugin</artifactId>
-            <version>1.2.1</version>
-            <executions>
-              <execution>
-                <goals>
-                  <goal>java</goal>
-                </goals>
-              </execution>
-            </executions>
-            <configuration>
-              <mainClass>org.apache.ambari.logsearch.LogSearch</mainClass>
-              <!-- <arguments> <argument></argument> </arguments> -->
-            </configuration>
-          </plugin>
-          <!-- copy-dependencies -->
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-dependency-plugin</artifactId>
-            <version>2.8</version>
-            <executions>
-              <execution>
-                <id>copy-dependencies</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>copy-dependencies</goal>
-                </goals>
-                <configuration>
-                  <artifactItems>*</artifactItems>
-                  <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
-                  <outputDirectory>${basedir}/target/libs</outputDirectory>
-                  <overWriteReleases>false</overWriteReleases>
-                  <overWriteSnapshots>false</overWriteSnapshots>
-                  <overWriteIfNewer>true</overWriteIfNewer>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-          <!-- - -->
-          <!-- ant pacakge -->
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-antrun-plugin</artifactId>
-            <version>1.7</version>
-            <executions>
-              <execution>
-                <phase>package</phase>
-                <configuration>
-                  <target>
-                    <!-- <taskdef resource="build.properties" classpathref="maven.plugin.classpath" 
-                      /> -->
-                    <ant antfile="build.xml">
-                      <target name="package"/>
-                    </ant>
-                  </target>
-                </configuration>
-                <goals>
-                  <goal>run</goal>
-                </goals>
-              </execution>
-            </executions>
-          </plugin>
         </plugins>
       </build>
     </profile>
@@ -455,61 +209,87 @@
     </dependency>
 
     <dependency>
-      <groupId>org.springframework.ldap</groupId>
-      <artifactId>spring-ldap-core</artifactId>
-      <version>${spring.ldap.version}</version>
+      <groupId>org.springframework.security.kerberos</groupId>
+      <artifactId>spring-security-kerberos-core</artifactId>
+      <version>1.0.1.RELEASE</version>
     </dependency>
     <dependency>
-      <groupId>org.springframework.security</groupId>
-      <artifactId>spring-security-ldap</artifactId>
-      <version>${spring.security.version}</version>
+      <groupId>org.springframework.security.kerberos</groupId>
+      <artifactId>spring-security-kerberos-web</artifactId>
+      <version>1.0.1.RELEASE</version>
     </dependency>
     <dependency>
-      <groupId>org.glassfish.jersey.ext</groupId>
-      <artifactId>jersey-spring3</artifactId>
-      <version>2.23.2</version>
+      <groupId>org.springframework.security.kerberos</groupId>
+      <artifactId>spring-security-kerberos-client</artifactId>
+      <version>1.0.1.RELEASE</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+      <version>${spring-boot.version}</version>
       <exclusions>
         <exclusion>
-          <groupId>org.springframework</groupId>
-          <artifactId>*</artifactId>
+          <groupId>org.springframework.boot</groupId>
+          <artifactId>spring-boot-starter-logging</artifactId>
         </exclusion>
       </exclusions>
     </dependency>
     <dependency>
-      <groupId>org.glassfish.jersey.connectors</groupId>
-      <artifactId>jersey-apache-connector</artifactId>
-      <version>${jersey.version}</version>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-log4j</artifactId>
+      <version>1.3.8.RELEASE</version>
     </dependency>
     <dependency>
-      <groupId>org.glassfish.jersey.core</groupId>
-      <artifactId>jersey-client</artifactId>
-      <version>${jersey.version}</version>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-web</artifactId>
+      <version>${spring-boot.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.glassfish.jersey.media</groupId>
-      <artifactId>jersey-media-json-jettison</artifactId>
-      <version>${jersey.version}</version>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-security</artifactId>
+      <version>${spring-boot.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-jetty</artifactId>
+      <version>${spring-boot.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-jersey</artifactId>
+      <version>${spring-boot.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-freemarker</artifactId>
+      <version>${spring-boot.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-autoconfigure</artifactId>
+      <version>${spring-boot.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-configuration-processor</artifactId>
+      <version>${spring-boot.version}</version>
     </dependency>
     <dependency>
       <groupId>org.glassfish.jersey.media</groupId>
-      <artifactId>jersey-media-json-jackson</artifactId>
+      <artifactId>jersey-media-json-jettison</artifactId>
       <version>${jersey.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.glassfish.jersey.core</groupId>
-      <artifactId>jersey-common</artifactId>
-      <version>${jersey.version}</version>
+        <artifactId>guava</artifactId>
+        <groupId>com.google.guava</groupId>
+        <version>20.0</version>
     </dependency>
+
     <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>javax.servlet-api</artifactId>
       <version>3.1.0</version>
     </dependency>
-    <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
-      <version>1.2.17</version>
-    </dependency>
     <dependency>
       <groupId>org.apache.solr</groupId>
       <artifactId>solr-solrj</artifactId>
@@ -582,6 +362,10 @@
           <groupId>org.apache.curator</groupId>
           <artifactId>curator-recipes</artifactId>
         </exclusion>
+        <exclusion>
+          <artifactId>guava</artifactId>
+          <groupId>com.google.guava</groupId>
+        </exclusion>
       </exclusions>
     </dependency>
     <dependency>
@@ -624,6 +408,10 @@
           <groupId>javax.servlet</groupId>
           <artifactId>servlet-api</artifactId>
         </exclusion>
+        <exclusion>
+          <artifactId>guava</artifactId>
+          <groupId>com.google.guava</groupId>
+        </exclusion>
       </exclusions>
     </dependency>
     <dependency>
@@ -644,68 +432,6 @@
       <groupId>commons-lang</groupId>
       <artifactId>commons-lang</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.springframework.security.kerberos</groupId>
-      <artifactId>spring-security-kerberos-core</artifactId>
-      <version>1.0.1.RELEASE</version>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework.security.kerberos</groupId>
-      <artifactId>spring-security-kerberos-web</artifactId>
-      <version>1.0.1.RELEASE</version>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework.security.kerberos</groupId>
-      <artifactId>spring-security-kerberos-client</artifactId>
-      <version>1.0.1.RELEASE</version>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-security</artifactId>
-      <version>${jetty-version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-server</artifactId>
-      <version>${jetty-version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-servlet</artifactId>
-      <version>${jetty-version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-servlets</artifactId>
-      <version>${jetty-version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-util</artifactId>
-      <version>${jetty-version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-webapp</artifactId>
-      <version>${jetty-version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.springframework</groupId>
-          <artifactId>*</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-annotations</artifactId>
-      <version>${jetty-version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.springframework</groupId>
-          <artifactId>*</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
     <dependency>
       <groupId>cglib</groupId>
       <artifactId>cglib</artifactId>
@@ -752,11 +478,6 @@
       <artifactId>spring-context-support</artifactId>
       <version>${spring.version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.freemarker</groupId>
-      <artifactId>freemarker</artifactId>
-      <version>2.3.20</version>
-    </dependency>
     <dependency>
       <groupId>io.jsonwebtoken</groupId>
       <artifactId>jjwt</artifactId>

+ 1 - 5
ambari-logsearch/ambari-logsearch-server/run.sh

@@ -17,8 +17,4 @@ echo "
 ███████╗╚██████╔╝╚██████╔╝    ███████║███████╗██║  ██║██║  ██║╚██████╗██║  ██║
 ╚══════╝ ╚═════╝  ╚═════╝     ╚══════╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝
 "
-cd ..
-mvn clean compile package -Pdev
-cd ambari-logsearch-server
-#mvn exec:java -Pdev
-java -cp target/libs/*:target/classes/ org.apache.ambari.logsearch.LogSearch
+mvn spring-boot:run

+ 21 - 160
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/LogSearch.java

@@ -18,169 +18,30 @@
  */
 package org.apache.ambari.logsearch;
 
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.EnumSet;
-
-import org.apache.ambari.logsearch.common.ManageStartEndTime;
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.conf.ApplicationConfig;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
-import org.apache.ambari.logsearch.util.SSLUtil;
-import org.apache.ambari.logsearch.util.WebUtil;
-import org.apache.ambari.logsearch.web.listener.LogSearchSessionListener;
-import org.apache.commons.lang.StringUtils;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.HttpConfiguration;
-import org.eclipse.jetty.server.HttpConnectionFactory;
-import org.eclipse.jetty.server.SecureRequestCustomizer;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.server.SslConnectionFactory;
-import org.eclipse.jetty.server.handler.HandlerList;
-import org.eclipse.jetty.server.handler.ResourceHandler;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.util.resource.ResourceCollection;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.context.ContextLoaderListener;
-import org.springframework.web.context.request.RequestContextListener;
-import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
-import org.springframework.web.filter.DelegatingFilterProxy;
-
-import javax.servlet.DispatcherType;
-
-import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
-import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_SESSION_ID;
-
-public class LogSearch {
-  private static final Logger LOG = LoggerFactory.getLogger(LogSearch.class);
-
-  @LogSearchPropertyDescription(
-    name = "logsearch.protocol",
-    description = "Log Search Protocol (http or https)",
-    examples = {"http", "https"},
-    defaultValue = "http",
-    sources = {LOGSEARCH_PROPERTIES_FILE}
-  )
-  private static final String LOGSEARCH_PROTOCOL_PROP = "logsearch.protocol";
-  private static final String HTTPS_PROTOCOL = "https";
-  private static final String HTTP_PROTOCOL = "http";
-  private static final String HTTPS_PORT = "61889";
-  private static final String HTTP_PORT = "61888";
-
-  private static final String ROOT_CONTEXT = "/";
-  private static final Integer SESSION_TIMEOUT = 60 * 30;
-
-  public static void main(String[] argv) {
-    LogSearch logSearch = new LogSearch();
-    ManageStartEndTime.manage();
-    try {
-      logSearch.run(argv);
-    } catch (Throwable e) {
-      LOG.error("Error running logsearch server", e);
-    }
+import org.springframework.boot.Banner;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration;
+import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.system.ApplicationPidFileWriter;
+
+@SpringBootApplication(
+  scanBasePackages = {"org.apache.ambari.logsearch"},
+  exclude = {
+    RepositoryRestMvcAutoConfiguration.class,
+    WebMvcAutoConfiguration.class
   }
+)
+public class LogSearch {
 
-  public void run(String[] argv) throws Exception {
-    SSLUtil.ensureStorePasswords();
-    SSLUtil.loadKeystore();
-    
-    Server server = buildSever(argv);
-    HandlerList handlers = new HandlerList();
-    handlers.addHandler(createSwaggerContext());
-    handlers.addHandler(createBaseWebappContext());
-
-    server.setHandler(handlers);
-    server.start();
-
-    LOG.debug("============================Server Dump=======================================");
-    LOG.debug(server.dump());
-    LOG.debug("==============================================================================");
-    server.join();
-  }
-
-  public Server buildSever(String argv[]) {
-    Server server = new Server();
-    boolean portSpecified = argv.length > 0;
-    String protcolProperty = PropertiesHelper.getProperty(LOGSEARCH_PROTOCOL_PROP,HTTP_PROTOCOL);
-    HttpConfiguration httpConfiguration = new HttpConfiguration();
-    httpConfiguration.setRequestHeaderSize(65535);
-    if (StringUtils.isEmpty(protcolProperty)) {
-      protcolProperty = HTTP_PROTOCOL;
-    }
-    String port = null;
-    if (HTTPS_PROTOCOL.equals(protcolProperty) && SSLUtil.isKeyStoreSpecified()) {
-      LOG.info("Building https server...........");
-      port = portSpecified ? argv[0] : HTTPS_PORT;
-      WebUtil.checkPort(Integer.parseInt(port));
-      httpConfiguration.addCustomizer(new SecureRequestCustomizer());
-      SslContextFactory sslContextFactory = SSLUtil.getSslContextFactory();
-      ServerConnector sslConnector = new ServerConnector(server,
-          new SslConnectionFactory(sslContextFactory, "http/1.1"),
-          new HttpConnectionFactory(httpConfiguration));
-      sslConnector.setPort(Integer.parseInt(port));
-      server.setConnectors(new Connector[] { sslConnector });
-    } else {
-      LOG.info("Building http server...........");
-      port = portSpecified ? argv[0] : HTTP_PORT;
-      WebUtil.checkPort(Integer.parseInt(port));
-      ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(httpConfiguration));
-      connector.setPort(Integer.parseInt(port));
-      server.setConnectors(new Connector[] { connector });
-    }
-    URI logsearchURI = URI.create(String.format("%s://0.0.0.0:%s", protcolProperty, port));
-    LOG.info("Starting logsearch server URI=" + logsearchURI);
-    return server;
-  }
-
-  private WebAppContext createBaseWebappContext() throws MalformedURLException {
-    URI webResourceBase = WebUtil.findWebResourceBase();
-    WebAppContext context = new WebAppContext();
-    context.setBaseResource(Resource.newResource(webResourceBase));
-    context.setContextPath(ROOT_CONTEXT);
-    context.setParentLoaderPriority(true);
-    context.addEventListener(new LogSearchSessionListener());
-
-    // Configure Spring
-    context.addEventListener(new ContextLoaderListener());
-    context.addEventListener(new RequestContextListener());
-    context.addFilter(new FilterHolder(new DelegatingFilterProxy("springSecurityFilterChain")), "/*", EnumSet.allOf(DispatcherType.class));
-    context.setInitParameter("contextClass", AnnotationConfigWebApplicationContext.class.getName());
-    context.setInitParameter("contextConfigLocation", ApplicationConfig.class.getName());
-
-    // Configure Jersey
-    ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/api/v1/*");
-    jerseyServlet.setInitOrder(1);
-    jerseyServlet.setInitParameter("jersey.config.server.provider.packages","org.apache.ambari.logsearch.rest");
-
-    context.getSessionHandler().getSessionManager().setMaxInactiveInterval(SESSION_TIMEOUT);
-    context.getSessionHandler().getSessionManager().getSessionCookieConfig().setName(LOGSEARCH_SESSION_ID);
+  public static void main(String[] args) {
 
-    return context;
+    String pidFile = System.getenv("PID_FILE") == null ? "logsearch.pid" : System.getenv("PID_FILE");
+    new SpringApplicationBuilder(LogSearch.class)
+      .bannerMode(Banner.Mode.OFF)
+      .listeners(new ApplicationPidFileWriter(pidFile))
+      .web(true)
+      .run(args);
   }
 
-  private ServletContextHandler createSwaggerContext() throws URISyntaxException {
-    ResourceHandler resourceHandler = new ResourceHandler();
-    ResourceCollection resources = new ResourceCollection(new String[] {
-      LogSearch.class.getClassLoader()
-        .getResource("META-INF/resources/webjars/swagger-ui/2.1.0")
-        .toURI().toString(),
-      LogSearch.class.getClassLoader()
-        .getResource("swagger")
-        .toURI().toString()
-    });
-    resourceHandler.setBaseResource(resources);
-    resourceHandler.setWelcomeFiles(new String[]{"swagger.html"}); // rewrite index.html from swagger-ui webjar
-    ServletContextHandler context = new ServletContextHandler();
-    context.setContextPath("/docs/");
-    context.setHandler(resourceHandler);
-    return context;
-  }
 }

+ 15 - 9
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/ExternalServerClient.java

@@ -25,7 +25,7 @@ import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.Response;
 
 import org.apache.ambari.logsearch.conf.AuthPropsConfig;
-import org.apache.ambari.logsearch.util.SSLUtil;
+import org.apache.ambari.logsearch.configurer.SslConfigurer;
 import org.apache.commons.httpclient.auth.InvalidCredentialsException;
 import org.apache.log4j.Logger;
 import org.glassfish.jersey.client.JerseyClient;
@@ -38,15 +38,11 @@ import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
 @Named
 public class ExternalServerClient {
 
+  @Inject
+  private SslConfigurer sslConfigurer;
+
   private static Logger LOG = Logger.getLogger(ExternalServerClient.class);
-  private static final ThreadLocal<JerseyClient> localJerseyClient = new ThreadLocal<JerseyClient>() {
-    @Override
-    protected JerseyClient initialValue() {
-      return SSLUtil.isKeyStoreSpecified() ?
-          new JerseyClientBuilder().sslContext(SSLUtil.getSSLContext()).build() :
-          JerseyClientBuilder.createClient();
-    }
-  };
+  private ThreadLocal<JerseyClient> localJerseyClient;
 
   @Inject
   private AuthPropsConfig authPropsConfig;
@@ -55,6 +51,16 @@ public class ExternalServerClient {
    * Send GET request to an external server
    */
   public Object sendGETRequest(String loginUrl, Class<?> klass, String username, String password) throws Exception {
+    if (localJerseyClient == null) {
+      localJerseyClient = new ThreadLocal<JerseyClient>() {
+        @Override
+        protected JerseyClient initialValue() {
+          return sslConfigurer.isKeyStoreSpecified() ?
+            new JerseyClientBuilder().sslContext(sslConfigurer.getSSLContext()).build() :
+            JerseyClientBuilder.createClient();
+        }
+      };
+    }
     String url = authPropsConfig.getExternalAuthHostUrl() + loginUrl;
     JerseyClient client = localJerseyClient.get();
     HttpAuthenticationFeature authFeature = HttpAuthenticationFeature.basicBuilder()

+ 1 - 1
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java

@@ -21,8 +21,8 @@ package org.apache.ambari.logsearch.common;
 
 public class LogSearchConstants {
 
+  public static final String LOGSEARCH_APPLICATION_NAME = "logsearch";
   public static final String LOGSEARCH_PROPERTIES_FILE = "logsearch.properties";
-
   public static final String LOGSEARCH_SESSION_ID = "LOGSEARCHSESSIONID";
 
   // Log Levels

+ 0 - 124
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java

@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ambari.logsearch.common;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
-
-public class PropertiesHelper extends PropertyPlaceholderConfigurer {
-  private static final Logger logger = LoggerFactory.getLogger(PropertiesHelper.class);
-  
-  private static final String LOGSEARCH_PROP_FILE="logsearch.properties";
-  
-  private static Map<String, String> propertiesMap;
-  public static Map<String, String> getProperties() {
-    return propertiesMap;
-  }
-
-  private PropertiesHelper() {
-  }
-  
-  static {
-    propertiesMap = new HashMap<String, String>();
-    Properties properties = new Properties();
-    URL fileCompleteUrl = Thread.currentThread().getContextClassLoader().getResource(LOGSEARCH_PROP_FILE);
-    FileInputStream fileInputStream = null;
-    try {
-      File file = new File(fileCompleteUrl.toURI());
-      fileInputStream = new FileInputStream(file.getAbsoluteFile());
-      properties.load(fileInputStream);
-    } catch (IOException | URISyntaxException e) {
-      logger.error("error loading prop for protocol config",e);
-    } finally {
-      if (fileInputStream != null) {
-        try {
-          fileInputStream.close();
-        } catch (IOException e) {
-        }
-      }
-    }
-    for (String key : properties.stringPropertyNames()) {
-      String value = properties.getProperty(key);
-      propertiesMap.put(key, value);
-    }
-  }
-
-  @Override
-  protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) throws BeansException {
-    super.processProperties(beanFactory, props);
-
-    propertiesMap = new HashMap<String, String>();
-
-    // First add the system properties
-    Set<Object> keySet = System.getProperties().keySet();
-    for (Object key : keySet) {
-      String keyStr = key.toString();
-      propertiesMap.put(keyStr, System.getProperties().getProperty(keyStr).trim());
-    }
-
-    // add our properties now
-    keySet = props.keySet();
-    for (Object key : keySet) {
-      String keyStr = key.toString();
-      propertiesMap.put(keyStr, props.getProperty(keyStr).trim());
-    }
-  }
-
-  public static String getProperty(String key, String defaultValue) {
-    if (key == null) {
-      return null;
-    }
-    String rtrnVal = propertiesMap.get(key);
-    if (rtrnVal == null) {
-      rtrnVal = defaultValue;
-    }
-    return rtrnVal;
-  }
-
-  public static String getProperty(String key) {
-    if (key == null) {
-      return null;
-    }
-    return propertiesMap.get(key);
-  }
-
-  public static boolean getBooleanProperty(String key, boolean defaultValue) {
-    if (key == null) {
-      return defaultValue;
-    }
-    String value = getProperty(key);
-    if (value == null) {
-      return defaultValue;
-    }
-    return Boolean.parseBoolean(value);
-  }
-}

+ 0 - 79
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/XMLPropertiesHelper.java

@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ambari.logsearch.common;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.log4j.Logger;
-import org.springframework.util.DefaultPropertiesPersister;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class XMLPropertiesHelper extends DefaultPropertiesPersister {
-  private static Logger logger = Logger.getLogger(XMLPropertiesHelper.class);
-
-  public XMLPropertiesHelper() {
-  }
-
-  @Override
-  public void loadFromXml(Properties properties, InputStream inputStream)
-      throws IOException {
-    try {
-      DocumentBuilderFactory xmlDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
-      xmlDocumentBuilderFactory.setIgnoringComments(true);
-      xmlDocumentBuilderFactory.setNamespaceAware(true);
-      DocumentBuilder xmlDocumentBuilder = xmlDocumentBuilderFactory.newDocumentBuilder();
-      Document xmlDocument = xmlDocumentBuilder.parse(inputStream);
-      if (xmlDocument != null) {
-        xmlDocument.getDocumentElement().normalize();
-        NodeList nList = xmlDocument.getElementsByTagName("property");
-        if (nList != null) {
-          for (int temp = 0; temp < nList.getLength(); temp++) {
-            Node nNode = nList.item(temp);
-            if (nNode.getNodeType() == Node.ELEMENT_NODE) {
-              Element eElement = (Element) nNode;
-              String propertyName = "";
-              String propertyValue = "";
-              if (eElement.getElementsByTagName("name") != null && eElement.getElementsByTagName("name").item(0) != null) {
-                propertyName = eElement.getElementsByTagName("name").item(0).getTextContent().trim();
-              }
-              if (eElement.getElementsByTagName("value") != null && eElement.getElementsByTagName("value").item(0) != null) {
-                propertyValue = eElement.getElementsByTagName("value").item(0).getTextContent().trim();
-              }
-              if (propertyName != null && !propertyName.isEmpty()) {
-                properties.put(propertyName, propertyValue);
-              }
-            }
-          }
-        }
-      }
-    } catch (Exception e) {
-      logger.error("Error loading xml properties ", e);
-    }
-  }
-
-}

+ 2 - 2
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApiDocConfig.java

@@ -23,6 +23,7 @@ import io.swagger.jaxrs.listing.SwaggerSerializers;
 
 import io.swagger.models.Info;
 import io.swagger.models.License;
+import org.apache.ambari.logsearch.rest.ServiceLogsResource;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -34,7 +35,6 @@ public class ApiDocConfig {
   private static final String TITLE = "Log Search REST API";
   private static final String LICENSE = "Apache 2.0";
   private static final String LICENSE_URL = "http://www.apache.org/licenses/LICENSE-2.0.html";
-  private static final String RESOURCE_PACKAGE = "org.apache.ambari.logsearch.rest";
   private static final String BASE_PATH = "/api/v1";
 
   @Bean
@@ -53,7 +53,7 @@ public class ApiDocConfig {
     beanConfig.setLicenseUrl(LICENSE_URL);
     beanConfig.setScan(true);
     beanConfig.setVersion(VERSION);
-    beanConfig.setResourcePackage(RESOURCE_PACKAGE);
+    beanConfig.setResourcePackage(ServiceLogsResource.class.getPackage().getName());
 
     License license = new License();
     license.setName(LICENSE);

+ 0 - 2
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java

@@ -20,7 +20,6 @@ package org.apache.ambari.logsearch.conf;
 
 import freemarker.template.TemplateException;
 import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.PropertySource;
 import org.springframework.context.support.ConversionServiceFactoryBean;
@@ -32,7 +31,6 @@ import java.io.IOException;
 import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
 
 @Configuration
-@ComponentScan("org.apache.ambari.logsearch")
 @PropertySource(value = {"classpath:default.properties", "classpath:"+ LOGSEARCH_PROPERTIES_FILE})
 public class ApplicationConfig {
 

+ 61 - 0
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchConfigMapHolder.java

@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+import org.springframework.core.env.MapPropertySource;
+import org.springframework.core.env.PropertySource;
+import org.springframework.web.context.support.StandardServletEnvironment;
+
+import javax.inject.Inject;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
+
+@Configuration
+public class LogSearchConfigMapHolder {
+
+  @Inject
+  private Environment environment;
+
+  private Map<String, String> logsearchProperties = new HashMap<>();
+
+  public Map<String, String> getLogsearchProperties() {
+    if (logsearchProperties.isEmpty()) {
+      PropertySource propertySource = ((StandardServletEnvironment) environment)
+        .getPropertySources().get("class path resource [" + LOGSEARCH_PROPERTIES_FILE + "]");
+      setLogsearchProperties(stringifyValues(((MapPropertySource) propertySource).getSource()));
+    }
+    return logsearchProperties;
+  }
+
+  public void setLogsearchProperties(Map<String, String> logsearchProperties) {
+    this.logsearchProperties = logsearchProperties;
+  }
+
+  private Map<String, String> stringifyValues(Map<String, Object> vars) {
+    return vars.entrySet()
+      .stream()
+      .collect(Collectors.toMap(Map.Entry::getKey, e -> (String) e.getValue()));
+  }
+
+}

+ 83 - 0
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchHttpConfig.java

@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
+
+@Configuration
+public class LogSearchHttpConfig {
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.http.port",
+    description = "Log Search http port",
+    examples = {"61888", "8888"},
+    defaultValue = "61888",
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.http.port:61888}")
+  private int httpPort;
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.https.port",
+    description = "Log Search https port",
+    examples = {"61889", "8889"},
+    defaultValue = "61889",
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.https.port:61889}")
+  private int httpsPort;
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.protocol",
+    description = "Log Search Protocol (http or https)",
+    examples = {"http", "https"},
+    defaultValue = "http",
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.protocol:http}")
+  private String protocol;
+
+  public String getProtocol() {
+    return protocol;
+  }
+
+  public void setProtocol(String protocol) {
+    this.protocol = protocol;
+  }
+
+  public int getHttpPort() {
+    return httpPort;
+  }
+
+  public void setHttpPort(int httpPort) {
+    this.httpPort = httpPort;
+  }
+
+  public int getHttpsPort() {
+    return httpsPort;
+  }
+
+  public void setHttpsPort(int httpsPort) {
+    this.httpsPort = httpsPort;
+  }
+}

+ 37 - 0
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchJerseyResourceConfig.java

@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.apache.ambari.logsearch.rest.ServiceLogsResource;
+import org.glassfish.jersey.jackson.JacksonFeature;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletProperties;
+
+import javax.ws.rs.ApplicationPath;
+
+@ApplicationPath("/api/v1")
+public class LogSearchJerseyResourceConfig extends ResourceConfig {
+
+  public LogSearchJerseyResourceConfig() {
+    packages(ServiceLogsResource.class.getPackage().getName());
+    register(JacksonFeature.class);
+    property(ServletProperties.FILTER_FORWARD_ON_404, true);
+  }
+
+}

+ 95 - 0
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchServletConfig.java

@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.apache.ambari.logsearch.configurer.SslConfigurer;
+import org.apache.ambari.logsearch.web.listener.LogSearchSessionListener;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.glassfish.jersey.servlet.ServletContainer;
+import org.glassfish.jersey.servlet.ServletProperties;
+import org.springframework.boot.autoconfigure.web.ServerProperties;
+import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
+import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer;
+import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
+import org.springframework.boot.context.embedded.jetty.JettyServerCustomizer;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.inject.Inject;
+import javax.servlet.http.HttpSessionListener;
+
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_APPLICATION_NAME;
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_SESSION_ID;
+
+@Configuration
+public class LogSearchServletConfig {
+
+  private static final Integer SESSION_TIMEOUT = 60 * 30;
+
+  @Inject
+  private ServerProperties serverProperties;
+
+  @Inject
+  private LogSearchHttpConfig logSearchHttpConfig;
+
+  @Inject
+  private SslConfigurer sslConfigurer;
+
+  @Bean
+  public HttpSessionListener httpSessionListener() {
+    return new LogSearchSessionListener();
+  }
+
+  @Bean
+  public ServletRegistrationBean jerseyServlet() {
+    ServletRegistrationBean registration = new ServletRegistrationBean(new ServletContainer(), "/api/v1/*");
+    registration.addInitParameter(ServletProperties.JAXRS_APPLICATION_CLASS, LogSearchJerseyResourceConfig.class.getName());
+    return registration;
+  }
+
+  @Bean
+  public EmbeddedServletContainerFactory containerFactory() {
+    final JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory = new JettyEmbeddedServletContainerFactory() {
+      @Override
+      protected JettyEmbeddedServletContainer getJettyEmbeddedServletContainer(Server server) {
+        return new JettyEmbeddedServletContainer(server);
+      }
+    };
+    jettyEmbeddedServletContainerFactory.setSessionTimeout(SESSION_TIMEOUT);
+    serverProperties.getSession().getCookie().setName(LOGSEARCH_SESSION_ID);
+    serverProperties.setDisplayName(LOGSEARCH_APPLICATION_NAME);
+    if ("https".equals(logSearchHttpConfig.getProtocol())) {
+      sslConfigurer.ensureStorePasswords();
+      sslConfigurer.loadKeystore();
+      jettyEmbeddedServletContainerFactory.addServerCustomizers((JettyServerCustomizer) server -> {
+        SslContextFactory sslContextFactory = sslConfigurer.getSslContextFactory();
+        ServerConnector sslConnector = new ServerConnector(server, sslContextFactory);
+        sslConnector.setPort(logSearchHttpConfig.getHttpsPort());
+        server.setConnectors(new Connector[]{sslConnector});
+      });
+    } else {
+      jettyEmbeddedServletContainerFactory.setPort(logSearchHttpConfig.getHttpPort());
+    }
+    return jettyEmbeddedServletContainerFactory;
+  }
+}

+ 173 - 0
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchSpnegoConfig.java

@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
+
+@Configuration
+public class LogSearchSpnegoConfig {
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.hadoop.security.auth_to_local",
+    description = "Rules that will be applied on authentication names and map them into local usernames.",
+    examples = {"RULE:[1:$1@$0](.*@EXAMPLE.COM)s/@.*//", "DEFAULT"},
+    defaultValue = "DEFAULT",
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.hadoop.security.auth_to_local:DEFAULT}")
+  private String nameRules;
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.admin.kerberos.token.valid.seconds",
+    description = "Kerberos token validity in seconds.",
+    examples = {"30"},
+    defaultValue = "30",
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.admin.kerberos.token.valid.seconds:30}")
+  private String tokenValid;
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.admin.kerberos.cookie.domain",
+    description = "Domain for Kerberos cookie.",
+    examples = {"c6401.ambari.apache.org", "localhost"},
+    defaultValue = "localhost",
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.admin.kerberos.cookie.domain:localhost}")
+  private String cookieDomain;
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.admin.kerberos.cookie.path",
+    description = "Cookie path of the kerberos cookie",
+    examples = {"/"},
+    defaultValue = "/",
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.admin.kerberos.cookie.path:/}")
+  private String cookiePath;
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.spnego.kerberos.principal",
+    description = "Principal for SPNEGO authentication for Http requests",
+    examples = {"myuser@EXAMPLE.COM"},
+    defaultValue = "",
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.spnego.kerberos.principal:}")
+  private String principal;
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.spnego.kerberos.keytab",
+    description = "Keytab for SPNEGO authentication for Http requests.",
+    examples = {"/etc/security/keytabs/mykeytab.keytab"},
+    defaultValue = "",
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.spnego.kerberos.keytab:}")
+  private String keyTab;
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.spnego.kerberos.host",
+    description = "",
+    examples = {"c6401.ambari.apache.org", "localhost"},
+    defaultValue = "localhost",
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.spnego.kerberos.host:localhost}")
+  private String hostName;
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.spnego.kerberos.enabled",
+    description = "Enable SPNEGO based authentication for Log Search Server.",
+    examples = {"true", "false"},
+    defaultValue = "false",
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.spnego.kerberos.enabled:false}")
+  private boolean kerberosEnabled;
+
+  public String getNameRules() {
+    return nameRules;
+  }
+
+  public void setNameRules(String nameRules) {
+    this.nameRules = nameRules;
+  }
+
+  public String getTokenValid() {
+    return tokenValid;
+  }
+
+  public void setTokenValid(String tokenValid) {
+    this.tokenValid = tokenValid;
+  }
+
+  public String getCookieDomain() {
+    return cookieDomain;
+  }
+
+  public void setCookieDomain(String cookieDomain) {
+    this.cookieDomain = cookieDomain;
+  }
+
+  public String getCookiePath() {
+    return cookiePath;
+  }
+
+  public void setCookiePath(String cookiePath) {
+    this.cookiePath = cookiePath;
+  }
+
+  public String getPrincipal() {
+    return principal;
+  }
+
+  public void setPrincipal(String principal) {
+    this.principal = principal;
+  }
+
+  public String getKeyTab() {
+    return keyTab;
+  }
+
+  public void setKeyTab(String keyTab) {
+    this.keyTab = keyTab;
+  }
+
+  public String getHostName() {
+    return hostName;
+  }
+
+  public void setHostName(String hostName) {
+    this.hostName = hostName;
+  }
+
+  public boolean isKerberosEnabled() {
+    return kerberosEnabled;
+  }
+
+  public void setKerberosEnabled(boolean kerberosEnabled) {
+    this.kerberosEnabled = kerberosEnabled;
+  }
+}

+ 86 - 0
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchSslConfig.java

@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
+
+@Configuration
+public class LogSearchSslConfig {
+
+  public static final String LOGSEARCH_CERT_DEFAULT_FOLDER = "/etc/ambari-logsearch-portal/conf/keys";
+  public static final String LOGSEARCH_CERT_DEFAULT_ALGORITHM = "sha256WithRSA";
+  public static final String CREDENTIAL_STORE_PROVIDER_PATH = "hadoop.security.credential.provider.path";
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.cert.algorithm",
+    description = "Algorithm to generate certificates for SSL (if needed).",
+    examples = {"sha256WithRSA"},
+    defaultValue = LOGSEARCH_CERT_DEFAULT_ALGORITHM,
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.cert.algorithm:" + LOGSEARCH_CERT_DEFAULT_ALGORITHM + "}")
+  private String certAlgorithm;
+
+  @LogSearchPropertyDescription(
+    name = "logsearch.cert.folder.location",
+    description = "Folder where the generated certificates (SSL) will be located. Make sure the user of Log Search Server can access it.",
+    examples = {"/etc/mypath/keys"},
+    defaultValue = LOGSEARCH_CERT_DEFAULT_FOLDER,
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${logsearch.cert.folder.location:" + LOGSEARCH_CERT_DEFAULT_FOLDER + "}")
+  private String certFolder;
+
+  @LogSearchPropertyDescription(
+    name = CREDENTIAL_STORE_PROVIDER_PATH,
+    description = "Path to interrogate for protected credentials. (see: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/CredentialProviderAPI.html)",
+    examples = {"localjceks://file/home/mypath/my.jceks"},
+    sources = {LOGSEARCH_PROPERTIES_FILE}
+  )
+  @Value("${hadoop.security.credential.provider.path:}")
+  private String credentialStoreProviderPath;
+
+  public String getCertAlgorithm() {
+    return certAlgorithm;
+  }
+
+  public void setCertAlgorithm(String certAlgorithm) {
+    this.certAlgorithm = certAlgorithm;
+  }
+
+  public String getCertFolder() {
+    return certFolder;
+  }
+
+  public void setCertFolder(String certFolder) {
+    this.certFolder = certFolder;
+  }
+
+  public String getCredentialStoreProviderPath() {
+    return credentialStoreProviderPath;
+  }
+
+  public void setCredentialStoreProviderPath(String credentialStoreProviderPath) {
+    this.credentialStoreProviderPath = credentialStoreProviderPath;
+  }
+}

+ 3 - 0
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java

@@ -190,6 +190,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
   @Bean
   public RequestMatcher requestMatcher() {
     List<RequestMatcher> matchers = Lists.newArrayList();
+    matchers.add(new AntPathRequestMatcher("/docs/**"));
+    matchers.add(new AntPathRequestMatcher("/swagger-ui/**"));
+    matchers.add(new AntPathRequestMatcher("/swagger.html"));
     matchers.add(new AntPathRequestMatcher("/login.html"));
     matchers.add(new AntPathRequestMatcher("/logout.html"));
     matchers.add(new AntPathRequestMatcher("/styles/**"));

+ 49 - 0
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/StaticResourceConfiguration.java

@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@EnableWebMvc
+@Configuration
+public class StaticResourceConfiguration extends WebMvcConfigurerAdapter {
+
+  private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
+    "classpath:/static/", "classpath:/swagger/","classpath:META-INF/resources/webjars/"
+  };
+
+  @Override
+  public void addResourceHandlers(ResourceHandlerRegistry registry) {
+    registry.addResourceHandler("/**")
+      .addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
+  }
+
+  @Override
+  public void addViewControllers(ViewControllerRegistry registry) {
+    registry.addViewController("/").setViewName(
+      "forward:/index.html");
+    registry.addViewController("/docs").setViewName(
+      "forward:/swagger.html");
+  }
+
+}

+ 7 - 3
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/LogSearchConfigConfigurer.java

@@ -23,7 +23,7 @@ import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 import javax.inject.Named;
 
-import org.apache.ambari.logsearch.common.PropertiesHelper;
+import org.apache.ambari.logsearch.conf.LogSearchConfigMapHolder;
 import org.apache.ambari.logsearch.conf.global.LogSearchConfigState;
 import org.apache.ambari.logsearch.config.api.LogSearchConfigFactory;
 import org.apache.ambari.logsearch.config.api.LogSearchConfigServer;
@@ -44,7 +44,10 @@ public class LogSearchConfigConfigurer implements Configurer {
   
   @Inject
   private LogSearchConfigState logSearchConfigState;
-  
+
+  @Inject
+  private LogSearchConfigMapHolder logSearchConfigMapHolder;
+
   @PostConstruct
   @Override
   public void start() {
@@ -54,7 +57,7 @@ public class LogSearchConfigConfigurer implements Configurer {
         logger.info("Started thread to set up log search config");
         while (true) {
           try {
-            logSearchConfig = LogSearchConfigFactory.createLogSearchConfigServer(PropertiesHelper.getProperties(),
+            logSearchConfig = LogSearchConfigFactory.createLogSearchConfigServer(logSearchConfigMapHolder.getLogsearchProperties(),
                 LogSearchConfigServerZK.class);
             logSearchConfigState.setLogSearchConfigAvailable(true);
             break;
@@ -68,4 +71,5 @@ public class LogSearchConfigConfigurer implements Configurer {
     setupThread.setDaemon(true);
     setupThread.start();
   }
+
 }

+ 39 - 64
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/util/SSLUtil.java → ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SslConfigurer.java

@@ -17,12 +17,14 @@
  * under the License.
  */
 
-package org.apache.ambari.logsearch.util;
+package org.apache.ambari.logsearch.configurer;
 
+import javax.inject.Inject;
+import javax.inject.Named;
 import javax.net.ssl.SSLContext;
 
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.apache.ambari.logsearch.conf.LogSearchSslConfig;
+import org.apache.ambari.logsearch.util.FileUtil;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.ArrayUtils;
@@ -69,10 +71,12 @@ import java.security.interfaces.RSAPrivateKey;
 import java.security.interfaces.RSAPublicKey;
 import java.util.Date;
 
-import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
+import static org.apache.ambari.logsearch.conf.LogSearchSslConfig.CREDENTIAL_STORE_PROVIDER_PATH;
+import static org.apache.ambari.logsearch.conf.LogSearchSslConfig.LOGSEARCH_CERT_DEFAULT_FOLDER;
 
-public class SSLUtil {
-  private static final Logger LOG = LoggerFactory.getLogger(SSLUtil.class);
+@Named
+public class SslConfigurer {
+  private static final Logger LOG = LoggerFactory.getLogger(SslConfigurer.class);
   
   private static final String KEYSTORE_LOCATION_ARG = "javax.net.ssl.keyStore";
   private static final String KEYSTORE_PASSWORD_ARG = "javax.net.ssl.keyStorePassword";
@@ -86,79 +90,50 @@ public class SSLUtil {
   private static final String TRUSTSTORE_PASSWORD_PROPERTY_NAME = "logsearch_truststore_password";
   private static final String KEYSTORE_PASSWORD_FILE = "ks_pass.txt";
   private static final String TRUSTSTORE_PASSWORD_FILE = "ts_pass.txt";
-
-  @LogSearchPropertyDescription(
-    name = "hadoop.security.credential.provider.path",
-    description = "Path to interrogate for protected credentials. (see: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/CredentialProviderAPI.html)",
-    examples = {"localjceks://file/home/mypath/my.jceks"},
-    sources = {LOGSEARCH_PROPERTIES_FILE}
-  )
-  private static final String CREDENTIAL_STORE_PROVIDER_PATH = "hadoop.security.credential.provider.path";
-
-  @LogSearchPropertyDescription(
-    name = "logsearch.cert.folder.location",
-    description = "Folder where the generated certificates (SSL) will be located. Make sure the user of Log Search Server can access it.",
-    examples = {"/etc/mypath/keys"},
-    defaultValue = "/etc/ambari-logsearch-portal/conf/keys",
-    sources = {LOGSEARCH_PROPERTIES_FILE}
-  )
-  private static final String LOGSEARCH_CERT_FOLDER_LOCATION = "logsearch.cert.folder.location";
-
-  @LogSearchPropertyDescription(
-    name = "logsearch.cert.algorithm",
-    description = "Algorithm to generate certificates for SSL (if needed).",
-    examples = {"sha256WithRSA"},
-    defaultValue = "sha256WithRSA",
-    sources = {LOGSEARCH_PROPERTIES_FILE}
-  )
-  private static final String LOGSEARCH_CERT_ALGORITHM = "logsearch.cert.algorithm";
   
   private static final String LOGSEARCH_CERT_FILENAME = "logsearch.crt";
   private static final String LOGSEARCH_KEYSTORE_FILENAME = "logsearch.jks";
   private static final String LOGSEARCH_KEYSTORE_PRIVATE_KEY = "logsearch.private.key";
   private static final String LOGSEARCH_KEYSTORE_PUBLIC_KEY = "logsearch.public.key";
-  private static final String LOGSEARCH_CERT_DEFAULT_ALGORITHM = "sha256WithRSA";
 
-  private static final String LOGSEARCH_CERT_DEFAULT_FOLDER = "/etc/ambari-logsearch-portal/conf/keys";
   private static final String LOGSEARCH_KEYSTORE_DEFAULT_PASSWORD = "bigdata";
+
+  @Inject
+  private LogSearchSslConfig logSearchSslConfig;
   
-  private SSLUtil() {
-    throw new UnsupportedOperationException();
-  }
-  
-  public static String getKeyStoreLocation() {
+  private String getKeyStoreLocation() {
     return System.getProperty(KEYSTORE_LOCATION_ARG);
   }
 
-  public static String getKeyStorePassword() {
+  private String getKeyStorePassword() {
     return System.getProperty(KEYSTORE_PASSWORD_ARG);
   }
 
-  public static String getKeyStoreType() {
+  private String getKeyStoreType() {
     return System.getProperty(KEYSTORE_TYPE_ARG, DEFAULT_KEYSTORE_TYPE);
   }
   
-  public static String getTrustStoreLocation() {
+  private String getTrustStoreLocation() {
     return System.getProperty(TRUSTSTORE_LOCATION_ARG);
   }
 
-  public static String getTrustStorePassword() {
+  private String getTrustStorePassword() {
     return System.getProperty(TRUSTSTORE_PASSWORD_ARG);
   }
 
-  public static String getTrustStoreType() {
+  private String getTrustStoreType() {
     return System.getProperty(TRUSTSTORE_TYPE_ARG, DEFAULT_TRUSTSTORE_TYPE);
   }
 
-  public static boolean isKeyStoreSpecified() {
+  public boolean isKeyStoreSpecified() {
     return StringUtils.isNotEmpty(getKeyStoreLocation());
   }
 
-  private static boolean isTrustStoreSpecified() {
+  private boolean isTrustStoreSpecified() {
     return StringUtils.isNotEmpty(getTrustStoreLocation());
   }
   
-  public static SslContextFactory getSslContextFactory() {
+  public SslContextFactory getSslContextFactory() {
     SslContextFactory sslContextFactory = new SslContextFactory();
     sslContextFactory.setKeyStorePath(getKeyStoreLocation());
     sslContextFactory.setKeyStorePassword(getKeyStorePassword());
@@ -172,7 +147,7 @@ public class SSLUtil {
     return sslContextFactory;
   }
 
-  public static SSLContext getSSLContext() {
+  public SSLContext getSSLContext() {
     SslContextFactory sslContextFactory = getSslContextFactory();
     
     try {
@@ -190,7 +165,7 @@ public class SSLUtil {
     }
   }
 
-  private static String getPasswordFromFile(String fileName) {
+  private String getPasswordFromFile(String fileName) {
     try {
       File pwdFile = new File(LOGSEARCH_CERT_DEFAULT_FOLDER, fileName);
       if (!pwdFile.exists()) {
@@ -205,10 +180,10 @@ public class SSLUtil {
     }
   }
 
-  private static String getPasswordFromCredentialStore(String propertyName) {
+  private String getPasswordFromCredentialStore(String propertyName) {
     try {
-      String providerPath = PropertiesHelper.getProperty(CREDENTIAL_STORE_PROVIDER_PATH);
-      if (providerPath == null) {
+      String providerPath = logSearchSslConfig.getCredentialStoreProviderPath();
+      if (StringUtils.isEmpty(providerPath)) {
         return null;
       }
       
@@ -222,7 +197,7 @@ public class SSLUtil {
     }
   }
 
-  private static String getPassword(String propertyName, String fileName) {
+  private String getPassword(String propertyName, String fileName) {
     String credentialStorePassword = getPasswordFromCredentialStore(propertyName);
     if (credentialStorePassword != null) {
       return credentialStorePassword;
@@ -239,7 +214,7 @@ public class SSLUtil {
   /**
    * Put private key into in-memory keystore and write it to a file (JKS file)
    */
-  private static void setKeyAndCertInKeystore(X509Certificate cert, KeyPair keyPair, KeyStore keyStore, String keyStoreLocation, char[] password)
+  private void setKeyAndCertInKeystore(X509Certificate cert, KeyPair keyPair, KeyStore keyStore, String keyStoreLocation, char[] password)
     throws Exception {
     Certificate[] certChain = new Certificate[1];
     certChain[0] = cert;
@@ -255,7 +230,7 @@ public class SSLUtil {
   /**
    * Create in-memory keypair with bouncy castle
    */
-  private static KeyPair createKeyPair(String encryptionType, int byteCount)
+  private KeyPair createKeyPair(String encryptionType, int byteCount)
     throws NoSuchProviderException, NoSuchAlgorithmException {
     Security.addProvider(new BouncyCastleProvider());
     KeyPairGenerator keyPairGenerator = createKeyPairGenerator(encryptionType, byteCount);
@@ -265,7 +240,7 @@ public class SSLUtil {
   /**
    * Generate X509 certificate if it does not exist
    */
-  private static X509Certificate generateCertificate(String certificateLocation, KeyPair keyPair, String algorithm) throws Exception {
+  private X509Certificate generateCertificate(String certificateLocation, KeyPair keyPair, String algorithm) throws Exception {
     try {
       File certFile = new File(certificateLocation);
       if (certFile.exists()) {
@@ -283,19 +258,19 @@ public class SSLUtil {
     }
   }
 
-  private static void ensureStorePassword(String locationArg, String pwdArg, String propertyName, String fileName) {
+  private void ensureStorePassword(String locationArg, String pwdArg, String propertyName, String fileName) {
     if (StringUtils.isNotEmpty(System.getProperty(locationArg)) && StringUtils.isEmpty(System.getProperty(pwdArg))) {
       String password = getPassword(propertyName, fileName);
       System.setProperty(pwdArg, password);
     }
   }
   
-  public static void ensureStorePasswords() {
+  public void ensureStorePasswords() {
     ensureStorePassword(KEYSTORE_LOCATION_ARG, KEYSTORE_PASSWORD_ARG, KEYSTORE_PASSWORD_PROPERTY_NAME, KEYSTORE_PASSWORD_FILE);
     ensureStorePassword(TRUSTSTORE_LOCATION_ARG, TRUSTSTORE_PASSWORD_ARG, TRUSTSTORE_PASSWORD_PROPERTY_NAME, TRUSTSTORE_PASSWORD_FILE);
   }
 
-  private static X509Certificate getCertFile(String location) throws Exception {
+  private X509Certificate getCertFile(String location) throws Exception {
     try (FileInputStream fos = new FileInputStream(location)) {
       CertificateFactory factory = CertificateFactory.getInstance("X.509");
       return (X509Certificate) factory.generateCertificate(fos);
@@ -305,7 +280,7 @@ public class SSLUtil {
     }
   }
 
-  private static X509Certificate createCert(KeyPair keyPair, String signatureAlgoritm, String domainName)
+  private X509Certificate createCert(KeyPair keyPair, String signatureAlgoritm, String domainName)
     throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, OperatorCreationException, CertificateException, IOException {
     
     RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
@@ -336,7 +311,7 @@ public class SSLUtil {
     return certConverter.getCertificate(certificateHolder);
   }
 
-  private static KeyPairGenerator createKeyPairGenerator(String algorithmIdentifier, int bitCount)
+  private KeyPairGenerator createKeyPairGenerator(String algorithmIdentifier, int bitCount)
     throws NoSuchProviderException, NoSuchAlgorithmException {
     KeyPairGenerator kpg = KeyPairGenerator.getInstance(algorithmIdentifier, BouncyCastleProvider.PROVIDER_NAME);
     kpg.initialize(bitCount);
@@ -346,10 +321,10 @@ public class SSLUtil {
   /**
    * Create keystore with keys and certificate (only if the keystore does not exist or if you have no permissions on the keystore file)
    */
-  public static void loadKeystore() {
+  public void loadKeystore() {
     try {
-      String certFolder = PropertiesHelper.getProperty(LOGSEARCH_CERT_FOLDER_LOCATION, LOGSEARCH_CERT_DEFAULT_FOLDER);
-      String certAlgorithm = PropertiesHelper.getProperty(LOGSEARCH_CERT_ALGORITHM, LOGSEARCH_CERT_DEFAULT_ALGORITHM);
+      String certFolder = logSearchSslConfig.getCertFolder();
+      String certAlgorithm = logSearchSslConfig.getCertAlgorithm();
       String certLocation = String.format("%s/%s", LOGSEARCH_CERT_DEFAULT_FOLDER, LOGSEARCH_CERT_FILENAME);
       String keyStoreLocation = StringUtils.isNotEmpty(getKeyStoreLocation()) ? getKeyStoreLocation()
         : String.format("%s/%s", LOGSEARCH_CERT_DEFAULT_FOLDER, LOGSEARCH_KEYSTORE_FILENAME);

+ 0 - 65
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/util/WebUtil.java

@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ambari.logsearch.util;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WebUtil {
-  private static final Logger LOG = LoggerFactory.getLogger(WebUtil.class);
-
-  private static final String WEB_RESOURCE_FOLDER = "webapps/app";
-
-  private WebUtil() {
-    throw new UnsupportedOperationException();
-  }
-
-  public static URI findWebResourceBase() {
-    URL fileCompleteUrl = Thread.currentThread().getContextClassLoader().getResource(WEB_RESOURCE_FOLDER);
-    String errorMessage = "Web Resource Folder " + WEB_RESOURCE_FOLDER + " not found in classpath";
-    if (fileCompleteUrl != null) {
-      try {
-        return fileCompleteUrl.toURI().normalize();
-      } catch (URISyntaxException e) {
-        LOG.error(errorMessage, e);
-        System.exit(1);
-      }
-    } else {
-      LOG.error(errorMessage);
-      System.exit(1);
-    }
-    throw new IllegalStateException(errorMessage);
-  }
-
-  public static void checkPort(int port) {
-    try (ServerSocket serverSocket = new ServerSocket(port)) {
-    } catch (IOException ex) {
-      LOG.error(ex.getLocalizedMessage() + " PORT :" + port);
-      System.exit(1);
-    }
-  }
-
-}

+ 19 - 88
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java

@@ -30,6 +30,8 @@ import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletContext;
@@ -40,7 +42,7 @@ import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.apache.ambari.logsearch.conf.LogSearchSpnegoConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.security.authentication.AbstractAuthenticationToken;
@@ -54,7 +56,6 @@ import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.security.core.context.SecurityContextImpl;
 import org.springframework.security.core.userdetails.User;
 import org.springframework.security.core.userdetails.UserDetails;
-import org.apache.ambari.logsearch.common.PropertiesHelper;
 import org.apache.commons.collections.iterators.IteratorEnumeration;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
@@ -63,83 +64,12 @@ import org.apache.hadoop.security.authentication.server.PseudoAuthenticationHand
 import org.apache.hadoop.security.authentication.util.KerberosName;
 import org.springframework.security.web.authentication.WebAuthenticationDetails;
 
-import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
 
 public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
   private static final Logger logger = LoggerFactory.getLogger(LogsearchKRBAuthenticationFilter.class);
 
-  @LogSearchPropertyDescription(
-    name = "logsearch.hadoop.security.auth_to_local",
-    description = "Rules that will be applied on authentication names and map them into local usernames.",
-    examples = {"RULE:[1:$1@$0](.*@EXAMPLE.COM)s/@.*//", "DEFAULT"},
-    defaultValue = "DEFAULT",
-    sources = {LOGSEARCH_PROPERTIES_FILE}
-  )
-  private static final String NAME_RULES = "logsearch.hadoop.security.auth_to_local";
-
-  @LogSearchPropertyDescription(
-    name = "logsearch.admin.kerberos.token.valid.seconds",
-    description = "Kerberos token validity in seconds.",
-    examples = {"30"},
-    defaultValue = "30",
-    sources = {LOGSEARCH_PROPERTIES_FILE}
-  )
-  private static final String TOKEN_VALID = "logsearch.admin.kerberos.token.valid.seconds";
-
-  @LogSearchPropertyDescription(
-    name = "logsearch.admin.kerberos.cookie.domain",
-    description = "Domain for Kerberos cookie.",
-    examples = {"c6401.ambari.apache.org", "localhost"},
-    defaultValue = "localhost",
-    sources = {LOGSEARCH_PROPERTIES_FILE}
-  )
-  private static final String COOKIE_DOMAIN = "logsearch.admin.kerberos.cookie.domain";
-
-  @LogSearchPropertyDescription(
-    name = "logsearch.admin.kerberos.cookie.path",
-    description = "Cookie path of the kerberos cookie",
-    examples = {"/"},
-    defaultValue = "/",
-    sources = {LOGSEARCH_PROPERTIES_FILE}
-  )
-  private static final String COOKIE_PATH = "logsearch.admin.kerberos.cookie.path";
-
-  @LogSearchPropertyDescription(
-    name = "logsearch.spnego.kerberos.principal",
-    description = "Principal for SPNEGO authentication for Http requests",
-    examples = {"myuser@EXAMPLE.COM"},
-    defaultValue = "",
-    sources = {LOGSEARCH_PROPERTIES_FILE}
-  )
-  private static final String PRINCIPAL = "logsearch.spnego.kerberos.principal";
-
-  @LogSearchPropertyDescription(
-    name = "logsearch.spnego.kerberos.keytab",
-    description = "Keytab for SPNEGO authentication for Http requests.",
-    examples = {"/etc/security/keytabs/mykeytab.keytab"},
-    defaultValue = "",
-    sources = {LOGSEARCH_PROPERTIES_FILE}
-  )
-  private static final String KEYTAB = "logsearch.spnego.kerberos.keytab";
-
-  @LogSearchPropertyDescription(
-    name = "logsearch.spnego.kerberos.host",
-    description = "",
-    examples = {"c6401.ambari.apache.org", "localhost"},
-    defaultValue = "localhost",
-    sources = {LOGSEARCH_PROPERTIES_FILE}
-  )
-  private static final String HOST_NAME = "logsearch.spnego.kerberos.host";
-
-  @LogSearchPropertyDescription(
-    name = "logsearch.spnego.kerberos.enabled",
-    description = "Enable SPNEGO based authentication for Log Search Server.",
-    examples = {"true", "false"},
-    defaultValue = "false",
-    sources = {LOGSEARCH_PROPERTIES_FILE}
-  )
-  private static final String KERBEROS_ENABLED = "logsearch.spnego.kerberos.enabled";
-
+  @Inject
+  private LogSearchSpnegoConfig logSearchSpnegoConfig;
 
   private static final String NAME_RULES_PARAM = "kerberos.name.rules";
   private static final String TOKEN_VALID_PARAM = "token.validity";
@@ -157,7 +87,8 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
   private String authType = PseudoAuthenticationHandler.TYPE;
   private static boolean spnegoEnable = false;
 
-  public LogsearchKRBAuthenticationFilter() {
+  @PostConstruct
+  public void postConstruct() {
     try {
       isSpnegoEnable();
       init(null);
@@ -169,18 +100,18 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
   @Override
   public void init(FilterConfig conf) throws ServletException {
     final FilterConfig globalConf = conf;
-    String hostName = PropertiesHelper.getProperty(HOST_NAME, "localhost");
+    String hostName = logSearchSpnegoConfig.getHostName();
     final Map<String, String> params = new HashMap<String, String>();
     if (spnegoEnable) {
       authType = KerberosAuthenticationHandler.TYPE;
     }
     params.put(AUTH_TYPE,authType);
-    params.put(NAME_RULES_PARAM,PropertiesHelper.getProperty(NAME_RULES, "DEFAULT"));
-    params.put(TOKEN_VALID_PARAM, PropertiesHelper.getProperty(TOKEN_VALID, "30"));
-    params.put(COOKIE_DOMAIN_PARAM, PropertiesHelper.getProperty(COOKIE_DOMAIN, hostName));
-    params.put(COOKIE_PATH_PARAM, PropertiesHelper.getProperty(COOKIE_PATH, "/"));
-    params.put(PRINCIPAL_PARAM,PropertiesHelper.getProperty(PRINCIPAL,""));
-    params.put(KEYTAB_PARAM,PropertiesHelper.getProperty(KEYTAB,""));
+    params.put(NAME_RULES_PARAM, logSearchSpnegoConfig.getNameRules());
+    params.put(TOKEN_VALID_PARAM, logSearchSpnegoConfig.getTokenValid());
+    params.put(COOKIE_DOMAIN_PARAM, logSearchSpnegoConfig.getCookieDomain());
+    params.put(COOKIE_PATH_PARAM, logSearchSpnegoConfig.getCookiePath());
+    params.put(PRINCIPAL_PARAM, logSearchSpnegoConfig.getPrincipal());
+    params.put(KEYTAB_PARAM, logSearchSpnegoConfig.getKeyTab());
     FilterConfig myConf = new FilterConfig() {
       @Override
       public ServletContext getServletContext() {
@@ -263,7 +194,7 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
     }
     if (!isLoginRequest(httpRequest) && spnegoEnable
         && (existingAuth == null || !existingAuth.isAuthenticated())) {
-      KerberosName.setRules(PropertiesHelper.getProperty(NAME_RULES, "DEFAULT"));
+      KerberosName.setRules(logSearchSpnegoConfig.getNameRules());
       String userName = getUsernameFromRequest(httpRequest);
       if ((existingAuth == null || !existingAuth.isAuthenticated())
           && (StringUtils.isNotEmpty(userName))) {
@@ -297,12 +228,12 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
   }
 
   private void isSpnegoEnable() {
-    spnegoEnable = PropertiesHelper.getBooleanProperty(KERBEROS_ENABLED, false);
+    spnegoEnable = logSearchSpnegoConfig.isKerberosEnabled();
     if (spnegoEnable) {
       spnegoEnable = false;
-      String keytab = PropertiesHelper.getProperty(KEYTAB);
-      String principal = PropertiesHelper.getProperty(PRINCIPAL);
-      String hostname = PropertiesHelper.getProperty(HOST_NAME);
+      String keytab = logSearchSpnegoConfig.getKeyTab();
+      String principal = logSearchSpnegoConfig.getPrincipal();
+      String hostname = logSearchSpnegoConfig.getHostName();
       if (StringUtils.isNotEmpty(keytab) && StringUtils.isNotEmpty(principal)
           && StringUtils.isNotEmpty(hostname)) {
         spnegoEnable = true;

+ 2 - 2
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/listener/LogSearchSessionListener.java

@@ -35,7 +35,7 @@ public class LogSearchSessionListener implements HttpSessionListener {
     synchronized (this) {
       numberOfSessions++;
     }
-    LOG.debug(String.format("New session is created (Id: %s). Number of sessions: %d", event.getSession().getId(), numberOfSessions));
+    LOG.info(String.format("New session is created (Id: %s). Number of sessions: %d", event.getSession().getId(), numberOfSessions));
   }
 
   @Override
@@ -43,6 +43,6 @@ public class LogSearchSessionListener implements HttpSessionListener {
     synchronized (this) {
       numberOfSessions--;
     }
-    LOG.debug(String.format("Session destroyed (Id: %s). Number of sessions: %d", event.getSession().getId(), numberOfSessions));
+    LOG.info(String.format("Session destroyed (Id: %s). Number of sessions: %d", event.getSession().getId(), numberOfSessions));
   }
 }

+ 0 - 365
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapProperties.java

@@ -1,365 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ambari.logsearch.web.security;
-
-import org.apache.commons.lang.StringUtils;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Describes LDAP Server connection parameters
- */
-public class LdapProperties {
-  private String primaryUrl;
-  private String secondaryUrl;
-  private boolean useSsl;
-  private boolean anonymousBind;
-  private String managerDn;
-  private String managerPassword;
-  private String baseDN;
-  private String dnAttribute;
-  private String referralMethod;
-
-  // LDAP group properties
-  private String groupBase;
-  private String groupObjectClass;
-  private String groupMembershipAttr;
-  private String groupNamingAttr;
-  private String adminGroupMappingRules;
-  private boolean groupMappingEnabled;
-
-  // LDAP user properties
-  private String userBase;
-  private String userObjectClass;
-  private String usernameAttribute;
-  private String userSearchBase = "";
-
-  private String groupSearchFilter;
-  private static final String userSearchFilter = "({attribute}={0})";
-
-  public List<String> getLdapUrls() {
-    String protocol = useSsl ? "ldaps://" : "ldap://";
-
-    if (StringUtils.isEmpty(primaryUrl) || primaryUrl.equalsIgnoreCase("none")) {
-      return Collections.emptyList();
-    } else {
-      List<String> list = new ArrayList<String>();
-      list.add(protocol + primaryUrl);
-      if (StringUtils.isNotEmpty(secondaryUrl)) {
-        list.add(protocol + secondaryUrl);
-      }
-      return list;
-    }
-  }
-
-  public String getPrimaryUrl() {
-    return primaryUrl;
-  }
-
-  public void setPrimaryUrl(String primaryUrl) {
-    this.primaryUrl = primaryUrl;
-  }
-
-  public String getSecondaryUrl() {
-    return secondaryUrl;
-  }
-
-  public void setSecondaryUrl(String secondaryUrl) {
-    this.secondaryUrl = secondaryUrl;
-  }
-
-  public boolean isUseSsl() {
-    return useSsl;
-  }
-
-  public void setUseSsl(boolean useSsl) {
-    this.useSsl = useSsl;
-  }
-
-  public boolean isAnonymousBind() {
-    return anonymousBind;
-  }
-
-  public void setAnonymousBind(boolean anonymousBind) {
-    this.anonymousBind = anonymousBind;
-  }
-
-  public String getManagerDn() {
-    return managerDn;
-  }
-
-  public void setManagerDn(String managerDn) {
-    this.managerDn = managerDn;
-  }
-
-  public String getManagerPassword() {
-    return managerPassword;
-  }
-
-  public void setManagerPassword(String managerPassword) {
-    this.managerPassword = managerPassword;
-  }
-
-  public String getBaseDN() {
-    return baseDN;
-  }
-
-  public void setBaseDN(String baseDN) {
-    this.baseDN = baseDN;
-  }
-
-  public String getUserSearchBase() {
-    return userSearchBase;
-  }
-
-  public void setUserSearchBase(String userSearchBase) {
-    this.userSearchBase = userSearchBase;
-  }
-
-  public String getUserSearchFilter() {
-    return userSearchFilter.replace("{attribute}", usernameAttribute);
-  }
-
-  public String getUsernameAttribute() {
-    return usernameAttribute;
-  }
-
-  public void setUsernameAttribute(String usernameAttribute) {
-    this.usernameAttribute = usernameAttribute;
-  }
-
-  public String getGroupBase() {
-    return groupBase;
-  }
-
-  public void setGroupBase(String groupBase) {
-    this.groupBase = groupBase;
-  }
-
-  public String getGroupObjectClass() {
-    return groupObjectClass;
-  }
-
-  public void setGroupObjectClass(String groupObjectClass) {
-    this.groupObjectClass = groupObjectClass;
-  }
-
-  public String getGroupMembershipAttr() {
-    return groupMembershipAttr;
-  }
-
-  public void setGroupMembershipAttr(String groupMembershipAttr) {
-    this.groupMembershipAttr = groupMembershipAttr;
-  }
-
-  public String getGroupNamingAttr() {
-    return groupNamingAttr;
-  }
-
-  public void setGroupNamingAttr(String groupNamingAttr) {
-    this.groupNamingAttr = groupNamingAttr;
-  }
-
-  public String getAdminGroupMappingRules() {
-    return adminGroupMappingRules;
-  }
-
-  public void setAdminGroupMappingRules(String adminGroupMappingRules) {
-    this.adminGroupMappingRules = adminGroupMappingRules;
-  }
-
-  public String getGroupSearchFilter() {
-    return groupSearchFilter;
-  }
-
-  public void setGroupSearchFilter(String groupSearchFilter) {
-    this.groupSearchFilter = groupSearchFilter;
-  }
-
-  public boolean isGroupMappingEnabled() {
-    return groupMappingEnabled;
-  }
-
-  public void setGroupMappingEnabled(boolean groupMappingEnabled) {
-    this.groupMappingEnabled = groupMappingEnabled;
-  }
-
-  public void setUserBase(String userBase) {
-    this.userBase = userBase;
-  }
-
-  public void setUserObjectClass(String userObjectClass) {
-    this.userObjectClass = userObjectClass;
-  }
-
-  public String getUserBase() {
-    return userBase;
-  }
-
-  public String getUserObjectClass() {
-    return userObjectClass;
-  }
-
-  public String getDnAttribute() {
-    return dnAttribute;
-  }
-
-  public void setDnAttribute(String dnAttribute) {
-    this.dnAttribute = dnAttribute;
-  }
-
-  public void setReferralMethod(String referralMethod) {
-    this.referralMethod = referralMethod;
-  }
-
-  public String getReferralMethod() {
-    return referralMethod;
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (this == obj)
-      return true;
-    if (obj == null || getClass() != obj.getClass())
-      return false;
-
-    LdapProperties that = (LdapProperties) obj;
-
-    if (primaryUrl != null ? !primaryUrl.equals(that.primaryUrl)
-      : that.primaryUrl != null)
-      return false;
-    if (secondaryUrl != null ? !secondaryUrl.equals(that.secondaryUrl)
-      : that.secondaryUrl != null)
-      return false;
-    if (useSsl != that.useSsl)
-      return false;
-    if (anonymousBind != that.anonymousBind)
-      return false;
-    if (managerDn != null ? !managerDn.equals(that.managerDn)
-      : that.managerDn != null)
-      return false;
-    if (managerPassword != null ? !managerPassword
-      .equals(that.managerPassword) : that.managerPassword != null)
-      return false;
-    if (baseDN != null ? !baseDN.equals(that.baseDN) : that.baseDN != null)
-      return false;
-    if (userBase != null ? !userBase.equals(that.userBase)
-      : that.userBase != null)
-      return false;
-    if (userObjectClass != null ? !userObjectClass
-      .equals(that.userObjectClass) : that.userObjectClass != null)
-      return false;
-    if (usernameAttribute != null ? !usernameAttribute
-      .equals(that.usernameAttribute)
-      : that.usernameAttribute != null)
-      return false;
-    if (groupBase != null ? !groupBase.equals(that.groupBase)
-      : that.groupBase != null)
-      return false;
-    if (groupObjectClass != null ? !groupObjectClass
-      .equals(that.groupObjectClass) : that.groupObjectClass != null)
-      return false;
-    if (groupMembershipAttr != null ? !groupMembershipAttr
-      .equals(that.groupMembershipAttr)
-      : that.groupMembershipAttr != null)
-      return false;
-    if (groupNamingAttr != null ? !groupNamingAttr
-      .equals(that.groupNamingAttr) : that.groupNamingAttr != null)
-      return false;
-    if (adminGroupMappingRules != null ? !adminGroupMappingRules
-      .equals(that.adminGroupMappingRules)
-      : that.adminGroupMappingRules != null)
-      return false;
-    if (groupSearchFilter != null ? !groupSearchFilter
-      .equals(that.groupSearchFilter)
-      : that.groupSearchFilter != null)
-      return false;
-    if (dnAttribute != null ? !dnAttribute.equals(that.dnAttribute)
-      : that.dnAttribute != null)
-      return false;
-    if (referralMethod != null ? !referralMethod
-      .equals(that.referralMethod) : that.referralMethod != null)
-      return false;
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = primaryUrl != null ? primaryUrl.hashCode() : 0;
-    result = 31 * result
-      + (secondaryUrl != null ? secondaryUrl.hashCode() : 0);
-    result = 31 * result + (useSsl ? 1 : 0);
-    result = 31 * result + (anonymousBind ? 1 : 0);
-    result = 31 * result + (managerDn != null ? managerDn.hashCode() : 0);
-    result = 31 * result
-      + (managerPassword != null ? managerPassword.hashCode() : 0);
-    result = 31 * result + (baseDN != null ? baseDN.hashCode() : 0);
-    result = 31 * result + (userBase != null ? userBase.hashCode() : 0);
-    result = 31 * result
-      + (userObjectClass != null ? userObjectClass.hashCode() : 0);
-    result = 31
-      * result
-      + (usernameAttribute != null ? usernameAttribute.hashCode() : 0);
-    result = 31 * result + (groupBase != null ? groupBase.hashCode() : 0);
-    result = 31 * result
-      + (groupObjectClass != null ? groupObjectClass.hashCode() : 0);
-    result = 31
-      * result
-      + (groupMembershipAttr != null ? groupMembershipAttr.hashCode()
-      : 0);
-    result = 31 * result
-      + (groupNamingAttr != null ? groupNamingAttr.hashCode() : 0);
-    result = 31
-      * result
-      + (adminGroupMappingRules != null ? adminGroupMappingRules
-      .hashCode() : 0);
-    result = 31
-      * result
-      + (groupSearchFilter != null ? groupSearchFilter.hashCode() : 0);
-    result = 31 * result
-      + (dnAttribute != null ? dnAttribute.hashCode() : 0);
-    result = 31 * result
-      + (referralMethod != null ? referralMethod.hashCode() : 0);
-    return result;
-  }
-
-  @Override
-  public String toString() {
-    return "LdapProperties [primaryUrl=" + primaryUrl + ", secondaryUrl="
-      + secondaryUrl + ", useSsl=" + useSsl + ", anonymousBind="
-      + anonymousBind + ", managerDn=" + managerDn
-      + ", managerPassword=" + managerPassword == null ? "null"
-      : "****" + ", baseDN=" + baseDN + ", dnAttribute="
-      + dnAttribute + ", referralMethod=" + referralMethod
-      + ", groupBase=" + groupBase + ", groupObjectClass="
-      + groupObjectClass + ", groupMembershipAttr="
-      + groupMembershipAttr + ", groupNamingAttr="
-      + groupNamingAttr + ", adminGroupMappingRules="
-      + adminGroupMappingRules + ", groupMappingEnabled="
-      + groupMappingEnabled + ", userBase=" + userBase
-      + ", userObjectClass=" + userObjectClass
-      + ", usernameAttribute=" + usernameAttribute
-      + ", userSearchBase=" + userSearchBase
-      + ", groupSearchFilter=" + groupSearchFilter + "]";
-  }
-
-}

+ 0 - 58
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapPropertyName.java

@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ambari.logsearch.web.security;
-
-public class LdapPropertyName {
-
-  public static final String LDAP_USE_SSL_KEY = "authentication.ldap.useSSL";
-  public static final String LDAP_PRIMARY_URL_KEY = "authentication.ldap.primaryUrl";
-  public static final String LDAP_SECONDARY_URL_KEY = "authentication.ldap.secondaryUrl";
-  public static final String LDAP_BASE_DN_KEY = "authentication.ldap.baseDn";
-  public static final String LDAP_BIND_ANONYMOUSLY_KEY = "authentication.ldap.bindAnonymously";
-  public static final String LDAP_MANAGER_DN_KEY = "authentication.ldap.managerDn";
-  public static final String LDAP_MANAGER_PASSWORD_KEY = "authentication.ldap.managerPassword";
-  public static final String LDAP_DN_ATTRIBUTE_KEY = "authentication.ldap.dnAttribute";
-  public static final String LDAP_USERNAME_ATTRIBUTE_KEY = "authentication.ldap.usernameAttribute";
-  public static final String LDAP_USER_BASE_KEY = "authentication.ldap.userBase";
-  public static final String LDAP_USER_OBJECT_CLASS_KEY = "authentication.ldap.userObjectClass";
-  public static final String LDAP_GROUP_BASE_KEY = "authentication.ldap.groupBase";
-  public static final String LDAP_GROUP_OBJECT_CLASS_KEY = "authentication.ldap.groupObjectClass";
-  public static final String LDAP_GROUP_NAMING_ATTR_KEY = "authentication.ldap.groupNamingAttr";
-  public static final String LDAP_GROUP_MEMEBERSHIP_ATTR_KEY = "authentication.ldap.groupMembershipAttr";
-  public static final String LDAP_ADMIN_GROUP_MAPPING_RULES_KEY = "authorization.ldap.adminGroupMappingRules";
-  public static final String LDAP_GROUP_SEARCH_FILTER_KEY = "authorization.ldap.groupSearchFilter";
-  public static final String LDAP_REFERRAL_KEY = "authentication.ldap.referral";
-
-  // default
-  public static final String LDAP_BIND_ANONYMOUSLY_DEFAULT = "true";
-  public static final String LDAP_PRIMARY_URL_DEFAULT = "localhost:389";
-  public static final String LDAP_BASE_DN_DEFAULT = "dc=example,dc=com";
-  public static final String LDAP_USERNAME_ATTRIBUTE_DEFAULT = "uid";
-  public static final String LDAP_DN_ATTRIBUTE_DEFAULT = "dn";
-  public static final String LDAP_USER_BASE_DEFAULT = "ou=people,dc=example,dc=com";
-  public static final String LDAP_USER_OBJECT_CLASS_DEFAULT = "person";
-  public static final String LDAP_GROUP_BASE_DEFAULT = "ou=groups,dc=example,dc=com";
-  public static final String LDAP_GROUP_OBJECT_CLASS_DEFAULT = "group";
-  public static final String LDAP_GROUP_NAMING_ATTR_DEFAULT = "cn";
-  public static final String LDAP_GROUP_MEMBERSHIP_ATTR_DEFAULT = "member";
-  public static final String LDAP_ADMIN_GROUP_MAPPING_RULES_DEFAULT = "Logsearch Administrators";
-  public static final String LDAP_GROUP_SEARCH_FILTER_DEFAULT = "";
-  public static final String LDAP_REFERRAL_DEFAULT = "ignore";
-
-}

+ 0 - 115
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapUtil.java

@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ambari.logsearch.web.security;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.common.XMLPropertiesHelper;
-import org.apache.log4j.Logger;
-import org.springframework.core.io.ClassPathResource;
-
-public class LdapUtil {
-
-  private static Logger logger = Logger.getLogger(LdapUtil.class);
-
-  /**
-   * Gets parameters of LDAP server to connect to
-   *
-   * @return LdapServerProperties object representing connection parameters
-   */
-  public static LdapProperties getLdapServerProperties(Properties properties) {
-    LdapProperties ldapServerProperties = new LdapProperties();
-
-    ldapServerProperties.setPrimaryUrl(properties.getProperty(LdapPropertyName.LDAP_PRIMARY_URL_KEY,
-      LdapPropertyName.LDAP_PRIMARY_URL_DEFAULT));
-    ldapServerProperties.setSecondaryUrl(properties.getProperty(LdapPropertyName.LDAP_SECONDARY_URL_KEY));
-    ldapServerProperties.setUseSsl("true".equalsIgnoreCase(properties
-      .getProperty(LdapPropertyName.LDAP_USE_SSL_KEY)));
-    ldapServerProperties.setAnonymousBind("true".equalsIgnoreCase(properties.getProperty(
-      LdapPropertyName.LDAP_BIND_ANONYMOUSLY_KEY, LdapPropertyName.LDAP_BIND_ANONYMOUSLY_DEFAULT)));
-    ldapServerProperties.setManagerDn(properties.getProperty(LdapPropertyName.LDAP_MANAGER_DN_KEY));
-    String ldapPasswordProperty = properties.getProperty(LdapPropertyName.LDAP_MANAGER_PASSWORD_KEY);
-    // TODO read password from password file
-    ldapServerProperties.setManagerPassword(ldapPasswordProperty);
-    ldapServerProperties.setBaseDN(properties.getProperty(LdapPropertyName.LDAP_BASE_DN_KEY,
-      LdapPropertyName.LDAP_BASE_DN_DEFAULT));
-    ldapServerProperties.setUsernameAttribute(properties.getProperty(LdapPropertyName.LDAP_USERNAME_ATTRIBUTE_KEY,
-      LdapPropertyName.LDAP_USERNAME_ATTRIBUTE_DEFAULT));
-
-    ldapServerProperties.setUserBase(properties.getProperty(LdapPropertyName.LDAP_USER_BASE_KEY,
-      LdapPropertyName.LDAP_USER_BASE_DEFAULT));
-    ldapServerProperties.setUserObjectClass(properties.getProperty(LdapPropertyName.LDAP_USER_OBJECT_CLASS_KEY,
-      LdapPropertyName.LDAP_USER_OBJECT_CLASS_DEFAULT));
-    ldapServerProperties.setDnAttribute(properties.getProperty(LdapPropertyName.LDAP_DN_ATTRIBUTE_KEY,
-      LdapPropertyName.LDAP_DN_ATTRIBUTE_DEFAULT));
-
-    ldapServerProperties.setGroupBase(properties.getProperty(LdapPropertyName.LDAP_GROUP_BASE_KEY,
-      LdapPropertyName.LDAP_GROUP_BASE_DEFAULT));
-    ldapServerProperties.setGroupObjectClass(properties.getProperty(LdapPropertyName.LDAP_GROUP_OBJECT_CLASS_KEY,
-      LdapPropertyName.LDAP_GROUP_OBJECT_CLASS_DEFAULT));
-    ldapServerProperties.setGroupMembershipAttr(properties.getProperty(
-      LdapPropertyName.LDAP_GROUP_MEMEBERSHIP_ATTR_KEY, LdapPropertyName.LDAP_GROUP_MEMBERSHIP_ATTR_DEFAULT));
-    ldapServerProperties.setGroupNamingAttr(properties.getProperty(LdapPropertyName.LDAP_GROUP_NAMING_ATTR_KEY,
-      LdapPropertyName.LDAP_GROUP_NAMING_ATTR_DEFAULT));
-    ldapServerProperties.setAdminGroupMappingRules(properties.getProperty(
-      LdapPropertyName.LDAP_ADMIN_GROUP_MAPPING_RULES_KEY,
-      LdapPropertyName.LDAP_ADMIN_GROUP_MAPPING_RULES_DEFAULT));
-    ldapServerProperties.setGroupSearchFilter(properties.getProperty(LdapPropertyName.LDAP_GROUP_SEARCH_FILTER_KEY,
-      LdapPropertyName.LDAP_GROUP_SEARCH_FILTER_DEFAULT));
-    ldapServerProperties.setReferralMethod(properties.getProperty(LdapPropertyName.LDAP_REFERRAL_KEY,
-      LdapPropertyName.LDAP_REFERRAL_DEFAULT));
-
-    if (properties.containsKey(LdapPropertyName.LDAP_GROUP_BASE_KEY)
-      || properties.containsKey(LdapPropertyName.LDAP_GROUP_OBJECT_CLASS_KEY)
-      || properties.containsKey(LdapPropertyName.LDAP_GROUP_MEMEBERSHIP_ATTR_KEY)
-      || properties.containsKey(LdapPropertyName.LDAP_GROUP_NAMING_ATTR_KEY)
-      || properties.containsKey(LdapPropertyName.LDAP_ADMIN_GROUP_MAPPING_RULES_KEY)
-      || properties.containsKey(LdapPropertyName.LDAP_GROUP_SEARCH_FILTER_KEY)) {
-      ldapServerProperties.setGroupMappingEnabled(true);
-    }
-
-    return ldapServerProperties;
-  }
-
-  /**
-   * @return
-   */
-  public static LdapProperties loadLdapProperties() {
-    LdapProperties ldapServerProperties = null;
-    String ldapConfigFileName = PropertiesHelper.getProperty("logsearch.login.ldap.config", "logsearch-admin-site.xml");
-    Properties props = null;
-    ClassPathResource resource = new ClassPathResource(ldapConfigFileName);
-    if (resource != null) {
-      try {
-        props = new Properties();
-        new XMLPropertiesHelper().loadFromXml(props, resource.getInputStream());
-        ldapServerProperties = getLdapServerProperties(props);
-      } catch (IOException e) {
-        logger.error("Ldap configudation file loading failed : " + e.getMessage());
-      }
-    }
-    if (ldapServerProperties == null) {
-      logger.error("ldapServerProperties object is not created.");
-    }
-    return ldapServerProperties;
-  }
-
-}

+ 1 - 1
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java

@@ -29,7 +29,7 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority;
 abstract class LogsearchAbstractAuthenticationProvider implements AuthenticationProvider {
 
   protected enum AuthMethod {
-    LDAP, FILE, EXTERNAL_AUTH, SIMPLE
+    FILE, EXTERNAL_AUTH, SIMPLE
   };
 
   @Override

+ 0 - 4
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java

@@ -36,9 +36,6 @@ public class LogsearchAuthenticationProvider extends LogsearchAbstractAuthentica
   private static final Logger logger = Logger .getLogger(LogsearchAuthenticationProvider.class);
   private static final Logger auditLogger = Logger.getLogger("org.apache.ambari.logsearch.audit");
 
-  @Inject
-  private LogsearchLdapAuthenticationProvider ldapAuthenticationProvider;
-
   @Inject
   private LogsearchFileAuthenticationProvider fileAuthenticationProvider;
 
@@ -106,7 +103,6 @@ public class LogsearchAuthenticationProvider extends LogsearchAbstractAuthentica
 
   private Authentication doAuth(Authentication authentication, AuthMethod authMethod) {
     switch (authMethod) {
-      case LDAP: return ldapAuthenticationProvider.authenticate(authentication);
       case FILE: return fileAuthenticationProvider.authenticate(authentication);
       case EXTERNAL_AUTH: return externalServerAuthenticationProvider.authenticate(authentication);
       case SIMPLE: return simpleAuthenticationProvider.authenticate(authentication);

+ 0 - 187
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java

@@ -1,187 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ambari.logsearch.web.security;
-
-import java.util.List;
-
-import org.apache.ambari.logsearch.conf.AuthPropsConfig;
-import org.apache.log4j.Logger;
-import org.springframework.ldap.CommunicationException;
-import org.springframework.ldap.core.support.LdapContextSource;
-import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
-import org.springframework.security.ldap.authentication.LdapAuthenticationProvider;
-import org.springframework.security.ldap.search.FilterBasedLdapUserSearch;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-@Named
-public class LogsearchLdapAuthenticationProvider extends
-  LogsearchAbstractAuthenticationProvider {
-
-  private static Logger logger = Logger
-    .getLogger(LogsearchLdapAuthenticationProvider.class);
-
-  private static LdapProperties ldapServerProperties = null;
-  private static LdapAuthenticationProvider ldapAuthProvider = null;
-  private String logStatement = "";
-
-  @Inject
-  private AuthPropsConfig authPropsConfig;
-
-  public LogsearchLdapAuthenticationProvider() {
-  }
-
-  @PostConstruct
-  public void postConstruct() {
-    logger.debug("Creating object of ldap auth provider ");
-    if (authPropsConfig.isAuthLdapEnabled()) {
-      ldapAuthProvider = loadLdapAuthenticationProvider();
-    } else {
-      logger.info("Ldap auth is disabled");
-    }
-  }
-
-  @Override
-  public Authentication authenticate(Authentication authentication)
-    throws AuthenticationException {
-    if (!authPropsConfig.isAuthLdapEnabled()) {
-      logger.debug("Ldap auth is disabled");
-      return authentication;
-    }
-    try {
-      LdapAuthenticationProvider authProvider = loadLdapAuthenticationProvider();
-      if (authProvider != null) {
-        return authProvider.authenticate(authentication);
-      } else {
-        return authentication;
-      }
-    } catch (AuthenticationException e) {
-      logger.info("Got exception during LDAP authentication attempt", e);
-      // Try to help in troubleshooting
-      Throwable cause = e.getCause();
-      if (cause != null) {
-        if ((cause != e)
-          && (cause instanceof org.springframework.ldap.AuthenticationException)) {
-          logger.warn(
-            "Looks like LDAP manager credentials (that are used for "
-              + "connecting to LDAP server) are invalid.",
-            e);
-        }
-      }
-    } catch (CommunicationException e) {
-      logger.error(e);
-    } catch (Exception e) {
-      logger.error(e, e.getCause());
-    }
-    if (authentication != null && !authentication.isAuthenticated()) {
-      logger.warn("Ldap authentication failed. username="
-        + authentication.getName() + ", details="
-        + authentication.getDetails());
-      throw new BadCredentialsException("Invalid credentials!!");
-    }
-    return authentication;
-  }
-
-  /**
-   * Reloads LDAP Context Source and depending objects if properties were
-   * changed
-   *
-   * @return corresponding LDAP authentication provider
-   */
-  private LdapAuthenticationProvider loadLdapAuthenticationProvider() {
-    if (reloadLdapServerProperties()) {
-      logger.info("LDAP Properties changed - rebuilding Context");
-      LdapContextSource springSecurityContextSource = new LdapContextSource();
-      List<String> ldapUrls = ldapServerProperties.getLdapUrls();
-      logStatement = "ldapUrls=" + ldapUrls;
-      if (ldapUrls == null || ldapUrls.size() == 0) {
-        logger.info("LDAP URL is empty. So won't initialize LDAP provider");
-        return null;
-      }
-
-      springSecurityContextSource.setUrls(ldapUrls
-        .toArray(new String[ldapUrls.size()]));
-      springSecurityContextSource.setBase(ldapServerProperties
-        .getBaseDN());
-      logStatement = logStatement + ", baseDN="
-        + ldapServerProperties.getBaseDN();
-
-      if (!ldapServerProperties.isAnonymousBind()) {
-        springSecurityContextSource.setUserDn(ldapServerProperties
-          .getManagerDn());
-        logStatement = logStatement + ", managerDN="
-          + ldapServerProperties.getManagerDn();
-        springSecurityContextSource.setPassword(ldapServerProperties
-          .getManagerPassword());
-      }
-
-      try {
-        springSecurityContextSource.afterPropertiesSet();
-      } catch (Exception e) {
-        logger.error("LDAP Context Source not loaded ", e);
-        throw new UsernameNotFoundException(
-          "LDAP Context Source not loaded. ldapDetails="
-            + logStatement, e);
-      }
-
-      String userSearchBase = ldapServerProperties.getUserSearchBase();
-      logStatement = logStatement + ", userSearchBase=" + userSearchBase;
-      String userSearchFilter = ldapServerProperties
-        .getUserSearchFilter();
-      logStatement = logStatement + ", userSearchFilter="
-        + userSearchFilter;
-
-      logger.info("LDAP properties=" + logStatement);
-      FilterBasedLdapUserSearch userSearch = new FilterBasedLdapUserSearch(
-        userSearchBase, userSearchFilter,
-        springSecurityContextSource);
-
-      LogsearchLdapBindAuthenticator bindAuthenticator = new LogsearchLdapBindAuthenticator(
-        springSecurityContextSource, ldapServerProperties);
-      bindAuthenticator.setUserSearch(userSearch);
-
-      LdapAuthenticationProvider authenticationProvider = new LdapAuthenticationProvider(
-        bindAuthenticator);
-      ldapAuthProvider = authenticationProvider;
-
-    }
-    return ldapAuthProvider;
-  }
-
-  /**
-   * Reloads LDAP Server properties from configuration
-   *
-   * @return true if properties were reloaded
-   */
-  private boolean reloadLdapServerProperties() {
-    LdapProperties properties = LdapUtil.loadLdapProperties();
-    if (!properties.equals(ldapServerProperties)) {
-      logger.info("Reloading properties");
-      ldapServerProperties = properties;
-      return true;
-    }
-    return false;
-  }
-
-}

+ 0 - 46
ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapBindAuthenticator.java

@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ambari.logsearch.web.security;
-
-import org.apache.log4j.Logger;
-import org.springframework.ldap.core.DirContextOperations;
-import org.springframework.ldap.core.support.BaseLdapPathContextSource;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.ldap.authentication.BindAuthenticator;
-
-public class LogsearchLdapBindAuthenticator extends BindAuthenticator {
-  private static Logger logger = Logger
-    .getLogger(LogsearchLdapBindAuthenticator.class);
-
-  LdapProperties ldapServerProperties;
-
-  public LogsearchLdapBindAuthenticator(
-    BaseLdapPathContextSource contextSource,
-    LdapProperties ldapServerProperties) {
-    super(contextSource);
-    this.ldapServerProperties = ldapServerProperties;
-    logger.info("LDAP properties=" + ldapServerProperties);
-  }
-
-  @Override
-  public DirContextOperations authenticate(Authentication authentication) {
-    return super.authenticate(authentication);
-  }
-
-}

+ 0 - 1
ambari-logsearch/ambari-logsearch-server/src/main/resources/default.properties

@@ -21,7 +21,6 @@ logsearch.auth.simple.enable=false
 
 #login config
 logsearch.login.credentials.file=user_pass.json
-logsearch.login.ldap.config=logsearch-admin-site.xml
 
 logsearch.cert.folder.location=/etc/ambari-logsearch-portal/conf/keys
 logsearch.cert.algorithm=sha256WithRSAEncryption

+ 38 - 80
ambari-logsearch/ambari-logsearch-server/src/main/resources/log4j.xml

@@ -16,112 +16,70 @@
   limitations under the License.
 -->
 
-<!DOCTYPE log4j:configuration SYSTEM "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+<!DOCTYPE log4j:configuration SYSTEM
+  "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
 
 <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
   <appender name="console" class="org.apache.log4j.ConsoleAppender">
-    <param name="Target" value="System.out" />
+    <param name="Target" value="System.out"/>
     <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
+      <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n"/>
     </layout>
   </appender>
 
-  <!-- <appender name="rolling_file" class="org.apache.log4j.RollingFileAppender">
-    <param name="file" value="logs/logsearch-app.log" />
-    <param name="Threshold" value="info" />
-    <param name="append" value="true" />
-    <param name="maxFileSize" value="10MB" />
-    <param name="maxBackupIndex" value="10" />
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
-    </layout>
-  </appender>
-
-  <appender name="audit_rolling_file" class="org.apache.log4j.RollingFileAppender">
-    <param name="file" value="logs/logsearch-audit.log" />
-    <param name="Threshold" value="info" />
-    <param name="append" value="true" />
-    <param name="maxFileSize" value="10MB" />
-    <param name="maxBackupIndex" value="10" />
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
-    </layout>
+  <appender name="rolling_file_json"
+            class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
+    <param name="file" value="target/logs/logsearch-app.json"/>
+    <param name="Threshold" value="info"/>
+    <param name="append" value="true"/>
+    <param name="maxFileSize" value="10MB"/>
+    <param name="maxBackupIndex" value="10"/>
+    <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion"/>
   </appender>
 
-  <appender name="performance_analyzer" class="org.apache.log4j.RollingFileAppender">
-    <param name="file" value="logs/logsearch-performance.log" />
-    <param name="Threshold" value="info" />
-    <param name="append" value="true" />
-    <param name="maxFileSize" value="10MB" />
-    <param name="maxBackupIndex" value="10" />
-
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
-    </layout>
-  </appender>
- -->
-
-<!-- logsearch appender config for the all above appender -->
-
- <appender name="rolling_file_json"
-  class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
-  <param name="file" value="target/logs/logsearch-app.json" />
-  <param name="Threshold" value="info" />
-  <param name="append" value="true" />
-  <param name="maxFileSize" value="10MB" />
-  <param name="maxBackupIndex" value="10" />
-  <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion" />
-</appender>
-
   <appender name="audit_rolling_file_json"
-    class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
-    <param name="file" value="target/logs/logsearch-audit.json" />
-    <param name="Threshold" value="info" />
-    <param name="append" value="true" />
-    <param name="maxFileSize" value="10MB" />
-    <param name="maxBackupIndex" value="10" />
-    <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion" />
+            class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
+    <param name="file" value="target/logs/logsearch-audit.json"/>
+    <param name="Threshold" value="info"/>
+    <param name="append" value="true"/>
+    <param name="maxFileSize" value="10MB"/>
+    <param name="maxBackupIndex" value="10"/>
+    <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion"/>
   </appender>
 
   <appender name="performance_analyzer_json"
-    class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
-    <param name="file" value="target/logs/logsearch-performance.json" />
-    <param name="Threshold" value="info" />
-    <param name="append" value="true" />
-    <param name="maxFileSize" value="10MB" />
-    <param name="maxBackupIndex" value="10" />
-    <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion" />
+            class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
+    <param name="file" value="target/logs/logsearch-performance.json"/>
+    <param name="Threshold" value="info"/>
+    <param name="append" value="true"/>
+    <param name="maxFileSize" value="10MB"/>
+    <param name="maxBackupIndex" value="10"/>
+    <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion"/>
   </appender>
- 
-  <!-- Logs to suppress BEGIN -->
+
   <category name="org.apache.solr.common.cloud.ZkStateReader" additivity="false">
-    <priority value="error" />
-    <appender-ref ref="console" />
+    <priority value="error"/>
+    <appender-ref ref="console"/>
   </category>
-  <!-- Logs to suppress END -->
 
   <logger name="org.apache.ambari.logsearch.audit"
-    additivity="true">
-    <!-- <appender-ref ref="audit_rolling_file" />-->
-        <appender-ref ref="audit_rolling_file_json" />
+          additivity="true">
+    <appender-ref ref="audit_rolling_file_json"/>
   </logger>
 
   <logger name="org.apache.ambari.logsearch.performance"
-    additivity="false">
-    <!-- <appender-ref ref="performance_analyzer" />-->
-        <appender-ref ref="performance_analyzer_json" />
+          additivity="false">
+    <appender-ref ref="performance_analyzer_json"/>
   </logger>
 
   <logger name="org.apache.ambari.logsearch" additivity="false">
-    <!-- <appender-ref ref="console" /> -->
-    <!-- <appender-ref ref="rolling_file" />-->
-        <appender-ref ref="rolling_file_json" />
+    <appender-ref ref="rolling_file_json"/>
   </logger>
 
   <root>
-    <level value="warn" />
-    <!-- <appender-ref ref="console" /> -->
-    <!--<appender-ref ref="rolling_file" />-->
-        <appender-ref ref="rolling_file_json" />
+    <level value="info"/>
+    <appender-ref ref="console"/>
+    <appender-ref ref="rolling_file_json"/>
   </root>
+
 </log4j:configuration>

+ 0 - 116
ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch-admin-site.xml

@@ -1,116 +0,0 @@
-<!-- Licensed under the Apache License, Version 2.0 (the "License"); you 
-	may not use this file except in compliance with the License. You may obtain 
-	a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless 
-	required by applicable law or agreed to in writing, software distributed 
-	under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 
-	OR CONDITIONS OF ANY KIND, either express or implied. See the License for 
-	the specific language governing permissions and limitations under the License. 
-	See accompanying LICENSE file. -->
-
-
-<configuration>
-	<property>
-		<name>authentication.ldap.primaryUrl</name>
-		<value></value>
-		<display-name></display-name>
-		<description>The hostname and port for the LDAP or AD server. Example: my.ldap.server:389</description>		
-	</property>
-	<property>
-		<name>authentication.ldap.useSSL</name>
-		<value>false</value>
-		<display-name></display-name>
-		<description>If true, use SSL when connecting to the LDAP or AD server.</description>
-	</property>
-	<property>
-		<name>authentication.ldap.baseDn</name>
-		<value>dc=example,dc=com</value>
-		<display-name></display-name>
-		<description>The root Distinguished Name to search in the directory for users. Example: ou=people,dc=hadoop,dc=apache,dc=org</description>
-	</property>
-	<property>
-		<name>authentication.ldap.bindAnonymously</name>
-		<value>false</value>
-		<display-name></display-name>
-		<description>If true, bind to the LDAP or AD server anonymously</description>
-	</property>
-	<property>
-		<name>authentication.ldap.managerDn</name>
-		<value>cn=Manager,dc=example,dc=com</value>
-		<display-name></display-name>
-		<description>If Bind anonymous is set to false, the Distinguished Name (“DN”) for the manager.
-		 Example: uid=hdfs,ou=people,dc=hadoop,dc=apache,dc=org</description>
-	</property>
-	<property>
-		<name>authentication.ldap.managerPassword</name>
-		<value></value>
-		<display-name></display-name>
-		<property-type>PASSWORD</property-type>
-		<description>If Bind anonymous is set to false, the password for the manager</description>
-	</property>
-	<property>
-		<name>authentication.ldap.dnAttribute</name>
-		<value>dn</value>
-		<display-name></display-name>
-		<description></description>
-	</property>
-	<property>
-		<name>authentication.ldap.usernameAttribute</name>
-		<value>uid</value>
-		<display-name></display-name>
-		<description>The attribute for username. Example: uid</description>
-	</property>
-	<property>
-		<name>authentication.ldap.userBase</name>
-		<value>ou=people,dc=example,dc=com</value>
-		<display-name></display-name>
-		<description></description>
-	</property>
-	<property>
-		<name>authentication.ldap.userObjectClass</name>
-		<value>person</value>
-		<display-name></display-name>
-		<description>The object class that is used for users. Example: organizationalPerson</description>
-	</property>
-	<property>
-		<name>authentication.ldap.groupBase</name>
-		<value>ou=groups,dc=example,dc=com"</value>
-		<display-name></display-name>
-		<description></description>
-	</property>
-	<property>
-		<name>authentication.ldap.groupObjectClass</name>
-		<value>group</value>
-		<display-name></display-name>
-		<description>The object class that is used for groups. Example: groupOfUniqueNames</description>
-	</property>
-	<property>
-		<name>authentication.ldap.groupNamingAttr</name>
-		<value>cn</value>
-		<display-name></display-name>
-		<description>The attribute for group name.</description>
-	</property>
-	<property>
-		<name>authentication.ldap.groupMembershipAttr</name>
-		<value>member</value>
-		<display-name></display-name>
-		<description>The attribute for group membership. Example: uniqueMember</description>
-	</property>
-	<property>
-		<name>authorization.ldap.adminGroupMappingRules</name>
-		<value>Logsearch Administrators</value>
-		<display-name></display-name>
-		<description></description>
-	</property>
-	<property>
-		<name>authorization.ldap.groupSearchFilter</name>
-		<value></value>
-		<display-name></display-name>
-		<description></description>
-	</property>
-	<property>
-		<name>authentication.ldap.referral</name>
-		<value>ignore</value>
-		<display-name></display-name>
-		<description>Determines if LDAP referrals should be followed, or ignored.</description>
-	</property>
-</configuration>

+ 3 - 3
ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch.properties

@@ -46,13 +46,13 @@ logsearch.auth.external_auth.login_url=/api/v1/users/$USERNAME/privileges?fields
 logsearch.roles.allowed=AMBARI.ADMINISTRATOR
 
 
-#communication protocol i.e http or https etc.
-logsearch.protocol=
+logsearch.http.port=61888
+logsearch.https.port=61889
+logsearch.protocol=http
 
 logsearch.solr.kerberos.enable=false
 logsearch.solr.jaas.file=/usr/lib/ambari-logsearch-portal/logsearch_solr_jaas.conf
 
-
 #portal Kerberos 
 logsearch.spnego.kerberos.enabled=false
 logsearch.spnego.kerberos.keytab=

+ 18 - 18
ambari-logsearch/ambari-logsearch-server/src/main/resources/swagger/swagger.html

@@ -18,24 +18,24 @@
 <html>
 <head>
     <title>Log Search REST API</title>
-    <link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" />
-    <link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" />
-    <link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
-    <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
-    <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
-    <link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
-    <link href='css/print.css' media='print' rel='stylesheet' type='text/css'/>
-    <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
-    <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
-    <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
-    <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
-    <script src='lib/handlebars-2.0.0.js' type='text/javascript'></script>
-    <script src='lib/underscore-min.js' type='text/javascript'></script>
-    <script src='lib/backbone-min.js' type='text/javascript'></script>
-    <script src='swagger-ui.js' type='text/javascript'></script>
-    <script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
-    <script src='lib/marked.js' type='text/javascript'></script>
-    <script src='lib/swagger-oauth.js' type='text/javascript'></script>
+    <link rel="icon" type="image/png" href="swagger-ui/2.1.0/images/favicon-32x32.png" sizes="32x32" />
+    <link rel="icon" type="image/png" href="swagger-ui/2.1.0/images/favicon-16x16.png" sizes="16x16" />
+    <link href='swagger-ui/2.1.0/css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
+    <link href='swagger-ui/2.1.0/css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
+    <link href='swagger-ui/2.1.0/css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
+    <link href='swagger-ui/2.1.0/css/reset.css' media='print' rel='stylesheet' type='text/css'/>
+    <link href='swagger-ui/2.1.0/css/print.css' media='print' rel='stylesheet' type='text/css'/>
+    <script src='swagger-ui/2.1.0/lib/jquery-1.8.0.min.js' type='text/javascript'></script>
+    <script src='swagger-ui/2.1.0/lib/jquery.slideto.min.js' type='text/javascript'></script>
+    <script src='swagger-ui/2.1.0/lib/jquery.wiggle.min.js' type='text/javascript'></script>
+    <script src='swagger-ui/2.1.0/lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
+    <script src='swagger-ui/2.1.0/lib/handlebars-2.0.0.js' type='text/javascript'></script>
+    <script src='swagger-ui/2.1.0/lib/underscore-min.js' type='text/javascript'></script>
+    <script src='swagger-ui/2.1.0/lib/backbone-min.js' type='text/javascript'></script>
+    <script src='swagger-ui/2.1.0/swagger-ui.js' type='text/javascript'></script>
+    <script src='swagger-ui/2.1.0/lib/highlight.7.3.pack.js' type='text/javascript'></script>
+    <script src='swagger-ui/2.1.0/lib/marked.js' type='text/javascript'></script>
+    <script src='swagger-ui/2.1.0/lib/swagger-oauth.js' type='text/javascript'></script>
 
     <script type="text/javascript">
         $(function () {

+ 1 - 2
ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh

@@ -96,5 +96,4 @@ LOGSEARCH_GC_OPTS="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$LOGSEARCH
 echo "Starting logsearch. Output file=$LOGFILE pid_file=$PID_FILE"
 #LOGSEARCH_CLI_CLASSPATH=
 #set -x
-nohup $JAVA -cp "$LOGSEARCH_CLI_CLASSPATH:$LOGSEARCH_CONF_DIR:$script_dir/libs/*:$script_dir/classes" $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_MEM $LOGSEARCH_JAVA_OPTS $JMX org.apache.ambari.logsearch.LogSearch $LOGSEARCH_PORT $* > $LOGFILE 2>&1 &
-echo $! > $PID_FILE
+nohup $JAVA -cp "$LOGSEARCH_CLI_CLASSPATH:$LOGSEARCH_CONF_DIR:$script_dir/libs/*:$script_dir/classes" $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_MEM $LOGSEARCH_JAVA_OPTS $JMX org.apache.ambari.logsearch.LogSearch $* > $LOGFILE 2>&1 &

+ 21 - 47
ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java

@@ -43,8 +43,7 @@ public class LogsearchAuthenticationProviderTest {
   }
   
   private LogsearchAuthenticationProvider provider;
-  
-  private LogsearchLdapAuthenticationProvider mockLdapProvider;
+
   private LogsearchFileAuthenticationProvider mockFileProvider;
   private LogsearchExternalServerAuthenticationProvider mockExternalServerProvider;
   private LogsearchSimpleAuthenticationProvider mockSimpleProvider;
@@ -52,16 +51,11 @@ public class LogsearchAuthenticationProviderTest {
   @Before
   public void resetContext() throws Exception {
     provider = new LogsearchAuthenticationProvider();
-    
-    mockLdapProvider = strictMock(LogsearchLdapAuthenticationProvider.class);
+
     mockFileProvider = strictMock(LogsearchFileAuthenticationProvider.class);
     mockExternalServerProvider = strictMock(LogsearchExternalServerAuthenticationProvider.class);
     mockSimpleProvider = strictMock(LogsearchSimpleAuthenticationProvider.class);
     
-    Field ldapProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("ldapAuthenticationProvider");
-    ldapProviderField.setAccessible(true);
-    ldapProviderField.set(provider, mockLdapProvider);
-    
     Field fileProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("fileAuthenticationProvider");
     fileProviderField.setAccessible(true);
     fileProviderField.set(provider, mockFileProvider);
@@ -75,103 +69,84 @@ public class LogsearchAuthenticationProviderTest {
     simpleProviderField.set(provider, mockSimpleProvider);
   }
   
-  @Test
-  public void testLdapAuthenticates() {
-    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
-    expect(mockLdapProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
-    
-    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
-    
-    Authentication authenticationResult = provider.authenticate(authentication);
-    assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
-    
-    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
-  }
-  
   @Test
   public void testFileAuthenticates() {
     Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
-    expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
     expect(mockFileProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
     
-    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
-    
+    replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+
     Authentication authenticationResult = provider.authenticate(authentication);
     assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
     
-    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
   }
   
   @Test
   public void testExternalAuthenticates() {
     Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
-    expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
     expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
     expect(mockExternalServerProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
     
-    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
     
     Authentication authenticationResult = provider.authenticate(authentication);
     assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
     
-    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
   }
   
   @Test
   public void testSimpleAuthenticates() {
     Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
-    expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
     expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
     expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
     expect(mockSimpleProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
     
-    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
     
     Authentication authenticationResult = provider.authenticate(authentication);
     assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
     
-    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
   }
   
   @Test
   public void testNoOneAuthenticates() {
     Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
-    expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
     expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
     expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
     expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
     
-    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
     
     Authentication authenticationResult = provider.authenticate(authentication);
     assertSame(authenticationResult, FAILED_AUTHENTICATION);
     
-    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
   }
   
   @Test
   public void testOneExceptionAndAuthenticates() {
     Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
-    expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("") {});
     expect(mockFileProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
     
-    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
     
     Authentication authenticationResult = provider.authenticate(authentication);
     assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
     
-    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
   }
   
   @Test
   public void testOneExceptionNoOneAuthenticates() {
     Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
-    expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {});
     expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
-    expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockExternalServerProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {});
     expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
     
-    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
     
     try {
       provider.authenticate(authentication);
@@ -180,18 +155,17 @@ public class LogsearchAuthenticationProviderTest {
       assertEquals(e.getMessage(), "msg1");
     }
     
-    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
   }
   
   @Test
   public void testTwoExceptionNoOneAuthenticates() {
     Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
-    expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {});
-    expect(mockFileProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg2") {});
-    expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockFileProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {});
+    expect(mockExternalServerProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg2") {});
     expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
-    
-    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+
+    replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
     
     try {
       provider.authenticate(authentication);
@@ -200,6 +174,6 @@ public class LogsearchAuthenticationProviderTest {
       assertEquals(e.getMessage(), "msg1");
     }
     
-    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
   }
 }

+ 0 - 61
ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java

@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ambari.logsearch.web.security;
-
-import org.apache.ambari.logsearch.conf.AuthPropsConfig;
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.security.authentication.TestingAuthenticationToken;
-import org.springframework.security.core.Authentication;
-
-import static junit.framework.Assert.assertSame;
-import static org.easymock.EasyMock.strictMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import java.lang.reflect.Field;
-
-public class LogsearchLdapAuthenticationProviderTest {
-
-  private LogsearchLdapAuthenticationProvider provider;
-  private AuthPropsConfig mockAuthPropsConfig;
-  
-  @Before
-  public void init() throws Exception {
-    provider = new LogsearchLdapAuthenticationProvider();
-    mockAuthPropsConfig = strictMock(AuthPropsConfig.class);
-    
-    Field f = LogsearchLdapAuthenticationProvider.class.getDeclaredField("authPropsConfig");
-    f.setAccessible(true);
-    f.set(provider, mockAuthPropsConfig);
-  }
-  
-  @Test
-  public void testAuthenticationDisabled() {
-    expect(mockAuthPropsConfig.isAuthLdapEnabled()).andReturn(false);
-    
-    replay(mockAuthPropsConfig);
-    
-    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
-    assertSame(provider.authenticate(authentication), authentication);
-    
-    verify(mockAuthPropsConfig);
-  }
-}

+ 1 - 1
ambari-logsearch/ambari-logsearch-web/build.properties

@@ -9,4 +9,4 @@
 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
-app.target.dir=${builddir}/target/classes/webapps/app
+app.target.dir=${builddir}/target/classes/static

+ 2 - 2
ambari-logsearch/ambari-logsearch-web/pom.xml

@@ -90,7 +90,7 @@
               <goal>copy-resources</goal>
             </goals>
             <configuration>
-              <outputDirectory>${basedir}/target/classes/webapps/app</outputDirectory>
+              <outputDirectory>${basedir}/target/classes/static</outputDirectory>
               <resources>
                 <resource>
                   <directory>src/main/webapp</directory>
@@ -127,7 +127,7 @@
               <goal>copy-resources</goal>
             </goals>
             <configuration>
-              <outputDirectory>${basedir}/target/classes/webapps/app/libs/bower</outputDirectory>
+              <outputDirectory>${basedir}/target/classes/static/libs/bower</outputDirectory>
               <resources>
                 <resource>
                   <directory>${basedir}/target/libs</directory>

+ 2 - 2
ambari-logsearch/docker/logsearch-docker.sh

@@ -69,8 +69,8 @@ function start_logsearch_container() {
     -v $AMBARI_LOCATION:/root/ambari -v $MAVEN_REPOSITORY_LOCATION:/root/.m2 $LOGSEARCH_EXPOSED_PORTS $LOGSEARCH_ENV_OPTS $LOGSEARCH_EXTRA_OPTS $LOGSEARCH_VOLUME_OPTS -p 9983:9983 -p 4444:4444 -p 5910:5910 \
     -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-logfeeder/target/classes:/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package/classes \
     -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-server/target/classes:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes \
-    -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-web/src/main/webapp:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/webapps/app \
-    -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-web/target/libs:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/webapps/app/libs/bower \
+    -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-web/src/main/webapp:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/static \
+    -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-web/target/libs:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/static/libs/bower \
     ambari-logsearch:v1.0
   ip_address=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' logsearch)
   echo "Log Search container started on $ip_address (for Mac OSX route to boot2docker/docker-machine VM address, e.g.: 'sudo route add -net 172.17.0.0/16 192.168.59.103')"

+ 20 - 15
ambari-logsearch/docker/test-config/logsearch/log4j.xml

@@ -1,14 +1,20 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
-	license agreements. See the NOTICE file distributed with this work for additional
-	information regarding copyright ownership. The ASF licenses this file to
-	You under the Apache License, Version 2.0 (the "License"); you may not use
-	this file except in compliance with the License. You may obtain a copy of
-	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
-	by applicable law or agreed to in writing, software distributed under the
-	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
-	OF ANY KIND, either express or implied. See the License for the specific
-	language governing permissions and limitations under the License. -->
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
 <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
 <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
   <appender name="console" class="org.apache.log4j.ConsoleAppender">
@@ -29,15 +35,14 @@
     </layout>
   </appender>
 
-  <!-- Logs to suppress BEGIN -->
-  <category name="org.apache.solr.common.cloud.ZkStateReader" additivity="false">
-    <priority value="error" />
+  <category name="org.apache.ambari.logsearch" additivity="false">
+    <priority value="info" />
     <appender-ref ref="console" />
+    <appender-ref ref="rolling_file" />
   </category>
-  <!-- Logs to suppress END -->
 
   <root>
-    <level value="debug" />
+    <level value="info" />
     <appender-ref ref="console" />
     <appender-ref ref="rolling_file" />
   </root>

+ 1 - 4
ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh

@@ -16,14 +16,11 @@
 
 set -e
 
-export LOGSEARCH_PORT=61888
-
-# path containing LogSearch.jar file
 export LOGSEARCH_PATH=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package
 
 export LOGSEARCH_CONF_DIR=/root/config/logsearch
 
-export LOGFILE=/var/log/ambari-logsearch-portal/logsearch.log
+export LOGFILE=/var/log/ambari-logsearch-portal/logsearch-app.log
 
 export PID_FILE=/var/run/ambari-logsearch-portal/logsearch.pid
 

+ 1 - 0
ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties

@@ -51,4 +51,5 @@ logsearch.auth.ldap.enable=false
 logsearch.auth.simple.enable=false
 logsearch.auth.external_auth.enable=false
 
+logsearch.https.port=61888
 logsearch.protocol=https

+ 13 - 6
ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImpl.java

@@ -36,15 +36,19 @@ public class LoggingRequestHelperFactoryImpl implements LoggingRequestHelperFact
 
   private static final Logger LOG = Logger.getLogger(LoggingRequestHelperFactoryImpl.class);
 
-  private static final String LOGSEARCH_ENV_CONFIG_TYPE_NAME = "logsearch-env";
+  private static final String LOGSEARCH_PROPERTIES_CONFIG_TYPE_NAME = "logsearch-properties";
 
   private static final String LOGSEARCH_SERVICE_NAME = "LOGSEARCH";
 
   private static final String LOGSEARCH_SERVER_COMPONENT_NAME = "LOGSEARCH_SERVER";
 
-  private static final String LOGSEARCH_UI_PORT_PROPERTY_NAME = "logsearch_ui_port";
+  private static final String LOGSEARCH_HTTP_PORT_PROPERTY_NAME = "logsearch.http.port";
 
-  private static final String LOGSEARCH_UI_PROTOCOL = "logsearch_ui_protocol";
+  private static final String LOGSEARCH_HTTPS_PORT_PROPERTY_NAME = "logsearch.https.port";
+
+  private static final String LOGSEARCH_UI_PROTOCOL = "logsearch.protocol";
+
+  private static final String LOGSEARCH_HTTPS_PROTOCOL_VALUE = "https";
 
   @Inject
   private Configuration ambariServerConfiguration;
@@ -73,7 +77,7 @@ public class LoggingRequestHelperFactoryImpl implements LoggingRequestHelperFact
         }
 
         Config logSearchEnvConfig =
-          cluster.getDesiredConfigByType(LOGSEARCH_ENV_CONFIG_TYPE_NAME);
+          cluster.getDesiredConfigByType(LOGSEARCH_PROPERTIES_CONFIG_TYPE_NAME);
 
         List<ServiceComponentHost> listOfMatchingHosts =
           cluster.getServiceComponentHosts(LOGSEARCH_SERVICE_NAME, LOGSEARCH_SERVER_COMPONENT_NAME);
@@ -97,11 +101,14 @@ public class LoggingRequestHelperFactoryImpl implements LoggingRequestHelperFact
         }
 
         final String logSearchHostName = serviceComponentHost.getHostName();
-        final String logSearchPortNumber =
-          logSearchEnvConfig.getProperties().get(LOGSEARCH_UI_PORT_PROPERTY_NAME);
+
         final String logSearchProtocol =
           logSearchEnvConfig.getProperties().get(LOGSEARCH_UI_PROTOCOL);
 
+        final String logSearchPortNumber = LOGSEARCH_HTTPS_PROTOCOL_VALUE.equalsIgnoreCase(logSearchProtocol)
+          ? logSearchEnvConfig.getProperties().get(LOGSEARCH_HTTPS_PORT_PROPERTY_NAME)
+          : logSearchEnvConfig.getProperties().get(LOGSEARCH_HTTP_PORT_PROPERTY_NAME);
+
         final LoggingRequestHelperImpl loggingRequestHelper = new LoggingRequestHelperImpl(logSearchHostName, logSearchPortNumber, logSearchProtocol, ambariManagementController.getCredentialStoreService(), cluster);
         // set configured timeouts for the Ambari connection to the LogSearch Portal service
         loggingRequestHelper.setLogSearchConnectTimeoutInMilliseconds(ambariServerConfiguration.getLogSearchPortalConnectTimeout());

+ 25 - 3
ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java

@@ -350,6 +350,15 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
             removeConfigurationPropertiesFromCluster(cluster, configType, removeProperties);
           }
 
+          Config logSearchEnv = cluster.getDesiredConfigByType("logsearch-env");
+
+          String oldProtocolProperty = null;
+          String oldPortProperty = null;
+          if (logSearchEnv != null) {
+            oldProtocolProperty = logSearchEnv.getProperties().get("logsearch_ui_port");
+            oldPortProperty = logSearchEnv.getProperties().get("logsearch_ui_protocol");
+          }
+
           Config logSearchProperties = cluster.getDesiredConfigByType("logsearch-properties");
           Config logFeederProperties = cluster.getDesiredConfigByType("logfeeder-properties");
           if (logSearchProperties != null && logFeederProperties != null) {
@@ -358,9 +367,22 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
             Set<String> removeProperties = Sets.newHashSet("logsearch.logfeeder.include.default.level");
             removeConfigurationPropertiesFromCluster(cluster, "logsearch-properties", removeProperties);
 
-            Map<String, String> newProperties = new HashMap<>();
-            newProperties.put("logfeeder.include.default.level", defaultLogLevels);
-            updateConfigurationPropertiesForCluster(cluster, "logfeeder-properties", newProperties, true, true);
+            Map<String, String> newLogSearchProperties = new HashMap<>();
+            if (oldProtocolProperty != null) {
+              newLogSearchProperties.put("logsearch.protocol", oldProtocolProperty);
+            }
+
+            if (oldPortProperty != null) {
+              newLogSearchProperties.put("logsearch.http.port", oldPortProperty);
+              newLogSearchProperties.put("logsearch.https.port", oldPortProperty);
+            }
+            if (!newLogSearchProperties.isEmpty()) {
+              updateConfigurationPropertiesForCluster(cluster, "logsearch-properties", newLogSearchProperties, true, true);
+            }
+
+            Map<String, String> newLogfeederProperties = new HashMap<>();
+            newLogfeederProperties.put("logfeeder.include.default.level", defaultLogLevels);
+            updateConfigurationPropertiesForCluster(cluster, "logfeeder-properties", newLogfeederProperties, true, true);
           }
 
           Config logFeederLog4jProperties = cluster.getDesiredConfigByType("logfeeder-log4j");

+ 3 - 3
ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/alerts.json

@@ -10,9 +10,9 @@
         "source": {
           "type": "WEB",
           "uri": {
-            "http": "{{logsearch-env/logsearch_ui_port}}",
-            "https": "{{logsearch-env/logsearch_ui_port}}",
-            "https_property": "{{logsearch-env/logsearch_ui_protocol}}",
+            "http": "{{logsearch-properties/logsearch.http.port}}",
+            "https": "{{logsearch-properties/logsearch.https.port}}",
+            "https_property": "{{logsearch-properties/logsearch.protocol}}",
             "https_property_value": "https",
             "default_port": 61888,
             "connection_timeout": 5.0

+ 0 - 14
ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml

@@ -21,20 +21,6 @@
 -->
 <!-- This is a special config file for properties used to monitor status of the service -->
 <configuration supports_adding_forbidden="true">
-  <property>
-    <name>logsearch_ui_protocol</name>
-    <value>http</value>
-    <description>Protocol (http or https)</description>
-    <display-name>Log Search UI Protocol</display-name>
-    <on-ambari-upgrade add="true"/>
-  </property>
-  <property>
-    <name>logsearch_ui_port</name>
-    <value>61888</value>
-    <description>Default port for Log Search UI</description>
-    <display-name>Log Search UI Port</display-name>
-    <on-ambari-upgrade add="true"/>
-  </property>
   <property>
     <name>logsearch_pid_dir</name>
     <value>/var/run/ambari-logsearch-portal</value>

+ 21 - 0
ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml

@@ -20,6 +20,27 @@
  */
 -->
 <configuration>
+  <property>
+    <name>logsearch.http.port</name>
+    <value>61888</value>
+    <description>Default port for Log Search UI (HTTP)</description>
+    <display-name>Log Search UI Http Port</display-name>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>logsearch.https.port</name>
+    <value>61888</value>
+    <description>Default port for Log Search UI (HTTPS)</description>
+    <display-name>Log Search UI Https Port</display-name>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>logsearch.protocol</name>
+    <value>http</value>
+    <description>Protocol (http or https)</description>
+    <display-name>Log Search UI Protocol</display-name>
+    <on-ambari-upgrade add="true"/>
+  </property>
   <property>
     <name>logsearch.collection.service.logs.numshards</name>
     <value>5</value>

+ 7 - 6
ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py

@@ -171,8 +171,6 @@ zookeeper_quorum = logsearch_solr_zk_quorum
 logsearch_user = config['configurations']['logsearch-env']['logsearch_user']
 logsearch_log_dir = config['configurations']['logsearch-env']['logsearch_log_dir']
 logsearch_log = logsearch_log_dir + '/logsearch.out'
-logsearch_ui_protocol = config['configurations']['logsearch-env']["logsearch_ui_protocol"]
-logsearch_ui_port = config['configurations']['logsearch-env']["logsearch_ui_port"]
 logsearch_debug_enabled = str(config['configurations']['logsearch-env']["logsearch_debug_enabled"]).lower()
 logsearch_debug_port = config['configurations']['logsearch-env']["logsearch_debug_port"]
 logsearch_app_max_memory = config['configurations']['logsearch-env']['logsearch_app_max_memory']
@@ -233,6 +231,10 @@ else:
 
 # Logsearch propreties
 
+logsearch_protocol = config['configurations']['logsearch-properties']["logsearch.protocol"]
+logsearch_http_port = config['configurations']['logsearch-properties']["logsearch.http.port"]
+logsearch_https_port = config['configurations']['logsearch-properties']["logsearch.https.port"]
+
 logsearch_properties = {}
 
 # default values
@@ -251,8 +253,6 @@ logsearch_properties['logsearch.auth.file.enabled'] = 'true'
 logsearch_properties['logsearch.auth.ldap.enabled'] = 'false'
 logsearch_properties['logsearch.auth.simple.enabled'] = 'false'
 
-logsearch_properties['logsearch.protocol'] = logsearch_ui_protocol
-
 # load config values
 
 logsearch_properties = dict(logsearch_properties.items() +\
@@ -288,7 +288,7 @@ logsearch_collection_audit_logs_numshards = logsearch_properties['logsearch.coll
 
 # check if logsearch uses ssl in any way
 
-logsearch_use_ssl = logsearch_solr_ssl_enabled or logsearch_ui_protocol == 'https' or ambari_server_use_ssl
+logsearch_use_ssl = logsearch_solr_ssl_enabled or logsearch_protocol == 'https' or ambari_server_use_ssl
 
 #####################################
 # Logfeeder configs
@@ -397,6 +397,7 @@ if 'infra-solr-env' in config['configurations'] and security_enabled and not log
 
 logsearch_server_hosts = default('/clusterHostInfo/logsearch_server_hosts', None)
 logsearch_server_host = ""
+logsearch_ui_port =  logsearch_https_port if logsearch_protocol == 'https' else logsearch_http_port
 if logsearch_server_hosts is not None and len(logsearch_server_hosts) > 0:
   logsearch_server_host = logsearch_server_hosts[0]
-smoke_logsearch_cmd = format('curl -k -s -o /dev/null -w "%{{http_code}}" {logsearch_ui_protocol}://{logsearch_server_host}:{logsearch_ui_port}/login.html | grep 200')
+smoke_logsearch_cmd = format('curl -k -s -o /dev/null -w "%{{http_code}}" {logsearch_protocol}://{logsearch_server_host}:{logsearch_ui_port}/login.html | grep 200')

+ 0 - 2
ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2

@@ -16,8 +16,6 @@
 
 set -e
 
-export LOGSEARCH_PORT={{logsearch_ui_port}}
-
 # path containing LogSearch.jar file
 export LOGSEARCH_PATH={{logsearch_dir}}
 

+ 5 - 5
ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/quicklinks/quicklinks.json

@@ -6,9 +6,9 @@
       "type":"https",
       "checks":[
         {
-          "property":"logsearch_ui_protocol",
+          "property":"logsearch.protocol",
           "desired":"https",
-          "site":"logsearch-env"
+          "site":"logsearch-properties"
         }
       ]
     },
@@ -21,12 +21,12 @@
         "requires_user_name": "false",
         "attributes": ["authenticated", "sso"],
         "port": {
-          "http_property": "logsearch_ui_port",
+          "http_property": "logsearch.http.port",
           "http_default_port": "8888",
-          "https_property": "logsearch_ui_port",
+          "https_property": "logsearch.https.port",
           "https_default_port": "8888",
           "regex": "^(\\d+)$",
-          "site": "logsearch-env"
+          "site": "logsearch-properties"
         }
       }
     ]

+ 5 - 5
ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImplTest.java

@@ -77,12 +77,12 @@ public class LoggingRequestHelperFactoryImplTest {
 
     Map<String, String> testProperties =
       new HashMap<>();
-    testProperties.put("logsearch_ui_port", expectedPortNumber);
+    testProperties.put("logsearch.http.port", expectedPortNumber);
 
     expect(controllerMock.getClusters()).andReturn(clustersMock).atLeastOnce();
     expect(controllerMock.getCredentialStoreService()).andReturn(credentialStoreServiceMock).atLeastOnce();
     expect(clustersMock.getCluster(expectedClusterName)).andReturn(clusterMock).atLeastOnce();
-    expect(clusterMock.getDesiredConfigByType("logsearch-env")).andReturn(logSearchEnvConfig).atLeastOnce();
+    expect(clusterMock.getDesiredConfigByType("logsearch-properties")).andReturn(logSearchEnvConfig).atLeastOnce();
     expect(clusterMock.getServiceComponentHosts("LOGSEARCH", "LOGSEARCH_SERVER")).andReturn(Collections.singletonList(serviceComponentHostMock)).atLeastOnce();
     expect(clusterMock.getServices()).andReturn(Collections.singletonMap("LOGSEARCH", (Service) null)).atLeastOnce();
     expect(logSearchEnvConfig.getProperties()).andReturn(testProperties).atLeastOnce();
@@ -145,11 +145,11 @@ public class LoggingRequestHelperFactoryImplTest {
 
     Map<String, String> testProperties =
       new HashMap<>();
-    testProperties.put("logsearch_ui_port", expectedPortNumber);
+    testProperties.put("logsearch.http.port", expectedPortNumber);
 
     expect(controllerMock.getClusters()).andReturn(clustersMock).atLeastOnce();
     expect(clustersMock.getCluster(expectedClusterName)).andReturn(clusterMock).atLeastOnce();
-    expect(clusterMock.getDesiredConfigByType("logsearch-env")).andReturn(logSearchEnvConfig).atLeastOnce();
+    expect(clusterMock.getDesiredConfigByType("logsearch-properties")).andReturn(logSearchEnvConfig).atLeastOnce();
     expect(clusterMock.getServiceComponentHosts("LOGSEARCH", "LOGSEARCH_SERVER")).andReturn(Collections.singletonList(serviceComponentHostMock)).atLeastOnce();
     expect(clusterMock.getServices()).andReturn(Collections.singletonMap("LOGSEARCH", (Service) null)).atLeastOnce();
 
@@ -198,7 +198,7 @@ public class LoggingRequestHelperFactoryImplTest {
 
     expect(controllerMock.getClusters()).andReturn(clustersMock).atLeastOnce();
     expect(clustersMock.getCluster(expectedClusterName)).andReturn(clusterMock).atLeastOnce();
-    expect(clusterMock.getDesiredConfigByType("logsearch-env")).andReturn(logSearchEnvConfig).atLeastOnce();
+    expect(clusterMock.getDesiredConfigByType("logsearch-properties")).andReturn(logSearchEnvConfig).atLeastOnce();
     expect(clusterMock.getServiceComponentHosts("LOGSEARCH", "LOGSEARCH_SERVER")).andReturn(Collections.<ServiceComponentHost>emptyList()).atLeastOnce();
     expect(clusterMock.getServices()).andReturn(Collections.singletonMap("LOGSEARCH", (Service)null)).atLeastOnce();
 

+ 2 - 0
ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py

@@ -100,6 +100,8 @@ class TestLogSearch(RMFTestCase):
                                             'logsearch.config.zk_connect_string': 'c6401.ambari.apache.org:2181',
                                             'logsearch.login.credentials.file': 'logsearch-admin.json',
                                             'logsearch.protocol': 'http',
+                                            'logsearch.http.port': '61888',
+                                            'logsearch.https.port': '61888',
                                             'logsearch.roles.allowed': 'AMBARI.ADMINISTRATOR,CLUSTER.ADMINISTRATOR',
                                             'logsearch.service.logs.split.interval.mins': '1',
                                             'logsearch.solr.audit.logs.zk_connect_string': 'c6401.ambari.apache.org:2181/infra-solr',

+ 3 - 2
ambari-server/src/test/python/stacks/2.4/configs/default.json

@@ -276,8 +276,6 @@
         "logsearch_log_dir": "/var/log/ambari-logsearch-portal",
         "logsearch_debug_enabled": "false",
         "logsearch_debug_port": "5005",
-        "logsearch_ui_protocol": "http",
-        "logsearch_ui_port" : "61888",
         "logsearch_keystore_password" : "bigdata",
         "logsearch_truststore_password" : "bigdata",
         "logsearch_solr_audit_logs_use_ranger": "false",
@@ -296,6 +294,9 @@
         "common-property": "common-value"
       },
       "logsearch-properties": {
+        "logsearch.protocol": "http",
+        "logsearch.http.port" : "61888",
+        "logsearch.https.port" : "61888",
         "logsearch.spnego.kerberos.host" : "localhost",
         "logsearch.solr.collection.service.logs" : "hadoop_logs",
         "logsearch.solr.collection.audit.logs" : "audit_logs",

+ 52 - 45
ambari-web/app/data/configs/services/logsearch_properties.js

@@ -245,111 +245,97 @@ module.exports = [
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
     "index": 1,
-    "name": "logsearch_ui_protocol",
-    "serviceName": "LOGSEARCH"
-  },
-  {
-    "category": "Advanced logsearch-env",
-    "filename": "logsearch-env.xml",
-    "index": 2,
-    "name": "logsearch_ui_port",
-    "serviceName": "LOGSEARCH"
-  },
-  {
-    "category": "Advanced logsearch-env",
-    "filename": "logsearch-env.xml",
-    "index": 3,
     "name": "logsearch_log_dir",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 4,
+    "index": 2,
     "name": "logsearch_pid_dir",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 5,
+    "index": 3,
     "name": "logsearch_app_max_memory",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 6,
+    "index": 4,
     "name": "logsearch_debug_enabled",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 7,
+    "index": 5,
     "name": "logsearch_debug_port",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 8,
+    "index": 6,
     "name": "logsearch_truststore_location",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 9,
+    "index": 7,
     "name": "logsearch_truststore_type",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 10,
+    "index": 8,
     "name": "logsearch_truststore_password",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 11,
+    "index": 9,
     "name": "logsearch_keystore_location",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 12,
+    "index": 10,
     "name": "logsearch_keystore_type",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 13,
+    "index": 11,
     "name": "logsearch_keystore_password",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 14,
+    "index": 12,
     "name": "logsearch_kerberos_keytab",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 15,
+    "index": 13,
     "name": "logsearch_kerberos_principal",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-env",
     "filename": "logsearch-env.xml",
-    "index": 16,
+    "index": 14,
     "name": "content",
     "serviceName": "LOGSEARCH"
   },
@@ -441,76 +427,97 @@ module.exports = [
     "category": "Advanced logsearch-properties",
     "filename": "logsearch-properties.xml",
     "index": 1,
-    "name": "logsearch.solr.collection.service.logs",
+    "name": "logsearch.http.port",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-properties",
     "filename": "logsearch-properties.xml",
     "index": 2,
-    "name": "logsearch.service.logs.fields",
+    "name": "logsearch.https.port",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-properties",
     "filename": "logsearch-properties.xml",
     "index": 3,
-    "name": "logsearch.service.logs.split.interval.mins",
+    "name": "logsearch.protocol",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-properties",
     "filename": "logsearch-properties.xml",
     "index": 4,
-    "name": "logsearch.solr.collection.audit.logs",
+    "name": "logsearch.solr.collection.service.logs",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-properties",
     "filename": "logsearch-properties.xml",
     "index": 5,
-    "name": "logsearch.audit.logs.split.interval.mins",
+    "name": "logsearch.service.logs.fields",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-properties",
     "filename": "logsearch-properties.xml",
     "index": 6,
-    "name": "logsearch.solr.audit.logs.use.ranger",
+    "name": "logsearch.service.logs.split.interval.mins",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-properties",
     "filename": "logsearch-properties.xml",
     "index": 7,
-    "name": "logsearch.ranger.audit.logs.collection.name",
+    "name": "logsearch.solr.collection.audit.logs",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-properties",
     "filename": "logsearch-properties.xml",
     "index": 8,
-    "name": "logsearch.solr.metrics.collector.hosts",
+    "name": "logsearch.audit.logs.split.interval.mins",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-properties",
     "filename": "logsearch-properties.xml",
     "index": 9,
-    "name": "logsearch.auth.external_auth.enable",
+    "name": "logsearch.solr.audit.logs.use.ranger",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-properties",
     "filename": "logsearch-properties.xml",
     "index": 10,
-    "name": "logsearch.auth.external_auth.host_url",
+    "name": "logsearch.ranger.audit.logs.collection.name",
     "serviceName": "LOGSEARCH"
   },
   {
     "category": "Advanced logsearch-properties",
     "filename": "logsearch-properties.xml",
     "index": 11,
+    "name": "logsearch.solr.metrics.collector.hosts",
+    "serviceName": "LOGSEARCH"
+  },
+  {
+    "category": "Advanced logsearch-properties",
+    "filename": "logsearch-properties.xml",
+    "index": 12,
+    "name": "logsearch.auth.external_auth.enable",
+    "serviceName": "LOGSEARCH"
+  },
+  {
+    "category": "Advanced logsearch-properties",
+    "filename": "logsearch-properties.xml",
+    "index": 13,
+    "name": "logsearch.auth.external_auth.host_url",
+    "serviceName": "LOGSEARCH"
+  },
+  {
+    "category": "Advanced logsearch-properties",
+    "filename": "logsearch-properties.xml",
+    "index": 14,
     "name": "logsearch.auth.external_auth.login_url",
     "serviceName": "LOGSEARCH"
   },
@@ -519,55 +526,55 @@ module.exports = [
     "serviceName": "LOGSEARCH",
     "filename": "logsearch-properties.xml",
     "category": "Advanced logsearch-properties",
-    "index": 12
+    "index": 15
   },
   {
     "name": "logsearch.auth.jwt.audiances",
     "serviceName": "LOGSEARCH",
     "filename": "logsearch-properties.xml",
     "category": "Advanced logsearch-properties",
-    "index": 13
+    "index": 16
   },
   {
     "name": "logsearch.auth.jwt.cookie.name",
     "serviceName": "LOGSEARCH",
     "filename": "logsearch-properties.xml",
     "category": "Advanced logsearch-properties",
-    "index": 14
+    "index": 17
   },
   {
     "name": "logsearch.auth.jwt.query.param.original_url",
     "serviceName": "LOGSEARCH",
     "filename": "logsearch-properties.xml",
     "category": "Advanced logsearch-properties",
-    "index": 15
+    "index": 18
   },
   {
     "name": "logsearch.spnego.kerberos.enabled",
     "serviceName": "LOGSEARCH",
     "filename": "logsearch-properties.xml",
     "category": "Advanced logsearch-properties",
-    "index": 16
+    "index": 19
   },
   {
     "name": "logsearch.spnego.kerberos.keytab",
     "serviceName": "LOGSEARCH",
     "filename": "logsearch-properties.xml",
     "category": "Advanced logsearch-properties",
-    "index": 17
+    "index": 20
   },
   {
     "name": "logsearch.spnego.kerberos.principal",
     "serviceName": "LOGSEARCH",
     "filename": "logsearch-properties.xml",
     "category": "Advanced logsearch-properties",
-    "index": 18
+    "index": 21
   },
   {
     "name": "logsearch.spnego.kerberos.host",
     "serviceName": "LOGSEARCH",
     "filename": "logsearch-properties.xml",
     "category": "Advanced logsearch-properties",
-    "index": 19
+    "index": 22
   }
 ];