kasakrisz closed pull request #7: AMBARI-24777 - Infra Manager: Remove dependencies due to security concerns. URL: https://github.com/apache/ambari-infra/pull/7
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/AbstractInfraSteps.java b/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/AbstractInfraSteps.java index da962b9..24d603b 100644 --- a/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/AbstractInfraSteps.java +++ b/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/AbstractInfraSteps.java @@ -137,7 +137,6 @@ protected void addDocument(OffsetDateTime logtime) { solrInputDocument.addField("level", "INFO"); solrInputDocument.addField("resource", "/ats/active"); solrInputDocument.addField("ip", "172.18.0.2"); - solrInputDocument.addField("evtTime", "2017-12-08T10:23:16.452Z"); solrInputDocument.addField("req_caller_id", "HIVE_QUERY_ID:ambari-qa_20160317200111_223b3079-4a2d-431c-920f-6ba37ed63e9f"); solrInputDocument.addField("repoType", 1); solrInputDocument.addField("enforcer", "hadoop-acl"); @@ -145,6 +144,7 @@ protected void addDocument(OffsetDateTime logtime) { solrInputDocument.addField("message_md5", "-6778765776916226588"); solrInputDocument.addField("event_md5", "5627261521757462732"); solrInputDocument.addField("logtime", new Date(logtime.toInstant().toEpochMilli())); + solrInputDocument.addField("evtTime", new Date(logtime.toInstant().toEpochMilli())); solrInputDocument.addField("_ttl_", "+7DAYS"); solrInputDocument.addField("_expire_at_", "2017-12-15T10:23:19.106Z"); solr.add(solrInputDocument); diff --git a/ambari-infra-manager-it/src/test/resources/stories/infra_api_tests.story b/ambari-infra-manager-it/src/test/resources/stories/infra_api_tests.story index 729d609..2330474 100644 --- a/ambari-infra-manager-it/src/test/resources/stories/infra_api_tests.story +++ b/ambari-infra-manager-it/src/test/resources/stories/infra_api_tests.story @@ -44,7 +44,7 @@ Then solr does not contain documents between 2012-10-09T05:00:00.000Z and 2012-1 Scenario: Archiving documents to hdfs Given 1000 documents in solr with logtime from 2014-01-04T05:00:00.000Z to 2014-01-06T20:00:00.000Z -When start archive_audit_logs job with parameters start=2014-01-04T05:00:00.000Z,end=2014-01-06T20:00:00.000Z,destination=HDFS after 2 seconds +When start archive_audit_logs job with parameters start=2014-01-04T05:00:00.000Z,end=2014-01-06T20:00:00.000Z,destination=HDFS,hdfsDestinationDirectory=/test_audit_logs after 2 seconds Then Check 7 files exists on hdfs with filenames containing the text audit_logs_-_2014-01-0 in the folder /test_audit_logs after 10 seconds And solr does not contain documents between 2014-01-04T05:00:00.000Z and 2014-01-06T20:00:00.000Z after 10 seconds diff --git a/ambari-infra-manager/pom.xml b/ambari-infra-manager/pom.xml index f28f59d..3cd9860 100644 --- a/ambari-infra-manager/pom.xml +++ b/ambari-infra-manager/pom.xml @@ -30,15 +30,15 @@ <artifactId>ambari-infra-manager</artifactId> <properties> - <spring.version>4.3.17.RELEASE</spring.version> - <spring.security.version>4.2.4.RELEASE</spring.security.version> - <spring.ldap.version>2.2.0.RELEASE</spring.ldap.version> - <jersey.version>2.25.1</jersey.version> + <spring.version>5.1.0.RELEASE</spring.version> + <spring.security.version>5.1.0.RELEASE</spring.security.version> + <spring.ldap.version>2.3.2.RELEASE</spring.ldap.version> + <jersey.version>2.27</jersey.version> <jetty.version>9.4.11.v20180605</jetty.version> <spring-batch.version>3.0.7.RELEASE</spring-batch.version> <sqlite.version>3.8.11.2</sqlite.version> - <spring-data-solr.version>2.0.2.RELEASE</spring-data-solr.version> - <spring-boot.version>1.5.13.RELEASE</spring-boot.version> + <spring-data-solr.version>3.0.10.RELEASE</spring-data-solr.version> + <spring-boot.version>2.0.5.RELEASE</spring-boot.version> <swagger.version>1.5.16</swagger.version> <jjwt.version>0.6.0</jjwt.version> </properties> @@ -120,6 +120,11 @@ </build> <dependencies> + <dependency> + <groupId>javax.validation</groupId> + <artifactId>validation-api</artifactId> + <version>2.0.1.Final</version> + </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -194,26 +199,44 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>${spring-boot.version}</version> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-security</artifactId> + <artifactId>spring-boot-starter-jetty</artifactId> <version>${spring-boot.version}</version> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> + <artifactId>spring-boot-starter-security</artifactId> <version>${spring-boot.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-jetty</artifactId> + <artifactId>spring-boot-starter-actuator</artifactId> <version>${spring-boot.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jersey</artifactId> <version>${spring-boot.version}</version> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -316,8 +339,24 @@ <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-security</artifactId> </exclusion> + <exclusion> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + </exclusion> + <exclusion> + <groupId>jdk.tools</groupId> + <artifactId>jdk.tools</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + </exclusion> </exclusions> </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-hdfs-client</artifactId> @@ -400,7 +439,7 @@ <dependency> <groupId>org.webjars</groupId> <artifactId>swagger-ui</artifactId> - <version>2.2.2</version> + <version>3.19.0</version> </dependency> <dependency> <groupId>org.springframework</groupId> @@ -436,12 +475,16 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </exclusion> + <exclusion> + <groupId>org.springframework.batch</groupId> + <artifactId>spring-batch-admin-resources</artifactId> + </exclusion> </exclusions> </dependency> <dependency> <artifactId>guava</artifactId> <groupId>com.google.guava</groupId> - <version>20.0</version> + <version>26.0-jre</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> @@ -449,10 +492,9 @@ <version>1.5</version> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-tomcat</artifactId> - <version>${spring-boot.version}</version> - <scope>provided</scope> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + <version>1.18</version> </dependency> <dependency> <groupId>io.minio</groupId> diff --git a/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java b/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java index 938cfd0..87622ad 100644 --- a/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java +++ b/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java @@ -19,15 +19,16 @@ package org.apache.ambari.infra; import org.springframework.boot.Banner; +import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration; import org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; -import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration; -import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; +import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.system.ApplicationPidFileWriter; +import org.springframework.boot.context.ApplicationPidFileWriter; @SpringBootApplication( scanBasePackages = {"org.apache.ambari.infra"}, @@ -47,7 +48,7 @@ public static void main(String[] args) { new SpringApplicationBuilder(InfraManager.class) .bannerMode(Banner.Mode.OFF) .listeners(new ApplicationPidFileWriter(pidFile)) - .web(true) + .web(WebApplicationType.SERVLET) .run(args); } } diff --git a/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerJerseyResourceConfig.java b/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerJerseyResourceConfig.java index 3a4c00f..338fac4 100644 --- a/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerJerseyResourceConfig.java +++ b/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerJerseyResourceConfig.java @@ -18,20 +18,19 @@ */ package org.apache.ambari.infra.conf; +import javax.ws.rs.ApplicationPath; + import org.apache.ambari.infra.rest.JobResource; -import org.glassfish.jersey.jackson.JacksonFeature; +import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletProperties; -import javax.ws.rs.ApplicationPath; - @ApplicationPath("/api/v1") public class InfraManagerJerseyResourceConfig extends ResourceConfig { public InfraManagerJerseyResourceConfig() { packages(JobResource.class.getPackage().getName()); - register(JacksonFeature.class); + register(JacksonJaxbJsonProvider.class); property(ServletProperties.FILTER_FORWARD_ON_404, true); } - } diff --git a/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerServletConfig.java b/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerServletConfig.java index 06aea79..dd101b0 100644 --- a/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerServletConfig.java +++ b/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerServletConfig.java @@ -18,31 +18,19 @@ */ package org.apache.ambari.infra.conf; -import org.eclipse.jetty.server.Server; +import javax.inject.Inject; + import org.eclipse.jetty.servlet.DefaultServlet; import org.glassfish.jersey.servlet.ServletContainer; import org.glassfish.jersey.servlet.ServletProperties; -import org.springframework.beans.factory.annotation.Value; 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.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import javax.inject.Inject; - @Configuration public class InfraManagerServletConfig { - private static final Integer SESSION_TIMEOUT = 60 * 30; - private static final String INFRA_MANAGER_SESSIONID = "INFRAMANAGER_SESSIONID"; - private static final String INFRA_MANAGER_APPLICATION_NAME = "infra-manager"; - - @Value("${infra-manager.server.port:61890}") - private int port; - @Inject private ServerProperties serverProperties; @@ -52,32 +40,17 @@ @Bean public ServletRegistrationBean jerseyServlet() { - ServletRegistrationBean jerseyServletBean = new ServletRegistrationBean(new ServletContainer(), "/api/v1/*"); + ServletRegistrationBean jerseyServletBean = new ServletRegistrationBean<>(new ServletContainer(), "/api/v1/*"); jerseyServletBean.addInitParameter(ServletProperties.JAXRS_APPLICATION_CLASS, InfraManagerJerseyResourceConfig.class.getName()); return jerseyServletBean; } @Bean public ServletRegistrationBean dataServlet() { - ServletRegistrationBean dataServletBean = new ServletRegistrationBean(new DefaultServlet(), "/files/*"); + ServletRegistrationBean dataServletBean = new ServletRegistrationBean<>(new DefaultServlet(), "/files/*"); dataServletBean.addInitParameter("dirAllowed","true"); dataServletBean.addInitParameter("pathInfoOnly","true"); dataServletBean.addInitParameter("resourceBase", infraManagerDataConfig.getDataFolder()); return dataServletBean; } - - @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(INFRA_MANAGER_SESSIONID); - serverProperties.setDisplayName(INFRA_MANAGER_APPLICATION_NAME); - jettyEmbeddedServletContainerFactory.setPort(port); - return jettyEmbeddedServletContainerFactory; - } } diff --git a/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerWebServerCustomizer.java b/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerWebServerCustomizer.java new file mode 100644 index 0000000..06174a0 --- /dev/null +++ b/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerWebServerCustomizer.java @@ -0,0 +1,51 @@ +/* + * 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.infra.conf; + +import java.time.Duration; + +import javax.inject.Inject; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.web.ServerProperties; +import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; +import org.springframework.boot.web.server.WebServerFactoryCustomizer; +import org.springframework.stereotype.Component; + +@Component +public class InfraManagerWebServerCustomizer implements WebServerFactoryCustomizer<JettyServletWebServerFactory> { + + @Value("${infra-manager.server.port:61890}") + private int port; + + @Inject + private ServerProperties serverProperties; + + private static final Integer SESSION_TIMEOUT = 60 * 30; + private static final String INFRA_MANAGER_SESSIONID = "INFRAMANAGER_SESSIONID"; + private static final String INFRA_MANAGER_APPLICATION_NAME = "infra-manager"; + + @Override + public void customize(JettyServletWebServerFactory factory) { + factory.setPort(port); + factory.setDisplayName(INFRA_MANAGER_APPLICATION_NAME); + factory.getSession().getCookie().setName(INFRA_MANAGER_SESSIONID); + factory.getSession().setTimeout(Duration.ofSeconds(SESSION_TIMEOUT)); + } +} diff --git a/ambari-infra-manager/src/main/java/org/apache/ambari/infra/doc/InfraManagerApiDocStorage.java b/ambari-infra-manager/src/main/java/org/apache/ambari/infra/doc/InfraManagerApiDocStorage.java index e536d9a..5d525fa 100644 --- a/ambari-infra-manager/src/main/java/org/apache/ambari/infra/doc/InfraManagerApiDocStorage.java +++ b/ambari-infra-manager/src/main/java/org/apache/ambari/infra/doc/InfraManagerApiDocStorage.java @@ -18,17 +18,20 @@ */ package org.apache.ambari.infra.doc; -import io.swagger.jaxrs.config.BeanConfig; -import io.swagger.models.Swagger; -import io.swagger.util.Yaml; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.inject.Named; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.swagger.jaxrs.config.BeanConfig; +import io.swagger.models.Swagger; +import io.swagger.models.auth.BasicAuthDefinition; +import io.swagger.util.Yaml; @Named public class InfraManagerApiDocStorage { @@ -47,20 +50,19 @@ private void postConstruct() { public void run() { LOG.info("Start thread to scan REST API doc from endpoints."); Swagger swagger = beanConfig.getSwagger(); + swagger.addSecurityDefinition("basicAuth", new BasicAuthDefinition()); beanConfig.configure(swagger); beanConfig.scanAndRead(); setSwagger(swagger); try { - if (swagger != null) { - String yaml = Yaml.mapper().writeValueAsString(swagger); - StringBuilder b = new StringBuilder(); - String[] parts = yaml.split("\n"); - for (String part : parts) { - b.append(part); - b.append("\n"); - } - setSwaggerYaml(b.toString()); + String yaml = Yaml.mapper().writeValueAsString(swagger); + StringBuilder b = new StringBuilder(); + String[] parts = yaml.split("\n"); + for (String part : parts) { + b.append(part); + b.append("\n"); } + setSwaggerYaml(b.toString()); } catch (Exception e) { e.printStackTrace(); } diff --git a/ambari-infra-manager/src/main/java/org/apache/ambari/infra/rest/JobResource.java b/ambari-infra-manager/src/main/java/org/apache/ambari/infra/rest/JobResource.java index 502057e..7e353fb 100644 --- a/ambari-infra-manager/src/main/java/org/apache/ambari/infra/rest/JobResource.java +++ b/ambari-infra-manager/src/main/java/org/apache/ambari/infra/rest/JobResource.java @@ -18,9 +18,21 @@ */ package org.apache.ambari.infra.rest; -import com.google.common.base.Splitter; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.Set; + +import javax.inject.Inject; +import javax.inject.Named; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.ws.rs.BeanParam; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; + import org.apache.ambari.infra.manager.JobManager; import org.apache.ambari.infra.model.ExecutionContextResponse; import org.apache.ambari.infra.model.JobDetailsResponse; @@ -51,21 +63,13 @@ import org.springframework.batch.core.repository.JobRestartException; import org.springframework.context.annotation.Scope; -import javax.inject.Inject; -import javax.inject.Named; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.ws.rs.BeanParam; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import java.util.List; -import java.util.Set; +import com.google.common.base.Splitter; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; -@Api(value = "jobs", description = "Job operations") +@Api(value = "jobs", description = "Job operations", authorizations = {@Authorization(value = "basicAuth")}) @Path("jobs") @Named @Scope("request") diff --git a/ambari-infra-manager/src/main/resources/infra-manager-env.sh b/ambari-infra-manager/src/main/resources/infra-manager-env.sh index 9a371fd..4aae179 100644 --- a/ambari-infra-manager/src/main/resources/infra-manager-env.sh +++ b/ambari-infra-manager/src/main/resources/infra-manager-env.sh @@ -17,12 +17,12 @@ # Extend with java options or system properties. e.g.: INFRA_MANAGER_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=5007,server=y,suspend=n" export INFRA_MANAGER_OPTS="" -# Log Search debug options -# export INFRA_MANAGER_DEBUG=true -# export INFRA_MANAGER_DEBUG_SUSPEND=n +# Infra Manager debug options +#export INFRA_MANAGER_DEBUG=true +#export INFRA_MANAGER_DEBUG_SUSPEND=n export INFRA_MANAGER_DEBUG_PORT=5005 -# Log Search memory +# Infra Manager memory # export INFRA_MANAGER_JAVA_MEM="--Xmx1024m" # export LOG_PATH=/var/log/ambari-logsearch-logfeeder/ diff --git a/ambari-infra-manager/src/main/resources/swagger/swagger.html b/ambari-infra-manager/src/main/resources/swagger/swagger.html index 4d261e7..b24dd25 100644 --- a/ambari-infra-manager/src/main/resources/swagger/swagger.html +++ b/ambari-infra-manager/src/main/resources/swagger/swagger.html @@ -1,4 +1,4 @@ -<!DOCTYPE html> +<!-- HTML for static distribution bundle build --> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,122 +15,63 @@ See the License for the specific language governing permissions and limitations under the License. --> -<html> +<!DOCTYPE html> +<html lang="en"> <head> <meta charset="UTF-8"> <title>Infra Manager REST API</title> - <link rel="icon" type="image/png" href="swagger-ui/2.2.2/images/favicon-32x32.png" sizes="32x32" /> - <link rel="icon" type="image/png" href="swagger-ui/2.2.2/images/favicon-16x16.png" sizes="16x16" /> - <link href='swagger-ui/2.2.2/css/typography.css' media='screen' rel='stylesheet' type='text/css'/> - <link href='swagger-ui/2.2.2/css/reset.css' media='screen' rel='stylesheet' type='text/css'/> - <link href='swagger-ui/2.2.2/css/screen.css' media='screen' rel='stylesheet' type='text/css'/> - <link href='swagger-ui/2.2.2/css/reset.css' media='print' rel='stylesheet' type='text/css'/> - <link href='swagger-ui/2.2.2/css/print.css' media='print' rel='stylesheet' type='text/css'/> - - <script src='swagger-ui/2.2.2/lib/object-assign-pollyfill.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/lib/jquery-1.8.0.min.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/lib/jquery.slideto.min.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/lib/jquery.wiggle.min.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/lib/jquery.ba-bbq.min.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/lib/handlebars-4.0.5.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/lib/lodash.min.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/lib/backbone-min.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/swagger-ui.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/lib/highlight.9.1.0.pack.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/lib/highlight.9.1.0.pack_extended.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/lib/jsoneditor.min.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/lib/marked.js' type='text/javascript'></script> - <script src='swagger-ui/2.2.2/lib/swagger-oauth.js' type='text/javascript'></script> - - <!-- Some basic translations --> - <!-- <script src='lang/translator.js' type='text/javascript'></script> --> - <!-- <script src='lang/ru.js' type='text/javascript'></script> --> - <!-- <script src='lang/en.js' type='text/javascript'></script> --> - - <script type="text/javascript"> - $(function () { - var url = window.location.search.match(/url=([^&]+)/); - if (url && url.length > 1) { - url = decodeURIComponent(url[1]); - } else { - var urlPrefix = location.protocol +'//'+ location.hostname+(location.port ? ':'+location.port: ''); - url = urlPrefix + "/api/v1/swagger.yaml"; - } + <link rel="stylesheet" type="text/css" href="swagger-ui/3.19.0/swagger-ui.css" > + <link rel="icon" type="image/png" href="swagger-ui/3.19.0/images/favicon-32x32.png" sizes="32x32" /> + <link rel="icon" type="image/png" href="swagger-ui/3.19.0/images/favicon-16x16.png" sizes="16x16" /> + <style> + html + { + box-sizing: border-box; + overflow: -moz-scrollbars-vertical; + overflow-y: scroll; + } - hljs.configure({ - highlightSizeThreshold: 5000 - }); + *, + *:before, + *:after + { + box-sizing: inherit; + } - // Pre load translate... - if(window.SwaggerTranslator) { - window.SwaggerTranslator.translate(); - } - window.swaggerUi = new SwaggerUi({ - url: url, - dom_id: "swagger-ui-container", - supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'], - onComplete: function(swaggerApi, swaggerUi){ - if(typeof initOAuth == "function") { - initOAuth({ - clientId: "your-client-id", - clientSecret: "your-client-secret-if-required", - realm: "your-realms", - appName: "your-app-name", - scopeSeparator: " ", - additionalQueryStringParams: {} - }); - } - - if(window.SwaggerTranslator) { - window.SwaggerTranslator.translate(); - } - }, - onFailure: function(data) { - log("Unable to Load SwaggerUI"); - }, - docExpansion: "none", - jsonEditor: false, - defaultModelRendering: 'schema', - showRequestHeaders: false - }); - - function addApiKeyAuthorization(){ - var username = encodeURIComponent($('#input_username')[0].value); - var password = encodeURIComponent($('#input_password')[0].value); - if (username && username.trim() != "" && password && password != "") { - var apiKeyAuth = new SwaggerClient.PasswordAuthorization("Authorization", username, password); - window.swaggerUi.api.clientAuthorizations.add("key", apiKeyAuth); - log("added authorization header: " + 'Basic ' + btoa(username + ':' + password)); - } - } - - $('#input_username, #input_password').change(addApiKeyAuthorization); + body + { + margin:0; + background: #fafafa; + } + </style> +</head> - window.swaggerUi.load(); +<body> +<div id="swagger-ui"></div> - function log() { - if ('console' in window) { - console.log.apply(console, arguments); - } - } - }); - </script> -</head> +<script src="swagger-ui/3.19.0/swagger-ui-bundle.js"> </script> +<script src="swagger-ui/3.19.0/swagger-ui-standalone-preset.js"> </script> +<script> + window.onload = function() { -<body class="swagger-section"> -<div id='header'> - <div class="swagger-ui-wrap"> - <a id="logo" href="http://swagger.io">swagger</a> - <form id='api_selector'> - <div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div> - <div class="input"><input placeholder="username" id="input_username" name="username" type="text" size="10"></div> - <div class="input"><input placeholder="password" id="input_password" name="password" type="password" size="10"></div> - <div class='input'><a id="explore" href="#">Explore</a></div> - </form> - </div> -</div> + var urlPrefix = location.protocol +'//'+ location.hostname+(location.port ? ':'+location.port: ''); + // Build a system + const ui = SwaggerUIBundle({ + url: urlPrefix + "/api/v1/swagger.yaml", + dom_id: '#swagger-ui', + deepLinking: true, + presets: [ + SwaggerUIBundle.presets.apis, + SwaggerUIStandalonePreset + ], + plugins: [ + SwaggerUIBundle.plugins.DownloadUrl + ], + layout: "StandaloneLayout" + }) -<div id="message-bar" class="swagger-ui-wrap" data-sw-translate> </div> -<div id="swagger-ui-container" class="swagger-ui-wrap"></div> + window.ui = ui + } + </script> </body> -</html> \ No newline at end of file +</html> diff --git a/pom.xml b/pom.xml index ab82c4b..29271c1 100644 --- a/pom.xml +++ b/pom.xml @@ -368,6 +368,11 @@ <artifactId>hamcrest-all</artifactId> <version>1.3</version> </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.6.2</version> + </dependency> </dependencies> </dependencyManagement> ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services