From 0954310a510c32121b88fa97f06435622a11a9d5 Mon Sep 17 00:00:00 2001 From: Martin Weise <martin.weise@tuwien.ac.at> Date: Fri, 26 May 2023 09:04:35 +0200 Subject: [PATCH] Fixed swagger-ui --- dbrepo-container-service/README.md | 18 ++++++--- dbrepo-container-service/pom.xml | 13 +++++-- .../java/at/tuwien/config/SwaggerConfig.java | 4 +- .../at/tuwien/config/WebSecurityConfig.java | 11 +++--- dbrepo-database-service/README.md | 15 ++++++++ dbrepo-database-service/pom.xml | 20 ++++++---- .../java/at/tuwien/config/SwaggerConfig.java | 2 +- .../at/tuwien/config/WebSecurityConfig.java | 8 ++-- dbrepo-identifier-service/README.md | 15 ++++++++ dbrepo-identifier-service/pom.xml | 14 ++++++- .../java/at/tuwien/config/SwaggerConfig.java | 2 +- .../at/tuwien/config/WebSecurityConfig.java | 10 ++--- dbrepo-metadata-db/pom.xml | 10 ++--- dbrepo-metadata-service/README.md | 37 +++++-------------- dbrepo-metadata-service/pom.xml | 14 ++++++- .../java/at/tuwien/config/SwaggerConfig.java | 2 +- .../at/tuwien/config/WebSecurityConfig.java | 8 ++-- dbrepo-query-service/README.md | 15 ++++++++ dbrepo-query-service/pom.xml | 14 ++++++- .../java/at/tuwien/config/SwaggerConfig.java | 2 +- .../at/tuwien/config/WebSecurityConfig.java | 12 +++--- dbrepo-semantics-service/README.md | 18 ++++++--- dbrepo-semantics-service/pom.xml | 13 +++++++ .../java/at/tuwien/config/SwaggerConfig.java | 2 +- .../at/tuwien/config/WebSecurityConfig.java | 8 ++-- dbrepo-table-service/README.md | 18 ++++++--- dbrepo-table-service/pom.xml | 14 ++++++- .../java/at/tuwien/config/SwaggerConfig.java | 2 +- .../at/tuwien/config/WebSecurityConfig.java | 8 ++-- dbrepo-user-service/README.md | 15 ++++++++ dbrepo-user-service/pom.xml | 14 ++++++- .../java/at/tuwien/config/SwaggerConfig.java | 2 +- .../at/tuwien/config/WebSecurityConfig.java | 12 +++--- 33 files changed, 258 insertions(+), 114 deletions(-) create mode 100644 dbrepo-database-service/README.md create mode 100644 dbrepo-identifier-service/README.md create mode 100644 dbrepo-query-service/README.md create mode 100644 dbrepo-user-service/README.md diff --git a/dbrepo-container-service/README.md b/dbrepo-container-service/README.md index 986b2885e1..a5ae3e58a1 100644 --- a/dbrepo-container-service/README.md +++ b/dbrepo-container-service/README.md @@ -1,7 +1,15 @@ -# FDA Container Service +# Container Service -## Documentation +## Actuator -- OpenAPI v3: http://localhost:9091/swagger-ui/index.html -- OpenAPI v3 endpoint: http://localhost:9091/v3/api-docs/ -- OpenAPI v3 YAML: http://localhost:9091/v3/api-docs.yaml \ No newline at end of file +- Actuator Info: http://localhost:9091/actuator/info +- Actuator Health: http://localhost:9091/actuator/health +- Actuator Prometheus: http://localhost:9091/actuator/prometheus + +## Swagger UI Endpoints + +- Swagger UI: http://localhost:9091/swagger-ui/index.html + +## OpenAPI Endpoints + +- OpenAPI v3 as .yaml: http://localhost:9091/v3/api-docs.yaml \ No newline at end of file diff --git a/dbrepo-container-service/pom.xml b/dbrepo-container-service/pom.xml index e780d3f864..b972c5fa5f 100644 --- a/dbrepo-container-service/pom.xml +++ b/dbrepo-container-service/pom.xml @@ -29,6 +29,7 @@ <swagger.version>2.2.9</swagger.version> <jacoco.version>0.8.10</jacoco.version> <jwt.version>4.3.0</jwt.version> + <springdoc-openapi.version>2.1.0</springdoc-openapi.version> </properties> <dependencies> @@ -72,9 +73,15 @@ </dependency> <!-- Swagger --> <dependency> - <groupId>io.swagger.core.v3</groupId> - <artifactId>swagger-core</artifactId> - <version>${swagger.version}</version> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> + <!-- Open API --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> + <version>${springdoc-openapi.version}</version> </dependency> <!-- Data Source --> <dependency> diff --git a/dbrepo-container-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java b/dbrepo-container-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java index 4965870c94..95da4f4d33 100644 --- a/dbrepo-container-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java +++ b/dbrepo-container-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java @@ -6,10 +6,8 @@ import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; import io.swagger.v3.oas.models.servers.Server; -import org.springdoc.core.GroupedOpenApi; -import org.springframework.beans.factory.annotation.Autowired; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.info.BuildProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/dbrepo-container-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java b/dbrepo-container-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java index c12c18252c..faa094b1c4 100644 --- a/dbrepo-container-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java +++ b/dbrepo-container-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java @@ -5,7 +5,6 @@ import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; import io.swagger.v3.oas.annotations.security.SecurityScheme; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpMethod; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; @@ -39,16 +38,16 @@ public class WebSecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { final OrRequestMatcher internalEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/actuator/prometheus/**", "GET") - ); - final OrRequestMatcher publicEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/api/container/**", "GET"), - new AntPathRequestMatcher("/api/image/**", "GET"), + new AntPathRequestMatcher("/actuator/**", "GET"), new AntPathRequestMatcher("/v3/api-docs.yaml"), new AntPathRequestMatcher("/v3/api-docs/**"), new AntPathRequestMatcher("/swagger-ui/**"), new AntPathRequestMatcher("/swagger-ui.html") ); + final OrRequestMatcher publicEndpoints = new OrRequestMatcher( + new AntPathRequestMatcher("/api/container/**", "GET"), + new AntPathRequestMatcher("/api/image/**", "GET") + ); /* enable CORS and disable CSRF */ http = http.cors().and().csrf().disable(); /* set session management to stateless */ diff --git a/dbrepo-database-service/README.md b/dbrepo-database-service/README.md new file mode 100644 index 0000000000..459dff58ac --- /dev/null +++ b/dbrepo-database-service/README.md @@ -0,0 +1,15 @@ +# Database Service + +## Actuator + +- Actuator Info: http://localhost:9092/actuator/info +- Actuator Health: http://localhost:9092/actuator/health +- Actuator Prometheus: http://localhost:9092/actuator/prometheus + +## Swagger UI Endpoints + +- Swagger UI: http://localhost:9092/swagger-ui/index.html + +## OpenAPI Endpoints + +- OpenAPI v3 as .yaml: http://localhost:9092/v3/api-docs.yaml \ No newline at end of file diff --git a/dbrepo-database-service/pom.xml b/dbrepo-database-service/pom.xml index 414a7afe17..3d3fbd8fce 100644 --- a/dbrepo-database-service/pom.xml +++ b/dbrepo-database-service/pom.xml @@ -26,11 +26,11 @@ <spring-cloud.version>4.0.2</spring-cloud.version> <mapstruct.version>1.5.5.Final</mapstruct.version> <docker.version>3.3.0</docker.version> - <swagger.version>2.2.9</swagger.version> <jacoco.version>0.8.10</jacoco.version> <jwt.version>4.3.0</jwt.version> <c3p0.version>0.9.5.5</c3p0.version> <c3p0-hibernate.version>6.2.2.Final</c3p0-hibernate.version> + <springdoc-openapi.version>2.1.0</springdoc-openapi.version> </properties> <dependencies> @@ -67,12 +67,6 @@ <artifactId>dbrepo-metadata-db-entites</artifactId> <version>${project.version}</version> </dependency> - <!-- Monitoring --> - <dependency> - <groupId>io.micrometer</groupId> - <artifactId>micrometer-registry-prometheus</artifactId> - <scope>runtime</scope> - </dependency> <!-- elasticsearch --> <dependency> <groupId>co.elastic.clients</groupId> @@ -89,6 +83,18 @@ <artifactId>spring-cloud-starter-bootstrap</artifactId> <version>${spring-cloud.version}</version> </dependency> + <!-- Swagger --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> + <!-- Open API --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> <!-- Data Source --> <dependency> <groupId>com.mchange</groupId> diff --git a/dbrepo-database-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java b/dbrepo-database-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java index 38208b7a49..de68a599f0 100644 --- a/dbrepo-database-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java +++ b/dbrepo-database-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java @@ -6,7 +6,7 @@ import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; import io.swagger.v3.oas.models.servers.Server; -import org.springdoc.core.GroupedOpenApi; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/dbrepo-database-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java b/dbrepo-database-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java index 7ee0e81e22..e0ff9189e5 100644 --- a/dbrepo-database-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java +++ b/dbrepo-database-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java @@ -39,15 +39,15 @@ public class WebSecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { final OrRequestMatcher internalEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/actuator/prometheus/**", "GET") - ); - final OrRequestMatcher publicEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/api/container/**/database/**", "GET"), + new AntPathRequestMatcher("/actuator/**", "GET"), new AntPathRequestMatcher("/v3/api-docs.yaml"), new AntPathRequestMatcher("/v3/api-docs/**"), new AntPathRequestMatcher("/swagger-ui/**"), new AntPathRequestMatcher("/swagger-ui.html") ); + final OrRequestMatcher publicEndpoints = new OrRequestMatcher( + new AntPathRequestMatcher("/api/container/**/database/**", "GET") + ); /* enable CORS and disable CSRF */ http = http.cors().and().csrf().disable(); /* set session management to stateless */ diff --git a/dbrepo-identifier-service/README.md b/dbrepo-identifier-service/README.md new file mode 100644 index 0000000000..9f9b6fcdd3 --- /dev/null +++ b/dbrepo-identifier-service/README.md @@ -0,0 +1,15 @@ +# Identifier Service + +## Actuator + +- Actuator Info: http://localhost:9096/actuator/info +- Actuator Health: http://localhost:9096/actuator/health +- Actuator Prometheus: http://localhost:9096/actuator/prometheus + +## Swagger UI Endpoints + +- Swagger UI: http://localhost:9096/swagger-ui/index.html + +## OpenAPI Endpoints + +- OpenAPI v3 as .yaml: http://localhost:9096/v3/api-docs.yaml \ No newline at end of file diff --git a/dbrepo-identifier-service/pom.xml b/dbrepo-identifier-service/pom.xml index cbd895ea27..cb8d587faa 100644 --- a/dbrepo-identifier-service/pom.xml +++ b/dbrepo-identifier-service/pom.xml @@ -27,7 +27,6 @@ <spring-cloud.version>4.0.2</spring-cloud.version> <mapstruct.version>1.5.5.Final</mapstruct.version> <docker.version>3.3.0</docker.version> - <swagger.version>2.2.9</swagger.version> <jacoco.version>0.8.10</jacoco.version> <jwt.version>4.3.0</jwt.version> <hibernate-c3po.version>5.6.3.Final</hibernate-c3po.version> @@ -35,6 +34,7 @@ <opencsv.version>5.7.1</opencsv.version> <super-csv.version>2.4.0</super-csv.version> <jsql.version>4.6</jsql.version> + <springdoc-openapi.version>2.1.0</springdoc-openapi.version> </properties> <dependencies> @@ -114,6 +114,18 @@ <version>${docker.version}</version> <scope>test</scope> </dependency> + <!-- Swagger --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> + <!-- Open API --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> <!-- Testing --> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/dbrepo-identifier-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java b/dbrepo-identifier-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java index b39fabcbba..7c8ddcff28 100644 --- a/dbrepo-identifier-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java +++ b/dbrepo-identifier-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java @@ -6,7 +6,7 @@ import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; import io.swagger.v3.oas.models.servers.Server; -import org.springdoc.core.GroupedOpenApi; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/dbrepo-identifier-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java b/dbrepo-identifier-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java index 13a5e63de3..4169e7977c 100644 --- a/dbrepo-identifier-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java +++ b/dbrepo-identifier-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java @@ -39,16 +39,16 @@ public class WebSecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { final OrRequestMatcher internalEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/actuator/prometheus/**", "GET") - ); - final OrRequestMatcher publicEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/api/identifier/**", "GET"), - new AntPathRequestMatcher("/api/pid/**", "GET"), + new AntPathRequestMatcher("/actuator/**", "GET"), new AntPathRequestMatcher("/v3/api-docs.yaml"), new AntPathRequestMatcher("/v3/api-docs/**"), new AntPathRequestMatcher("/swagger-ui/**"), new AntPathRequestMatcher("/swagger-ui.html") ); + final OrRequestMatcher publicEndpoints = new OrRequestMatcher( + new AntPathRequestMatcher("/api/identifier/**", "GET"), + new AntPathRequestMatcher("/api/pid/**", "GET") + ); /* enable CORS and disable CSRF */ http = http.cors().and().csrf().disable(); /* set session management to stateless */ diff --git a/dbrepo-metadata-db/pom.xml b/dbrepo-metadata-db/pom.xml index 924d8d9c07..6d3b7f7774 100644 --- a/dbrepo-metadata-db/pom.xml +++ b/dbrepo-metadata-db/pom.xml @@ -31,6 +31,7 @@ <jsql-parser.version>4.6</jsql-parser.version> <jackson-datatype.version>2.15.0</jackson-datatype.version> <commons.version>2.11.0</commons.version> + <springdoc-openapi.version>2.1.0</springdoc-openapi.version> </properties> <dependencies> @@ -82,13 +83,8 @@ <!-- OpenAPI --> <dependency> <groupId>org.springdoc</groupId> - <artifactId>springdoc-openapi-ui</artifactId> - <version>1.6.6</version> - </dependency> - <dependency> - <groupId>org.springdoc</groupId> - <artifactId>springdoc-openapi-javadoc</artifactId> - <version>1.6.6</version> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + <version>${springdoc-openapi.version}</version> </dependency> <!-- Docker --> <dependency> diff --git a/dbrepo-metadata-service/README.md b/dbrepo-metadata-service/README.md index 2b9e354bef..54443a4e20 100644 --- a/dbrepo-metadata-service/README.md +++ b/dbrepo-metadata-service/README.md @@ -1,34 +1,15 @@ -# Metadata Service +# Semantics Service -Conforms (partly) to OAI-PMH 2.0 +## Actuator -THe exposed endpoint is `http://localhost:9098/api/oai` or at the gateway `http://localhost:9095/api/oai` +- Actuator Info: http://localhost:9099/actuator/info +- Actuator Health: http://localhost:9099/actuator/health +- Actuator Prometheus: http://localhost:9099/actuator/prometheus -## Implemented +## Swagger UI Endpoints -### Identify +- Swagger UI: http://localhost:9099/swagger-ui/index.html -```console -$ curl -X GET http://localhost:9095/api/oai?verb=Identify -<?xml version='1.0' encoding='UTF-8'?> -<OAI-PMH xmlns='http://www.openarchives.org/OAI/2.0/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' - xsi:schemaLocation='http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd'> - <responseDate>2022-09-17T20:07:30Z</responseDate> - <request verb="Identify">https://metadata-service:9098/api/oai</request> - <Identify> - <repositoryName>Example Repository</repositoryName> - <baseURL>https://example.com</baseURL> - <protocolVersion>2.0</protocolVersion> - <adminEmail>noreply@example.com</adminEmail> - <earliestDatestamp>2022-09-17T18:23:00Z</earliestDatestamp> - <deletedRecord>persistent</deletedRecord> - <granularity>YYYY-MM-DDThh:mm:ssZ</granularity> -</Identify> -</OAI-PMH>( -``` +## OpenAPI Endpoints -### ListIdentifiers - -```console -$ curl -X GET http://localhost:9095/api/oai?verb=ListIdentifiers -``` \ No newline at end of file +- OpenAPI v3 as .yaml: http://localhost:9099/v3/api-docs.yaml \ No newline at end of file diff --git a/dbrepo-metadata-service/pom.xml b/dbrepo-metadata-service/pom.xml index 8dfab218ee..e6acaea732 100644 --- a/dbrepo-metadata-service/pom.xml +++ b/dbrepo-metadata-service/pom.xml @@ -40,7 +40,6 @@ <spring-cloud.version>4.0.2</spring-cloud.version> <mapstruct.version>1.5.5.Final</mapstruct.version> <docker.version>3.3.0</docker.version> - <swagger.version>2.2.9</swagger.version> <jacoco.version>0.8.10</jacoco.version> <jwt.version>4.3.0</jwt.version> <hibernate-c3po.version>5.6.3.Final</hibernate-c3po.version> @@ -49,6 +48,7 @@ <jsql.version>4.6</jsql.version> <keycloak.version>21.0.2</keycloak.version> <hibernate.version>6.2.2.Final</hibernate.version> + <springdoc-openapi.version>2.1.0</springdoc-openapi.version> </properties> <dependencies> @@ -137,6 +137,18 @@ <artifactId>mapstruct</artifactId> <version>${mapstruct.version}</version> </dependency> + <!-- Swagger --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> + <!-- Open API --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> <!-- Testing --> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java b/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java index fc7efc6d75..7907a04f77 100644 --- a/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java +++ b/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java @@ -6,7 +6,7 @@ import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; import io.swagger.v3.oas.models.servers.Server; -import org.springdoc.core.GroupedOpenApi; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/dbrepo-metadata-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java b/dbrepo-metadata-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java index 7bec3fbf94..2b7e04859f 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java +++ b/dbrepo-metadata-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java @@ -23,15 +23,15 @@ public class WebSecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { final OrRequestMatcher internalEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/actuator/prometheus/**", "GET") - ); - final OrRequestMatcher publicEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/api/oai/**", "GET"), + new AntPathRequestMatcher("/actuator/**", "GET"), new AntPathRequestMatcher("/v3/api-docs.yaml"), new AntPathRequestMatcher("/v3/api-docs/**"), new AntPathRequestMatcher("/swagger-ui/**"), new AntPathRequestMatcher("/swagger-ui.html") ); + final OrRequestMatcher publicEndpoints = new OrRequestMatcher( + new AntPathRequestMatcher("/api/oai/**", "GET") + ); /* enable CORS and disable CSRF */ http = http.cors().and().csrf().disable(); /* set session management to stateless */ diff --git a/dbrepo-query-service/README.md b/dbrepo-query-service/README.md new file mode 100644 index 0000000000..4e2547c3ff --- /dev/null +++ b/dbrepo-query-service/README.md @@ -0,0 +1,15 @@ +# Query Service + +## Actuator + +- Actuator Info: http://localhost:9093/actuator/info +- Actuator Health: http://localhost:9093/actuator/health +- Actuator Prometheus: http://localhost:9093/actuator/prometheus + +## Swagger UI Endpoints + +- Swagger UI: http://localhost:9093/swagger-ui/index.html + +## OpenAPI Endpoints + +- OpenAPI v3 as .yaml: http://localhost:9093/v3/api-docs.yaml \ No newline at end of file diff --git a/dbrepo-query-service/pom.xml b/dbrepo-query-service/pom.xml index c533f3b2b8..8decc97e39 100644 --- a/dbrepo-query-service/pom.xml +++ b/dbrepo-query-service/pom.xml @@ -44,13 +44,13 @@ <spring-cloud.version>4.0.2</spring-cloud.version> <mapstruct.version>1.5.5.Final</mapstruct.version> <docker.version>3.3.0</docker.version> - <swagger.version>2.2.9</swagger.version> <jacoco.version>0.8.10</jacoco.version> <jwt.version>4.3.0</jwt.version> <opencsv.version>5.7.1</opencsv.version> <jsql.version>4.6</jsql.version> <c3p0.version>0.9.5.5</c3p0.version> <c3p0-hibernate.version>6.2.2.Final</c3p0-hibernate.version> + <springdoc-openapi.version>2.1.0</springdoc-openapi.version> </properties> <dependencies> @@ -130,6 +130,18 @@ <artifactId>amqp-client</artifactId> <version>${rabbit-amqp-client.version}</version> </dependency> + <!-- Swagger --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> + <!-- Open API --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> <!-- Docker --> <dependency> <groupId>com.github.docker-java</groupId> diff --git a/dbrepo-query-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java b/dbrepo-query-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java index 3b18d5fc28..f61db6ccbf 100644 --- a/dbrepo-query-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java +++ b/dbrepo-query-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java @@ -6,7 +6,7 @@ import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; import io.swagger.v3.oas.models.servers.Server; -import org.springdoc.core.GroupedOpenApi; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/dbrepo-query-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java b/dbrepo-query-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java index 1c36be92a4..b6fab51c6d 100644 --- a/dbrepo-query-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java +++ b/dbrepo-query-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java @@ -38,7 +38,11 @@ public class WebSecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { final OrRequestMatcher internalEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/actuator/prometheus/**", "GET") + new AntPathRequestMatcher("/actuator/**", "GET"), + new AntPathRequestMatcher("/v3/api-docs.yaml"), + new AntPathRequestMatcher("/v3/api-docs/**"), + new AntPathRequestMatcher("/swagger-ui/**"), + new AntPathRequestMatcher("/swagger-ui.html") ); final OrRequestMatcher publicEndpoints = new OrRequestMatcher( new AntPathRequestMatcher("/api/container/**/database/data/**", "GET"), @@ -48,11 +52,7 @@ public class WebSecurityConfig { new AntPathRequestMatcher("/api/container/**/database/**/table/**/export/**", "GET"), new AntPathRequestMatcher("/api/container/**/database/**/query/**", "GET"), new AntPathRequestMatcher("/api/container/**/database/**/query/**/export", "GET"), - new AntPathRequestMatcher("/api/container/**/database/**/query/**", "PUT"), - new AntPathRequestMatcher("/v3/api-docs.yaml"), - new AntPathRequestMatcher("/v3/api-docs/**"), - new AntPathRequestMatcher("/swagger-ui/**"), - new AntPathRequestMatcher("/swagger-ui.html") + new AntPathRequestMatcher("/api/container/**/database/**/query/**", "PUT") ); /* enable CORS and disable CSRF */ http = http.cors().and().csrf().disable(); diff --git a/dbrepo-semantics-service/README.md b/dbrepo-semantics-service/README.md index 986b2885e1..859ab6d6ac 100644 --- a/dbrepo-semantics-service/README.md +++ b/dbrepo-semantics-service/README.md @@ -1,7 +1,15 @@ -# FDA Container Service +# Semantics Service -## Documentation +## Actuator -- OpenAPI v3: http://localhost:9091/swagger-ui/index.html -- OpenAPI v3 endpoint: http://localhost:9091/v3/api-docs/ -- OpenAPI v3 YAML: http://localhost:9091/v3/api-docs.yaml \ No newline at end of file +- Actuator Info: http://localhost:9097/actuator/info +- Actuator Health: http://localhost:9097/actuator/health +- Actuator Prometheus: http://localhost:9097/actuator/prometheus + +## Swagger UI Endpoints + +- Swagger UI: http://localhost:9097/swagger-ui/index.html + +## OpenAPI Endpoints + +- OpenAPI v3 as .yaml: http://localhost:9097/v3/api-docs.yaml \ No newline at end of file diff --git a/dbrepo-semantics-service/pom.xml b/dbrepo-semantics-service/pom.xml index d2891ee0b8..aeb1451ea6 100644 --- a/dbrepo-semantics-service/pom.xml +++ b/dbrepo-semantics-service/pom.xml @@ -35,6 +35,7 @@ <c3p0.version>0.9.5.5</c3p0.version> <c3p0-hibernate.version>6.2.2.Final</c3p0-hibernate.version> <apache-jena.version>4.8.0</apache-jena.version> + <springdoc-openapi.version>2.1.0</springdoc-openapi.version> </properties> <dependencies> @@ -150,6 +151,18 @@ <artifactId>mapstruct</artifactId> <version>${mapstruct.version}</version> </dependency> + <!-- Swagger --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> + <!-- Open API --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> </dependencies> <build> diff --git a/dbrepo-semantics-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java b/dbrepo-semantics-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java index 140a531132..53198e3489 100644 --- a/dbrepo-semantics-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java +++ b/dbrepo-semantics-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java @@ -6,7 +6,7 @@ import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; import io.swagger.v3.oas.models.servers.Server; -import org.springdoc.core.GroupedOpenApi; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/dbrepo-semantics-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java b/dbrepo-semantics-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java index 49510d6efb..3bd2ce6956 100644 --- a/dbrepo-semantics-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java +++ b/dbrepo-semantics-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java @@ -38,15 +38,15 @@ public class WebSecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { final OrRequestMatcher internalEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/actuator/**", "GET") - ); - final OrRequestMatcher publicEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/api/semantic/ontology/**", "GET"), + new AntPathRequestMatcher("/actuator/**", "GET"), new AntPathRequestMatcher("/v3/api-docs.yaml"), new AntPathRequestMatcher("/v3/api-docs/**"), new AntPathRequestMatcher("/swagger-ui/**"), new AntPathRequestMatcher("/swagger-ui.html") ); + final OrRequestMatcher publicEndpoints = new OrRequestMatcher( + new AntPathRequestMatcher("/api/semantic/ontology/**", "GET") + ); /* enable CORS and disable CSRF */ http = http.cors().and().csrf().disable(); /* set session management to stateless */ diff --git a/dbrepo-table-service/README.md b/dbrepo-table-service/README.md index 986b2885e1..2275ec5de6 100644 --- a/dbrepo-table-service/README.md +++ b/dbrepo-table-service/README.md @@ -1,7 +1,15 @@ -# FDA Container Service +# Semantics Service -## Documentation +## Actuator -- OpenAPI v3: http://localhost:9091/swagger-ui/index.html -- OpenAPI v3 endpoint: http://localhost:9091/v3/api-docs/ -- OpenAPI v3 YAML: http://localhost:9091/v3/api-docs.yaml \ No newline at end of file +- Actuator Info: http://localhost:9094/actuator/info +- Actuator Health: http://localhost:9094/actuator/health +- Actuator Prometheus: http://localhost:9094/actuator/prometheus + +## Swagger UI Endpoints + +- Swagger UI: http://localhost:9094/swagger-ui/index.html + +## OpenAPI Endpoints + +- OpenAPI v3 as .yaml: http://localhost:9094/v3/api-docs.yaml \ No newline at end of file diff --git a/dbrepo-table-service/pom.xml b/dbrepo-table-service/pom.xml index d82996f45d..7f444e593f 100644 --- a/dbrepo-table-service/pom.xml +++ b/dbrepo-table-service/pom.xml @@ -26,7 +26,6 @@ <spring-cloud.version>4.0.2</spring-cloud.version> <mapstruct.version>1.5.5.Final</mapstruct.version> <docker.version>3.3.0</docker.version> - <swagger.version>2.2.9</swagger.version> <jacoco.version>0.8.10</jacoco.version> <jwt.version>4.3.0</jwt.version> <opencsv.version>5.7.1</opencsv.version> @@ -34,6 +33,7 @@ <jsql.version>4.6</jsql.version> <c3p0.version>0.9.5.5</c3p0.version> <c3p0-hibernate.version>6.2.2.Final</c3p0-hibernate.version> + <springdoc-openapi.version>2.1.0</springdoc-openapi.version> </properties> <dependencies> @@ -96,6 +96,18 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> + <!-- Swagger --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> + <!-- Open API --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> <!-- DataSource --> <dependency> <groupId>com.mchange</groupId> diff --git a/dbrepo-table-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java b/dbrepo-table-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java index 341d465037..67509e1920 100644 --- a/dbrepo-table-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java +++ b/dbrepo-table-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java @@ -6,7 +6,7 @@ import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; import io.swagger.v3.oas.models.servers.Server; -import org.springdoc.core.GroupedOpenApi; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/dbrepo-table-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java b/dbrepo-table-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java index 73dd29d4ef..5c4cfc9bf3 100644 --- a/dbrepo-table-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java +++ b/dbrepo-table-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java @@ -38,15 +38,15 @@ public class WebSecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { final OrRequestMatcher internalEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/actuator/prometheus/**", "GET") - ); - final OrRequestMatcher publicEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/api/container/**/database/**/table/**", "GET"), + new AntPathRequestMatcher("/actuator/**", "GET"), new AntPathRequestMatcher("/v3/api-docs.yaml"), new AntPathRequestMatcher("/v3/api-docs/**"), new AntPathRequestMatcher("/swagger-ui/**"), new AntPathRequestMatcher("/swagger-ui.html") ); + final OrRequestMatcher publicEndpoints = new OrRequestMatcher( + new AntPathRequestMatcher("/api/container/**/database/**/table/**", "GET") + ); /* enable CORS and disable CSRF */ http = http.cors().and().csrf().disable(); /* set session management to stateless */ diff --git a/dbrepo-user-service/README.md b/dbrepo-user-service/README.md new file mode 100644 index 0000000000..ae61ee03af --- /dev/null +++ b/dbrepo-user-service/README.md @@ -0,0 +1,15 @@ +# User Service + +## Actuator + +- Actuator Info: http://localhost:9098/actuator/info +- Actuator Health: http://localhost:9098/actuator/health +- Actuator Prometheus: http://localhost:9098/actuator/prometheus + +## Swagger UI Endpoints + +- Swagger UI: http://localhost:9098/swagger-ui/index.html + +## OpenAPI Endpoints + +- OpenAPI v3 as .yaml: http://localhost:9098/v3/api-docs.yaml \ No newline at end of file diff --git a/dbrepo-user-service/pom.xml b/dbrepo-user-service/pom.xml index f1ae609dca..1b5fd796af 100644 --- a/dbrepo-user-service/pom.xml +++ b/dbrepo-user-service/pom.xml @@ -43,7 +43,6 @@ <spring-cloud.version>4.0.2</spring-cloud.version> <mapstruct.version>1.5.5.Final</mapstruct.version> <docker.version>3.3.0</docker.version> - <swagger.version>2.2.9</swagger.version> <jacoco.version>0.8.10</jacoco.version> <jwt.version>4.3.0</jwt.version> <hibernate-c3po.version>5.6.3.Final</hibernate-c3po.version> @@ -52,6 +51,7 @@ <jsql.version>4.6</jsql.version> <keycloak.version>21.0.2</keycloak.version> <hibernate.version>6.2.2.Final</hibernate.version> + <springdoc-openapi.version>2.1.0</springdoc-openapi.version> </properties> <dependencies> @@ -119,6 +119,18 @@ <groupId>org.springframework.data</groupId> <artifactId>spring-data-elasticsearch</artifactId> </dependency> + <!-- Swagger --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> + <!-- Open API --> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> + <version>${springdoc-openapi.version}</version> + </dependency> <!-- IDE --> <dependency> <groupId>org.projectlombok</groupId> diff --git a/dbrepo-user-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java b/dbrepo-user-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java index eb08f946aa..353d949c4b 100644 --- a/dbrepo-user-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java +++ b/dbrepo-user-service/rest-service/src/main/java/at/tuwien/config/SwaggerConfig.java @@ -5,7 +5,7 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; -import org.springdoc.core.GroupedOpenApi; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/dbrepo-user-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java b/dbrepo-user-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java index fe44809a44..5df5406709 100644 --- a/dbrepo-user-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java +++ b/dbrepo-user-service/services/src/main/java/at/tuwien/config/WebSecurityConfig.java @@ -38,17 +38,17 @@ public class WebSecurityConfig { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { final OrRequestMatcher internalEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/actuator/prometheus/**", "GET") - ); - final OrRequestMatcher publicEndpoints = new OrRequestMatcher( - new AntPathRequestMatcher("/api/user/**", "GET"), - new AntPathRequestMatcher("/api/user/**", "POST"), - new AntPathRequestMatcher("/api/maintenance/**", "GET"), + new AntPathRequestMatcher("/actuator/**", "GET"), new AntPathRequestMatcher("/v3/api-docs.yaml"), new AntPathRequestMatcher("/v3/api-docs/**"), new AntPathRequestMatcher("/swagger-ui/**"), new AntPathRequestMatcher("/swagger-ui.html") ); + final OrRequestMatcher publicEndpoints = new OrRequestMatcher( + new AntPathRequestMatcher("/api/user/**", "GET"), + new AntPathRequestMatcher("/api/user/**", "POST"), + new AntPathRequestMatcher("/api/maintenance/**", "GET") + ); /* enable CORS and disable CSRF */ http = http.cors().and().csrf().disable(); /* set session management to stateless */ -- GitLab