Commit c0abd4d4 authored by Aman Verma's avatar Aman Verma
Browse files

adding dockerfile

parent b3bcea61
Pipeline #80664 passed with stages
in 22 minutes and 38 seconds
......@@ -151,14 +151,9 @@
<!-- swagger dependencies -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox-version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox-version}</version>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.12</version>
</dependency>
</dependencies>
......
......@@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
public class HomeController {
@RequestMapping(value = "/swagger")
public String swagger() {
System.out.println("swagger-ui.html");
return "redirect:swagger-ui.html";
System.out.println("swagger-ui/index.html");
return "redirect:swagger-ui/index.html";
}
}
// Copyright © 2021 Amazon Web Services
// Copyright 2017-2019, Schlumberger
//
// 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.
package org.opengroup.osdu.dataset.swagger;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import springfox.documentation.service.Parameter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Configuration
@EnableSwagger2
@Profile("!noswagger")
public class SwaggerDocumentationConfig {
public static final String AUTHORIZATION_HEADER = "Authorization";
public static final String DEFAULT_INCLUDE_PATTERN = "/.*";
@Bean
public Docket api() {
ParameterBuilder builder = new ParameterBuilder();
List<Parameter> parameters = new ArrayList<>();
builder.name(DpsHeaders.DATA_PARTITION_ID)
.description("tenant")
.defaultValue("common")
.modelRef(new ModelRef("string"))
.parameterType("header")
.required(true)
.build();
parameters.add(builder.build());
builder.name("frame-of-reference")
.description("reference")
.defaultValue("none")
.modelRef(new ModelRef("string"))
.parameterType("header")
.required(true)
.build();
parameters.add(builder.build());
return new Docket(DocumentationType.SWAGGER_2)
.globalOperationParameters(parameters)
.select()
.apis(RequestHandlerSelectors.basePackage("org.opengroup.osdu.dataset.api"))
.build()
.securityContexts(Collections.singletonList(securityContext()))
.securitySchemes(Collections.singletonList(apiKey()));
}
private ApiKey apiKey() {
return new ApiKey("JWT", AUTHORIZATION_HEADER, "header");
}
private SecurityContext securityContext() {
return SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(PathSelectors.regex(DEFAULT_INCLUDE_PATTERN))
.build();
}
List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope
= new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes =
new AuthorizationScope[]{authorizationScope};
return Collections.singletonList(
new SecurityReference("JWT", authorizationScopes));
}
}
FROM community.opengroup.org:5555/osdu/platform/deployment-and-operations/base-containers-azure/alpine-zulu8:0.0.3
VOLUME /tmp
ARG JAR_FILE=./provider/dataset-azure/target/dataset-azure-0.11.0-spring-boot.jar
ARG APPLICATIONINSIGHTS_INSTRUMENTATION_KEY
COPY ${JAR_FILE} app.jar
ENV DEFAULT_JVM_OPTS="-XX:InitialRAMPercentage=25.0 -XX:MaxRAMPercentage=50.0 -XX:+HeapDumpOnOutOfMemoryError"
ENV JAVA_OPTS="${DEFAULT_JVM_OPTS} -javaagent:/opt/agents/applicationinsights-agent.jar ${JAVA_OPTS}"
ENTRYPOINT exec java ${JAVA_OPTS} -jar /app.jar
\ No newline at end of file
......@@ -42,6 +42,10 @@ public class AADSecurityConfig extends WebSecurityConfigurerAdapter {
.authorizeRequests()
.antMatchers("/", "/index.html",
"/v2/api-docs",
"/v3/api-docs",
"*/api-docs",
"/swagger-ui/index.html",
"*/swagger-ui.html",
"/configuration/ui",
"/swagger-resources/**",
"/configuration/security",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment